diff --git a/src/main/java/us/ajg0702/queue/Manager.java b/src/main/java/us/ajg0702/queue/Manager.java index 18b8a3b..001ac7c 100644 --- a/src/main/java/us/ajg0702/queue/Manager.java +++ b/src/main/java/us/ajg0702/queue/Manager.java @@ -32,8 +32,16 @@ public class Manager { private Manager(Main pl) { this.pl = pl; msgs = BungeeMessages.getInstance(); - reloadServers(); reloadIntervals(); + if(!pl.config.getBoolean("wait-to-load-servers")) { + reloadServers(); + } else { + pl.getProxy().getScheduler().schedule(pl, new Runnable() { + public void run() { + reloadServers(); + } + }, 0, TimeUnit.SECONDS); + } } /* @@ -49,6 +57,7 @@ public class Manager { int updateId = -1; int messagerId = -1; int actionbarId = -1; + int srvRefId = -1; /** * Clears all intervals and re-makes them */ @@ -65,6 +74,9 @@ public class Manager { if(actionbarId != -1) { pl.getProxy().getScheduler().cancel(actionbarId); } + if(srvRefId != -1) { + pl.getProxy().getScheduler().cancel(srvRefId); + } sendId = pl.getProxy().getScheduler().schedule(pl, new Runnable() { public void run() { @@ -77,6 +89,7 @@ public class Manager { updateServers(); } }, 0, Math.max(pl.timeBetweenPlayers, 2), TimeUnit.SECONDS).getId(); + //pl.getLogger().info("Time: "+pl.timeBetweenPlayers); messagerId = pl.getProxy().getScheduler().schedule(pl, new Runnable() { public void run() { @@ -88,6 +101,14 @@ public class Manager { sendActionBars(); } }, 0, 2, TimeUnit.SECONDS).getId(); + + if(pl.config.getInt("reload-servers-interval") > 0) { + srvRefId = pl.getProxy().getScheduler().schedule(pl, new Runnable() { + public void run() { + updateServers(); + } + }, pl.config.getInt("reload-servers-interval"), pl.config.getInt("reload-servers-interval"), TimeUnit.SECONDS).getId(); + } } /** diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index a46a838..e9ad7d0 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1,5 +1,5 @@ # Dont touch this number please -config-version: 5 +config-version: 6 # The time the server will wait between sending people in the queue # Default: 5 @@ -23,7 +23,7 @@ queue-servers: send-actionbar: true # What kick reasons should cause the player to be removed from the queue? -# For example, if one of the below kick-reasons is 'banned' and the player gets kicked when trying to connect to +# For example, if one of the below kick reasons is 'banned' and the player gets kicked when trying to connect to # a server in a queue with a message saying "You are banned from this server!" then it will kick them from the queue too. kick-reasons: - 'banned' @@ -35,4 +35,16 @@ kick-reasons: # This is more meant for if you have multiple lobbies if you want to let the player switch # between them without losing their queue position # Default: true -remove-player-on-server-switch: true \ No newline at end of file +remove-player-on-server-switch: true + + +# Should we wait until the server is done loading to load the servers? +# Enable this if you have a plugin that adds servers to the server list during startup. +# Default: false +wait-to-load-servers: false + + +# How often (in seconds) we should check for new servers to add queues for. +# If you dynamicly add servers, set this to something other than 0. +# To disable, set to 0 +reload-servers-interval: 0