aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/world/anhgelus
diff options
context:
space:
mode:
authorLéo Kosman <leo.kosman@proton.me>2024-08-22 20:44:23 +0200
committerLéo Kosman <leo.kosman@proton.me>2024-08-22 20:44:23 +0200
commit64977f4392c79871ad252c6071d397c05c2f97ad (patch)
treefba1f0c5ec27f4df147fa9b465d1155847dc87f1 /src/main/java/world/anhgelus
parent2736ce66b5c6344422dfcdc613cd6cc0be55cc64 (diff)
fix: check if game has started before stopping
Diffstat (limited to 'src/main/java/world/anhgelus')
-rw-r--r--src/main/java/world/anhgelus/molehunt/Molehunt.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/world/anhgelus/molehunt/Molehunt.java b/src/main/java/world/anhgelus/molehunt/Molehunt.java
index 7140512..cbb415d 100644
--- a/src/main/java/world/anhgelus/molehunt/Molehunt.java
+++ b/src/main/java/world/anhgelus/molehunt/Molehunt.java
@@ -69,9 +69,12 @@ public class Molehunt implements ModInitializer {
return Command.SINGLE_SUCCESS;
}));
command.then(literal("stop").requires(source -> source.hasPermissionLevel(1)).executes(context -> {
- if (game != null) {
- game.stop();
+ if (game == null || !game.isStarted()) {
+ context.getSource().sendError(Text.of("Game has not started yet"));
}
+
+ game.stop();
+
return Command.SINGLE_SUCCESS;
}));