From 48d2eeb2675e92e2c1fd50a6105f6f439249e87b Mon Sep 17 00:00:00 2001 From: ajgeiss0702 Date: Mon, 11 May 2020 08:31:24 -0700 Subject: [PATCH] will check the config when plugin enables too --- src/main/java/us/ajg0702/queue/Main.java | 11 +++++++++++ src/main/java/us/ajg0702/queue/ManageCommand.java | 8 +------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main/java/us/ajg0702/queue/Main.java b/src/main/java/us/ajg0702/queue/Main.java index 6c1efa5..68c6031 100644 --- a/src/main/java/us/ajg0702/queue/Main.java +++ b/src/main/java/us/ajg0702/queue/Main.java @@ -40,6 +40,7 @@ public class Main extends Plugin implements Listener { msgs = BungeeMessages.getInstance(this); config = new BungeeConfig(this); + checkConfig(); this.getProxy().getPluginManager().registerCommand(this, new MoveCommand(this)); this.getProxy().getPluginManager().registerCommand(this, new ManageCommand(this)); @@ -71,6 +72,16 @@ public class Main extends Plugin implements Listener { } + public void checkConfig() { + List svs = getConfig().getStringList("queue-servers"); + for(String s : svs) { + if(!s.contains(":")) { + getLogger().warning("The queue-servers section in the config has been set up incorrectly! Please read the comment above the setting and make sure you have a queue server and a destination server separated by a colon (:)"); + break; + } + } + } + public BungeeConfig getConfig() { return config; } diff --git a/src/main/java/us/ajg0702/queue/ManageCommand.java b/src/main/java/us/ajg0702/queue/ManageCommand.java index ce8beee..2f414f2 100644 --- a/src/main/java/us/ajg0702/queue/ManageCommand.java +++ b/src/main/java/us/ajg0702/queue/ManageCommand.java @@ -31,13 +31,7 @@ public class ManageCommand extends Command { } msgs.reload(); pl.getConfig().reload(); - List svs = pl.getConfig().getStringList("queue-servers"); - for(String s : svs) { - if(!s.contains(":")) { - pl.getLogger().warning("The queue-servers section in the config has been set up incorrectly! Please read the comment above the setting and make sure you have a queue server and a destination server separated by a colon (:)"); - break; - } - } + pl.checkConfig(); sender.sendMessage(msgs.getBC("commands.reload")); return;