aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Writerside/topics/usage.md2
-rw-r--r--src/main/java/world/anhgelus/molehunt/Molehunt.java10
2 files changed, 9 insertions, 3 deletions
diff --git a/Writerside/topics/usage.md b/Writerside/topics/usage.md
index 707721b..46bc5fb 100644
--- a/Writerside/topics/usage.md
+++ b/Writerside/topics/usage.md
@@ -20,7 +20,7 @@ The mod also provide a few commands for every player.
If you forgot your role during the game, you can use `/molehunt role`
This command will also provide you with some additional information :
- For survivors, it will give the mole count;
-- For moles, it will give the list of all moles.
+- For moles and spectators, it will give the list of all moles.
To some people, the timer above you hotbar could be annoying. To hide it,
use `/molehunt timer hide`. If you want to see it again, use
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")