diff options
| author | anhgelus <anhgelus.morhtuuzh@proton.me> | 2024-08-23 22:29:40 +0000 |
|---|---|---|
| committer | anhgelus <anhgelus.morhtuuzh@proton.me> | 2024-08-23 22:29:40 +0000 |
| commit | d1d56e097d1aaa90358069370f454e65fc9dbbd5 (patch) | |
| tree | fcfe59c6d292f4c52d3c81cd51dd019b0e72b388 /src/main/java/world/anhgelus | |
| parent | 6401c130571f5dbd069cd04e7b1c58fb97d6de08 (diff) | |
feat(command): disable autocompletion for /molehunt moles when not mole
Diffstat (limited to 'src/main/java/world/anhgelus')
| -rw-r--r-- | src/main/java/world/anhgelus/molehunt/Game.java | 4 | ||||
| -rw-r--r-- | src/main/java/world/anhgelus/molehunt/Molehunt.java | 9 |
2 files changed, 5 insertions, 8 deletions
diff --git a/src/main/java/world/anhgelus/molehunt/Game.java b/src/main/java/world/anhgelus/molehunt/Game.java index ce6f335..dbe7ebd 100644 --- a/src/main/java/world/anhgelus/molehunt/Game.java +++ b/src/main/java/world/anhgelus/molehunt/Game.java @@ -133,7 +133,9 @@ public class Game { } else {
winner = new TitleS2CPacket(Text.translatable("molehunt.game.end.winners.survivors.title"));
}
- pm.sendToAll(new SubtitleS2CPacket(Text.translatable("molehunt.game.end.winners.subtitle").append(getMolesAsString())));
+ pm.sendToAll(new SubtitleS2CPacket(Text.translatable("molehunt.game.end.winners.subtitle")
+ .append(" " + getMolesAsString()))
+ );
pm.sendToAll(winner);
pm.sendToAll(timing);
moles.clear();
diff --git a/src/main/java/world/anhgelus/molehunt/Molehunt.java b/src/main/java/world/anhgelus/molehunt/Molehunt.java index c6ce7c7..d7c0d58 100644 --- a/src/main/java/world/anhgelus/molehunt/Molehunt.java +++ b/src/main/java/world/anhgelus/molehunt/Molehunt.java @@ -117,13 +117,8 @@ public class Molehunt implements ModInitializer { return Command.SINGLE_SUCCESS; }) )); - command.then(literal("moles").executes(context -> { - final var source = context.getSource(); - if (game == null || !game.isAMole(source.getPlayer())) { - source.sendFeedback(() -> Text.translatable("commands.molehunt.moles.list.deny"),false); - return Command.SINGLE_SUCCESS; - } - source.sendFeedback(() -> Text.translatable("commands.molehunt.moles.list").append(" " + game.getMolesAsString()),false); + command.then(literal("moles").requires(source -> game != null && game.isAMole(source.getPlayer())).executes(context -> { + context.getSource().sendFeedback(() -> Text.translatable("commands.molehunt.moles.list").append(" " + game.getMolesAsString()),false); return Command.SINGLE_SUCCESS; })); command.then(literal("stop").requires(source -> source.hasPermissionLevel(1)).executes(context -> { |
