diff options
| author | anhgelus <anhgelus.morhtuuzh@proton.me> | 2024-08-31 17:02:19 +0000 |
|---|---|---|
| committer | anhgelus <anhgelus.morhtuuzh@proton.me> | 2024-08-31 17:02:19 +0000 |
| commit | 0cb936f15eb7ec1fd50a366e859137336028eb5f (patch) | |
| tree | af0382d10a37f5fb24642e6569a279b4e087c0a8 /src/main/java/world/anhgelus | |
| parent | 2060d80ab5a34c6a6c3cda813de7f934e3e64bfb (diff) | |
fix(game): spectator cannot get list of moles
Diffstat (limited to 'src/main/java/world/anhgelus')
| -rw-r--r-- | src/main/java/world/anhgelus/molehunt/Molehunt.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main/java/world/anhgelus/molehunt/Molehunt.java b/src/main/java/world/anhgelus/molehunt/Molehunt.java index abce46b..c2b8b4f 100644 --- a/src/main/java/world/anhgelus/molehunt/Molehunt.java +++ b/src/main/java/world/anhgelus/molehunt/Molehunt.java @@ -145,14 +145,20 @@ public class Molehunt implements ModInitializer { throw (new SimpleCommandExceptionType(Text.translatable("commands.molehunt.error.game_not_started"))).create(); } - var source = context.getSource(); + final var source = context.getSource(); + final var player = source.getPlayer(); + assert player != null; - if (game.isAMole(source.getPlayer())) { + if (game.isAMole(player)) { source.sendFeedback( () -> Text.translatable("commands.molehunt.role.mole") .append("\n\n") .append(Text.translatable("commands.molehunt.role.mole.list", game.getMolesAsString())), false); + } else if (player.isSpectator()) { + source.sendFeedback( + () -> Text.translatable("commands.molehunt.role.survivor.mole_count", game.getMoles().size()), + false); } else { source.sendFeedback( () -> Text.translatable("commands.molehunt.role.survivor") |
