minimessage support progress
This commit is contained in:
@@ -65,7 +65,7 @@ public class Main extends Plugin implements Listener {
|
|||||||
|
|
||||||
d.put("status.online.base", "&7You are in position &f{POS}&7 of &f{LEN}&7. Estimated time: {TIME}");
|
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 for {SERVER}! &7You are in position &f{POS}&7 of &f{LEN}&7.\n&7Type &f/leavequeue&7 to leave the queue!");
|
d.put("status.now-in-queue", "&aYou are now queued for {SERVER}! &7You are in position &f{POS}&7 of &f{LEN}&7.\n&7Type &f/leavequeue&7 or &f<click:run_command:/leavequeue {SERVERNAME}>click here</click>&7 to leave the queue!");
|
||||||
d.put("status.now-in-empty-queue", "");
|
d.put("status.now-in-empty-queue", "");
|
||||||
d.put("status.sending-now", "&aSending you to &f{SERVER} &anow..");
|
d.put("status.sending-now", "&aSending you to &f{SERVER} &anow..");
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ public class Main extends Plugin implements Listener {
|
|||||||
d.put("commands.send.player-not-found", "&cThat player could not be found. Make sure they are online!");
|
d.put("commands.send.player-not-found", "&cThat player could not be found. Make sure they are online!");
|
||||||
|
|
||||||
d.put("commands.listqueues.header", "&9Queues:");
|
d.put("commands.listqueues.header", "&9Queues:");
|
||||||
d.put("commands.listqueues.format", "{COLOR}{NAME}&7: {COUNT} queued");
|
d.put("commands.listqueues.format", "<hover:show_text:'&7Status: {STATUS}'>{COLOR}{NAME}&7: {COUNT} queued</hover>");
|
||||||
|
|
||||||
d.put("max-tries-reached", "&cUnable to connect to {SERVER}. Max retries reached.");
|
d.put("max-tries-reached", "&cUnable to connect to {SERVER}. Max retries reached.");
|
||||||
d.put("auto-queued", "&aYou've been auto-queued for {SERVER} because you were kicked.");
|
d.put("auto-queued", "&aYou've been auto-queued for {SERVER} because you were kicked.");
|
||||||
|
|||||||
@@ -277,29 +277,8 @@ public class Manager {
|
|||||||
int len = plys.size();
|
int len = plys.size();
|
||||||
if(!s.isJoinable(p)) {
|
if(!s.isJoinable(p)) {
|
||||||
|
|
||||||
String status = "unknown";
|
String status = s.getStatusString(p);
|
||||||
|
|
||||||
|
|
||||||
if(!s.canAccess(p)) {
|
|
||||||
status = msgs.getString("status.offline.restricted");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(s.isFull()) {
|
|
||||||
status = msgs.getString("status.offline.full");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(s.isPaused()) {
|
|
||||||
status = msgs.getString("status.offline.paused");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!s.isOnline()) {
|
|
||||||
status = msgs.getString("status.offline.restarting");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(s.getOfflineTime() > pl.config.getInt("offline-time")) {
|
|
||||||
status = msgs.getString("status.offline.offline");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
p.sendMessage(ChatMessageType.ACTION_BAR, msgs.getBC("spigot.actionbar.offline",
|
p.sendMessage(ChatMessageType.ACTION_BAR, msgs.getBC("spigot.actionbar.offline",
|
||||||
"POS:"+pos,
|
"POS:"+pos,
|
||||||
@@ -375,23 +354,7 @@ public class Manager {
|
|||||||
int ot = s.getOfflineTime();
|
int ot = s.getOfflineTime();
|
||||||
if(!s.isJoinable(ply)) {
|
if(!s.isJoinable(ply)) {
|
||||||
|
|
||||||
String status = msgs.getString("status.offline.restarting");
|
String status = s.getStatusString(ply);
|
||||||
|
|
||||||
if(ot > pl.config.getInt("offline-time")) {
|
|
||||||
status = msgs.getString("status.offline.offline");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(s.isFull() && s.isOnline()) {
|
|
||||||
status = msgs.getString("status.offline.full");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!s.canAccess(ply)) {
|
|
||||||
status = msgs.getString("status.offline.restricted");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(s.isPaused()) {
|
|
||||||
status = msgs.getString("status.offline.paused");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(status.isEmpty()) return;
|
if(status.isEmpty()) return;
|
||||||
|
|
||||||
@@ -709,7 +672,8 @@ public class Manager {
|
|||||||
p.sendMessage(msgs.getBC("status.now-in-queue",
|
p.sendMessage(msgs.getBC("status.now-in-queue",
|
||||||
"POS:"+pos,
|
"POS:"+pos,
|
||||||
"LEN:"+len,
|
"LEN:"+len,
|
||||||
"SERVER:"+pl.aliases.getAlias(server.getName())
|
"SERVER:"+pl.aliases.getAlias(server.getName()),
|
||||||
|
"SERVERNAME:"+server.getName()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
//p.sendMessage(Main.formatMessage(sendInstant+" && ("+sendInstantp+" && " + timeGood+")"));
|
//p.sendMessage(Main.formatMessage(sendInstant+" && ("+sendInstantp+" && " + timeGood+")"));
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import net.md_5.bungee.api.ServerPing;
|
|||||||
import net.md_5.bungee.api.config.ServerInfo;
|
import net.md_5.bungee.api.config.ServerInfo;
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||||
import us.ajg0702.utils.bungee.BungeeConfig;
|
import us.ajg0702.utils.bungee.BungeeConfig;
|
||||||
|
import us.ajg0702.utils.bungee.BungeeMessages;
|
||||||
|
|
||||||
public class QueueServer {
|
public class QueueServer {
|
||||||
|
|
||||||
@@ -84,6 +85,33 @@ public class QueueServer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getStatusString(ProxiedPlayer p) {
|
||||||
|
BungeeMessages msgs = Main.plugin.msgs;
|
||||||
|
|
||||||
|
if(getOfflineTime() > Main.plugin.getConfig().getInt("offline-time")) {
|
||||||
|
return msgs.getString("status.offline.offline");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isOnline()) {
|
||||||
|
return msgs.getString("status.offline.restarting");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isPaused()) {
|
||||||
|
return msgs.getString("status.offline.paused");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isFull()) {
|
||||||
|
return msgs.getString("status.offline.full");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(p != null && !canAccess(p)) {
|
||||||
|
return msgs.getString("status.offline.restricted");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return "Online";
|
||||||
|
}
|
||||||
|
|
||||||
public HashMap<ServerInfo, ServerPing> getLastPings() {
|
public HashMap<ServerInfo, ServerPing> getLastPings() {
|
||||||
return pings;
|
return pings;
|
||||||
|
|||||||
@@ -63,13 +63,13 @@ public class LeaveCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String getQueueList(List<QueueServer> servers) {
|
private String getQueueList(List<QueueServer> servers) {
|
||||||
String queueList = "";
|
StringBuilder queueList = new StringBuilder();
|
||||||
for(QueueServer server : servers) {
|
for(QueueServer server : servers) {
|
||||||
queueList += msgs.get("commands.leave.queues-list-format").replaceAll("\\{NAME\\}", server.getName());
|
queueList.append(msgs.getString("commands.leave.queues-list-format").replaceAll("\\{NAME\\}", server.getName()));
|
||||||
}
|
}
|
||||||
if(queueList.length() > 2) {
|
if(queueList.length() > 2) {
|
||||||
queueList = queueList.substring(0, queueList.length()-2);
|
queueList = new StringBuilder(queueList.substring(0, queueList.length() - 2));
|
||||||
}
|
}
|
||||||
return queueList;
|
return queueList.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package us.ajg0702.queue.commands;
|
package us.ajg0702.queue.commands;
|
||||||
|
|
||||||
import net.md_5.bungee.api.CommandSender;
|
import net.md_5.bungee.api.CommandSender;
|
||||||
|
import net.md_5.bungee.api.chat.BaseComponent;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||||
import net.md_5.bungee.api.plugin.Command;
|
import net.md_5.bungee.api.plugin.Command;
|
||||||
@@ -9,6 +10,9 @@ import us.ajg0702.queue.Manager;
|
|||||||
import us.ajg0702.queue.QueueServer;
|
import us.ajg0702.queue.QueueServer;
|
||||||
import us.ajg0702.utils.bungee.BungeeMessages;
|
import us.ajg0702.utils.bungee.BungeeMessages;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class ListCommand extends Command {
|
public class ListCommand extends Command {
|
||||||
Main pl;
|
Main pl;
|
||||||
BungeeMessages msgs;
|
BungeeMessages msgs;
|
||||||
@@ -31,7 +35,7 @@ public class ListCommand extends Command {
|
|||||||
spp = (ProxiedPlayer) sender;
|
spp = (ProxiedPlayer) sender;
|
||||||
}
|
}
|
||||||
|
|
||||||
String m = msgs.get("commands.listqueues.header");
|
ArrayList<BaseComponent> m = new ArrayList<>(Arrays.asList(msgs.getBC("commands.listqueues.header")));
|
||||||
for(QueueServer s : Manager.getInstance().getServers()) {
|
for(QueueServer s : Manager.getInstance().getServers()) {
|
||||||
String color = "&a";
|
String color = "&a";
|
||||||
if(!s.isOnline()) {
|
if(!s.isOnline()) {
|
||||||
@@ -39,13 +43,17 @@ public class ListCommand extends Command {
|
|||||||
} else if(!s.isJoinable(spp)) {
|
} else if(!s.isJoinable(spp)) {
|
||||||
color = "&e";
|
color = "&e";
|
||||||
}
|
}
|
||||||
m += "\n"+msgs.get("commands.listqueues.format")
|
|
||||||
.replaceAll("\\{COLOR\\}", msgs.color(color))
|
m.addAll(Arrays.asList(TextComponent.fromLegacyText("\n")));
|
||||||
.replaceAll("\\{NAME\\}", s.getName())
|
m.addAll(Arrays.asList(msgs.getBC("commands.listqueues.format",
|
||||||
.replaceAll("\\{COUNT\\}", s.getQueue().size()+"");
|
"COLOR:" + msgs.color(color),
|
||||||
|
"NAME:" + s.getName(),
|
||||||
|
"COUNT:" + s.getQueue().size(),
|
||||||
|
"STATUS:" + s.getStatusString(spp)
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(TextComponent.fromLegacyText(m));
|
sender.sendMessage(m.toArray(new BaseComponent[m.size()-1]));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user