Added wait-to-load-servers and reload-servers-interval to config

This commit is contained in:
ajgeiss0702
2020-06-25 08:33:42 -07:00
parent 4f5d5be97f
commit a2f81043b7
2 changed files with 37 additions and 4 deletions
+22 -1
View File
@@ -32,8 +32,16 @@ public class Manager {
private Manager(Main pl) { private Manager(Main pl) {
this.pl = pl; this.pl = pl;
msgs = BungeeMessages.getInstance(); msgs = BungeeMessages.getInstance();
reloadServers();
reloadIntervals(); 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 updateId = -1;
int messagerId = -1; int messagerId = -1;
int actionbarId = -1; int actionbarId = -1;
int srvRefId = -1;
/** /**
* Clears all intervals and re-makes them * Clears all intervals and re-makes them
*/ */
@@ -65,6 +74,9 @@ public class Manager {
if(actionbarId != -1) { if(actionbarId != -1) {
pl.getProxy().getScheduler().cancel(actionbarId); pl.getProxy().getScheduler().cancel(actionbarId);
} }
if(srvRefId != -1) {
pl.getProxy().getScheduler().cancel(srvRefId);
}
sendId = pl.getProxy().getScheduler().schedule(pl, new Runnable() { sendId = pl.getProxy().getScheduler().schedule(pl, new Runnable() {
public void run() { public void run() {
@@ -77,6 +89,7 @@ public class Manager {
updateServers(); updateServers();
} }
}, 0, Math.max(pl.timeBetweenPlayers, 2), TimeUnit.SECONDS).getId(); }, 0, Math.max(pl.timeBetweenPlayers, 2), TimeUnit.SECONDS).getId();
//pl.getLogger().info("Time: "+pl.timeBetweenPlayers);
messagerId = pl.getProxy().getScheduler().schedule(pl, new Runnable() { messagerId = pl.getProxy().getScheduler().schedule(pl, new Runnable() {
public void run() { public void run() {
@@ -88,6 +101,14 @@ public class Manager {
sendActionBars(); sendActionBars();
} }
}, 0, 2, TimeUnit.SECONDS).getId(); }, 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();
}
} }
/** /**
+14 -2
View File
@@ -1,5 +1,5 @@
# Dont touch this number please # Dont touch this number please
config-version: 5 config-version: 6
# The time the server will wait between sending people in the queue # The time the server will wait between sending people in the queue
# Default: 5 # Default: 5
@@ -23,7 +23,7 @@ queue-servers:
send-actionbar: true send-actionbar: true
# What kick reasons should cause the player to be removed from the queue? # 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. # 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: kick-reasons:
- 'banned' - 'banned'
@@ -36,3 +36,15 @@ kick-reasons:
# between them without losing their queue position # between them without losing their queue position
# Default: true # Default: true
remove-player-on-server-switch: true 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