no longer requires spigot added for actionbar
This commit is contained in:
@@ -7,6 +7,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.TimeUnit;
|
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.ProxyServer;
|
||||||
import net.md_5.bungee.api.ServerPing;
|
import net.md_5.bungee.api.ServerPing;
|
||||||
import net.md_5.bungee.api.chat.BaseComponent;
|
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("\\{POS\\}", pos+"")
|
||||||
.replaceAll("\\{LEN\\}", len+"")
|
.replaceAll("\\{LEN\\}", len+"")
|
||||||
.replaceAll("\\{SERVER\\}", pl.aliases.getAlias(s.getName()))
|
.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 {
|
} else {
|
||||||
int time = (int) Math.round(pos*pl.timeBetweenPlayers);
|
int time = (int) Math.round(pos*pl.timeBetweenPlayers);
|
||||||
int min = (int) Math.floor((time) / (60));
|
int min = (int) Math.floor((time) / (60));
|
||||||
@@ -295,11 +301,16 @@ public class Manager {
|
|||||||
.replaceAll("\\{m\\}", min+"")
|
.replaceAll("\\{m\\}", min+"")
|
||||||
.replaceAll("\\{s\\}", sec+"");
|
.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("\\{POS\\}", pos+"")
|
||||||
.replaceAll("\\{LEN\\}", len+"")
|
.replaceAll("\\{LEN\\}", len+"")
|
||||||
.replaceAll("\\{SERVER\\}", pl.aliases.getAlias(s.getName()))
|
.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() {
|
public void sendMessages() {
|
||||||
for(QueueServer s : servers) {
|
for(QueueServer s : servers) {
|
||||||
int ot = s.getOfflineTime();
|
|
||||||
List<ProxiedPlayer> plys = s.getQueue();
|
List<ProxiedPlayer> plys = s.getQueue();
|
||||||
Iterator<ProxiedPlayer> it = plys.iterator();
|
Iterator<ProxiedPlayer> it = plys.iterator();
|
||||||
while(it.hasNext()) {
|
while(it.hasNext()) {
|
||||||
@@ -374,7 +384,21 @@ public class Manager {
|
|||||||
it.remove();
|
it.remove();
|
||||||
continue;
|
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 len = plys.size();
|
||||||
|
int ot = s.getOfflineTime();
|
||||||
if(!s.isJoinable(ply)) {
|
if(!s.isJoinable(ply)) {
|
||||||
|
|
||||||
String status = msgs.get("status.offline.restarting");
|
String status = msgs.get("status.offline.restarting");
|
||||||
@@ -427,9 +451,6 @@ public class Manager {
|
|||||||
.replaceAll("\\{SERVER\\}", pl.aliases.getAlias(s.getName()))
|
.replaceAll("\\{SERVER\\}", pl.aliases.getAlias(s.getName()))
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ queue-servers:
|
|||||||
- 'survivalqueue:survival'
|
- 'survivalqueue:survival'
|
||||||
|
|
||||||
# Should the plugin send an actionbar to the player?
|
# 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
|
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?
|
||||||
|
|||||||
Reference in New Issue
Block a user