diff options
author | HacktheTime <l4bg0jb7@duck.com> | 2023-10-13 14:22:07 +0200 |
---|---|---|
committer | HacktheTime <l4bg0jb7@duck.com> | 2023-10-13 14:22:07 +0200 |
commit | 76acd0ddad4230728fd5db6aad0918c25138e5cb (patch) | |
tree | 79587c95760432bd68367b5ff708d2acc0a6c937 /common | |
parent | 75b0e492df112bc8cb0e4bad941d4e2b8713bb3c (diff) | |
download | BBsentials-76acd0ddad4230728fd5db6aad0918c25138e5cb.tar.gz BBsentials-76acd0ddad4230728fd5db6aad0918c25138e5cb.tar.bz2 BBsentials-76acd0ddad4230728fd5db6aad0918c25138e5cb.zip |
got the split into common and fabric working.
Diffstat (limited to 'common')
17 files changed, 95 insertions, 439 deletions
diff --git a/common/src/main/java/de/hype/bbsentials/common/chat/Chat.java b/common/src/main/java/de/hype/bbsentials/common/chat/Chat.java index 1d7aef1..7f450bb 100644 --- a/common/src/main/java/de/hype/bbsentials/common/chat/Chat.java +++ b/common/src/main/java/de/hype/bbsentials/common/chat/Chat.java @@ -3,8 +3,8 @@ package de.hype.bbsentials.common.chat; import de.hype.bbsentials.common.api.Formatting; import de.hype.bbsentials.common.client.BBsentials; import de.hype.bbsentials.common.client.Config; +import de.hype.bbsentials.common.mclibraries.EnvironmentCore; import de.hype.bbsentials.common.packets.packets.SplashUpdatePacket; -import net.minecraft.text.Text; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; @@ -159,9 +159,9 @@ public class Chat { if (message.isFromReportedUser()) { } - else if (!MCUtils.isWindowFocused()) { + else if (!EnvironmentCore.mcUtils.isWindowFocused()) { if (config.doDesktopNotifications) { - if ((messageUnformatted.endsWith("is visiting Your Garden !") || messageUnformatted.endsWith("is visiting Your Island !")) && !MCUtils.isWindowFocused() && config.doDesktopNotifications) { + if ((messageUnformatted.endsWith("is visiting Your Garden !") || messageUnformatted.endsWith("is visiting Your Island !")) && !EnvironmentCore.mcUtils.isWindowFocused() && config.doDesktopNotifications) { sendNotification("BBsentials Visit-Watcher", messageUnformatted); } else if (message.isMsg()) { @@ -191,7 +191,7 @@ public class Chat { } } } - if (!MCUtils.isWindowFocused()) { + if (!EnvironmentCore.mcUtils.isWindowFocused()) { sendNotification("BBsentials Party Notifier", "You got invited too a party by: " + username); } } @@ -282,6 +282,8 @@ public class Chat { public boolean isSpam(String message) { + if (message==null) return true; + if (message.isEmpty()) return true; if (message.contains("Mana")) return true; if (message.contains("Status")) return true; if (message.contains("Achievement Points")) return true; @@ -319,11 +321,11 @@ public class Chat { } private static void sendPrivateMessageToSelfBase(String message) { - MCUtils.sendClientSideMessage(Message.of(message)); + EnvironmentCore.chat.sendClientSideMessage(Message.of(message)); } public static void sendPrivateMessageToSelfText(Message message) { - MCUtils.sendClientSideMessage(message); + EnvironmentCore.chat.sendClientSideMessage(message); } public static void sendCommand(String s) { @@ -363,18 +365,6 @@ public class Chat { e.printStackTrace(); } } - - public static Text createClientSideTellraw(String tellrawInput) { - Text formattedMessage = null; - try { - formattedMessage = Text.Serializer.fromJson(tellrawInput); - } catch (Exception e) { - e.printStackTrace(); - System.out.println("Invalid Json: \n" + tellrawInput); - } - return formattedMessage; - } - public static void setChatPromtId(String logMessage) { String cbUUIDPattern = "/cb ([a-fA-F0-9-]+)"; Pattern cbPattern = Pattern.compile(cbUUIDPattern); @@ -428,14 +418,4 @@ public class Chat { } } - - public static Text replaceAllForText(Text input, String replace, String replaceWith) { - String text = Text.Serializer.toJson(input); - if (text.contains(replace)) { - text = text.replaceAll("\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}", ""); - } - text = text.replace(replace, replaceWith); - Text output = Text.Serializer.fromJson(text); - return output; - } } diff --git a/common/src/main/java/de/hype/bbsentials/common/chat/Message.java b/common/src/main/java/de/hype/bbsentials/common/chat/Message.java index 506146f..66a3599 100644 --- a/common/src/main/java/de/hype/bbsentials/common/chat/Message.java +++ b/common/src/main/java/de/hype/bbsentials/common/chat/Message.java @@ -9,7 +9,8 @@ public class Message { private String string; public Message(String textJson,String string) { - this.text = text; + this.text = textJson; + if (string==null) string = ""; this.string=string; } public static Message of(String string){ diff --git a/common/src/main/java/de/hype/bbsentials/common/chat/Sender.java b/common/src/main/java/de/hype/bbsentials/common/chat/Sender.java index 3dfb13c..9bdde1f 100644 --- a/common/src/main/java/de/hype/bbsentials/common/chat/Sender.java +++ b/common/src/main/java/de/hype/bbsentials/common/chat/Sender.java @@ -1,6 +1,7 @@ package de.hype.bbsentials.common.chat; import de.hype.bbsentials.common.api.Formatting; +import de.hype.bbsentials.common.mclibraries.EnvironmentCore; import java.util.ArrayList; import java.util.List; @@ -95,7 +96,7 @@ public class Sender { } catch (InterruptedException e) { throw new RuntimeException(e); } - MC.sendChatMessage(toSend); + EnvironmentCore.chat.sendChatMessage(toSend); if (!hidden) { sendPrivateMessageToSelfInfo("Sent Command to Server: " + toSend); } diff --git a/common/src/main/java/de/hype/bbsentials/common/client/BBsentials.java b/common/src/main/java/de/hype/bbsentials/common/client/BBsentials.java index 91ba982..b694add 100644 --- a/common/src/main/java/de/hype/bbsentials/common/client/BBsentials.java +++ b/common/src/main/java/de/hype/bbsentials/common/client/BBsentials.java @@ -1,14 +1,10 @@ package de.hype.bbsentials.common.client; import de.hype.bbsentials.common.chat.Chat; -import de.hype.bbsentials.common.client.Commands.CommandsOLD; +import de.hype.bbsentials.common.client.Commands.Commands; import de.hype.bbsentials.common.communication.BBsentialConnection; -import de.hype.bbsentials.common.mclibraries.Options; -import org.lwjgl.glfw.GLFW; +import de.hype.bbsentials.common.mclibraries.EnvironmentCore; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.List; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; @@ -16,7 +12,7 @@ import java.util.concurrent.TimeUnit; public class BBsentials { public static Config config; public static BBsentialConnection connection; - public static CommandsOLD coms; + public static Commands coms; public static ScheduledExecutorService executionService = Executors.newScheduledThreadPool(1000); public static boolean splashLobby; private static Thread bbthread; @@ -56,7 +52,7 @@ public class BBsentials { } bbthread = new Thread(() -> { connection = new BBsentialConnection(); - coms = new CommandsOLD(); + coms = new Commands(); connection.setMessageReceivedCallback(message -> executionService.execute(() -> connection.onMessageReceived(message))); if (beta) { connection.connect(config.getBBServerURL(), 5011); @@ -64,7 +60,7 @@ public class BBsentials { else { connection.connect(config.getBBServerURL(), 5000); } - executionService.scheduleAtFixedRate(new DebugThread(), 0, 20, TimeUnit.SECONDS); + executionService.scheduleAtFixedRate(EnvironmentCore.debug, 0, 20, TimeUnit.SECONDS); }); bbthread.start(); } @@ -77,7 +73,7 @@ public class BBsentials { splashLobby = false; if (!initialised) { config = Config.load(); - if (config.doGammaOverride) Options.setGamma(10); + if (config.doGammaOverride) EnvironmentCore.mcoptions.setGamma(10); Chat chat = new Chat(); if (Config.isBingoTime() || config.overrideBingoTime()) { connectToBBserver(); diff --git a/common/src/main/java/de/hype/bbsentials/common/client/Commands/Commands.java b/common/src/main/java/de/hype/bbsentials/common/client/Commands/Commands.java new file mode 100644 index 0000000..deb4dda --- /dev/null +++ b/common/src/main/java/de/hype/bbsentials/common/client/Commands/Commands.java @@ -0,0 +1,23 @@ +package de.hype.bbsentials.common.client.Commands; + +import de.hype.bbsentials.common.client.Config; +import de.hype.bbsentials.common.mclibraries.EnvironmentCore; + +import static de.hype.bbsentials.common.client.BBsentials.getConfig; +public class Commands { + public Commands() { + EnvironmentCore.commands.registerMain(); + Config config = getConfig(); + if (config.bbsentialsRoles != null) { + EnvironmentCore.commands.registerRoleRequired( + config.hasBBRoles("dev"), + config.hasBBRoles("admin"), + config.hasBBRoles("mod"), + config.hasBBRoles("splasher"), + config.hasBBRoles("beta"), + config.hasBBRoles("mining_events"), + config.hasBBRoles("mining_events") + ); + } + } +}
\ No newline at end of file diff --git a/common/src/main/java/de/hype/bbsentials/common/client/Commands/CommandsOLD.java b/common/src/main/java/de/hype/bbsentials/common/client/Commands/CommandsOLD.java deleted file mode 100644 index 92e801c..0000000 --- a/common/src/main/java/de/hype/bbsentials/common/client/Commands/CommandsOLD.java +++ /dev/null @@ -1,363 +0,0 @@ -package de.hype.bbsentials.common.client.Commands; - -import com.mojang.brigadier.CommandDispatcher; -import com.mojang.brigadier.arguments.IntegerArgumentType; -import com.mojang.brigadier.arguments.StringArgumentType; -import de.hype.bbsentials.common.chat.Chat; -import de.hype.bbsentials.common.client.BBsentials; -import de.hype.bbsentials.common.constants.enviromentShared.ChChestItems; -import de.hype.bbsentials.common.constants.enviromentShared.MiningEvents; -import de.hype.bbsentials.common.packets.AbstractPacket; -import de.hype.bbsentials.common.packets.packets.*; -import de.hype.bbsentials.fabric.BBUtils; -import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager; -import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback; -import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; -import net.fabricmc.fabric.api.event.Event; -import net.minecraft.command.CommandSource; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -public class CommandsOLD { - public CommandsOLD() { - Event<ClientCommandRegistrationCallback> event = ClientCommandRegistrationCallback.EVENT; - event.register((dispatcher, registryAccess) -> { - dispatcher.register(ClientCommandManager.literal("creport") - .then(ClientCommandManager.argument("Player_Name", StringArgumentType.string()) - .executes((context) -> { - String playerName = StringArgumentType.getString(context, "Player_Name"); - BBsentials.getConfig().sender.addSendTask("/creport " + playerName, 0); - BBsentials.getConfig().addReported(playerName); - return 1; - }))); - });//creport helper → no double report during same launch - event.register((dispatcher, registryAccess) -> { - dispatcher.register(ClientCommandManager.literal("socialoptions") - .then(ClientCommandManager.argument("playername", StringArgumentType.greedyString()) - .executes((context) -> { - String[] parameters = StringArgumentType.getString(context, "playername").trim().split(" ", 3); - Chat.sendPrivateMessageToSelfDebug(String.join(" ", parameters)); - String tellrawjson = ""; - if (parameters.length >= 3) { - if (parameters[0].equals("sb")) { - tellrawjson = "[\"\",{\"text\":\"\n\n$username\",\"underlined\":true,\"color\":\"blue\",\"clickEvent\":{\"action\":\"copy_to_clipboard\",\"value\":\"$username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[{\"text\":\"Click to copy the username\",\"color\":\"blue\"}]}},\" \",{\"text\":\"[Party]\",\"color\":\"gold\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/p invite $username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to party player\"]}},\" \",{\"text\":\"[Invite]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/invite\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to invite them to visit your private island/garden\"]}},\" \",{\"text\":\"[Visit]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/visit $username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to open the visit menu for that user\"]}},\" \",{\"text\":\"[creport]\",\"color\":\"dark_red\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/creport $username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to report the player for chat (public)\"]}},\" \",{\"text\":\"[Ignore add]\",\"color\":\"red\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/ignore add $username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to ignore add the user\"]}},\" \",{\"text\":\"[Copy content]\",\"color\":\"gray\",\"clickEvent\":{\"action\":\"copy_to_clipboard\",\"value\":\"$messagecontent\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to copy the message content\"]}},\" \",{\"text\":\"[Copy message]\",\"color\":\"blue\",\"clickEvent\":{\"action\":\"copy_to_clipboard\",\"value\":\"$message\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to copy the exact message\"]}},\" \",{\"text\":\"[Msg]\",\"color\":\"dark_purple\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/msg $username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to msg the user\"]}},\" \",{\"text\":\"[Sky shiiyu]\",\"color\":\"aqua\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://sky.shiiyu.moe/stats/$username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to open the users sky shiiyu page.\"]}},\"\\n\"]"; - //{"jformat":8,"jobject":[{"bold":false,"italic":false,"underlined":true,"strikethrough":false,"obfuscated":false,"font":null,"color":"blue","insertion":"","click_event_type":"copy_to_clipboard","click_event_value":"$username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"blue","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to copy the username"}],"text":"$username"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"gold","insertion":"","click_event_type":"run_command","click_event_value":"/p invite $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to party player"}],"text":"[Party]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"green","insertion":"","click_event_type":"run_command","click_event_value":"/invite","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to invite them to visit your private island/garden"}],"text":"[Invite]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"green","insertion":"","click_event_type":"run_command","click_event_value":"/visit $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to open the visit menu for that user"}],"text":"[Visit]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"dark_red","insertion":"","click_event_type":"suggest_command","click_event_value":"/creport $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to report the player for chat (public)"}],"text":"[creport]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"red","insertion":"","click_event_type":"suggest_command","click_event_value":"/ignore add $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to ignore add the user"}],"text":"[Ignore add]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"gray","insertion":"","click_event_type":"copy_to_clipboard","click_event_value":"$messagecontent","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to copy the message content"}],"text":"[Copy content]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"blue","insertion":"","click_event_type":"copy_to_clipboard","click_event_value":"$message","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to copy the exact message"}],"text":"[Copy message]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"dark_purple","insertion":"","click_event_type":"suggest_command","click_event_value":"/msg $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to msg the user"}],"text":"[Msg]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"aqua","insertion":"","click_event_type":"open_url","click_event_value":"https://sky.shiiyu.moe/stats/$username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to open the users sky shiiyu page."}],"text":"[Sky shiiyu]"}],"command":"%s","jtemplate":"tellraw"} - } - else if (parameters[0].equals("guild")) { - tellrawjson = "[\"\",{\"text\":\"\n\n$username\",\"underlined\":true,\"color\":\"blue\",\"clickEvent\":{\"action\":\"copy_to_clipboard\",\"value\":\"$username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[{\"text\":\"Click to copy the username\",\"color\":\"blue\"}]}},\" \",{\"text\":\"[Party]\",\"color\":\"gold\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/p invite $username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to party player\"]}},\" \",{\"text\":\"[SB Options]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/socialoptions sb $username $message\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to open the SB options\"]}},\" \",{\"text\":\"[Member info]\",\"color\":\"dark_aqua\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/g member $username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Show guild info about the user.\"]}},\" \",{\"text\":\"[Copy content]\",\"color\":\"gray\",\"clickEvent\":{\"action\":\"copy_to_clipboard\",\"value\":\"$messagecontent\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to copy the message content\"]}},\" \",{\"text\":\"[Copy message]\",\"color\":\"blue\",\"clickEvent\":{\"action\":\"copy_to_clipboard\",\"value\":\"$message\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to copy the exact message\"]}},\" \",{\"text\":\"[Msg]\",\"color\":\"dark_purple\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/msg $username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to msg the user\"]}},\" \",{\"text\":\"[Ignore add]\",\"color\":\"red\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/ignore add $username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to ignore add the user\"]}},\"\\n\",{\"text\":\"G Admin: \",\"color\":\"dark_red\"},{\"text\":\"[kick]\",\"color\":\"dark_purple\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/g kick $username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"suggest the command to kick the user\"]}},\" \",{\"text\":\"[mute]\",\"color\":\"red\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/g mute $username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Suggest a mute command for the user.\"]}},\" \",{\"text\":\"[promote]\",\"color\":\"dark_green\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/g promote $username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to promote the user\"]}},\" \",{\"text\":\"[demote]\",\"color\":\"red\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/g demote $username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to demote the user\"]}}]"; - //{"jformat":8,"jobject":[{"bold":false,"italic":false,"underlined":true,"strikethrough":false,"obfuscated":false,"font":null,"color":"blue","insertion":"","click_event_type":"copy_to_clipboard","click_event_value":"$username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"blue","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to copy the username"}],"text":"$username"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"gold","insertion":"","click_event_type":"run_command","click_event_value":"/p invite $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to party player"}],"text":"[Party]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"green","insertion":"","click_event_type":"run_command","click_event_value":"/socialoptions sb $username $message","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to open the SB options"}],"text":"[SB Options]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"dark_aqua","insertion":"","click_event_type":"run_command","click_event_value":"/g member $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Show guild info about the user."}],"text":"[Member info]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"gray","insertion":"","click_event_type":"copy_to_clipboard","click_event_value":"$messagecontent","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to copy the message content"}],"text":"[Copy content]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"blue","insertion":"","click_event_type":"copy_to_clipboard","click_event_value":"$message","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to copy the exact message"}],"text":"[Copy message]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"dark_purple","insertion":"","click_event_type":"suggest_command","click_event_value":"/msg $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to msg the user"}],"text":"[Msg]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"red","insertion":"","click_event_type":"suggest_command","click_event_value":"/ignore add $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to ignore add the user"}],"text":"[Ignore add]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"\n"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"dark_red","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"G Admin: "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"dark_purple","insertion":"","click_event_type":"suggest_command","click_event_value":"/g kick $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"suggest the command to kick the user"}],"text":"[kick]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"red","insertion":"","click_event_type":"suggest_command","click_event_value":"/g mute $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Suggest a mute command for the user."}],"text":"[mute]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"dark_green","insertion":"","click_event_type":"suggest_command","click_event_value":"/g promote $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to promote the user"}],"text":"[promote]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"red","insertion":"","click_event_type":"suggest_command","click_event_value":"/g demote $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to demote the user"}],"text":"[demote]"}],"command":"%s","jtemplate":"tellraw"} - } - else if (parameters[0].equals("party")) { - if (BBsentials.config.isLeader()) { - tellrawjson = "[\"\",{\"text\":\"\n\n$username\",\"underlined\":true,\"color\":\"blue\",\"clickEvent\":{\"action\":\"copy_to_clipboard\",\"value\":\"$username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[{\"text\":\"Click to copy the username\",\"color\":\"blue\"}]}},\" \",{\"text\":\"[Party]\",\"color\":\"gold\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/p invite $username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to party player\"]}},\" \",{\"text\":\"[SB Options]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/socialoptions sb $username $message\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to open the SB options\"]}},\" \",{\"text\":\"[Copy content]\",\"color\":\"gray\",\"clickEvent\":{\"action\":\"copy_to_clipboard\",\"value\":\"$messagecontent\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to copy the message content\"]}},\" \",{\"text\":\"[Copy message]\",\"color\":\"blue\",\"clickEvent\":{\"action\":\"copy_to_clipboard\",\"value\":\"$message\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to copy the exact message\"]}},\" \",{\"text\":\"[Msg]\",\"color\":\"dark_purple\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/msg $username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to msg the user\"]}},\" \",{\"text\":\"[Ignore add]\",\"color\":\"red\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/ignore add $username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to ignore add the user\"]}},\"\\n\",\"\\n\",{\"text\":\"P Leader: \",\"color\":\"dark_red\"},{\"text\":\"[kick]\",\"color\":\"dark_purple\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/p kick $username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"suggest the command to kick the user\"]}},\" \",{\"text\":\"[transfer]\",\"color\":\"dark_red\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/p transfer $username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Suggest a mute command for the user.\"]}},\" \",{\"text\":\"[promote]\",\"color\":\"dark_green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/p promote $username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to promote the user\"]}},\" \",{\"text\":\"[demote]\",\"color\":\"red\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/p demote $username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to demote the user\"]}}]"; - //{"jformat":8,"jobject":[{"bold":false,"italic":false,"underlined":true,"strikethrough":false,"obfuscated":false,"font":null,"color":"blue","insertion":"","click_event_type":"copy_to_clipboard","click_event_value":"$username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"blue","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to copy the username"}],"text":"$username"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"gold","insertion":"","click_event_type":"run_command","click_event_value":"/p invite $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to party player"}],"text":"[Party]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"green","insertion":"","click_event_type":"run_command","click_event_value":"/socialoptions sb $username $message","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to open the SB options"}],"text":"[SB Options]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"gray","insertion":"","click_event_type":"copy_to_clipboard","click_event_value":"$messagecontent","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to copy the message content"}],"text":"[Copy content]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"blue","insertion":"","click_event_type":"copy_to_clipboard","click_event_value":"$message","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to copy the exact message"}],"text":"[Copy message]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"dark_purple","insertion":"","click_event_type":"suggest_command","click_event_value":"/msg $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to msg the user"}],"text":"[Msg]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"red","insertion":"","click_event_type":"suggest_command","click_event_value":"/ignore add $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to ignore add the user"}],"text":"[Ignore add]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"\n"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"\n"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"dark_red","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"P Leader: "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"dark_purple","insertion":"","click_event_type":"run_command","click_event_value":"/p kick $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"suggest the command to kick the user"}],"text":"[kick]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"dark_red","insertion":"","click_event_type":"suggest_command","click_event_value":"/p transfer $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Suggest a mute command for the user."}],"text":"[transfer]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"dark_green","insertion":"","click_event_type":"run_command","click_event_value":"/p promote $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to promote the user"}],"text":"[promote]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"red","insertion":"","click_event_type":"run_command","click_event_value":"/p demote $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to demote the user"}],"text":"[demote]"}],"command":"%s","jtemplate":"tellraw"} - } - else { - tellrawjson = "[\"\",{\"text\":\"\n\n$username\",\"underlined\":true,\"color\":\"blue\",\"clickEvent\":{\"action\":\"copy_to_clipboard\",\"value\":\"$username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[{\"text\":\"Click to copy the username\",\"color\":\"blue\"}]}},\" \",{\"text\":\"[Party]\",\"color\":\"gold\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/p invite $username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to party player\"]}},\" \",{\"text\":\"[SB Options]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/socialoptions sb $username $message\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to open the SB options\"]}},\" \",{\"text\":\"[Copy content]\",\"color\":\"gray\",\"clickEvent\":{\"action\":\"copy_to_clipboard\",\"value\":\"$messagecontent\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to copy the message content\"]}},\" \",{\"text\":\"[Copy message]\",\"color\":\"blue\",\"clickEvent\":{\"action\":\"copy_to_clipboard\",\"value\":\"$message\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to copy the exact message\"]}},\" \",{\"text\":\"[Msg]\",\"color\":\"dark_purple\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/msg $username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to msg the user\"]}},\" \",{\"text\":\"[Ignore add]\",\"color\":\"red\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/ignore add $username\"},\"hoverEvent\":{\"action\":\"show_text\",\"contents\":[\"Click to ignore add the user\"]}}]"; - //{"jformat":8,"jobject":[{"bold":false,"italic":false,"underlined":true,"strikethrough":false,"obfuscated":false,"font":null,"color":"blue","insertion":"","click_event_type":"copy_to_clipboard","click_event_value":"$username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"blue","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to copy the username"}],"text":"$username"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"gold","insertion":"","click_event_type":"run_command","click_event_value":"/p invite $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to party player"}],"text":"[Party]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"green","insertion":"","click_event_type":"run_command","click_event_value":"/socialoptions sb $username $message","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to open the SB options"}],"text":"[SB Options]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"gray","insertion":"","click_event_type":"copy_to_clipboard","click_event_value":"$messagecontent","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to copy the message content"}],"text":"[Copy content]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"blue","insertion":"","click_event_type":"copy_to_clipboard","click_event_value":"$message","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to copy the exact message"}],"text":"[Copy message]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"dark_purple","insertion":"","click_event_type":"suggest_command","click_event_value":"/msg $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to msg the user"}],"text":"[Msg]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"red","insertion":"","click_event_type":"suggest_command","click_event_value":"/ignore add $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to ignore add the user"}],"text":"[Ignore add]"}],"command":"%s","jtemplate":"tellraw"} - } - //{"jformat":8,"jobject":[{"bold":false,"italic":false,"underlined":true,"strikethrough":false,"obfuscated":false,"font":null,"color":"blue","insertion":"","click_event_type":"copy_to_clipboard","click_event_value":"$username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"blue","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to copy the username"}],"text":"$username"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"gold","insertion":"","click_event_type":"run_command","click_event_value":"/p invite $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to party player"}],"text":"[Party]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"green","insertion":"","click_event_type":"run_command","click_event_value":"/socialoptions sb $username $message","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to open the SB options"}],"text":"[SB Options]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"gray","insertion":"","click_event_type":"copy_to_clipboard","click_event_value":"$messagecontent","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to copy the message content"}],"text":"[Copy content]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"blue","insertion":"","click_event_type":"copy_to_clipboard","click_event_value":"$message","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to copy the exact message"}],"text":"[Copy message]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"dark_purple","insertion":"","click_event_type":"suggest_command","click_event_value":"/msg $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to msg the user"}],"text":"[Msg]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"red","insertion":"","click_event_type":"suggest_command","click_event_value":"/ignore add $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to ignore add the user"}],"text":"[Ignore add]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"\n"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"dark_red","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"P Leader: "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"dark_purple","insertion":"","click_event_type":"run_command","click_event_value":"/p kick $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"suggest the command to kick the user"}],"text":"[kick]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"red","insertion":"","click_event_type":"suggest_command","click_event_value":"/p mute $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Suggest a mute command for the user."}],"text":"[mute]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"dark_green","insertion":"","click_event_type":"run_command","click_event_value":"/p promote $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to promote the user"}],"text":"[promote]"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":" "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"red","insertion":"","click_event_type":"run_command","click_event_value":"/p demote $username","hover_event_type":"show_text","hover_event_value":"","hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"none","click_event_value":"","hover_event_type":"none","hover_event_value":"","hover_event_children":[],"text":"Click to demote the user"}],"text":"[demote]"}],"command":"%s","jtemplate":"tellraw"} - } - tellrawjson = tellrawjson.replace("$username", parameters[1]); - int doublepointIndex = parameters[2].indexOf(":"); - if (doublepointIndex != -1) { - tellrawjson = tellrawjson.replace("$messagecontent", parameters[2].substring(doublepointIndex + 1).trim()); - } - tellrawjson = tellrawjson.replace("$message", parameters[2]); - } - if (tellrawjson.isEmpty()) - Chat.sendCommand("/socialoptions " + String.join(" ", parameters)); - else { - Chat.sendPrivateMessageToSelfText(Chat.createClientSideTellraw(tellrawjson)); - } - return 1; - }))); - });//sbsocialoptions - event.register((dispatcher, registryAccess) -> { - miningEvent(dispatcher, "goblinraid", MiningEvents.GOBLIN_RAID); - });/*goblinraid*/ - event.register((dispatcher, registryAccess) -> { - miningEvent(dispatcher, "2xpowder", MiningEvents.DOUBLE_POWDER); - });/*2xpowder*/ - event.register((dispatcher, registryAccess) -> { - miningEvent(dispatcher, "bettertogether", MiningEvents.BETTER_TOGETHER); - });/*b2g*/ - event.register((dispatcher, registryAccess) -> { - miningEvent(dispatcher, "raffle", MiningEvents.RAFFLE); - });/*raffle*/ - event.register((dispatcher, registryAccess) -> { - miningEvent(dispatcher, "gonewiththewind", MiningEvents.GONE_WITH_THE_WIND); - });/*gonewiththewind*/ - event.register((dispatcher, registryAccess) -> { - miningEvent(dispatcher, "mithrilgourmand", MiningEvents.MITHRIL_GOURMAND); - });/*gonewiththewind*/ - event.register((dispatcher, registryAccess) -> { - dispatcher.register(ClientCommandManager.literal("chchest") - .then(ClientCommandManager.argument("Item", StringArgumentType.string()) - .suggests((context, builder) -> { - String[] items = new String[]{"PrehistoricEgg", "Pickonimbus2000", "ElectronTransmitter", "FTX3070", "RobotronReflector", "ControlSwitch", "SyntheticHeart", "SuperliteMotor", "BlueGoblinEgg", "YellowGoblinEgg", "FlawlessAmberGemstone", "FlawlessJadeGemstone", "FlawlessSapphireGemstone", "FlawlessRubyGemstone", "FlawlessAmethystGemstone", "JungleHeart", "FlawlessTopazGemstone", "FlawlessJasperGemstone"}; - String input = builder.getRemaining().toLowerCase(); - int lastSemicolonIndex = input.lastIndexOf(";"); - List<String> suggestions = new ArrayList<>(); - if (lastSemicolonIndex >= 0) { - String inputBeforeSemicolon = input.substring(0, lastSemicolonIndex + 1); // Include the semicolon - - for (String item : items) { - suggestions.add(inputBeforeSemicolon + item); - } - } - return CommandSource.suggestMatching(suggestions, builder); - }) - .then(ClientCommandManager.argument("X", IntegerArgumentType.integer()) - .then(ClientCommandManager.argument("Y", IntegerArgumentType.integer()) - .then(ClientCommandManager.argument("Z", IntegerArgumentType.integer()) - .then(ClientCommandManager.argument("ContactWay", StringArgumentType.string()) - .suggests(((context, builder) -> { - return CommandSource.suggestMatching(new String[]{"\"/msg " + BBsentials.getConfig().getUsername() + " bb:party me\"", "\"/p join " + BBsentials.config.getUsername() + "\""}, builder); - })) - .executes((context) -> { - String item = StringArgumentType.getString(context, "Item"); - int x = IntegerArgumentType.getInteger(context, "X"); - int y = IntegerArgumentType.getInteger(context, "Y"); - int z = IntegerArgumentType.getInteger(context, "Z"); - String contactWay = StringArgumentType.getString(context, "ContactWay"); - - BBsentials.connection.sendPacket(new ChChestPacket("", ChChestItems.getItem(item.split(";")), x + " " + y + " " + z, contactWay, "")); - return 1; - } - ) - ) - ) - ) - ) - ) - ); - });/*chchest*/ - event.register((dispatcher, registryAccess) -> { - dispatcher.register( - ClientCommandManager.literal("bc") - .then(ClientCommandManager.argument("Message to Bingo Chat", StringArgumentType.greedyString()) - .executes((context) -> { - String message = StringArgumentType.getString(context, "Message to Bingo Chat"); - sendPacket(new BingoChatMessagePacket("", "", message, 0)); - return 1; - }) - ) - ); - });/*BincoChatShort*/ - event.register((dispatcher, registryAccess) -> { - dispatcher.register( - ClientCommandManager.literal("bingochat") - .then(ClientCommandManager.argument("Message to Bingo Chat", StringArgumentType.greedyString()) - .executes((context) -> { - String message = StringArgumentType.getString(context, "Message to Bingo Chat"); - sendPacket(new BingoChatMessagePacket("", "", message, 0)); - return 1; - }) - ) - ); - });/*BingoChatLong*/ - if (BBsentials.getConfig().bbsentialsRoles != null) { - if (BBsentials.getConfig().hasBBRoles("mod")) { - event.register((dispatcher, registryAccess) -> { - dispatcher.register( - ClientCommandManager.literal("bannounce") - .then(ClientCommandManager.argument("message", StringArgumentType.greedyString()) - .executes((context) -> { - String message = StringArgumentType.getString(context, "message"); - sendCommand("?announce " + message); - return 1; - }) - ) - ); - });/*bAnnounce*/ - event.register((dispatcher, registryAccess) -> { - dispatcher.register(ClientCommandManager.literal("bmute") - .then(ClientCommandManager.argument("userId/mcusername", StringArgumentType.string()) - .then(ClientCommandManager.argument("[Duration(d/h/m/s) | 0 forever]", StringArgumentType.string()) - .then(ClientCommandManager.argument("reason", StringArgumentType.greedyString()) - .executes((context) -> { - String identification = StringArgumentType.getString(context, "userId/mcusername"); - String duration = StringArgumentType.getString(context, "[Duration(d/h/m/s) | 0 forever]"); - String reason = StringArgumentType.getString(context, "reason"); - int userId = -1; - String mcusername = ""; - if (identification.replaceAll("[\\d]", "").trim().isEmpty()) { - userId = Integer.parseInt(identification); - } - else { - mcusername = identification; - } - sendPacket(new PunishUserPacket(PunishUserPacket.PUNISHMENT_TYPE_MUTE, userId, mcusername, duration, reason)); - return 1; - }) - ) - ) - ) - ); - });/*bmute*/ - event.register((dispatcher, registryAccess) -> { - dispatcher.register(ClientCommandManager.literal("bban") - .then(ClientCommandManager.argument("userId/mcusername", StringArgumentType.string()) - .then(ClientCommandManager.argument("[Duration(d/h/m/s) | 0 forever]", StringArgumentType.string()) - .then(ClientCommandManager.argument("reason", StringArgumentType.greedyString()) - .executes((context) -> { - String identification = StringArgumentType.getString(context, "userId/mcusername"); - String duration = StringArgumentType.getString(context, "[Duration(d/h/m/s) | 0 forever]"); - String reason = StringArgumentType.getString(context, "reason"); - int userId = -1; - String mcusername = ""; - if (identification.replaceAll("[\\d]", "").trim().isEmpty()) { - userId = Integer.parseInt(identification); - } - else { - mcusername = identification; - } - sendPacket(new PunishUserPacket(PunishUserPacket.PUNISHMENT_TYPE_BAN, userId, mcusername, duration, reason)); - return 1; - }) - ) - ) - ) - ); - });/*ban*/ - event.register((dispatcher, registryAccess) -> { - dispatcher.register(ClientCommandManager.literal("bgetinfo") - .then(ClientCommandManager.argument("userId/mcusername", StringArgumentType.string()) - .executes((context) -> { - String identification = StringArgumentType.getString(context, "userId/mcusername"); - sendPacket(new InternalCommandPacket(InternalCommandPacket.GET_USER_INFO, new String[]{identification})); - return 1; - }) - ) - ); - });/*getInfo*/ - } - if (BBsentials.getConfig().hasBBRoles("splasher")) { - event.register((dispatcher, registryAccess) -> { - dispatcher.register( - ClientCommandManager.literal("splashAnnounce") - .then(ClientCommandManager.argument("Hub", IntegerArgumentType.integer(1, 28)) - .then(ClientCommandManager.argument("location", StringArgumentType.string()) - .suggests((context, builder) -> { - return CommandSource.suggestMatching(new String[]{"kat", "bea", "guild-house"}, builder); - }) - .then(ClientCommandManager.argument("lasswaste", StringArgumentType.string()) - .suggests((context, builder) -> { - return CommandSource.suggestMatching(new String[]{"true", "false"}, builder); - }) - .then(ClientCommandManager.argument("extramessage", StringArgumentType.greedyString()) - .executes((context) -> { - int hub = IntegerArgumentType.getInteger(context, "Hub"); - String extramessage = StringArgumentType.getString(context, "extramessage"); - String location = StringArgumentType.getString(context, "location"); - boolean lessWaste = Boolean.parseBoolean(StringArgumentType.getString(context, "lasswaste")); - splashAnnounce(hub, location, extramessage, lessWaste); - return 1; - }) - ) - .executes((context) -> { - int hub = IntegerArgumentType.getInteger(context, "Hub"); - String location = StringArgumentType.getString(context, "location"); - boolean lessWaste = Boolean.parseBoolean(StringArgumentType.getString(context, "lasswaste")); - splashAnnounce(hub, location, "", lessWaste); - return 1; - }) - )) - .executes((context) -> { - int hub = IntegerArgumentType.getInteger(context, "Hub"); - String location = "bea"; - splashAnnounce(hub, location, "", true); - return 1; - }) - - ) - ); - });/*SplashAnnounce*/ - event.register((dispatcher, registryAccess) -> { - dispatcher.register( - ClientCommandManager.literal("requestpottimes") - .executes((context) -> { - sendPacket(new InternalCommandPacket(InternalCommandPacket.REQUEST_POT_DURATION, new String[0])); - return 1; - }) - ); - });/*requestpottimes*/ - } - if (BBsentials.getConfig().hasBBRoles("admin")) { - event.register((dispatcher, registryAccess) -> { - dispatcher.register( - ClientCommandManager.literal("bshutdown") - .then(ClientCommandManager.argument("Reason", StringArgumentType.greedyString()) - .suggests((context, builder) -> { - return CommandSource.suggestMatching(new String[]{"Emergency Shutdown", "System Shutdown", "Other"}, builder); - }) - .executes((context) -> { - String reason = StringArgumentType.getString(context, "Reason"); - sendPacket(new InternalCommandPacket(InternalCommandPacket.SHUTDOWN_SERVER, new String[]{reason})); - return 1; - }) - ) - ); - });/*BBShutdown*/ - event.register((dispatcher, registryAccess) -> { - dispatcher.register( - ClientCommandManager.literal("bsetmotd") - .then(ClientCommandManager.argument("Message", StringArgumentType.greedyString()) - .suggests((context, builder) -> { - return CommandSource.suggestMatching(new String[]{""}, builder); - }) - .executes((context) -> { - String message = StringArgumentType.getString(context, "Message").trim(); - sendPacket(new InternalCommandPacket(InternalCommandPacket.SET_MOTD, new String[]{message})); - return 1; - }) - ) - ); - });/*BBServerMotd*/ - } - else { - } - } - } - - private static void simpleCommand(CommandDispatcher<FabricClientCommandSource> dispatcher, String commandName, String[] parameters) { - dispatcher.register( - ClientCommandManager.literal(commandName) - .executes((context) -> { - BBsentials.connection.sendPacket(new InternalCommandPacket(commandName, parameters)); - return 1; - }) - ); - } - - private static void miningEvent(CommandDispatcher<FabricClientCommandSource> dispatcher, String commandName, MiningEvents event) { - dispatcher.register( - ClientCommandManager.literal(commandName) - .executes((context) -> { - try { - BBsentials.connection.sendPacket(new MiningEventPacket(event, - BBsentials.config.getUsername(), Objects.requireNonNull(BBUtils.getCurrentIsland()))); - } catch (Exception e) { - Chat.sendPrivateMessageToSelfError(e.getMessage()); - } - return 1; - }) - ); - } - - public void splashAnnounce(int hubNumber, String locationInHub, String extramessage, boolean lessWaste) { - sendPacket(new SplashNotifyPacket(0, hubNumber, BBsentials.config.getUsername(), locationInHub, BBUtils.getCurrentIsland(), extramessage, lessWaste)); - } - - - public void sendCommand(String message) { - BBsentials.connection.sendCommand(message); - } - - public <E extends AbstractPacket> void sendPacket(E packet) { - BBsentials.connection.sendPacket(packet); - } -}
\ No newline at end of file diff --git a/common/src/main/java/de/hype/bbsentials/common/client/Config.java b/common/src/main/java/de/hype/bbsentials/common/client/Config.java index d82e238..a23fe62 100644 --- a/common/src/main/java/de/hype/bbsentials/common/client/Config.java +++ b/common/src/main/java/de/hype/bbsentials/common/client/Config.java @@ -199,6 +199,6 @@ public class Config implements Serializable { } public String getMCUUID() { - return MCUtils.getMCUUID().replace("-", ""); + return EnvironmentCore.mcUtils.getMCUUID().replace("-", ""); } } diff --git a/common/src/main/java/de/hype/bbsentials/common/client/DebugThread.java b/common/src/main/java/de/hype/bbsentials/common/client/DebugThread.java index 9047403..d51fcec 100644 --- a/common/src/main/java/de/hype/bbsentials/common/client/DebugThread.java +++ b/common/src/main/java/de/hype/bbsentials/common/client/DebugThread.java @@ -1,22 +1,20 @@ package de.hype.bbsentials.common.client; -import java.util.ArrayList; import java.util.List; -public class DebugThread implements Runnable { +public interface DebugThread extends Runnable { @Override - public void run() { + public default void run() { loop(); //place a breakpoint for only this thread here. } - public void loop() { - + public default void loop() { } - public static List<String> test() { + public default List<String> test() { return List.of(""); } } diff --git a/common/src/main/java/de/hype/bbsentials/common/client/SplashStatusUpdateListener.java b/common/src/main/java/de/hype/bbsentials/common/client/SplashStatusUpdateListener.java index a250534..5ea2384 100644 --- a/common/src/main/java/de/hype/bbsentials/common/client/SplashStatusUpdateListener.java +++ b/common/src/main/java/de/hype/bbsentials/common/client/SplashStatusUpdateListener.java @@ -1,6 +1,7 @@ package de.hype.bbsentials.common.client; import de.hype.bbsentials.common.communication.BBsentialConnection; +import de.hype.bbsentials.common.mclibraries.EnvironmentCore; import de.hype.bbsentials.common.packets.packets.SplashNotifyPacket; import de.hype.bbsentials.common.packets.packets.SplashUpdatePacket; @@ -22,9 +23,9 @@ public class SplashStatusUpdateListener implements Runnable { @Override public void run() { BBsentials.splashLobby = true; - int maxPlayerCount = BBUtils.getMaximumPlayerCount() - 5; + int maxPlayerCount = EnvironmentCore.utils.getMaximumPlayerCount() - 5; while (BBsentials.splashLobby) { - if (!full&&(BBUtils.getPlayerCount() >= maxPlayerCount)) { + if (!full&&(EnvironmentCore.utils.getPlayerCount() >= maxPlayerCount)) { newStatus = SplashUpdatePacket.STATUS_FULL; full=true; } diff --git a/common/src/main/java/de/hype/bbsentials/common/client/ToDisplayConfig.java b/common/src/main/java/de/hype/bbsentials/common/client/ToDisplayConfig.java index 0a046d9..8e8998c 100644 --- a/common/src/main/java/de/hype/bbsentials/common/client/ToDisplayConfig.java +++ b/common/src/main/java/de/hype/bbsentials/common/client/ToDisplayConfig.java @@ -2,7 +2,7 @@ package de.hype.bbsentials.common.client; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import de.hype.bbsentials.fabric.MCUtils; +import de.hype.bbsentials.common.mclibraries.EnvironmentCore; import java.io.File; import java.io.FileReader; @@ -40,7 +40,7 @@ public class ToDisplayConfig { // Serialize the object to JSON and save to file public void saveToFile() { - File configFile = new File(MCUtils.getConfigPath(), "BBsentials_display_Config.json"); + File configFile = new File(EnvironmentCore.mcUtils.getConfigPath(), "BBsentials_display_Config.json"); Gson gson = new GsonBuilder().setPrettyPrinting().create(); try (FileWriter writer = new FileWriter(configFile)) { @@ -52,7 +52,7 @@ public class ToDisplayConfig { // Deserialize the object from JSON file public static ToDisplayConfig loadFromFile() { - File configFile = new File(MCUtils.getConfigPath(), "BBsentials_display_Config.json"); + File configFile = new File(EnvironmentCore.mcUtils.getConfigPath(), "BBsentials_display_Config.json"); Gson gson = new Gson(); try (FileReader reader = new FileReader(configFile)) { diff --git a/common/src/main/java/de/hype/bbsentials/common/communication/BBsentialConnection.java b/common/src/main/java/de/hype/bbsentials/common/communication/BBsentialConnection.java index e7aa3a4..76ee4bd 100644 --- a/common/src/main/java/de/hype/bbsentials/common/communication/BBsentialConnection.java +++ b/common/src/main/java/de/hype/bbsentials/common/communication/BBsentialConnection.java @@ -1,13 +1,12 @@ package de.hype.bbsentials.common.communication; +import de.hype.bbsentials.common.chat.Chat; import de.hype.bbsentials.common.chat.Message; import de.hype.bbsentials.common.client.BBsentials; import de.hype.bbsentials.common.client.SplashManager; import de.hype.bbsentials.common.client.SplashStatusUpdateListener; -import de.hype.bbsentials.common.constants.enviromentShared.ChChestItem; -import de.hype.bbsentials.common.constants.enviromentShared.ChChestItems; -import de.hype.bbsentials.common.constants.enviromentShared.Islands; -import de.hype.bbsentials.common.constants.enviromentShared.MiningEvents; +import de.hype.bbsentials.common.constants.enviromentShared.*; +import de.hype.bbsentials.common.mclibraries.EnvironmentCore; import de.hype.bbsentials.common.packets.AbstractPacket; import de.hype.bbsentials.common.packets.PacketManager; import de.hype.bbsentials.common.packets.PacketUtils; @@ -305,7 +304,7 @@ public class BBsentialConnection { else { SplashManager.addSplash(packet); if (packet.lessWaste) { - waitTime = Math.min(((getPotTime() * 1000) / 80), 25 * 1000); + waitTime = Math.min(((EnvironmentCore.mcUtils.getPotTime() * 1000) / 80), 25 * 1000); } else { waitTime = 0; @@ -415,13 +414,13 @@ public class BBsentialConnection { public void onInternalCommandPacket(InternalCommandPacket packet) { if (packet.command.equals(InternalCommandPacket.REQUEST_POT_DURATION)) { - sendPacket(new InternalCommandPacket(InternalCommandPacket.SET_POT_DURATION, new String[]{String.valueOf(getPotTime())})); + sendPacket(new InternalCommandPacket(InternalCommandPacket.SET_POT_DURATION, new String[]{String.valueOf(EnvironmentCore.mcUtils.getPotTime())})); } else if (packet.command.equals(InternalCommandPacket.SELFDESTRUCT)) { selfDestruct(); Chat.sendPrivateMessageToSelfFatal("BB: Self remove activated. Stopping in 10 seconds."); if (!packet.parameters[0].isEmpty()) Chat.sendPrivateMessageToSelfFatal("Reason: " + packet.parameters[0]); - playsound(SoundEvents.BLOCK_ANVIL_DESTROY); + EnvironmentCore.mcUtils.playsound("block.anvil.destroy"); for (int i = 0; i < 10; i++) { int finalI = i; BBsentials.executionService.schedule(() -> Chat.sendPrivateMessageToSelfFatal("BB: Time till crash: " + finalI), i, TimeUnit.SECONDS); @@ -432,7 +431,7 @@ public class BBsentialConnection { selfDestruct(); Chat.sendPrivateMessageToSelfFatal("BB: Self remove activated! Becomes effective on next launch"); if (!packet.parameters[0].isEmpty()) Chat.sendPrivateMessageToSelfFatal("Reason: " + packet.parameters[0]); - playsound(SoundEvents.BLOCK_ANVIL_DESTROY); + EnvironmentCore.mcUtils.playsound("block.anvil.destroy"); } else if (packet.command.equals(InternalCommandPacket.HUB)) { BBsentials.config.sender.addImmediateSendTask("/hub"); @@ -450,7 +449,7 @@ public class BBsentialConnection { Chat.sendPrivateMessageToSelfFatal("BB: Stopping in 10 seconds."); if (!packet.parameters[0].isEmpty()) Chat.sendPrivateMessageToSelfFatal("Reason: " + packet.parameters[0]); Thread crashThread = new Thread(() -> { - playsound(SoundEvents.BLOCK_ANVIL_DESTROY); + EnvironmentCore.mcUtils.playsound("block.anvil.destroy"); for (int i = 10; i >= 0; i--) { Chat.sendPrivateMessageToSelfFatal("BB: Time till crash: " + i); try { @@ -489,7 +488,7 @@ public class BBsentialConnection { Chat.sendPrivateMessageToSelfInfo(packet.message); } if (packet.ping) { - playsound(SoundEvents.ENTITY_WARDEN_DIG); + EnvironmentCore.mcUtils.playsound("block.anvil.destroy"); } } diff --git a/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/EnumUtils.java b/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/EnumUtils.java index 173d299..5214f65 100644 --- a/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/EnumUtils.java +++ b/common/src/main/java/de/hype/bbsentials/common/constants/enviromentShared/EnumUtils.java @@ -143,6 +143,14 @@ public class EnumUtils { return null; // Enum value not found } } + public static <T extends Enum<T> & BBDisplayNameProvider, U extends Enum<U>> U getEnumByName(Class<T> enumClass, Class<U> enumType, String enumName) { + try { + return Enum.valueOf(enumType, enumName); + } catch (IllegalArgumentException e) { + return null; // Enum value not found + } + } + public static <T extends Enum<T> & BBDisplayNameProvider> T getEnumByValue(Class<T> enumClass, String value) { for (T enumValue : enumClass.getEnumConstants()) { diff --git a/common/src/main/java/de/hype/bbsentials/common/mclibraries/Chat.java b/common/src/main/java/de/hype/bbsentials/common/mclibraries/Chat.java deleted file mode 100644 index 1c62c87..0000000 --- a/common/src/main/java/de/hype/bbsentials/common/mclibraries/Chat.java +++ /dev/null @@ -1,5 +0,0 @@ -package de.hype.bbsentials.common.mclibraries; - -public interface Chat { - void init(); -} diff --git a/common/src/main/java/de/hype/bbsentials/common/mclibraries/EnvironmentCore.java b/common/src/main/java/de/hype/bbsentials/common/mclibraries/EnvironmentCore.java index 53f7c2b..f7e2eab 100644 --- a/common/src/main/java/de/hype/bbsentials/common/mclibraries/EnvironmentCore.java +++ b/common/src/main/java/de/hype/bbsentials/common/mclibraries/EnvironmentCore.java @@ -1,13 +1,22 @@ package de.hype.bbsentials.common.mclibraries; + +import de.hype.bbsentials.common.client.DebugThread; + public class EnvironmentCore { + public static MCCommand commands; public static BBUtils utils; - public static Chat chat; + public static MCChat chat; public static MCUtils mcUtils; + public static Options mcoptions; + public static DebugThread debug; - public EnvironmentCore(BBUtils utils, Chat chat, MCUtils mcUtils) { + public EnvironmentCore(BBUtils utils, MCChat chat, MCUtils mcUtils, MCCommand commands, Options options, DebugThread debug) { EnvironmentCore.utils = utils; EnvironmentCore.chat = chat; EnvironmentCore.mcUtils = mcUtils; + EnvironmentCore.commands = commands; + EnvironmentCore.mcoptions = options; + EnvironmentCore.debug=debug; } } diff --git a/common/src/main/java/de/hype/bbsentials/common/mclibraries/MCChat.java b/common/src/main/java/de/hype/bbsentials/common/mclibraries/MCChat.java new file mode 100644 index 0000000..eeb89fe --- /dev/null +++ b/common/src/main/java/de/hype/bbsentials/common/mclibraries/MCChat.java @@ -0,0 +1,9 @@ +package de.hype.bbsentials.common.mclibraries; + +import de.hype.bbsentials.common.chat.Message; + +public interface MCChat { + void init(); + void sendChatMessage(String message); + void sendClientSideMessage(Message message); +} diff --git a/common/src/main/java/de/hype/bbsentials/common/mclibraries/MCCommand.java b/common/src/main/java/de/hype/bbsentials/common/mclibraries/MCCommand.java new file mode 100644 index 0000000..133cff0 --- /dev/null +++ b/common/src/main/java/de/hype/bbsentials/common/mclibraries/MCCommand.java @@ -0,0 +1,6 @@ +package de.hype.bbsentials.common.mclibraries; + +public interface MCCommand { + public void registerMain(); + public void registerRoleRequired(boolean hasDev, boolean hasAdmin, boolean hasMod, boolean hasSplasher, boolean hasBeta, boolean hasMiningEvents, boolean hasChChest); +} diff --git a/common/src/main/java/de/hype/bbsentials/common/mclibraries/MCUtils.java b/common/src/main/java/de/hype/bbsentials/common/mclibraries/MCUtils.java index d86f7d8..493785a 100644 --- a/common/src/main/java/de/hype/bbsentials/common/mclibraries/MCUtils.java +++ b/common/src/main/java/de/hype/bbsentials/common/mclibraries/MCUtils.java @@ -1,7 +1,5 @@ package de.hype.bbsentials.common.mclibraries; -import de.hype.bbsentials.common.chat.Message; - import java.io.File; public interface MCUtils { @@ -12,12 +10,7 @@ public interface MCUtils { String getUsername(); String getMCUUID(); - - void sendChatMessage(String message); - void playsound(String eventName); - void sendClientSideMessage(Message message); - int getPotTime(); } |