From 64977f4392c79871ad252c6071d397c05c2f97ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Kosman?= Date: Thu, 22 Aug 2024 20:44:23 +0200 Subject: fix: check if game has started before stopping --- src/main/java/world/anhgelus/molehunt/Molehunt.java | 7 +++++-- 1 file 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; })); -- cgit v1.2.3