From e40f0919617bd274fa83c6881a28b9d1291da8a0 Mon Sep 17 00:00:00 2001 From: hhhzzzsss Date: Thu, 30 May 2024 22:53:31 -0500 Subject: [PATCH] Add checks for survival only mode --- .../github/hhhzzzsss/songplayer/CommandProcessor.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/com/github/hhhzzzsss/songplayer/CommandProcessor.java b/src/main/java/com/github/hhhzzzsss/songplayer/CommandProcessor.java index cc155ba..7eb7c25 100644 --- a/src/main/java/com/github/hhhzzzsss/songplayer/CommandProcessor.java +++ b/src/main/java/com/github/hhhzzzsss/songplayer/CommandProcessor.java @@ -218,6 +218,11 @@ public class CommandProcessor { } public boolean processCommand(String args) { if (args.length() > 0) { + if (Config.getConfig().survivalOnly && SongPlayer.MC.interactionManager.getCurrentGameMode() != GameMode.SURVIVAL) { + SongPlayer.addChatMessage("§cTo play in survival only mode, you must be in survival mode to start with."); + return true; + } + SongHandler.getInstance().loadSong(args); return true; } @@ -1177,6 +1182,11 @@ public class CommandProcessor { } public boolean processCommand(String args) { if (args.length() == 0) { + if (!SongHandler.getInstance().isIdle()) { + SongPlayer.addChatMessage("§cYou cannot change this setting while playing or building"); + return true; + } + Config.getConfig().survivalOnly = !Config.getConfig().survivalOnly; if (Config.getConfig().survivalOnly) { SongPlayer.addChatMessage("§6Enabled survival only mode");