add estimated queue time
This commit is contained in:
@@ -117,11 +117,25 @@ public class Main extends Plugin implements Listener {
|
|||||||
for(ProxiedPlayer ply : plys) {
|
for(ProxiedPlayer ply : plys) {
|
||||||
int pos = plys.indexOf(ply)+1;
|
int pos = plys.indexOf(ply)+1;
|
||||||
int len = plys.size();
|
int len = plys.size();
|
||||||
|
int time = pos*timeBetweenPlayers;
|
||||||
|
int min = (int) Math.floor((time) / (60));
|
||||||
|
int sec = (int) Math.floor((time % (60)));
|
||||||
|
String timeStr;
|
||||||
|
if(min <= 0) {
|
||||||
|
timeStr = msgs.get("format.time.secs")
|
||||||
|
.replaceAll("\\{m\\}", "0")
|
||||||
|
.replaceAll("\\{s\\}", sec+"");
|
||||||
|
} else {
|
||||||
|
timeStr = msgs.get("format.time.mins")
|
||||||
|
.replaceAll("\\{m\\}", min+"")
|
||||||
|
.replaceAll("\\{s\\}", sec+"");
|
||||||
|
}
|
||||||
if(notif) {
|
if(notif) {
|
||||||
ply.sendMessage(formatMessage(
|
ply.sendMessage(formatMessage(
|
||||||
msgs.get("status.online.base")
|
msgs.get("status.online.base")
|
||||||
.replaceAll("\\{POS\\}", pos+"")
|
.replaceAll("\\{POS\\}", pos+"")
|
||||||
.replaceAll("\\{LEN\\}", len+"")
|
.replaceAll("\\{LEN\\}", len+"")
|
||||||
|
.replaceAll("\\{TIME\\}", timeStr)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class BungeeMessages {
|
|||||||
d.put("status.offline.base", "&cThe server you are queued for is {STATUS}. &7You are in position &f{POS}&7 of &f{LEN}&7.");
|
d.put("status.offline.base", "&cThe server you are queued for is {STATUS}. &7You are in position &f{POS}&7 of &f{LEN}&7.");
|
||||||
d.put("status.offline.offline", "offline");
|
d.put("status.offline.offline", "offline");
|
||||||
d.put("status.offline.restarting", "restarting");
|
d.put("status.offline.restarting", "restarting");
|
||||||
d.put("status.online.base", "&7You are in position &f{POS}&7 of &f{LEN}&7.");
|
d.put("status.online.base", "&7You are in position &f{POS}&7 of &f{LEN}&7. Estimated time: {TIME}");
|
||||||
d.put("status.left-last-queue", "&aYou left the last queue you were in.");
|
d.put("status.left-last-queue", "&aYou left the last queue you were in.");
|
||||||
d.put("status.now-in-queue", "&aYou are now queued! &7You are in position &f{POS}&7 of &f{LEN}&7.");
|
d.put("status.now-in-queue", "&aYou are now queued! &7You are in position &f{POS}&7 of &f{LEN}&7.");
|
||||||
|
|
||||||
@@ -69,6 +69,9 @@ public class BungeeMessages {
|
|||||||
|
|
||||||
d.put("noperm", "&cYou do not have permission to do this!");
|
d.put("noperm", "&cYou do not have permission to do this!");
|
||||||
|
|
||||||
|
d.put("format.time.mins", "{m}m {s}s");
|
||||||
|
d.put("format.time.secs", "{s} seconds");
|
||||||
|
|
||||||
|
|
||||||
for(String k : d.keySet()) {
|
for(String k : d.keySet()) {
|
||||||
if(!msgs.contains(k)) {
|
if(!msgs.contains(k)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user