Replace all § with ChatColor.COLOR_CHAR

This commit is contained in:
Heliosares
2023-03-05 20:37:51 -05:00
parent 7872572a2d
commit f2a6cc1c55
21 changed files with 130 additions and 152 deletions

View File

@@ -1,3 +1,6 @@
#
# Russian translation courtesy of l_MrBoom_l
#
version: 4
color:
p: '9'
@@ -20,12 +23,16 @@ watch-now: '&sВы теперь наблюдаете за &p%s'
backup-sqliteonly: 'Резервное копирование доступно только на SQLite'
unknown-subcommand: 'Неизвестная субкоманда. Используйте ''/ap help'', чтобы узнать больше.'
command:
saveinv:
success: '&tИнвентарь &p<target> &tбыл сохранён вручную. &otime:<time>'
toosoon: '&cИнвентарь этого пользователя был сохранён совсем недавно.'
claiminv:
cancelled-other: '&aВы отменили возможность восстановления инвентаря для <target>.'
cancelled: '&cВосстановление вашего инвентаря было отменено.'
youhavenone: '&cНет инвентаря, который можно было бы восстановить.'
otherhasnone: '&cУ игрока нет восстанавливаемого инвентаря, который можно было бы отменить.'
header: 'Восстановление инвентаря'
inv:
recovered: '&p<admin> &sвосстановил инвентарь &p<target> &sот &p<time> &sназад.'
force-recovered: '&p<admin> &sпринудительно восстановил инвентарь &p<target> &sот &p<time> &sназад.'
purge:
@@ -54,6 +61,9 @@ command:
action-none: '&cВы должны указать действие.'
rating-wrong: '&cВы можете указывать ''rating'' только для a:vein.'
nodata: '&cВ этой таблице нет логов данных.'
playtime:
nouser: '&cПользователь не указан'
toomanyusers: '&cУказано слишком много пользователей'
playback:
starting: '&pВоспроизведение запущено...'
stopped: '&pВоспроизведение остановлено.'
@@ -81,13 +91,9 @@ command:
- '&s/$prefix &ppurge &s<таблица | all> <время>'
- '&sСмотрите все доступные таблицы в авто-продолжении'
- '&sМинимальное время 2 недели.'
lookup-playtime-nouser: '&cПользователь не указан'
lookup-playtime-toomanyusers: '&cУказано слишком много пользователей'
playernotfound: '&cИгрок не найден.'
lookup-playernotfound: '&cИгрок <target> не найден.'
lookup-unknownaction: '&cНеизвестное действие: <action>.'
playtime-toomanyusers: '&cВы не можете указывать более одного игрока в поиске игрового времени.'
playtime-nouser: '&cВы должны указать пользователя для поиска по игровому времени.'
xray-rate-nochange: '&cЭто уже рейтинг для этой записи.'
xray-rate-written: '&aРейтинг успешно записан.'
xray-done: '&aБольше нет проверок на xray!'
@@ -98,8 +104,6 @@ xray-click-to-change: '&aНажмите, чтобы оценить'
inactive-alert: '&8[&4Сервер&8] &e<user> &tможет быть неактивен. &e<inactive_minutes> &tиз &e<total_minutes> &tминут неактивен.'
yes: 'Да'
no: 'Нет'
inv-manual-success: '&tИнвентарь &p<target> &tбыл сохранён вручную. &otime:<time>'
inv-toosoon: '&cИнвентарь этого пользователя был сохранён совсем недавно.'
database-busy: '&cБаза данных занята. Пожалуйста, повторите попытку позже или проверьте консоль, чтобы узнать больше.'
protocollib-not-loaded: "&cДля этого действия требуется ProtocolLib, но он не установлен."

View File

@@ -6,6 +6,7 @@ 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.connection.ProxiedPlayer;
import org.bukkit.ChatColor;
import java.util.UUID;
@@ -20,7 +21,7 @@ public class BungeeSenderAdapter extends SenderAdapter {
}
public void sendMessageRaw(String message) {
sender.sendMessage(TextComponent.fromLegacyText(message));
sender.sendMessage(TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', message)));
}
public void sendMessage(BaseComponent... message) {

View File

@@ -2,6 +2,7 @@ package dev.heliosares.auxprotect.adapters.sender;
import dev.heliosares.auxprotect.core.PlatformType;
import dev.heliosares.auxprotect.spigot.AuxProtectSpigot;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.BaseComponent;
import org.bukkit.GameMode;
import org.bukkit.Location;
@@ -23,7 +24,7 @@ public class SpigotSenderAdapter extends SenderAdapter {
}
public void sendMessageRaw(String message) {
sender.sendMessage(message);
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', message));
}
public void sendMessage(BaseComponent... message) {

View File

@@ -3,6 +3,7 @@ package dev.heliosares.auxprotect.core;
import dev.heliosares.auxprotect.adapters.config.ConfigAdapter;
import dev.heliosares.auxprotect.api.AuxProtectAPI;
import dev.heliosares.auxprotect.utils.ColorTranslate;
import net.md_5.bungee.api.ChatColor;
import javax.annotation.Nullable;
import java.io.File;
@@ -52,6 +53,7 @@ public class Language {
for (L l : L.values()) {
if (lang.getString(l.name) == null) {
//lang.set(l.name, "");
plugin.warning("Lang file does not contain " + l.name);
}
}

View File

@@ -118,7 +118,7 @@ public class APCommand extends Command {
} catch (NumberFormatException ignored) {
}
if (verbosity < 0 || verbosity > 5) {
sender.sendMessageRaw("§cInvalid verbosity level. /ap debug [0-5]"); // TODO lang
sender.sendMessageRaw("&cInvalid verbosity level. /ap debug [0-5]"); // TODO lang
return;
}
} else {
@@ -134,7 +134,7 @@ public class APCommand extends Command {
sender.sendLang(Language.L.ERROR);
plugin.print(e);
}
sender.sendMessageRaw("Debug " + (verbosity > 0 ? "§aenabled. §7Level: " + verbosity : "§cdisabled."));
sender.sendMessageRaw("Debug " + (verbosity > 0 ? "&aenabled. &7Level: " + verbosity : "&cdisabled."));
return;
} else if (args[0].equalsIgnoreCase("info")) {
sendInfo(sender);
@@ -197,11 +197,11 @@ public class APCommand extends Command {
}
private void sendInfo(SenderAdapter sender) {
sender.sendMessageRaw("§9AuxProtect"
+ (APPermission.ADMIN.hasPermission(sender) ? (" §7v" + plugin.getPluginVersion()) : ""));
sender.sendMessageRaw("§7" + Language.L.COMMAND__AP__DEVELOPED_BY.translate() + " §9Heliosares");
sender.sendMessageRaw("&9AuxProtect"
+ (APPermission.ADMIN.hasPermission(sender) ? (" &7v" + plugin.getPluginVersion()) : ""));
sender.sendMessageRaw("&7" + Language.L.COMMAND__AP__DEVELOPED_BY.translate() + " &9Heliosares");
if (APPermission.ADMIN.hasPermission(sender)) {
sender.sendMessageRaw("§7§ohttps://www.spigotmc.org/resources/auxprotect.99147/");
sender.sendMessageRaw("&7&ohttps://www.spigotmc.org/resources/auxprotect.99147/");
}
}

View File

@@ -198,16 +198,16 @@ public class DumpCommand extends Command {
}
}
}
sender.sendMessageRaw("§aBuilding trace...");
sender.sendMessageRaw("&aBuilding trace...");
}
try {
sender.sendMessageRaw("§a" + dump(plugin, simple, chat, file, config, stats));
sender.sendMessageRaw("&a" + dump(plugin, simple, chat, file, config, stats));
} catch (Exception e) {
plugin.print(e);
sender.sendLang(Language.L.ERROR);
}
if (config) {
sender.sendMessageRaw("§cWARNING! §eThis contains the contents of config.yml. Please ensure all §cMySQL passwords §ewere properly removed before sharing.");
sender.sendMessageRaw("&cWARNING! &eThis contains the contents of config.yml. Please ensure all &cMySQL passwords &ewere properly removed before sharing.");
}
}

View File

@@ -12,6 +12,7 @@ import dev.heliosares.auxprotect.spigot.AuxProtectSpigot;
import dev.heliosares.auxprotect.utils.*;
import dev.heliosares.auxprotect.utils.InvSerialization.PlayerInventoryRecord;
import dev.heliosares.auxprotect.utils.Pane.Type;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
@@ -134,12 +135,12 @@ public class InvCommand extends Command {
targetO.sendMessage(L.COMMAND__INV__NOTIFY_PLAYER.translate(player.getName(), TimeUtil.millisToString(System.currentTimeMillis() - when)));
targetO.sendMessage(L.COMMAND__INV__NOTIFY_PLAYER_ENSURE_ROOM.translate());
ComponentBuilder message = new ComponentBuilder();
message.append("§f\n ");
message.append("§a[" + L.COMMAND__CLAIMINV__CLAIM_BUTTON__LABEL.translate() + "]")
message.append(ChatColor.COLOR_CHAR + "f\n ");
message.append(ChatColor.COLOR_CHAR + "a[" + L.COMMAND__CLAIMINV__CLAIM_BUTTON__LABEL.translate() + "]")
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/claiminv"))
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
new Text(L.COMMAND__CLAIMINV__CLAIM_BUTTON__HOVER.translate())));
message.append("\n§f").event((ClickEvent) null).event((HoverEvent) null);
message.append("\n" + ChatColor.COLOR_CHAR + "f").event((ClickEvent) null).event((HoverEvent) null);
targetO.spigot().sendMessage(message.create());
targetO.playSound(targetO.getLocation(), Sound.BLOCK_NOTE_BLOCK_PLING, 1, 1);
}

View File

@@ -90,10 +90,10 @@ public class InventoryCommand extends Command {
Inventory output = InvCommand.makeInventory(plugin, player, targetP, inv.inventory(), time);
sender.sendMessageRaw(String.format("§fDisplaying inventory of §9%s§f from §9%s ago §7(%s)",
sender.sendMessageRaw(String.format("&fDisplaying inventory of &9%s&f from &9%s ago &7(%s)",
targetP.getName(), TimeUtil.millisToString(System.currentTimeMillis() - time), time + "e"));
sender.sendMessageRaw(
String.format("§fBased on inventory from §9%s§f ago §7(%s)§f with §9%s§f differences",
String.format("&fBased on inventory from &9%s&f ago &7(%s)&f with &9%s&f differences",
TimeUtil.millisToString(System.currentTimeMillis() - inv.basetime()),
inv.basetime() + "e", inv.numdiff()));

View File

@@ -331,20 +331,20 @@ public class LookupCommand extends Command {
if (totalMoney != 0 && plugin.getPlatform() == PlatformType.SPIGOT) {
boolean negative = totalMoney < 0;
totalMoney = Math.abs(totalMoney);
sender.sendMessageRaw("§fTotal Money: §9" + (negative ? "-" : "") + ((AuxProtectSpigot) plugin).formatMoney(totalMoney));
sender.sendMessageRaw("&fTotal Money: &9" + (negative ? "-" : "") + ((AuxProtectSpigot) plugin).formatMoney(totalMoney));
}
if (totalExp != 0) {
sender.sendMessageRaw("§fTotal Experience: §9" + Math.round(totalExp * 100f) / 100f);
sender.sendMessageRaw("&fTotal Experience: &9" + Math.round(totalExp * 100f) / 100f);
}
String msg = "";
if (pickupcount > 0) {
msg += "§fPicked up: §9" + pickupcount + "§7, ";
msg += "&fPicked up: &9" + pickupcount + "&7, ";
}
if (dropcount > 0) {
msg += "§fDropped: §9" + dropcount + "§7, ";
msg += "&fDropped: &9" + dropcount + "&7, ";
}
if (pickupcount > 0 && dropcount > 0) {
msg += "§fNet: §9" + (pickupcount - dropcount);
msg += "&fNet: &9" + (pickupcount - dropcount);
}
if (msg.length() > 0) {
sender.sendMessageRaw(msg);

View File

@@ -28,7 +28,7 @@ public class SQLCommand extends Command {
msg.append(args[i]).append(" ");
}
final String stmt = msg.toString().trim();
sender.sendMessageRaw("§aRunning...");
sender.sendMessageRaw("&aRunning...");
try {
if (args[0].equalsIgnoreCase("sql")) {
plugin.getSqlManager().execute(stmt, 3000L);
@@ -64,7 +64,7 @@ public class SQLCommand extends Command {
plugin.print(e);
return;
}
sender.sendMessageRaw("§aSQL statement executed successfully.");
sender.sendMessageRaw("&aSQL statement executed successfully.");
}
@Override

View File

@@ -23,8 +23,8 @@ public class TimeCommand extends Command {
public void onCommand(SenderAdapter sender, String label, String[] args) throws CommandException {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("ddMMMyy HH:mm.ss");
if (args.length == 1) {
sender.sendMessageRaw("§9Server time:");
sender.sendMessageRaw("§7" + LocalDateTime.now().format(formatter));
sender.sendMessageRaw("&9Server time:");
sender.sendMessageRaw("&7" + LocalDateTime.now().format(formatter));
return;
} else if (args.length == 2) {
if (args[1].startsWith("+") || args[1].startsWith("-")) {
@@ -36,13 +36,13 @@ public class TimeCommand extends Command {
sender.sendLang(Language.L.INVALID_SYNTAX);
return;
}
sender.sendMessageRaw("§9Server time " + (add ? "plus" : "minus") + " " + args[1].substring(1) + ":");
sender.sendMessageRaw("&9Server time " + (add ? "plus" : "minus") + " " + args[1].substring(1) + ":");
sender.sendMessageRaw(
"§7" + LocalDateTime.now().plusSeconds((add ? 1 : -1) * (time / 1000)).format(formatter));
"&7" + LocalDateTime.now().plusSeconds((add ? 1 : -1) * (time / 1000)).format(formatter));
sender.sendMessageRaw(
String.format("§7%s %s", TimeUtil.millisToString(time), add ? "from now" : "ago"));
String.format("&7%s %s", TimeUtil.millisToString(time), add ? "from now" : "ago"));
sender.sendMessageRaw(
String.format("§7%s %s", TimeUtil.millisToStringExtended(time), add ? "from now" : "ago"));
String.format("&7%s %s", TimeUtil.millisToStringExtended(time), add ? "from now" : "ago"));
return;
}

View File

@@ -5,6 +5,7 @@ import dev.heliosares.auxprotect.core.*;
import dev.heliosares.auxprotect.database.*;
import dev.heliosares.auxprotect.exceptions.*;
import dev.heliosares.auxprotect.spigot.AuxProtectSpigot;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
@@ -122,7 +123,7 @@ public class XrayCommand extends Command {
if (entry.getRating() >= 0 && !override) {
sender.sendLang(Language.L.XRAY_ALREADY_RATED);
ComponentBuilder message = new ComponentBuilder();
message.append("§c§l[Overwrite]");
message.append(ChatColor.RED + "" + ChatColor.BOLD + "[Overwrite]");
StringBuilder thiscmd = new StringBuilder("/" + label);
for (String arg : args) {
thiscmd.append(" ").append(arg);
@@ -206,10 +207,10 @@ public class XrayCommand extends Command {
}
}
});
sender.sendMessageRaw("§aDone!");
sender.sendMessageRaw("&aDone!");
} else {
ComponentBuilder message = new ComponentBuilder("§cAre you sure you want to rate all entries from " + name + " as 0?\n\n");
message.append("§c§l[Yes]");
ComponentBuilder message = new ComponentBuilder(ChatColor.COLOR_CHAR + "cAre you sure you want to rate all entries from " + name + " as 0?\n\n");
message.append(ChatColor.COLOR_CHAR + "c" + ChatColor.COLOR_CHAR + "l[Yes]");
StringBuilder thiscmd = new StringBuilder("/" + label);
for (String arg : args) {
thiscmd.append(" ").append(arg);

View File

@@ -10,6 +10,7 @@ import dev.heliosares.auxprotect.spigot.AuxProtectSpigot;
import dev.heliosares.auxprotect.spigot.VeinManager;
import dev.heliosares.auxprotect.utils.InvSerialization;
import dev.heliosares.auxprotect.utils.TimeUtil;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
@@ -73,17 +74,17 @@ public class Results {
.event(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, entry.getTime() + "e"));
}
String actionColor = "§7-";
String actionColor = ChatColor.COLOR_CHAR + "7-";
if (entry.getAction().hasDual) {
actionColor = entry.getState() ? "§a+" : "§c-";
actionColor = entry.getState() ? ChatColor.COLOR_CHAR + "a+" : ChatColor.COLOR_CHAR + "c-";
}
message.append(" " + actionColor + " ").event((HoverEvent) null);
HoverEvent clickToCopy = new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(Language.L.RESULTS__CLICK_TO_COPY.translate()));
message.append("§9" + entry.getUser()).event(clickToCopy)
message.append(ChatColor.COLOR_CHAR + "9" + entry.getUser()).event(clickToCopy)
.event(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, entry.getUser()));
message.append(" §f" + entry.getAction().getText(entry.getState())).event((HoverEvent) null)
message.append(" " + ChatColor.COLOR_CHAR + "f" + entry.getAction().getText(entry.getState())).event((HoverEvent) null)
.event((ClickEvent) null);
message.append(" §9" + entry.getTarget()).event(clickToCopy)
message.append(" " + ChatColor.COLOR_CHAR + "9" + entry.getTarget()).event(clickToCopy)
.event(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, entry.getTarget()));
XrayEntry xray;
@@ -91,14 +92,14 @@ public class Results {
xray = (XrayEntry) entry;
String rating;
if (xray.getRating() == -2) {
rating = "§5Ignored";
rating = ChatColor.COLOR_CHAR + "5Ignored";
} else if (xray.getRating() == -1) {
rating = "§7Unrated";
rating = ChatColor.COLOR_CHAR + "7Unrated";
} else {
rating = xray.getRating() + "";
}
String color = VeinManager.getSeverityColor(xray.getRating());
message.append(String.format(" §8[%s%s§8]", color, rating)).event(new ClickEvent(
message.append(String.format(" " + ChatColor.COLOR_CHAR + "8[%s%s" + ChatColor.COLOR_CHAR + "8]", color, rating)).event(new ClickEvent(
ClickEvent.Action.RUN_COMMAND, "/" + plugin.getCommandPrefix() + " xray rate " + entry.getTime()));
String hover = "";
if (xray.getRating() >= 0) {
@@ -111,7 +112,7 @@ public class Results {
String data = entry.getData();
if (entry.hasBlob()) {
if (APPermission.INV.hasPermission(player)) {
message.append(" §a[" + Language.L.RESULTS__VIEW + "]")
message.append(" " + ChatColor.COLOR_CHAR + "a[" + Language.L.RESULTS__VIEW + "]")
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND,
String.format(commandPrefix + " inv %d", index)))
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(Language.L.RESULTS__CLICK_TO_VIEW.translate())));
@@ -119,7 +120,7 @@ public class Results {
}
if (entry.getAction().equals(EntryAction.KILL)) {
if (APPermission.INV.hasPermission(player) && !entry.getTarget().startsWith("#")) {
message.append(" §a[" + Language.L.RESULTS__VIEW_INV + "]")
message.append(" " + ChatColor.COLOR_CHAR + "a[" + Language.L.RESULTS__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())))
@@ -127,7 +128,7 @@ public class Results {
}
}
if (entry instanceof SingleItemEntry sientry) {
message.append(" §8[§7x" + sientry.getQty() + (sientry.getDamage() > 0 ? ", " + sientry.getDamage() + " damage" : "") + "§8]").event((HoverEvent) null).event((ClickEvent) null);
message.append(" " + ChatColor.COLOR_CHAR + "8[" + ChatColor.COLOR_CHAR + "7x" + sientry.getQty() + (sientry.getDamage() > 0 ? ", " + sientry.getDamage() + " damage" : "") + ChatColor.COLOR_CHAR + "8]").event((HoverEvent) null).event((ClickEvent) null);
}
if (plugin.getAPConfig().doSkipV6Migration()) {
if (data.contains(InvSerialization.ITEM_SEPARATOR)) {
@@ -138,7 +139,7 @@ public class Results {
}
}
if (data != null && data.length() > 0) {
message.append(" §8[§7" + data + "§8]").event(clickToCopy)
message.append(" " + ChatColor.COLOR_CHAR + "8[" + ChatColor.COLOR_CHAR + "7" + data + ChatColor.COLOR_CHAR + "8]").event(clickToCopy)
.event(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, entry.getData()));
}
if (entry.getWorld() != null && !entry.getWorld().equals("$null") && coords) {
@@ -153,11 +154,11 @@ public class Results {
tpCommand += String.format(" %d %d", entry.getPitch(), entry.getYaw());
}
message.append("\n ").event((HoverEvent) null).event((ClickEvent) null);
message.append(String.format("§7(x%d/y%d/z%d/%s)", entry.getX(), entry.getY(), entry.getZ(), entry.getWorld()))
message.append(String.format(ChatColor.COLOR_CHAR + "7(x%d/y%d/z%d/%s)", entry.getX(), entry.getY(), entry.getZ(), entry.getWorld()))
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, tpCommand))
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("§7" + tpCommand)));
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(ChatColor.COLOR_CHAR + "7" + tpCommand)));
if (entry.getAction().getTable().hasLook()) {
message.append(String.format("§7 (p%s/y%d)", entry.getPitch(), entry.getYaw()));
message.append(String.format(ChatColor.COLOR_CHAR + "7 (p%s/y%d)", entry.getPitch(), entry.getYaw()));
}
}
player.sendMessage(message.create());
@@ -172,15 +173,15 @@ public class Results {
}
public void sendHeader() {
String headerColor = "§7";
StringBuilder line = new StringBuilder("§m");
String headerColor = "&7";
StringBuilder line = new StringBuilder("&m");
line.append(String.valueOf((char) 65293).repeat(6));
line.append("§7");
line.append("&7");
if (new Random().nextDouble() < 0.001) {
headerColor = "§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 + " " + Language.L.RESULTS__HEADER + "§7 " + line);
player.sendMessageRaw(headerColor + line + " " + Language.L.RESULTS__HEADER + "&7 " + line);
}
public void showPage(int page) throws SQLException {
@@ -212,40 +213,40 @@ public class Results {
String commandPrefix = "/" + plugin.getCommandPrefix();
ComponentBuilder message = new ComponentBuilder();
int lastpage = getNumPages(perPage);
message.append("§7(");
message.append(ChatColor.COLOR_CHAR + "7(");
if (page > 1) {
message.append("§9§l" + AuxProtectSpigot.LEFT_ARROW + AuxProtectSpigot.LEFT_ARROW)
message.append(ChatColor.COLOR_CHAR + "9" + ChatColor.COLOR_CHAR + "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(Language.L.RESULTS__PAGE__FIRST.translate())));
message.append(" ").event((ClickEvent) null).event((HoverEvent) null);
message.append("§9§l" + AuxProtectSpigot.LEFT_ARROW)
message.append(ChatColor.COLOR_CHAR + "9" + ChatColor.COLOR_CHAR + "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(Language.L.RESULTS__PAGE__PREVIOUS.translate())));
} else {
message.event(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, ""));
message.append("§8§l" + AuxProtectSpigot.LEFT_ARROW + AuxProtectSpigot.LEFT_ARROW).event((ClickEvent) null)
message.append(ChatColor.COLOR_CHAR + "8" + ChatColor.COLOR_CHAR + "l" + AuxProtectSpigot.LEFT_ARROW + AuxProtectSpigot.LEFT_ARROW).event((ClickEvent) null)
.event((HoverEvent) null);
message.append(" ");
message.append("§8§l" + AuxProtectSpigot.LEFT_ARROW);
message.append(ChatColor.COLOR_CHAR + "8" + ChatColor.COLOR_CHAR + "l" + AuxProtectSpigot.LEFT_ARROW);
}
message.append(" ").event((ClickEvent) null).event((HoverEvent) null);
if (page < lastpage) {
message.append("§9§l" + AuxProtectSpigot.RIGHT_ARROW)
message.append(ChatColor.COLOR_CHAR + "9" + ChatColor.COLOR_CHAR + "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(Language.L.RESULTS__PAGE__NEXT.translate())));
message.append(" ").event((ClickEvent) null).event((HoverEvent) null);
message.append("§9§l" + AuxProtectSpigot.RIGHT_ARROW + AuxProtectSpigot.RIGHT_ARROW)
message.append(ChatColor.COLOR_CHAR + "9" + ChatColor.COLOR_CHAR + "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(Language.L.RESULTS__PAGE__LAST.translate())));
} else {
message.append("§8§l" + AuxProtectSpigot.RIGHT_ARROW).event((ClickEvent) null).event((HoverEvent) null);
message.append(ChatColor.COLOR_CHAR + "8" + ChatColor.COLOR_CHAR + "l" + AuxProtectSpigot.RIGHT_ARROW).event((ClickEvent) null).event((HoverEvent) null);
message.append(" ");
message.append("§8§l" + AuxProtectSpigot.RIGHT_ARROW + AuxProtectSpigot.RIGHT_ARROW);
message.append(ChatColor.COLOR_CHAR + "8" + ChatColor.COLOR_CHAR + "l" + AuxProtectSpigot.RIGHT_ARROW + AuxProtectSpigot.RIGHT_ARROW);
}
message.append("§7) ").event((ClickEvent) null).event((HoverEvent) null);
message.append(ChatColor.COLOR_CHAR + "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());
}

View File

@@ -4,6 +4,7 @@ import dev.heliosares.auxprotect.adapters.sender.SenderAdapter;
import dev.heliosares.auxprotect.core.APPermission;
import dev.heliosares.auxprotect.spigot.AuxProtectSpigot;
import dev.heliosares.auxprotect.spigot.VeinManager;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
@@ -14,7 +15,7 @@ import java.sql.SQLException;
public class XrayResults {
public static void sendHeader(SenderAdapter sender) {
sender.sendMessageRaw("§f------ §9AuxProtect Xray Check Results§7 ------"); // TODO lang
sender.sendMessageRaw("&f------ &9AuxProtect Xray Check Results&7 ------"); // TODO lang
}
public static void sendEntry(AuxProtectSpigot plugin, SenderAdapter sender, XrayEntry en, boolean auto) throws SQLException {
@@ -32,22 +33,22 @@ public class XrayResults {
for (int sev = -1; sev <= 3; sev++) {
String color = VeinManager.getSeverityColor(sev);
String desc = VeinManager.getSeverityDescription(sev);
message.append(String.format("%s§l[%s]", color, sev == -1 ? "Clear" : ("" + sev)))
message.append(String.format("%s" + ChatColor.COLOR_CHAR + "l[%s]", color, sev == -1 ? "Clear" : (sev)))
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, String.format(xraycmd, en.getTime(), sev)))
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(color + String.format(descFormat, sev, desc))));
message.append(" ").event((ClickEvent) null).event((HoverEvent) null);
}
message.append("§7§l[Skip]")
message.append(ChatColor.COLOR_CHAR + "7" + ChatColor.COLOR_CHAR + "l[Skip]")
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/ap xray skip " + en.getTime() + "e" + (auto ? " -auto" : "")))
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("§7Click to skip this entry.")));
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("" + ChatColor.COLOR_CHAR + "7Click to skip this entry.")));
if (APPermission.LOOKUP_XRAY_BULK.hasPermission(sender)) {
message.append(" ").event((ClickEvent) null).event((HoverEvent) null);
message.append("§7§l[0-All]")
message.append("" + ChatColor.COLOR_CHAR + "7" + ChatColor.COLOR_CHAR + "l[0-All]")
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/ap xray zero " + en.getUserUUID().substring(1)))
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("§7Rate all entries from " + en.getUser() + " as 0.")));
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("" + ChatColor.COLOR_CHAR + "7Rate all entries from " + en.getUser() + " as 0.")));
}
sender.sendMessage(message.create());
@@ -56,6 +57,6 @@ public class XrayResults {
}
public static void sendArrowKeys(SenderAdapter sender, int size) {
sender.sendMessageRaw(String.format("§9%d§7 remaining.", size)); // TODO lang
sender.sendMessageRaw(String.format("&9%d&7 remaining.", size)); // TODO lang
}
}

View File

@@ -4,6 +4,7 @@ import dev.heliosares.auxprotect.api.AuxProtectAPI;
import dev.heliosares.auxprotect.database.DbEntry;
import dev.heliosares.auxprotect.database.SQLManager;
import dev.heliosares.auxprotect.database.XrayEntry;
import net.md_5.bungee.api.ChatColor;
import java.sql.SQLException;
import java.util.*;
@@ -27,12 +28,12 @@ public class VeinManager {
}
public static String getSeverityColor(int severity) {
return switch (severity) {
case -2, -1 -> "§5";
case 0 -> "§a";
case 1 -> "§e";
case 2 -> "§c";
case 3 -> "§4";
return ChatColor.COLOR_CHAR + switch (severity) {
case -2, -1 -> "5";
case 0 -> "a";
case 1 -> "e";
case 2 -> "c";
case 3 -> "4";
default -> "";
};
}

View File

@@ -8,6 +8,7 @@ import dev.heliosares.auxprotect.database.SingleItemEntry;
import dev.heliosares.auxprotect.spigot.AuxProtectSpigot;
import dev.heliosares.auxprotect.utils.InvSerialization;
import dev.heliosares.auxprotect.utils.PlaybackSolver;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
@@ -189,14 +190,14 @@ public class PlayerListener implements Listener {
} catch (SQLException e1) {
return;
}
e.getPlayer().sendMessage("§aYou have an inventory waiting to be claimed!");
e.getPlayer().sendMessage("§7Ensure you have room in your inventory before claiming!");
e.getPlayer().sendMessage(ChatColor.COLOR_CHAR + "aYou have an inventory waiting to be claimed!");
e.getPlayer().sendMessage(ChatColor.COLOR_CHAR + "7Ensure you have room in your inventory before claiming!");
ComponentBuilder message = new ComponentBuilder();
message.append("§f\n ");
message.append("§a[Claim]").event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/claiminv"))
message.append(ChatColor.COLOR_CHAR + "f\n ");
message.append(ChatColor.COLOR_CHAR + "a[Claim]").event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/claiminv"))
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
new Text("§aClick to claim your recovered inventory")));
message.append("\n§f").event((ClickEvent) null).event((HoverEvent) null);
new Text(ChatColor.COLOR_CHAR + "aClick to claim your recovered inventory")));
message.append("\n" + ChatColor.COLOR_CHAR + "f").event((ClickEvent) null).event((HoverEvent) null);
e.getPlayer().spigot().sendMessage(message.create());
e.getPlayer().playSound(e.getPlayer().getLocation(), Sound.BLOCK_NOTE_BLOCK_PLING, 1, 1);
}
@@ -323,7 +324,7 @@ public class PlayerListener implements Listener {
plugin.getAPPlayer(e.getPlayer()).addActivity(5);
plugin.add(new DbEntry(AuxProtectSpigot.getLabel(e.getPlayer()), EntryAction.CHAT, false, e.getPlayer().getLocation(), e.getMessage().trim(), ""));
if (plugin.getAPConfig().isDemoMode()) {
e.getPlayer().sendMessage("§cChat is disabled.");
e.getPlayer().sendMessage(ChatColor.COLOR_CHAR + "cChat is disabled.");
e.setCancelled(true);
}
}

View File

@@ -32,11 +32,9 @@ public class ActivitySolver {
int[] counter = new int[minutes];
Location[] locations = new Location[minutes];
Arrays.fill(counter, -1);
StringBuilder line = new StringBuilder("§7§m");
for (int i = 0; i < 6; i++) {
line.append((char) 65293);
}
line.append("§7");
StringBuilder line = new StringBuilder("" + ChatColor.COLOR_CHAR + "7" + ChatColor.COLOR_CHAR + "m");
line.append(String.valueOf((char) 65293).repeat(6));
line.append("" + ChatColor.COLOR_CHAR + "7");
long lastTime = startMillis;
for (int i = entries.size() - 1, minute = 0; i >= 0; i--) {
DbEntry entry = entries.get(i);
@@ -89,7 +87,7 @@ public class ActivitySolver {
break;
}
if (time.getMinute() == 0) {
message.append(line + String.format("§f %s ", time.format(formatterHour)) + line + "\n")
message.append(line + String.format("" + ChatColor.COLOR_CHAR + "f %s ", time.format(formatterHour)) + line + "\n")
.event((ClickEvent) null).event((HoverEvent) null);
}
if (millis < newestEntryAt) {
@@ -99,18 +97,18 @@ public class ActivitySolver {
int activity = counter[i];
String hovertext = "§9" + time.format(formatterDateTime) + "\n";
String hovertext = "" + ChatColor.COLOR_CHAR + "9" + time.format(formatterDateTime) + "\n";
if (activity < 0) {
hovertext += "§7Offline";
hovertext += "" + ChatColor.COLOR_CHAR + "7Offline";
} else if (activity > 0) {
hovertext += "§7Activity Level §9" + activity;
hovertext += "" + ChatColor.COLOR_CHAR + "7Activity Level " + ChatColor.COLOR_CHAR + "9" + activity;
} else {
hovertext += "§cNo Activity";
hovertext += "" + ChatColor.COLOR_CHAR + "cNo Activity";
}
ClickEvent clickevent = null;
if (locations[i] != null) {
hovertext += String.format("\n\n§7(x%d/y%d/z%d/%s)\7Click to teleport", locations[i].getBlockX(),
hovertext += String.format("\n\n" + ChatColor.COLOR_CHAR + "7(x%d/y%d/z%d/%s)\n" + ChatColor.COLOR_CHAR + "7Click to teleport", locations[i].getBlockX(),
locations[i].getBlockY(), locations[i].getBlockZ(), locations[i].getWorld().getName());
clickevent = new ClickEvent(ClickEvent.Action.RUN_COMMAND,
String.format("/auxprotect tp %d %d %d %s", locations[i].getBlockX(),
@@ -136,37 +134,6 @@ public class ActivitySolver {
message.append("\n");
}
}
/*
* int[] counter = new int[minutes + 1]; for (int i = 0; i < counter.length;
* i++) { counter[i] = -1; } int minute = 0; for (int i = entries.size() - 1; i
* >= 0; i--) { DbEntry entry = entries.get(i); if (entry.getAction() !=
* EntryAction.ACTIVITY) { continue; } int activity =
* Integer.parseInt(entry.getData());
*
* while (minute < counter.length) { long hourTime = firstTime + minute *
* 60000L; long hourTimeEnd = hourTime + 60000L;
*
* if (entry.getTime() > hourTimeEnd) { minute++; continue; }
*
* counter[minute] = activity; break; } } int shiftMinutes = 0; while
* ((counter.length + shiftMinutes) % 30 != 0) { message.append(AuxProtect.BLOCK
* + "").color(ChatColor.BLACK); shiftMinutes++; }
*
* for (int i = 0; i < counter.length; i++) { LocalDateTime time =
* startTime.plusMinutes(i);
*
* int activity = counter[i];
*
* message.append(AuxProtect.BLOCK + "").event(new
* HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("§9" +
* time.format(formatterDateTime) + "\n" + "Activity Level " + activity))); if
* (activity >= 20) { message.color(ChatColor.of("#1ecb0d")); // green } else if
* (activity >= 10) { message.color(ChatColor.of("#f9ff17")); // yellow } else
* if (activity > 0) { message.color(ChatColor.of("#c50000")); // Light red }
* else if (activity == 0) { message.color(ChatColor.of("#4e0808")); // Dark red
* } else { message.color(ChatColor.BLACK); } if ((i + 1 + shiftMinutes) % 30 ==
* 0 && i < counter.length - 1) { message.append("\n"); } }
*/
return message.create();
}
}

View File

@@ -20,13 +20,13 @@ public class PlayTimeSolver {
public static BaseComponent[] solvePlaytime(List<DbEntry> entries, long startTimeMillis, int hours, String player, final boolean currentlyOnline) {
ComponentBuilder message = new ComponentBuilder().append("", FormatRetention.NONE);
if (hours > 840) {
message.append("§cTime period too long. Max 5 weeks.");
message.append("" + ChatColor.COLOR_CHAR + "cTime period too long. Max 5 weeks.");
return message.create();
}
StringBuilder line = new StringBuilder("§7§m");
line.append(String.valueOf((char) 65293).repeat(6)).append("§r");
StringBuilder line = new StringBuilder("" + ChatColor.COLOR_CHAR + "7" + ChatColor.COLOR_CHAR + "m");
line.append(String.valueOf((char) 65293).repeat(6)).append("" + ChatColor.COLOR_CHAR + "r");
player += "'" + (player.toLowerCase().endsWith("s") ? "" : "s");
message.append(line + " §9" + player + " Playtime " + line);
message.append(line + " " + ChatColor.COLOR_CHAR + "9" + player + " Playtime " + line);
message.append("\n");
LocalDateTime startTime = Instant.ofEpochMilli(startTimeMillis).atZone(ZoneId.systemDefault()).toLocalDateTime()
.withMinute(0).withSecond(0).withNano(0);
@@ -108,7 +108,7 @@ public class PlayTimeSolver {
LocalDateTime time = startTime.plusHours(i);
double count = counter[i];
message.append(AuxProtectSpigot.BLOCK + "").event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(
"§9" + time.format(formatterDateTime) + "\n" + (Math.round(count * 60.0) + " §8min online"))));
"" + ChatColor.COLOR_CHAR + "9" + time.format(formatterDateTime) + "\n" + (Math.round(count * 60.0) + " " + ChatColor.COLOR_CHAR + "8min online"))));
if (count > 0.99) {
message.color(ChatColor.of("#ffffff"));
} else if (count > 0.75) {

View File

@@ -11,6 +11,7 @@ import dev.heliosares.auxprotect.database.DbEntryBukkit;
import dev.heliosares.auxprotect.database.SQLManager;
import dev.heliosares.auxprotect.exceptions.LookupException;
import dev.heliosares.auxprotect.spigot.AuxProtectSpigot;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Location;
@@ -181,7 +182,7 @@ public class PlaybackSolver extends BukkitRunnable {
}
final long timeNow = System.currentTimeMillis() - realReferenceTime + startTime;
audience.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(TimeUtil.format(timeNow, TimeUtil.entryTimeFormat) + " §7- " + TimeUtil.millisToString(System.currentTimeMillis() - timeNow) + " ago"));
audience.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(TimeUtil.format(timeNow, TimeUtil.entryTimeFormat) + " " + ChatColor.COLOR_CHAR + "7- " + TimeUtil.millisToString(System.currentTimeMillis() - timeNow) + " ago"));
for (Iterator<PosPoint> it = points.iterator(); it.hasNext(); ) {

View File

@@ -68,11 +68,11 @@ public class RetentionSolver {
} else {
time = key + "m";
}
sender.sendMessageRaw(String.format("§7Above %s: §9%s §7(%d/%d)", time, Math.round(val) + "%",
sender.sendMessageRaw(String.format("&7Above %s: &9%s &7(%d/%d)", time, Math.round(val) + "%",
entry.getValue(), playtimes.size()));
}
sender.sendMessageRaw(String.format("§7Online now: §9%s §7(%d/%d)",
sender.sendMessageRaw(String.format("&7Online now: &9%s &7(%d/%d)",
Math.round((double) onlinern / (double) playtimes.size() * 100) + "%", onlinern, playtimes.size()));
sender.sendMessageRaw(String.format("§7(%sms)", "" + (System.currentTimeMillis() - start)));
sender.sendMessageRaw(String.format("&7(%sms)", "" + (System.currentTimeMillis() - start)));
}
}

View File

@@ -9,6 +9,7 @@ import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.ComponentBuilder.FormatRetention;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.hover.content.Text;
import org.bukkit.ChatColor;
import java.sql.SQLException;
import java.util.ArrayList;
@@ -38,26 +39,21 @@ public class XraySolver {
}
if (score >= 6 || hash.size() == 1) {
String user = entries1.get(0).getUser();
StringBuilder tooltip = new StringBuilder("§4Hits for '" + user + "':\n");
StringBuilder tooltip = new StringBuilder(ChatColor.DARK_RED + "Hits for '" + user + "':\n");
for (DbEntry entry : entries1) {
short severity = ((XrayEntry) entry).getRating();
switch (severity) {
case 1:
tooltip.append("§e");
break;
case 2:
tooltip.append("§c");
break;
case 3:
tooltip.append("§4");
break;
default:
case 1 -> tooltip.append(ChatColor.YELLOW);
case 2 -> tooltip.append(ChatColor.RED);
case 3 -> tooltip.append(ChatColor.DARK_RED);
default -> {
continue;
}
}
tooltip.append("\n").append(TimeUtil.millisToString(System.currentTimeMillis() - entry.getTime())).append(" ago, severity ").append(severity);
}
message.append(String.format("§4§l%s§c - score %d / 6", user, score))
message.append(String.format(ChatColor.DARK_RED + "" + ChatColor.BOLD + "%s" + ChatColor.RED + " - score %d / 6", user, score))
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(tooltip.toString())))
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND,
String.format("/ap lookup action:vein #xray user:%s", user)));