no longer requires spigot added for actionbar

This commit is contained in:
ajgeiss0702
2020-09-05 11:30:49 -07:00
parent 0ec25476e5
commit 0b47fde43f
2 changed files with 81 additions and 60 deletions
+29 -8
View File
@@ -7,6 +7,7 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.ServerPing;
import net.md_5.bungee.api.chat.BaseComponent;
@@ -276,11 +277,16 @@ public class Manager {
}
BungeeUtils.sendCustomData(p, "actionbar", msgs.get("spigot.actionbar.offline")
/*BungeeUtils.sendCustomData(p, "actionbar", msgs.get("spigot.actionbar.offline")
.replaceAll("\\{POS\\}", pos+"")
.replaceAll("\\{LEN\\}", len+"")
.replaceAll("\\{SERVER\\}", pl.aliases.getAlias(s.getName()))
.replaceAll("\\{STATUS\\}", status)+";time="+pl.timeBetweenPlayers);
.replaceAll("\\{STATUS\\}", status)+";time="+pl.timeBetweenPlayers);*/
p.sendMessage(ChatMessageType.ACTION_BAR, msgs.getBC("spigot.actionbar.offline",
"POS:"+pos,
"LEN:"+len,
"SERVER:"+pl.aliases.getAlias(s.getName()),
"STATUS:"+status));
} else {
int time = (int) Math.round(pos*pl.timeBetweenPlayers);
int min = (int) Math.floor((time) / (60));
@@ -295,11 +301,16 @@ public class Manager {
.replaceAll("\\{m\\}", min+"")
.replaceAll("\\{s\\}", sec+"");
}
BungeeUtils.sendCustomData(p, "actionbar", msgs.get("spigot.actionbar.online")
/*BungeeUtils.sendCustomData(p, "actionbar", msgs.get("spigot.actionbar.online")
.replaceAll("\\{POS\\}", pos+"")
.replaceAll("\\{LEN\\}", len+"")
.replaceAll("\\{SERVER\\}", pl.aliases.getAlias(s.getName()))
.replaceAll("\\{TIME\\}", timeStr)+";time="+pl.timeBetweenPlayers);
.replaceAll("\\{TIME\\}", timeStr)+";time="+pl.timeBetweenPlayers);*/
p.sendMessage(ChatMessageType.ACTION_BAR, msgs.getBC("spigot.actionbar.online",
"POS:"+pos,
"LEN:"+len,
"SERVER:"+pl.aliases.getAlias(s.getName()),
"TIME:"+timeStr));
}
}
@@ -364,7 +375,6 @@ public class Manager {
*/
public void sendMessages() {
for(QueueServer s : servers) {
int ot = s.getOfflineTime();
List<ProxiedPlayer> plys = s.getQueue();
Iterator<ProxiedPlayer> it = plys.iterator();
while(it.hasNext()) {
@@ -374,7 +384,21 @@ public class Manager {
it.remove();
continue;
}
sendMessage(ply, s);
}
}
}
/**
* Sends a status message to a player
* @param ply The player to send the message to
* @param s The QueueServer the message should be about
*/
public void sendMessage(ProxiedPlayer ply, QueueServer s) {
List<ProxiedPlayer> plys = s.getQueue();
int pos = plys.indexOf(ply)+1;
if(pos == 0) return;
int len = plys.size();
int ot = s.getOfflineTime();
if(!s.isJoinable(ply)) {
String status = msgs.get("status.offline.restarting");
@@ -427,9 +451,6 @@ public class Manager {
.replaceAll("\\{SERVER\\}", pl.aliases.getAlias(s.getName()))
));
}
}
}
}
/**
+1 -1
View File
@@ -19,7 +19,7 @@ queue-servers:
- 'survivalqueue:survival'
# Should the plugin send an actionbar to the player?
# Requires this plugin to be installed on the server the player is on for it to work
# The actionbar contains some info such as which server they are queued for, what position they are in, estimated time remaining, etc.
send-actionbar: true
# What kick reasons should cause the player to be removed from the queue?