Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Cloud 2.0 and adapt to upstream changes #45

Merged
merged 3 commits into from
Jun 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Maven
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: 1.8
java-version: 21
distribution: temurin
cache: maven
- name: maven-settings-xml-action
uses: whelk-io/maven-settings-xml-action@v9
with:
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/push-gh-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: '8'
java-version: 21
distribution: temurin
cache: maven
- name: Build jar
run: mvn --batch-mode --update-snapshots verify
- name: Move generated jar file
Expand Down
20 changes: 10 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.PGMDev</groupId>
<groupId>dev.pgm</groupId>
<artifactId>Events</artifactId>
<version>master-9671be2b43-1</version>
<version>1.0.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -66,17 +66,17 @@
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>retrofit</artifactId>
<version>2.9.0</version>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>converter-jackson</artifactId>
<version>2.9.0</version>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>converter-gson</artifactId>
<version>2.9.0</version>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>co.aikar</groupId>
Expand All @@ -86,7 +86,7 @@
<dependency>
<groupId>org.java-websocket</groupId>
<artifactId>Java-WebSocket</artifactId>
<version>1.5.1</version>
<version>1.5.6</version>
</dependency>
</dependencies>

Expand All @@ -95,10 +95,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<version>3.13.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>21</source>
<target>21</target>
</configuration>
</plugin>

Expand All @@ -123,7 +123,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.1</version>
<version>3.6.0</version>
<configuration>
<createDependencyReducedPom>true</createDependencyReducedPom>
<filters>
Expand Down
48 changes: 24 additions & 24 deletions src/main/java/rip/bolt/ingame/commands/AdminCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.format.NamedTextColor;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import rip.bolt.ingame.Ingame;
import rip.bolt.ingame.api.definitions.BoltMatch;
Expand All @@ -21,20 +21,20 @@
import tc.oc.pgm.api.match.Match;
import tc.oc.pgm.api.match.MatchPhase;
import tc.oc.pgm.api.player.MatchPlayer;
import tc.oc.pgm.lib.cloud.commandframework.annotations.Argument;
import tc.oc.pgm.lib.cloud.commandframework.annotations.CommandDescription;
import tc.oc.pgm.lib.cloud.commandframework.annotations.CommandMethod;
import tc.oc.pgm.lib.cloud.commandframework.annotations.CommandPermission;
import tc.oc.pgm.lib.cloud.commandframework.annotations.Flag;
import tc.oc.pgm.lib.cloud.commandframework.annotations.specifier.Greedy;
import tc.oc.pgm.lib.org.incendo.cloud.annotation.specifier.Greedy;
import tc.oc.pgm.lib.org.incendo.cloud.annotations.Argument;
import tc.oc.pgm.lib.org.incendo.cloud.annotations.Command;
import tc.oc.pgm.lib.org.incendo.cloud.annotations.CommandDescription;
import tc.oc.pgm.lib.org.incendo.cloud.annotations.Flag;
import tc.oc.pgm.lib.org.incendo.cloud.annotations.Permission;
import tc.oc.pgm.util.Audience;

@CommandMethod("ingame")
@Command("ingame")
public class AdminCommands {

@CommandMethod("poll")
@Command("poll")
@CommandDescription("Poll the API once for a new Bolt match")
@CommandPermission("ingame.staff.poll")
@Permission("ingame.staff.poll")
public void poll(
MatchManager matchManager,
CommandSender sender,
Expand All @@ -52,9 +52,9 @@ public void poll(
text("Manual poll has been triggered, checking API for match.", NamedTextColor.GRAY));
}

@CommandMethod("clear|reset")
@Command("clear|reset")
@CommandDescription("Clear the currently stored Bolt match")
@CommandPermission("ingame.staff.clear")
@Permission("ingame.staff.clear")
public void clear(MatchManager matchManager, CommandSender sender) throws CommandException {
BoltMatch match = matchManager.getMatch();
if (match == null)
Expand All @@ -70,9 +70,9 @@ public void clear(MatchManager matchManager, CommandSender sender) throws Comman
NamedTextColor.GRAY));
}

@CommandMethod("match")
@Command("match")
@CommandDescription("View info about the current Bolt match")
@CommandPermission("ingame.staff.match")
@Permission("ingame.staff.match")
public void match(MatchManager matchManager, CommandSender sender) throws CommandException {
BoltMatch boltMatch = matchManager.getMatch();
if (boltMatch == null)
Expand All @@ -83,9 +83,9 @@ public void match(MatchManager matchManager, CommandSender sender) throws Comman
if (AppData.Web.getMatchLink() != null) audience.sendMessage(Messages.matchLink(boltMatch));
}

@CommandMethod("status")
@Command("status")
@CommandDescription("View the status of the API polling")
@CommandPermission("ingame.staff.status")
@Permission("ingame.staff.status")
public void status(MatchManager matchManager, CommandSender sender) throws CommandException {
GameManager gameTypeManager = matchManager.getGameManager();
String gameManager = gameTypeManager.getClass().getSimpleName();
Expand Down Expand Up @@ -119,9 +119,9 @@ public void status(MatchManager matchManager, CommandSender sender) throws Comma
newline().append(apiPolling.append(newline().append(websocketConnected)))));
}

@CommandMethod("cancel")
@Command("cancel")
@CommandDescription("Report the current Bolt match as cancelled")
@CommandPermission("ingame.staff.cancel")
@Permission("ingame.staff.cancel")
public void cancel(MatchManager matchManager, CommandSender sender, Match match)
throws CommandException {
BoltMatch boltMatch = matchManager.getMatch();
Expand All @@ -142,9 +142,9 @@ public void cancel(MatchManager matchManager, CommandSender sender, Match match)
match.sendMessage(text("Match has been cancelled by an admin.", NamedTextColor.RED));
}

@CommandMethod("ban <player> [reason]")
@Command("ban <player> [reason]")
@CommandDescription("Manually queue bans a player")
@CommandPermission("ingame.staff.ban")
@Permission("ingame.staff.ban")
public void ban(
CommandSender sender,
@Argument("player") MatchPlayer target,
Expand All @@ -159,9 +159,9 @@ public void ban(
Ingame.get(), () -> Ingame.get().getApiManager().postPlayerPunishment(punishment));
}

@CommandMethod("reconnect")
@Command("reconnect")
@CommandDescription("Reconnect to the matches websocket")
@CommandPermission("ingame.staff.reconnect")
@Permission("ingame.staff.reconnect")
public void reconnect(MatchManager matchManager, CommandSender sender) throws CommandException {
GameManager gameManager = matchManager.getGameManager();
if (!(gameManager instanceof PugManager))
Expand All @@ -173,9 +173,9 @@ public void reconnect(MatchManager matchManager, CommandSender sender) throws Co
((PugManager) gameManager).connect(matchManager.getMatch());
}

@CommandMethod("disconnect")
@Command("disconnect")
@CommandDescription("Disconnect from the matches websocket")
@CommandPermission("ingame.staff.reconnect")
@Permission("ingame.staff.reconnect")
public void disconnect(MatchManager matchManager, CommandSender sender) throws CommandException {
GameManager gameManager = matchManager.getGameManager();
if (!(gameManager instanceof PugManager))
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/rip/bolt/ingame/commands/ForfeitCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import static net.kyori.adventure.text.Component.text;

import net.md_5.bungee.api.ChatColor;
import org.bukkit.ChatColor;
import rip.bolt.ingame.config.AppData;
import rip.bolt.ingame.managers.GameManager;
import rip.bolt.ingame.managers.MatchManager;
Expand All @@ -13,12 +13,12 @@
import tc.oc.pgm.api.match.MatchPhase;
import tc.oc.pgm.api.party.Competitor;
import tc.oc.pgm.api.player.MatchPlayer;
import tc.oc.pgm.lib.cloud.commandframework.annotations.CommandDescription;
import tc.oc.pgm.lib.cloud.commandframework.annotations.CommandMethod;
import tc.oc.pgm.lib.org.incendo.cloud.annotations.Command;
import tc.oc.pgm.lib.org.incendo.cloud.annotations.CommandDescription;

public class ForfeitCommands {

@CommandMethod("forfeit|ff")
@Command("forfeit|ff")
@CommandDescription("Accept that you have no chance of winning")
public void forfeit(MatchManager matchManager, MatchPlayer sender, Match match)
throws CommandException {
Expand Down
13 changes: 4 additions & 9 deletions src/main/java/rip/bolt/ingame/commands/IngameCommandGraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import tc.oc.pgm.api.match.Match;
import tc.oc.pgm.api.party.Party;
import tc.oc.pgm.api.player.MatchPlayer;
import tc.oc.pgm.command.injectors.AudienceProvider;
import tc.oc.pgm.command.injectors.MatchPlayerProvider;
import tc.oc.pgm.command.injectors.MatchProvider;
import tc.oc.pgm.command.injectors.PlayerProvider;
Expand All @@ -25,9 +26,8 @@
import tc.oc.pgm.command.parsers.TeamParser;
import tc.oc.pgm.command.parsers.TeamsParser;
import tc.oc.pgm.command.util.CommandGraph;
import tc.oc.pgm.lib.cloud.commandframework.extra.confirmation.CommandConfirmationManager;
import tc.oc.pgm.lib.cloud.commandframework.minecraft.extras.MinecraftHelp;
import tc.oc.pgm.lib.io.leangen.geantyref.TypeFactory;
import tc.oc.pgm.lib.org.incendo.cloud.minecraft.extras.MinecraftHelp;
import tc.oc.pgm.teams.Team;
import tc.oc.pgm.teams.TeamMatchModule;
import tc.oc.pgm.util.Audience;
Expand All @@ -40,12 +40,7 @@ public IngameCommandGraph(Ingame ingame) throws Exception {

@Override
protected MinecraftHelp<CommandSender> createHelp() {
return new MinecraftHelp<>("/ingame help", Audience::get, manager);
}

@Override
protected CommandConfirmationManager<CommandSender> createConfirmationManager() {
return null;
return MinecraftHelp.create("/ingame help", manager, Audience::get);
}

@Override
Expand All @@ -56,7 +51,7 @@ protected void setupInjectors() {
registerInjector(MapOrder.class, () -> PGM.get().getMapOrder());
registerInjector(MatchManager.class, () -> Ingame.get().getMatchManager());

registerInjector(Audience.class, (c, s) -> Audience.get(c.getSender()));
registerInjector(Audience.class, new AudienceProvider());
registerInjector(Match.class, new MatchProvider());
registerInjector(MatchPlayer.class, new MatchPlayerProvider());
registerInjector(Player.class, new PlayerProvider());
Expand Down
Loading