From dcee385ae54719621f81cd3a0ee329167cb54165 Mon Sep 17 00:00:00 2001 From: Focusvity Date: Fri, 26 Jan 2024 18:31:42 +1100 Subject: [PATCH] Fix set time --- src/main/java/dev/plex/NUSHModule.java | 6 ++++++ src/main/java/dev/plex/UserData.java | 2 +- src/main/java/dev/plex/command/NUSHCommand.java | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/plex/NUSHModule.java b/src/main/java/dev/plex/NUSHModule.java index 7c42338..e73f3f5 100644 --- a/src/main/java/dev/plex/NUSHModule.java +++ b/src/main/java/dev/plex/NUSHModule.java @@ -48,4 +48,10 @@ public static void toggle(boolean toggle) enabled = toggle; config.set("server.enabled", toggle); } + + public static void setTime(int minutes) + { + time = minutes; + config.set("server.wait_time", minutes); + } } diff --git a/src/main/java/dev/plex/UserData.java b/src/main/java/dev/plex/UserData.java index ccbda6a..c5e3376 100644 --- a/src/main/java/dev/plex/UserData.java +++ b/src/main/java/dev/plex/UserData.java @@ -33,7 +33,7 @@ public static void queueNewPlayer(Player player) USERS_MAP.remove(player.getUniqueId()); } }, - 20L * 60L * NUSHModule.getConfig().getInt("server.wait_time", 2)); + 20L * 60L * NUSHModule.getTime()); } public static boolean isNewPlayer(Player player) diff --git a/src/main/java/dev/plex/command/NUSHCommand.java b/src/main/java/dev/plex/command/NUSHCommand.java index 99faf3d..5af0606 100644 --- a/src/main/java/dev/plex/command/NUSHCommand.java +++ b/src/main/java/dev/plex/command/NUSHCommand.java @@ -68,7 +68,7 @@ else if (args.length == 2) return MiniMessage.miniMessage().deserialize("The time must be a number!"); } - NUSHModule.getConfig().set("server.wait_time", time); + NUSHModule.setTime(time); return MiniMessage.miniMessage().deserialize("The wait time for new players before they can chat is now set to " + time + " minutes."); }