aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/world
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/world')
-rw-r--r--src/main/java/world/anhgelus/molehunt/Molehunt.java28
-rw-r--r--src/main/java/world/anhgelus/molehunt/game/Game.java4
2 files changed, 23 insertions, 9 deletions
diff --git a/src/main/java/world/anhgelus/molehunt/Molehunt.java b/src/main/java/world/anhgelus/molehunt/Molehunt.java
index 9026dab..7fa924d 100644
--- a/src/main/java/world/anhgelus/molehunt/Molehunt.java
+++ b/src/main/java/world/anhgelus/molehunt/Molehunt.java
@@ -124,7 +124,7 @@ public class Molehunt implements ModInitializer {
if (game == null || !game.hasStarted()) {
player.networkHandler.sendPacket(new OverlayMessageS2CPacket(
- Text.translatable("commands.molehunt.stop.failed").setStyle(Style.EMPTY.withColor(16733525))
+ Text.translatable("commands.molehunt.stop.failed").withColor(16733525)
));
} else {
player.networkHandler.sendPacket(new OverlayMessageS2CPacket(Text.of(game.getShortRemainingText())));
@@ -139,11 +139,27 @@ public class Molehunt implements ModInitializer {
return Command.SINGLE_SUCCESS;
})
));
- command.then(literal("moles").requires(source ->
- (game != null && game.isAMole(source.getPlayer())) ||
- (source.getPlayer() != null && source.getPlayer().isSpectator())
- ).executes(context -> {
- context.getSource().sendFeedback(() -> Text.translatable("commands.molehunt.moles.list").append(" " + game.getMolesAsString()),false);
+ command.then(literal("role").requires(ServerCommandSource::isExecutedByPlayer).executes(context -> {
+ if (game == null || !game.hasStarted()) {
+ throw (new SimpleCommandExceptionType(Text.translatable("commands.molehunt.stop.failed"))).create();
+ }
+
+ var source = context.getSource();
+
+ if (game.isAMole(source.getPlayer())) {
+ source.sendFeedback(
+ () -> Text.translatable("commands.molehunt.role.mole")
+ .append("\n\n")
+ .append(Text.stringifiedTranslatable("commands.molehunt.role.mole.list", game.getMolesAsString())),
+ false);
+ } else {
+ source.sendFeedback(
+ () -> Text.translatable("commands.molehunt.role.survivor")
+ .append("\n\n")
+ .append(Text.stringifiedTranslatable("commands.molehunt.role.survivor.mole_count", game.getMoles().size())),
+ false);
+ }
+
return Command.SINGLE_SUCCESS;
}));
command.then(literal("stop").requires(source -> source.hasPermissionLevel(1)).executes(context -> {
diff --git a/src/main/java/world/anhgelus/molehunt/game/Game.java b/src/main/java/world/anhgelus/molehunt/game/Game.java
index 0bc7270..b797b72 100644
--- a/src/main/java/world/anhgelus/molehunt/game/Game.java
+++ b/src/main/java/world/anhgelus/molehunt/game/Game.java
@@ -155,9 +155,7 @@ 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.stringifiedTranslatable("molehunt.game.end.winners.subtitle", getMolesAsString())));
pm.sendToAll(winner);
pm.sendToAll(timing);
moles.clear();