diff --git a/pom.xml b/pom.xml
index efa173a..e18575a 100755
--- a/pom.xml
+++ b/pom.xml
@@ -218,7 +218,7 @@
io.papermc.paper
paper-api
- 1.21.1-R0.1-SNAPSHOT
+ 1.21.11-R0.1-SNAPSHOT
provided
diff --git a/src/main/java/net/coreprotect/spigot/SpigotHandler.java b/src/main/java/net/coreprotect/spigot/SpigotHandler.java
index 5d62489..dd22088 100644
--- a/src/main/java/net/coreprotect/spigot/SpigotHandler.java
+++ b/src/main/java/net/coreprotect/spigot/SpigotHandler.java
@@ -22,7 +22,8 @@ public class SpigotHandler extends SpigotAdapter implements SpigotInterface {
public static ChatColor DARK_AQUA = ChatColor.of("#31b0e8");
public SpigotHandler() {
- Color.DARK_AQUA = SpigotHandler.DARK_AQUA.toString();
+ //Color.DARK_AQUA = SpigotHandler.DARK_AQUA.toString();
+ Color.DARK_AQUA = "<#31b0e8>"; // griefus
}
@Override
diff --git a/src/main/java/net/coreprotect/utility/Chat.java b/src/main/java/net/coreprotect/utility/Chat.java
index 6057321..8fd577e 100644
--- a/src/main/java/net/coreprotect/utility/Chat.java
+++ b/src/main/java/net/coreprotect/utility/Chat.java
@@ -26,24 +26,32 @@ public final class Chat {
}
public static void sendComponent(CommandSender sender, String string, String bypass) {
- SpigotAdapter.ADAPTER.sendComponent(sender, string, bypass);
+ //SpigotAdapter.ADAPTER.sendComponent(sender, string, bypass);
+ sendMessage(sender, string + bypass); // griefus
}
public static void sendComponent(CommandSender sender, String string) {
- sendComponent(sender, string, null);
+ //sendComponent(sender, string, null);
+ sendMessage(sender, string); // griefus
}
public static void sendMessage(CommandSender sender, String message) {
+ // griefus start
+ try {
+ MiniMessage miniMessage = MiniMessage.miniMessage();
+ sender.sendMessage(miniMessage.deserialize(message));
+ return;
+ } catch (ParsingException ignored) {
+ ignored.printStackTrace();
+ }
+ // griefus end
+
if (sender instanceof ConsoleCommandSender) {
message = message.replace(Color.DARK_AQUA, ChatColor.DARK_AQUA.toString());
}
- try {
- MiniMessage miniMessage = MiniMessage.miniMessage();
- sender.sendMessage(miniMessage.deserialize(message));
- } catch (ParsingException e) {
- sender.sendMessage(message);
- }
+ sender.sendMessage(message);
+
}
public static void sendConsoleMessage(String string) {
diff --git a/src/main/java/net/coreprotect/utility/ChatUtils.java b/src/main/java/net/coreprotect/utility/ChatUtils.java
index 27a6239..865a5f9 100644
--- a/src/main/java/net/coreprotect/utility/ChatUtils.java
+++ b/src/main/java/net/coreprotect/utility/ChatUtils.java
@@ -2,6 +2,7 @@ package net.coreprotect.utility;
import net.coreprotect.language.Phrase;
import net.coreprotect.language.Selector;
+import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.command.ConsoleCommandSender;
import java.text.DecimalFormat;
@@ -17,7 +18,8 @@ public class ChatUtils {
}
public static String getCoordinates(String command, int worldId, int x, int y, int z, boolean displayWorld, boolean italic) {
- StringBuilder message = new StringBuilder(Chat.COMPONENT_TAG_OPEN + Chat.COMPONENT_COMMAND);
+ //StringBuilder message = new StringBuilder(Chat.COMPONENT_TAG_OPEN + Chat.COMPONENT_COMMAND);
+ StringBuilder message = new StringBuilder("");
+ // griefus end
// chat output
message.append(Color.GREY + (italic ? Color.ITALIC : "") + "(x" + x + "/y" + y + "/z" + z + worldDisplay.toString() + ")");
- return message.append(Chat.COMPONENT_TAG_CLOSE).toString();
+ //return message.append(Chat.COMPONENT_TAG_CLOSE).toString();
+ return message.append("").toString(); // griefus
}
public static String getPageNavigation(String command, int page, int totalPages) {
@@ -41,21 +49,24 @@ public class ChatUtils {
String backArrow = "";
if (page > 1) {
backArrow = "◀ ";
- backArrow = Chat.COMPONENT_TAG_OPEN + Chat.COMPONENT_COMMAND + "|/" + command + " l " + (page - 1) + "|" + backArrow + Chat.COMPONENT_TAG_CLOSE;
+ //backArrow = Chat.COMPONENT_TAG_OPEN + Chat.COMPONENT_COMMAND + "|/" + command + " l " + (page - 1) + "|" + backArrow + Chat.COMPONENT_TAG_CLOSE;
+ backArrow = "" + backArrow + ""; // griefus
}
// next arrow
String nextArrow = " ";
if (page < totalPages) {
nextArrow = " ▶ ";
- nextArrow = Chat.COMPONENT_TAG_OPEN + Chat.COMPONENT_COMMAND + "|/" + command + " l " + (page + 1) + "|" + nextArrow + Chat.COMPONENT_TAG_CLOSE;
+ //nextArrow = Chat.COMPONENT_TAG_OPEN + Chat.COMPONENT_COMMAND + "|/" + command + " l " + (page + 1) + "|" + nextArrow + Chat.COMPONENT_TAG_CLOSE;
+ nextArrow = "" + nextArrow + ""; // griefus
}
StringBuilder pagination = new StringBuilder();
if (totalPages > 1) {
pagination.append(Color.GREY + "(");
if (page > 3) {
- pagination.append(Color.WHITE + Chat.COMPONENT_TAG_OPEN + Chat.COMPONENT_COMMAND + "|/" + command + " l " + 1 + "|" + "1 " + Chat.COMPONENT_TAG_CLOSE);
+ //pagination.append(Color.WHITE + Chat.COMPONENT_TAG_OPEN + Chat.COMPONENT_COMMAND + "|/" + command + " l " + 1 + "|" + "1 " + Chat.COMPONENT_TAG_CLOSE);
+ pagination.append(Color.WHITE + "").append("1 "); //griefus
if (page > 4 && totalPages > 7) {
pagination.append(Color.GREY + "... ");
}
@@ -99,7 +110,8 @@ public class ChatUtils {
for (int displayPage = displayStart; displayPage <= displayEnd; displayPage++) {
if (page != displayPage) {
- pagination.append(Color.WHITE + Chat.COMPONENT_TAG_OPEN + Chat.COMPONENT_COMMAND + "|/" + command + " l " + displayPage + "|" + displayPage + (displayPage < totalPages ? " " : "") + Chat.COMPONENT_TAG_CLOSE);
+ //pagination.append(Color.WHITE + Chat.COMPONENT_TAG_OPEN + Chat.COMPONENT_COMMAND + "|/" + command + " l " + displayPage + "|" + displayPage + (displayPage < totalPages ? " " : "") + Chat.COMPONENT_TAG_CLOSE);
+ pagination.append(Color.WHITE + "" + displayPage + (displayPage < totalPages ? " " : "") + ""); // griefus
}
else {
pagination.append(Color.WHITE + Color.UNDERLINE + displayPage + Color.RESET + (displayPage < totalPages ? " " : ""));
@@ -117,7 +129,8 @@ public class ChatUtils {
pagination.append(Color.GREY + "| ");
}
if (page != totalPages) {
- pagination.append(Color.WHITE + Chat.COMPONENT_TAG_OPEN + Chat.COMPONENT_COMMAND + "|/" + command + " l " + totalPages + "|" + totalPages + Chat.COMPONENT_TAG_CLOSE);
+ //pagination.append(Color.WHITE + Chat.COMPONENT_TAG_OPEN + Chat.COMPONENT_COMMAND + "|/" + command + " l " + totalPages + "|" + totalPages + Chat.COMPONENT_TAG_CLOSE);
+ pagination.append(Color.WHITE + "" + totalPages + ""); // griefus
}
else {
pagination.append(Color.WHITE + Color.UNDERLINE + totalPages);
@@ -163,7 +176,8 @@ public class ChatUtils {
Date logDate = new Date(resultTime * 1000L);
String formattedTimestamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z").format(logDate);
- return Chat.COMPONENT_TAG_OPEN + Chat.COMPONENT_POPUP + "|" + Color.GREY + formattedTimestamp + "|" + Color.GREY + message.toString() + Chat.COMPONENT_TAG_CLOSE;
+ //return Chat.COMPONENT_TAG_OPEN + Chat.COMPONENT_POPUP + "|" + Color.GREY + formattedTimestamp + "|" + Color.GREY + message.toString() + Chat.COMPONENT_TAG_CLOSE;
+ return "" + escape(formattedTimestamp) + "\">" + message + ""; // griefus
}
return message.toString();
@@ -174,19 +188,27 @@ public class ChatUtils {
return phrase;
}
- StringBuilder message = new StringBuilder(Chat.COMPONENT_TAG_OPEN + Chat.COMPONENT_POPUP);
+ //StringBuilder message = new StringBuilder(Chat.COMPONENT_TAG_OPEN + Chat.COMPONENT_POPUP);
+ StringBuilder message = new StringBuilder("").toString(); // griefus
}
// This theoretically initializes the component code, to prevent gson adapter errors
public static void sendConsoleComponentStartup(ConsoleCommandSender consoleSender, String string) {
- Chat.sendComponent(consoleSender, Color.RESET + "[Griefus] " + string + Chat.COMPONENT_TAG_OPEN + Chat.COMPONENT_POPUP + "| | " + Chat.COMPONENT_TAG_CLOSE);
+ //Chat.sendComponent(consoleSender, Color.RESET + "[Griefus] " + string + Chat.COMPONENT_TAG_OPEN + Chat.COMPONENT_POPUP + "| | " + Chat.COMPONENT_TAG_CLOSE);
+ Chat.sendComponent(consoleSender, Color.RESET + "[Griefus] " + MiniMessage.miniMessage().stripTags(string)); // griefus
+ }
+
+ public static String escape(String string) {
+ return MiniMessage.miniMessage().escapeTags(string).replace("\"", "\\");
}
}
\ No newline at end of file
diff --git a/src/main/java/net/coreprotect/utility/Color.java b/src/main/java/net/coreprotect/utility/Color.java
index a460e9d..53b32b8 100644
--- a/src/main/java/net/coreprotect/utility/Color.java
+++ b/src/main/java/net/coreprotect/utility/Color.java
@@ -1,6 +1,6 @@
package net.coreprotect.utility;
-import org.bukkit.ChatColor;
+//import org.bukkit.ChatColor;
public final class Color {
@@ -10,112 +10,134 @@ public final class Color {
/**
* Represents black.
*/
- public static final String BLACK = ChatColor.BLACK.toString();
+ //public static final String BLACK = ChatColor.BLACK.toString();
+ public static final String BLACK = ""; // griefus
/**
* Represents dark blue.
*/
- public static final String DARK_BLUE = ChatColor.DARK_BLUE.toString();
+ //public static final String DARK_BLUE = ChatColor.DARK_BLUE.toString();
+ public static final String DARK_BLUE = ""; // griefus
/**
* Represents dark green.
*/
- public static final String DARK_GREEN = ChatColor.DARK_GREEN.toString();
+ //public static final String DARK_GREEN = ChatColor.DARK_GREEN.toString();
+ public static final String DARK_GREEN = ""; // griefus
/**
* Represents dark blue (aqua).
*/
- public static String DARK_AQUA = ChatColor.DARK_AQUA.toString();
+ //public static String DARK_AQUA = ChatColor.DARK_AQUA.toString();
+ public static String DARK_AQUA = ""; // griefus
/**
* Represents dark red.
*/
- public static final String DARK_RED = ChatColor.DARK_RED.toString();
+ //public static final String DARK_RED = ChatColor.DARK_RED.toString();
+ public static final String DARK_RED = ""; // griefus
/**
* Represents dark purple.
*/
- public static final String DARK_PURPLE = ChatColor.DARK_PURPLE.toString();
+ //public static final String DARK_PURPLE = ChatColor.DARK_PURPLE.toString();
+ public static final String DARK_PURPLE = ""; // griefus
/**
* Represents gold.
*/
- public static final String GOLD = ChatColor.GOLD.toString();
+ //public static final String GOLD = ChatColor.GOLD.toString();
+ public static final String GOLD = ""; // griefus
/**
* Represents grey.
*/
- public static final String GREY = ChatColor.GRAY.toString();
+ //public static final String GREY = ChatColor.GRAY.toString();
+ public static final String GREY = ""; // griefus
/**
* Represents dark grey.
*/
- public static final String DARK_GREY = ChatColor.DARK_GRAY.toString();
+ //public static final String DARK_GREY = ChatColor.DARK_GRAY.toString();
+ public static final String DARK_GREY = ""; // griefus
/**
* Represents blue.
*/
- public static final String BLUE = ChatColor.BLUE.toString();
+ //public static final String BLUE = ChatColor.BLUE.toString();
+ public static final String BLUE = ""; // griefus
/**
* Represents green.
*/
- public static final String GREEN = ChatColor.GREEN.toString();
+ //public static final String GREEN = ChatColor.GREEN.toString();
+ public static final String GREEN = ""; // griefus
/**
* Represents aqua.
*/
- public static final String AQUA = ChatColor.AQUA.toString();
+ //public static final String AQUA = ChatColor.AQUA.toString();
+ public static final String AQUA = ""; // griefus
/**
* Represents red.
*/
- public static final String RED = ChatColor.RED.toString();
+ //public static final String RED = ChatColor.RED.toString();
+ public static final String RED = ""; // griefus
/**
* Represents light purple.
*/
- public static final String LIGHT_PURPLE = ChatColor.LIGHT_PURPLE.toString();
+ //public static final String LIGHT_PURPLE = ChatColor.LIGHT_PURPLE.toString();
+ public static final String LIGHT_PURPLE = ""; // griefus
/**
* Represents yellow.
*/
- public static final String YELLOW = ChatColor.YELLOW.toString();
+ //public static final String YELLOW = ChatColor.YELLOW.toString();
+ public static final String YELLOW = ""; // griefus
/**
* Represents white.
*/
- public static final String WHITE = ChatColor.WHITE.toString();
+ //public static final String WHITE = ChatColor.WHITE.toString();
+ public static final String WHITE = ""; // griefus
/**
* Represents magical characters that change around randomly.
*/
- public static final String MAGIC = ChatColor.COLOR_CHAR + "k";
+ //public static final String MAGIC = ChatColor.COLOR_CHAR + "k";
+ public static final String MAGIC = ""; // griefus
/**
* Makes the text bold.
*/
- public static final String BOLD = ChatColor.COLOR_CHAR + "l";
+ //public static final String BOLD = ChatColor.COLOR_CHAR + "l";
+ public static final String BOLD = ""; // griefus
/**
* Makes a line appear through the text.
*/
- public static final String STRIKETHROUGH = ChatColor.COLOR_CHAR + "m";
+ //public static final String STRIKETHROUGH = ChatColor.COLOR_CHAR + "m";
+ public static final String STRIKETHROUGH = ""; // griefus
/**
* Makes the text appear underlined.
*/
- public static final String UNDERLINE = ChatColor.COLOR_CHAR + "n";
+ //public static final String UNDERLINE = ChatColor.COLOR_CHAR + "n";
+ public static final String UNDERLINE = ""; // griefus
/**
* Makes the text italic.
*/
- public static final String ITALIC = ChatColor.COLOR_CHAR + "o";
+ //public static final String ITALIC = ChatColor.COLOR_CHAR + "o";
+ public static final String ITALIC = ""; // griefus
/**
* Resets all previous chat colors or formats.
*/
- public static final String RESET = ChatColor.COLOR_CHAR + "r";
+ //public static final String RESET = ChatColor.COLOR_CHAR + "r";
+ public static final String RESET = ""; // griefus
private Color() {
throw new IllegalStateException("Utility class");