aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/resources/assets/molehunt/lang/en_us.json10
-rw-r--r--src/client/resources/assets/molehunt/lang/fr_fr.json12
-rw-r--r--src/main/java/world/anhgelus/molehunt/Molehunt.java28
-rw-r--r--src/main/java/world/anhgelus/molehunt/game/Game.java4
4 files changed, 36 insertions, 18 deletions
diff --git a/src/client/resources/assets/molehunt/lang/en_us.json b/src/client/resources/assets/molehunt/lang/en_us.json
index 5896c03..0158b58 100644
--- a/src/client/resources/assets/molehunt/lang/en_us.json
+++ b/src/client/resources/assets/molehunt/lang/en_us.json
@@ -2,16 +2,18 @@
"commands.molehunt.stop.failed": "The Molehunt game has not been started yet.",
"commands.molehunt.timer.show": "Showing Molehunt timer.",
"commands.molehunt.timer.hide": "Hiding Molehunt timer.",
- "commands.molehunt.moles.list": "List of moles:",
- "commands.molehunt.moles.list.deny": "You can't see the list of moles.",
+ "commands.molehunt.role.mole": "§cYou are a Mole.\nKill all the survivors before the timer runs out.",
+ "commands.molehunt.role.mole.list": "§eThe moles are: %s",
+ "commands.molehunt.role.survivor": "§aYou are not the Mole. \nSurvive until the timer runs out, and try to discover who's the Mole.",
+ "commands.molehunt.role.survivor.mole_count": "§eThere are %d §emoles among you.",
"commands.molehunt.stop.success": "The Molehunt game has been stopped.",
"molehunt.game.end.suspense.title": "§eAnd the winners are...",
"molehunt.game.end.winners.moles.title": "§cThe Moles!",
"molehunt.game.end.winners.survivors.title": "§aNot the Moles!",
- "molehunt.game.end.winners.subtitle": "§6The Moles were",
+ "molehunt.game.end.winners.subtitle": "§6The Moles were %s",
"molehunt.game.start.suspense": "§eYou are...",
"molehunt.game.start.mole.title": "§cThe Mole!",
- "molehunt.game.start.mole.subtitle": "§eGet the list of moles with §6/molehunt moles",
+ "molehunt.game.start.mole.subtitle": "§eGet the list of moles with §6/molehunt role§e.",
"molehunt.game.start.survivor.title": "§aNot the Mole!",
"molehunt.game.start.survivor.subtitle": "§eTry to survive and find out who's the mole!",
"gamerule.molehunt:gameDuration": "Molehunt: Duration of a game",
diff --git a/src/client/resources/assets/molehunt/lang/fr_fr.json b/src/client/resources/assets/molehunt/lang/fr_fr.json
index 42b4722..022c2ea 100644
--- a/src/client/resources/assets/molehunt/lang/fr_fr.json
+++ b/src/client/resources/assets/molehunt/lang/fr_fr.json
@@ -1,10 +1,12 @@
{
"commands.molehunt.stop.failed": "La partie de Molehunt n'a pas encore commencé.",
- "commands.molehunt.timer.show": "Affiche le timer.",
- "commands.molehunt.timer.hide": "Cache le timer.",
- "commands.molehunt.moles.list": "Liste des taupes:",
- "commands.molehunt.moles.list.deny": "Vous ne pouvez pas voir la liste des taupes.",
- "commands.molehunt.stop.success": "La partie de Molehunt a été stoppée.",
+ "commands.molehunt.timer.show": "Le timer est maintenant affiché.",
+ "commands.molehunt.timer.hide": "Le timer est maintenant caché.",
+ "commands.molehunt.role.mole": "§cVous êtes une taupe.\nTuez tous les survivants avant la fin de la partie..",
+ "commands.molehunt.role.mole.list": "§eThe moles are: %s",
+ "commands.molehunt.role.survivor": "§aVous n'êtes pas la taupe. \nSurvivez jusqu'à la fin, et découvrez qui sont les moles.",
+ "commands.molehunt.role.survivor.mole_count": "§eIl y a %d §etaupes parmi vous.",
+ "commands.molehunt.stop.success": "La partie de Molehunt a été arrêtée.",
"molehunt.game.end.suspense.title": "§eEt les gagnants sont...",
"molehunt.game.end.winners.moles.title": "§cLes Taupes !",
"molehunt.game.end.winners.survivors.title": "§aPas les Taupes !",
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();