diff --git a/pom.xml b/pom.xml
index ab1fd87..f4b9242 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,6 +11,7 @@
21
UTF-8
+ full
2.0.0
diff --git a/src/main/java/net/tfminecraft/tfmcweb/managers/LinkDiscordCommand.java b/src/main/java/net/tfminecraft/tfmcweb/managers/LinkDiscordCommand.java
index fe91522..461eb76 100644
--- a/src/main/java/net/tfminecraft/tfmcweb/managers/LinkDiscordCommand.java
+++ b/src/main/java/net/tfminecraft/tfmcweb/managers/LinkDiscordCommand.java
@@ -33,6 +33,8 @@ public LinkDiscordCommand(
this.gateService = gateService;
}
+ // Keep the existing legacy text representation, formatting, and exact-string comparisons.
+ @SuppressWarnings("deprecation")
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
diff --git a/src/main/java/net/tfminecraft/tfmcweb/managers/PluginNoticePoller.java b/src/main/java/net/tfminecraft/tfmcweb/managers/PluginNoticePoller.java
index 07d80f2..3371fe3 100644
--- a/src/main/java/net/tfminecraft/tfmcweb/managers/PluginNoticePoller.java
+++ b/src/main/java/net/tfminecraft/tfmcweb/managers/PluginNoticePoller.java
@@ -73,6 +73,8 @@ private void tick() {
Bukkit.getScheduler().runTask(plugin, () -> deliverAndAck(snapshot));
}
+ // Keep the existing legacy text representation, formatting, and exact-string comparisons.
+ @SuppressWarnings("deprecation")
private void deliverAndAck(List notices) {
List toAck = new ArrayList<>();
diff --git a/src/main/java/net/tfminecraft/tfmcweb/managers/TokenCommand.java b/src/main/java/net/tfminecraft/tfmcweb/managers/TokenCommand.java
index d87c9bb..1fd2387 100644
--- a/src/main/java/net/tfminecraft/tfmcweb/managers/TokenCommand.java
+++ b/src/main/java/net/tfminecraft/tfmcweb/managers/TokenCommand.java
@@ -75,6 +75,8 @@ private static boolean rejectIfScopeDisabled(Player player, String apiScope) {
return true;
}
+ // Keep the existing legacy text representation, formatting, and exact-string comparisons.
+ @SuppressWarnings("deprecation")
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (args.length == 0) {
@@ -98,6 +100,8 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
return true;
}
+ // Keep the existing legacy text representation, formatting, and exact-string comparisons.
+ @SuppressWarnings("deprecation")
private void sendUsage(CommandSender sender) {
boolean canCreate = sender.hasPermission(PERM_CREATE) || sender.hasPermission(PERM_CREATE_STAFF);
boolean canReset = sender.hasPermission(PERM_RESET);
@@ -121,6 +125,8 @@ private void sendUsage(CommandSender sender) {
}
}
+ // Keep the existing legacy text representation, formatting, and exact-string comparisons.
+ @SuppressWarnings("deprecation")
private boolean handleResetCooldowns(CommandSender sender, String[] args) {
if (!sender.hasPermission(PERM_RESET)) {
if (sender instanceof Player) {
@@ -185,6 +191,8 @@ private boolean handleResetCooldowns(CommandSender sender, String[] args) {
return true;
}
+ // Keep the existing legacy text representation, formatting, and exact-string comparisons.
+ @SuppressWarnings("deprecation")
private boolean handleCreate(CommandSender sender, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage(ChatColor.RED + "Players only.");
diff --git a/src/main/java/net/tfminecraft/tfmcweb/managers/UnlinkDiscordCommand.java b/src/main/java/net/tfminecraft/tfmcweb/managers/UnlinkDiscordCommand.java
index 4d54a5c..4268d7d 100644
--- a/src/main/java/net/tfminecraft/tfmcweb/managers/UnlinkDiscordCommand.java
+++ b/src/main/java/net/tfminecraft/tfmcweb/managers/UnlinkDiscordCommand.java
@@ -32,6 +32,8 @@ public UnlinkDiscordCommand(
this.gateService = gateService;
}
+ // Keep the existing legacy text representation, formatting, and exact-string comparisons.
+ @SuppressWarnings("deprecation")
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
diff --git a/src/main/java/net/tfminecraft/tfmcweb/managers/WarningCommand.java b/src/main/java/net/tfminecraft/tfmcweb/managers/WarningCommand.java
index 1dd29f7..f151316 100644
--- a/src/main/java/net/tfminecraft/tfmcweb/managers/WarningCommand.java
+++ b/src/main/java/net/tfminecraft/tfmcweb/managers/WarningCommand.java
@@ -31,6 +31,8 @@ public WarningCommand(JavaPlugin plugin, LinkCache linkCache) {
this.linkCache = linkCache;
}
+ // Keep the existing legacy text representation, formatting, and exact-string comparisons.
+ @SuppressWarnings("deprecation")
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!sender.hasPermission("tfmcweb.warning")) {
diff --git a/src/main/java/net/tfminecraft/tfmcweb/managers/WebCommand.java b/src/main/java/net/tfminecraft/tfmcweb/managers/WebCommand.java
index d20f443..73226a7 100644
--- a/src/main/java/net/tfminecraft/tfmcweb/managers/WebCommand.java
+++ b/src/main/java/net/tfminecraft/tfmcweb/managers/WebCommand.java
@@ -46,6 +46,8 @@ public WebCommand(JavaPlugin plugin, LinkCache linkCache, DiscordGateService gat
this.gateService = gateService;
}
+ // Keep the existing legacy text representation, formatting, and exact-string comparisons.
+ @SuppressWarnings("deprecation")
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!sender.hasPermission("tfmcweb.admin")) {
@@ -78,6 +80,8 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
}
}
+ // Keep the existing legacy text representation, formatting, and exact-string comparisons.
+ @SuppressWarnings("deprecation")
private boolean cmdStatus(CommandSender sender) {
sender.sendMessage(ChatColor.GREEN + "[TFMCWeb] Checking APIā¦");
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
@@ -101,6 +105,8 @@ private boolean cmdStatus(CommandSender sender) {
return true;
}
+ // Keep the existing legacy text representation, formatting, and exact-string comparisons.
+ @SuppressWarnings("deprecation")
private boolean cmdReload(CommandSender sender) {
if (plugin instanceof TFMCWeb) {
((TFMCWeb) plugin).reloadLocalConfig();
@@ -114,6 +120,8 @@ private boolean cmdReload(CommandSender sender) {
return true;
}
+ // Keep the existing legacy text representation, formatting, and exact-string comparisons.
+ @SuppressWarnings("deprecation")
private boolean cmdSyncMeta(CommandSender sender, String[] args) {
if (args.length >= 2) {
OfflinePlayer target = resolvePlayer(args[1]);
@@ -136,6 +144,8 @@ private boolean cmdSyncMeta(CommandSender sender, String[] args) {
return true;
}
+ // Keep the existing legacy text representation, formatting, and exact-string comparisons.
+ @SuppressWarnings("deprecation")
private boolean cmdLookup(CommandSender sender, String[] args) {
if (args.length < 2) {
sender.sendMessage(ChatColor.YELLOW + "Usage: /web lookup ");
@@ -182,6 +192,8 @@ private boolean cmdLookup(CommandSender sender, String[] args) {
return true;
}
+ // Keep the existing legacy text representation, formatting, and exact-string comparisons.
+ @SuppressWarnings("deprecation")
private boolean cmdUnlink(CommandSender sender, String[] args) {
if (args.length < 2) {
sender.sendMessage(ChatColor.YELLOW + "Usage: /web unlink ");
@@ -214,6 +226,8 @@ private boolean cmdUnlink(CommandSender sender, String[] args) {
return true;
}
+ // Keep the existing legacy text representation, formatting, and exact-string comparisons.
+ @SuppressWarnings("deprecation")
private boolean cmdReconcile(CommandSender sender) {
List online = new ArrayList<>(Bukkit.getOnlinePlayers());
sender.sendMessage(ChatColor.GREEN + "[TFMCWeb] Reconciling "
diff --git a/src/main/java/net/tfminecraft/tfmcweb/utils/ChatMessages.java b/src/main/java/net/tfminecraft/tfmcweb/utils/ChatMessages.java
index fff1a9f..abb123b 100644
--- a/src/main/java/net/tfminecraft/tfmcweb/utils/ChatMessages.java
+++ b/src/main/java/net/tfminecraft/tfmcweb/utils/ChatMessages.java
@@ -1,19 +1,19 @@
package net.tfminecraft.tfmcweb.utils;
-import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
-import net.md_5.bungee.api.chat.ClickEvent;
-import net.md_5.bungee.api.chat.ComponentBuilder;
-import net.md_5.bungee.api.chat.HoverEvent;
-import net.md_5.bungee.api.chat.TextComponent;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.event.ClickEvent;
+import net.kyori.adventure.text.event.HoverEvent;
+import net.kyori.adventure.text.format.NamedTextColor;
+import net.kyori.adventure.text.format.TextDecoration;
/**
* Prefixed chat helpers, including click-to-copy codes.
*/
public final class ChatMessages {
- public static final String PREFIX = ChatColor.GREEN + "[TFMCWeb] " + ChatColor.RESET;
+ public static final String PREFIX = "\u00A7a[TFMCWeb] \u00A7r";
private ChatMessages() {}
@@ -22,7 +22,7 @@ public static void info(Player player, String message) {
}
public static void error(Player player, String message) {
- player.sendMessage(PREFIX + ChatColor.RED + message);
+ player.sendMessage(PREFIX + "\u00A7c" + message);
}
public static void sendCopyableCode(Player player, String intro, String code) {
@@ -33,26 +33,14 @@ public static void sendCopyableCode(Player player, String intro, String code) {
return;
}
- TextComponent label = new TextComponent("Code: ");
- label.setColor(net.md_5.bungee.api.ChatColor.GRAY);
-
- TextComponent codeComp = new TextComponent(code);
- codeComp.setColor(net.md_5.bungee.api.ChatColor.AQUA);
- codeComp.setBold(true);
- codeComp.setClickEvent(
- new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, code)
- );
- @SuppressWarnings("deprecation")
- HoverEvent hover = new HoverEvent(
- HoverEvent.Action.SHOW_TEXT,
- new ComponentBuilder("Click to copy").create()
- );
- codeComp.setHoverEvent(hover);
-
- TextComponent hint = new TextComponent(" (click to copy)");
- hint.setColor(net.md_5.bungee.api.ChatColor.DARK_GRAY);
- hint.setItalic(true);
-
- player.spigot().sendMessage(label, codeComp, hint);
+ Component label = Component.text("Code: ", NamedTextColor.GRAY);
+ Component codeComp = Component.text(code, NamedTextColor.AQUA)
+ .decorate(TextDecoration.BOLD)
+ .clickEvent(ClickEvent.copyToClipboard(code))
+ .hoverEvent(HoverEvent.showText(Component.text("Click to copy")));
+ Component hint = Component.text(" (click to copy)", NamedTextColor.DARK_GRAY)
+ .decorate(TextDecoration.ITALIC);
+
+ player.sendMessage(Component.empty().append(label).append(codeComp).append(hint));
}
}