Fix encoding issues in Results
This commit is contained in:
@@ -64,28 +64,28 @@ public class Results {
|
||||
if (time) {
|
||||
String msg = "";
|
||||
if (System.currentTimeMillis() - entry.getTime() < 55) {
|
||||
msg = "<EFBFBD>7Just Now";
|
||||
msg = "§7Just Now";
|
||||
} else {
|
||||
msg = String.format("<EFBFBD>7%s ago", TimeUtil.millisToString(System.currentTimeMillis() - entry.getTime()),
|
||||
msg = String.format("§7%s ago", TimeUtil.millisToString(System.currentTimeMillis() - entry.getTime()),
|
||||
entry.getUser());
|
||||
}
|
||||
message.append(msg).event(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
|
||||
new Text(Instant.ofEpochMilli(entry.getTime()).atZone(ZoneId.systemDefault()).format(dateFormatter)
|
||||
+ "\n<EFBFBD>7Click to copy epoch time. (" + entry.getTime() + "ms)")))
|
||||
+ "\n§7Click to copy epoch time. (" + entry.getTime() + "ms)")))
|
||||
.event(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, entry.getTime() + "e"));
|
||||
}
|
||||
|
||||
String actionColor = "<EFBFBD>7-";
|
||||
String actionColor = "§7-";
|
||||
if (entry.getAction().hasDual) {
|
||||
actionColor = entry.getState() ? "<EFBFBD>a+" : "<EFBFBD>c-";
|
||||
actionColor = entry.getState() ? "§a+" : "§c-";
|
||||
}
|
||||
message.append(" " + actionColor + " ").event((HoverEvent) null);
|
||||
HoverEvent clickToCopy = new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("Click to copy to clipboard"));
|
||||
message.append("<EFBFBD>9" + entry.getUser()).event(clickToCopy)
|
||||
message.append("§9" + entry.getUser()).event(clickToCopy)
|
||||
.event(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, entry.getUser()));
|
||||
message.append(" <EFBFBD>f" + entry.getAction().getText(entry.getState())).event((HoverEvent) null)
|
||||
message.append(" §f" + entry.getAction().getText(entry.getState())).event((HoverEvent) null)
|
||||
.event((ClickEvent) null);
|
||||
message.append(" <EFBFBD>9" + entry.getTarget()).event(clickToCopy)
|
||||
message.append(" §9" + entry.getTarget()).event(clickToCopy)
|
||||
.event(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, entry.getTarget()));
|
||||
|
||||
XrayEntry xray = null;
|
||||
@@ -93,14 +93,14 @@ public class Results {
|
||||
xray = (XrayEntry) entry;
|
||||
String rating = null;
|
||||
if (xray.getRating() == -2) {
|
||||
rating = "<EFBFBD>5Ignored";
|
||||
rating = "§5Ignored";
|
||||
} else if (xray.getRating() == -1) {
|
||||
rating = "<EFBFBD>7Unrated";
|
||||
rating = "§7Unrated";
|
||||
} else {
|
||||
rating = xray.getRating() + "";
|
||||
}
|
||||
String color = VeinManager.getSeverityColor(xray.getRating());
|
||||
message.append(String.format(" <EFBFBD>8[%s%s<EFBFBD>8]", color, rating)).event(new ClickEvent(
|
||||
message.append(String.format(" §8[%s%s§8]", color, rating)).event(new ClickEvent(
|
||||
ClickEvent.Action.RUN_COMMAND, "/" + plugin.getCommandPrefix() + " xray rate " + entry.getTime()));
|
||||
String hover = "";
|
||||
if (xray.getRating() >= 0) {
|
||||
@@ -113,19 +113,19 @@ public class Results {
|
||||
String data = entry.getData();
|
||||
if (entry.hasBlob()) {
|
||||
if (APPermission.INV.hasPermission(player)) {
|
||||
message.append(" <EFBFBD>a[View]")
|
||||
message.append(" §a[View]")
|
||||
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND,
|
||||
String.format(commandPrefix + " inv %d", index)))
|
||||
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("<EFBFBD>fClick to view!")));
|
||||
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("§fClick to view!")));
|
||||
}
|
||||
}
|
||||
if (entry.getAction().equals(EntryAction.KILL)) {
|
||||
if (APPermission.INV.hasPermission(player) && !entry.getTarget().startsWith("#")) {
|
||||
message.append(" <EFBFBD>a[View Inv]")
|
||||
message.append(" §a[View Inv]")
|
||||
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND,
|
||||
String.format(commandPrefix + " l u:%s a:inventory target:death time:%de+-20e",
|
||||
entry.getTarget(), entry.getTime())))
|
||||
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("<EFBFBD>fClick to view!")));
|
||||
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("§fClick to view!")));
|
||||
}
|
||||
}
|
||||
if (plugin.getAPConfig().doSkipV6Migration()) {
|
||||
@@ -137,7 +137,7 @@ public class Results {
|
||||
}
|
||||
}
|
||||
if (data != null && data.length() > 0) {
|
||||
message.append(" <EFBFBD>8[<EFBFBD>7" + data + "<EFBFBD>8]").event(clickToCopy)
|
||||
message.append(" §8[§7" + data + "§8]").event(clickToCopy)
|
||||
.event(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, entry.getData()));
|
||||
}
|
||||
if (entry.world != null && !entry.world.equals("$null") && coords) {
|
||||
@@ -146,11 +146,11 @@ public class Results {
|
||||
tpCommand += String.format(" %d %d", entry.pitch, entry.yaw);
|
||||
}
|
||||
message.append("\n ").event((HoverEvent) null).event((ClickEvent) null);
|
||||
message.append(String.format("<EFBFBD>7(x%d/y%d/z%d/%s)", entry.x, entry.y, entry.z, entry.world))
|
||||
message.append(String.format("§7(x%d/y%d/z%d/%s)", entry.x, entry.y, entry.z, entry.world))
|
||||
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, tpCommand))
|
||||
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("<EFBFBD>7" + tpCommand)));
|
||||
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("§7" + tpCommand)));
|
||||
if (entry.getAction().getTable().hasLook()) {
|
||||
message.append(String.format("<EFBFBD>7 (p%s/y%d)", entry.pitch, entry.yaw));
|
||||
message.append(String.format("§7 (p%s/y%d)", entry.pitch, entry.yaw));
|
||||
}
|
||||
}
|
||||
player.sendMessage(message.create());
|
||||
@@ -165,17 +165,17 @@ public class Results {
|
||||
}
|
||||
|
||||
public void sendHeader() {
|
||||
String headerColor = "<EFBFBD>7";
|
||||
String line = "<EFBFBD>m";
|
||||
String headerColor = "§7";
|
||||
String line = "§m";
|
||||
for (int i = 0; i < 6; i++) {
|
||||
line += (char) 65293;
|
||||
}
|
||||
line += "<EFBFBD>7";
|
||||
line += "§7";
|
||||
if (plugin.getAPConfig().isPrivate() && new Random().nextDouble() < 0.001) {
|
||||
headerColor = "<EFBFBD>f"; // The header had these mismatched colors for over a year of development until
|
||||
headerColor = "§f"; // The header had these mismatched colors for over a year of development until
|
||||
// v1.1.3. This is a tribute to that screw up
|
||||
}
|
||||
player.sendMessageRaw(headerColor + line + " <EFBFBD>9AuxProtect Results<EFBFBD>7 " + line);
|
||||
player.sendMessageRaw(headerColor + line + " §9AuxProtect Results§7 " + line);
|
||||
}
|
||||
|
||||
public void showPage(int page) {
|
||||
@@ -207,40 +207,40 @@ public class Results {
|
||||
String commandPrefix = "/" + plugin.getCommandPrefix();
|
||||
ComponentBuilder message = new ComponentBuilder();
|
||||
int lastpage = getNumPages(perpage);
|
||||
message.append("<EFBFBD>7(");
|
||||
message.append("§7(");
|
||||
if (page > 1) {
|
||||
message.append("<EFBFBD>9<EFBFBD>l" + AuxProtectSpigot.LEFT_ARROW + AuxProtectSpigot.LEFT_ARROW)
|
||||
message.append("§9§l" + AuxProtectSpigot.LEFT_ARROW + AuxProtectSpigot.LEFT_ARROW)
|
||||
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, commandPrefix + " l 1:" + perpage))
|
||||
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("<EFBFBD>9Jump to First Page")));
|
||||
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("§9Jump to First Page")));
|
||||
message.append(" ").event((ClickEvent) null).event((HoverEvent) null);
|
||||
message.append("<EFBFBD>9<EFBFBD>l" + AuxProtectSpigot.LEFT_ARROW)
|
||||
message.append("§9§l" + AuxProtectSpigot.LEFT_ARROW)
|
||||
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND,
|
||||
commandPrefix + " l " + (page - 1) + ":" + perpage))
|
||||
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("Last Page")));
|
||||
} else {
|
||||
message.event(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, ""));
|
||||
message.append("<EFBFBD>8<EFBFBD>l" + AuxProtectSpigot.LEFT_ARROW + AuxProtectSpigot.LEFT_ARROW).event((ClickEvent) null)
|
||||
message.append("§8§l" + AuxProtectSpigot.LEFT_ARROW + AuxProtectSpigot.LEFT_ARROW).event((ClickEvent) null)
|
||||
.event((HoverEvent) null);
|
||||
message.append(" ");
|
||||
message.append("<EFBFBD>8<EFBFBD>l" + AuxProtectSpigot.LEFT_ARROW);
|
||||
message.append("§8§l" + AuxProtectSpigot.LEFT_ARROW);
|
||||
}
|
||||
message.append(" ").event((ClickEvent) null).event((HoverEvent) null);
|
||||
if (page < lastpage) {
|
||||
message.append("<EFBFBD>9<EFBFBD>l" + AuxProtectSpigot.RIGHT_ARROW)
|
||||
message.append("§9§l" + AuxProtectSpigot.RIGHT_ARROW)
|
||||
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND,
|
||||
commandPrefix + " l " + (page + 1) + ":" + perpage))
|
||||
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("Next Page")));
|
||||
message.append(" ").event((ClickEvent) null).event((HoverEvent) null);
|
||||
message.append("<EFBFBD>9<EFBFBD>l" + AuxProtectSpigot.RIGHT_ARROW + AuxProtectSpigot.RIGHT_ARROW)
|
||||
message.append("§9§l" + AuxProtectSpigot.RIGHT_ARROW + AuxProtectSpigot.RIGHT_ARROW)
|
||||
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND,
|
||||
commandPrefix + " l " + lastpage + ":" + perpage))
|
||||
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("Jump to Last Page")));
|
||||
} else {
|
||||
message.append("<EFBFBD>8<EFBFBD>l" + AuxProtectSpigot.RIGHT_ARROW).event((ClickEvent) null).event((HoverEvent) null);
|
||||
message.append("§8§l" + AuxProtectSpigot.RIGHT_ARROW).event((ClickEvent) null).event((HoverEvent) null);
|
||||
message.append(" ");
|
||||
message.append("<EFBFBD>8<EFBFBD>l" + AuxProtectSpigot.RIGHT_ARROW + AuxProtectSpigot.RIGHT_ARROW);
|
||||
message.append("§8§l" + AuxProtectSpigot.RIGHT_ARROW + AuxProtectSpigot.RIGHT_ARROW);
|
||||
}
|
||||
message.append("<EFBFBD>7) ").event((ClickEvent) null).event((HoverEvent) null);
|
||||
message.append("§7) ").event((ClickEvent) null).event((HoverEvent) null);
|
||||
message.append(Language.translate(Language.L.COMMAND__LOOKUP__PAGE_FOOTER, page, getNumPages(perpage), getEntries().size()));
|
||||
player.sendMessage(message.create());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user