check-last-player-sent-time config option
This commit is contained in:
@@ -181,6 +181,7 @@ public class Main extends Plugin implements Listener {
|
|||||||
int pos = queue.indexOf(p);
|
int pos = queue.indexOf(p);
|
||||||
if((pos == 0 && ser.getInfos().contains(p.getServer().getInfo())) || config.getBoolean("remove-player-on-server-switch")) {
|
if((pos == 0 && ser.getInfos().contains(p.getServer().getInfo())) || config.getBoolean("remove-player-on-server-switch")) {
|
||||||
queue.remove(p);
|
queue.remove(p);
|
||||||
|
ser.setLastSentTime(System.currentTimeMillis());
|
||||||
Manager.getInstance().sendingAttempts.remove(p);
|
Manager.getInstance().sendingAttempts.remove(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -657,8 +657,15 @@ public class Manager {
|
|||||||
}
|
}
|
||||||
int pos = list.indexOf(p)+1;
|
int pos = list.indexOf(p)+1;
|
||||||
int len = list.size();
|
int len = list.size();
|
||||||
boolean sendInstant = pl.config.getStringList("send-instantly").indexOf(server.getName()) != -1;
|
|
||||||
if((list.size() <= 1 || sendInstant) && server.canAccess(p)) {
|
|
||||||
|
boolean sendInstant = pl.config.getStringList("send-instantly").indexOf(server.getName()) != -1 && server.canAccess(p);
|
||||||
|
boolean sendInstantp = list.size() <= 1 && server.canAccess(p);
|
||||||
|
boolean timeGood = pl.config.getBoolean("check-last-player-sent-time") ?
|
||||||
|
System.currentTimeMillis() - server.getLastSentTime() > Math.floor(pl.getConfig().getDouble("wait-time")*1000)
|
||||||
|
: true;
|
||||||
|
|
||||||
|
if(sendInstant || (sendInstantp && timeGood)) {
|
||||||
sendPlayers(s);
|
sendPlayers(s);
|
||||||
BaseComponent[] m = msgs.getBC("status.now-in-empty-queue", "POS:"+pos, "LEN:"+len, "SERVER:"+pl.aliases.getAlias(s));
|
BaseComponent[] m = msgs.getBC("status.now-in-empty-queue", "POS:"+pos, "LEN:"+len, "SERVER:"+pl.aliases.getAlias(s));
|
||||||
if(TextComponent.toPlainText(m).length() > 0) {
|
if(TextComponent.toPlainText(m).length() > 0) {
|
||||||
|
|||||||
@@ -166,6 +166,15 @@ public class QueueServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
long lastSent = 0;
|
||||||
|
public long getLastSentTime() {
|
||||||
|
return lastSent;
|
||||||
|
}
|
||||||
|
public void setLastSentTime(long newLastSent) {
|
||||||
|
lastSent = newLastSent;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
boolean whitelisted = false;
|
boolean whitelisted = false;
|
||||||
List<String> whitelistedplayers = new ArrayList<>();
|
List<String> whitelistedplayers = new ArrayList<>();
|
||||||
public void setWhitelisted(boolean b) {
|
public void setWhitelisted(boolean b) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Dont touch this number please
|
# Dont touch this number please
|
||||||
config-version: 19
|
config-version: 20
|
||||||
|
|
||||||
# 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
|
||||||
@@ -146,3 +146,10 @@ max-tries: 10
|
|||||||
# If enabled, anyone with the permission ajqueue.bypasspaused will be able to join paused servers
|
# If enabled, anyone with the permission ajqueue.bypasspaused will be able to join paused servers
|
||||||
# Default: false
|
# Default: false
|
||||||
enable-bypasspaused-permission: false
|
enable-bypasspaused-permission: false
|
||||||
|
|
||||||
|
|
||||||
|
# Should we check to make sure that people dont get sent quicker than wait-time?
|
||||||
|
# Default: true
|
||||||
|
check-last-player-sent-time: true
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user