Skip to content

Commit

Permalink
Update to Cloud 2.0 and adapt to upstream changes (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
calcastor authored Jun 23, 2024
1 parent 9671be2 commit d8004a6
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 53 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,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
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom2</artifactId>
<version>2.0.5</version>
<version>2.0.6.1</version>
</dependency>
</dependencies>

Expand All @@ -42,10 +42,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 @@ -69,7 +69,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<version>3.6.0</version>
<configuration>
<createDependencyReducedPom>true</createDependencyReducedPom>
<filters>
Expand Down
10 changes: 2 additions & 8 deletions src/main/java/dev/pgm/events/commands/EventsCommandGraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
import tc.oc.pgm.command.injectors.MatchProvider;
import tc.oc.pgm.command.injectors.PlayerProvider;
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.org.incendo.cloud.minecraft.extras.MinecraftHelp;
import tc.oc.pgm.util.Audience;

public class EventsCommandGraph extends CommandGraph<EventsPlugin> {
Expand All @@ -28,12 +27,7 @@ public EventsCommandGraph(EventsPlugin plugin) throws Exception {

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

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

@Override
Expand Down
32 changes: 16 additions & 16 deletions src/main/java/dev/pgm/events/commands/TournamentAdminCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@
import tc.oc.pgm.api.match.Match;
import tc.oc.pgm.api.match.MatchManager;
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.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.Permission;

@CommandMethod("tourney|tournament|tm|events")
@Command("tourney|tournament|tm|events")
public class TournamentAdminCommands {

@CommandMethod("create <format>")
@Command("create <format>")
@CommandDescription("Creates a tournament")
@CommandPermission("events.staff")
@Permission("events.staff")
public void tourney(
CommandSender sender,
TournamentManager manager,
Expand All @@ -37,9 +37,9 @@ public void tourney(
sender.sendMessage(ChatColor.GOLD + "Starting tournament.");
}

@CommandMethod("register <team>")
@Command("register <team>")
@CommandDescription("Register a team")
@CommandPermission("events.staff")
@Permission("events.staff")
public void register(
CommandSender sender,
TournamentTeamRegistry teamRegistry,
Expand All @@ -61,9 +61,9 @@ public void register(
sender.sendMessage(ChatColor.YELLOW + "Added team " + team.getName() + "!");
}

@CommandMethod("list")
@Command("list")
@CommandDescription("List all loaded teams")
@CommandPermission("events.staff")
@Permission("events.staff")
public void list(CommandSender sender, TournamentTeamRegistry registry) {
sender.sendMessage(
ChatColor.GOLD
Expand All @@ -77,9 +77,9 @@ public void list(CommandSender sender, TournamentTeamRegistry registry) {
sender.sendMessage(ChatColor.YELLOW + "Run /tourney info <team> to see player roster!");
}

@CommandMethod("info <team>")
@Command("info <team>")
@CommandDescription("View information about a team")
@CommandPermission("events.staff")
@Permission("events.staff")
public void info(
CommandSender sender,
TournamentTeamRegistry registry,
Expand All @@ -104,9 +104,9 @@ public void info(
}
}

@CommandMethod("unregisterall")
@Command("unregisterall")
@CommandDescription("Clear all registered teams")
@CommandPermission("events.staff")
@Permission("events.staff")
public void clear(CommandSender sender, TournamentTeamManager teamManager) {
teamManager.clear();
sender.sendMessage(ChatColor.YELLOW + "Unregistered all teams!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
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;

@CommandMethod("tourney|tournament|tm|events")
@Command("tourney|tournament|tm|events")
public class TournamentUserCommands {

@CommandMethod("score")
@Command("score")
@CommandDescription("Shows the current score in the tournament")
public void currentScore(CommandSender sender, TournamentFormat format) {
if (format instanceof FormatTournamentImpl) {
Expand All @@ -33,7 +33,7 @@ public void currentScore(CommandSender sender, TournamentFormat format) {
}
}

@CommandMethod("rounds")
@Command("rounds")
@CommandDescription("Shows the rounds from this event")
public void rounds(CommandSender sender, TournamentFormat format) {
String header = "Event Rounds";
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/dev/pgm/events/commands/VetoCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import tc.oc.pgm.api.match.Match;
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.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;

public class VetoCommands {

@CommandMethod("veto <map>")
@Command("veto <map>")
@CommandDescription("Veto a map")
public void veto(
CommandSender sender,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
import dev.pgm.events.format.rounds.format.FormatRound;
import java.util.Optional;
import org.bukkit.command.CommandSender;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import tc.oc.pgm.lib.cloud.commandframework.annotations.AnnotationAccessor;
import tc.oc.pgm.lib.cloud.commandframework.annotations.injection.ParameterInjector;
import tc.oc.pgm.lib.cloud.commandframework.context.CommandContext;
import tc.oc.pgm.lib.cloud.commandframework.exceptions.CommandExecutionException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import tc.oc.pgm.lib.org.incendo.cloud.context.CommandContext;
import tc.oc.pgm.lib.org.incendo.cloud.exception.CommandExecutionException;
import tc.oc.pgm.lib.org.incendo.cloud.injection.ParameterInjector;
import tc.oc.pgm.lib.org.incendo.cloud.util.annotation.AnnotationAccessor;

public class TournamentProvider implements ParameterInjector<CommandSender, TournamentFormat> {

Expand All @@ -23,8 +23,8 @@ public TournamentProvider(TournamentManager tournamentManager) {

@Override
public @Nullable TournamentFormat create(
@NonNull CommandContext<CommandSender> context,
@NonNull AnnotationAccessor annotationAccessor) {
@NotNull CommandContext<CommandSender> context,
@NotNull AnnotationAccessor annotationAccessor) {
Optional<TournamentFormat> tournamentFormat = tournamentManager.currentTournament();
if (tournamentFormat.isPresent()) {
TournamentFormat format = tournamentFormat.get();
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/dev/pgm/events/ready/ReadyCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import dev.pgm.events.utils.Response;
import org.bukkit.command.CommandSender;
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 ReadyCommands {

Expand All @@ -15,7 +15,7 @@ public ReadyCommands(ReadyManager readyManager) {
this.manager = readyManager;
}

@CommandMethod("ready")
@Command("ready")
@CommandDescription("Ready up")
public void readyCommand(CommandSender sender, MatchPlayer player) {
Response response = manager.canReady(player);
Expand All @@ -24,7 +24,7 @@ public void readyCommand(CommandSender sender, MatchPlayer player) {
manager.ready(player.getParty(), player);
}

@CommandMethod("unready")
@Command("unready")
@CommandDescription("Mark your team as no longer being ready")
public void unreadyCommand(CommandSender sender, MatchPlayer player) {
Response response = manager.canUnready(player);
Expand Down

0 comments on commit d8004a6

Please sign in to comment.