diff options
| author | Léo Kosman <leo.kosman@proton.me> | 2024-08-22 20:44:23 +0200 |
|---|---|---|
| committer | Léo Kosman <leo.kosman@proton.me> | 2024-08-22 20:44:23 +0200 |
| commit | 64977f4392c79871ad252c6071d397c05c2f97ad (patch) | |
| tree | fba1f0c5ec27f4df147fa9b465d1155847dc87f1 /src/main | |
| parent | 2736ce66b5c6344422dfcdc613cd6cc0be55cc64 (diff) | |
fix: check if game has started before stopping
Diffstat (limited to 'src/main')
| -rw-r--r-- | src/main/java/world/anhgelus/molehunt/Molehunt.java | 7 |
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; })); |
