Skip to content

Commit

Permalink
Verbose output on gamemode command
Browse files Browse the repository at this point in the history
  • Loading branch information
MrSlimeDiamond committed Jul 2, 2024
1 parent fd37ed2 commit 546ff95
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ public class GamemodeCommand {
public void gamemodeCommand(CommandContext ctx) {
Gamemode gamemode = Gamemode.SURVIVAL;
AtomicReference<Player> target = new AtomicReference<>();
AtomicBoolean shouldContinue = new AtomicBoolean(true);
AtomicBoolean shouldContinue = new AtomicBoolean(true); // this is stupid i hate consumers
ctx.ifPlayer(player -> {
if (ctx.getCommandArgs().length == 1) {
ctx.getCaller().sendMessage(Component.text(Colors.LIGHT_RED + "/gamemode <survival|creative|adventure|spectator|0|1|2|3|s|c|a|sp> [player]"));
shouldContinue.set(false);
return;
}

if (ctx.getCommandArgs().length == 2) {
target.set(player);
}
Expand Down Expand Up @@ -59,5 +60,6 @@ public void gamemodeCommand(CommandContext ctx) {
}

target.get().setGamemode(gamemode);
ctx.getCaller().sendMessage(Component.text(target.get().getName() + Colors.GREEN + " has had their gamemode changed to " + Colors.WHITE + gamemode.name()));
}
}

0 comments on commit 546ff95

Please sign in to comment.