From 208ee28028e4a772a573a75f2aef6780304b3f53 Mon Sep 17 00:00:00 2001 From: HacktheTime Date: Sun, 5 Nov 2023 10:04:20 +0100 Subject: bug fixes --- .../java/de/hype/bbsentials/common/chat/Chat.java | 21 ++++++++++++--------- .../bbsentials/common/client/SplashManager.java | 4 ---- .../common/communication/BBsentialConnection.java | 13 ++++--------- 3 files changed, 16 insertions(+), 22 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 7cab353..517a93f 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 @@ -122,31 +122,31 @@ public class Chat { } public static void sendPrivateMessageToSelfError(String message) { - sendPrivateMessageToSelfBase(Formatting.RED + message); + sendPrivateMessageToSelfBase(message, Formatting.RED); } public static void sendPrivateMessageToSelfFatal(String message) { - sendPrivateMessageToSelfBase(Formatting.DARK_RED + message); + sendPrivateMessageToSelfBase(message, Formatting.DARK_RED); } public static void sendPrivateMessageToSelfSuccess(String message) { - sendPrivateMessageToSelfBase(Formatting.GREEN + message); + sendPrivateMessageToSelfBase(message, Formatting.GREEN); } public static void sendPrivateMessageToSelfInfo(String message) { - sendPrivateMessageToSelfBase(Formatting.YELLOW + message); + sendPrivateMessageToSelfBase(message, Formatting.YELLOW); } public static void sendPrivateMessageToSelfImportantInfo(String message) { - sendPrivateMessageToSelfBase(Formatting.GOLD + message); + sendPrivateMessageToSelfBase(message, Formatting.GOLD); } public static void sendPrivateMessageToSelfDebug(String message) { - sendPrivateMessageToSelfBase(Formatting.AQUA + message); + sendPrivateMessageToSelfBase(message, Formatting.AQUA); } - private static void sendPrivateMessageToSelfBase(String message) { - EnvironmentCore.chat.sendClientSideMessage(Message.of(message), false); + private static void sendPrivateMessageToSelfBase(String message, Formatting formatting) { + EnvironmentCore.chat.sendClientSideMessage(Message.of(formatting.toString() + message.replace("§r", "§r" + formatting.toString())), false); } public static void sendPrivateMessageToSelfText(Message message) { @@ -205,7 +205,7 @@ public class Chat { return null; } if (message.isFromReportedUser()) { - sendPrivateMessageToSelfBase(Formatting.RED + "B: " + message.getUnformattedString()); + sendPrivateMessageToSelfBase("B: " + message.getUnformattedString(), Formatting.RED); return null; } if (BBsentials.config.doPartyChatCustomMenu && message.isFromParty()) { @@ -326,6 +326,9 @@ public class Chat { else if (messageUnformatted.equals("Click here to purchase a new 6 hour pass for 10,000 Coins")) { setChatCommand("/purchasecrystallhollowspass", 30); } + else if (messageUnformatted.startsWith("FEAR. A Primal Fear")) { + sendNotification("BB: Primal Fear", messageUnformatted); + } } else if (message.isFromGuild()) { diff --git a/common/src/main/java/de/hype/bbsentials/common/client/SplashManager.java b/common/src/main/java/de/hype/bbsentials/common/client/SplashManager.java index 5d7d464..f89608a 100644 --- a/common/src/main/java/de/hype/bbsentials/common/client/SplashManager.java +++ b/common/src/main/java/de/hype/bbsentials/common/client/SplashManager.java @@ -11,10 +11,6 @@ import java.util.Map; public class SplashManager { public static Map splashPool = new HashMap<>(); - public SplashManager() { - - } - public static void addSplash(SplashNotifyPacket packet) { splashPool.put(packet.splashId, new DisplaySplash(packet)); } 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 f5d83a7..7d593f9 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 @@ -149,12 +149,7 @@ public class BBsentialConnection { onMessageReceived(message); } else { - Chat.sendPrivateMessageToSelfError("BB: It seemed like you disconnected. Reconnecting..."); - BBsentials.connectToBBserver(); - try { - Thread.sleep(1000 * 10); - } catch (Exception ignored) { - } + Chat.sendPrivateMessageToSelfError("BB: It seemed like you disconnected."); } } } catch (IOException e) { @@ -288,7 +283,7 @@ public class BBsentialConnection { public void onBingoChatMessagePacket(BingoChatMessagePacket packet) { if (BBsentials.config.showBingoChat) { - Chat.sendPrivateMessageToSelfInfo("[" + packet.prefix + "] " + packet.username + ": " + packet.message); + Chat.sendPrivateMessageToSelfInfo("[" + packet.prefix + "§r] " + packet.username + ": " + packet.message); } } @@ -352,7 +347,7 @@ public class BBsentialConnection { return; } } - Chat.sendPrivateMessageToSelfImportantInfo(packet.username + "There is a " + packet.event.getDisplayName() + "in the " + packet.island.getDisplayName() + " now/soon."); + Chat.sendPrivateMessageToSelfImportantInfo(packet.username + ": There is a " + packet.event.getDisplayName() + " in the " + packet.island.getDisplayName() + " now/soon."); } } @@ -371,7 +366,7 @@ public class BBsentialConnection { public void onDisconnectPacket(DisconnectPacket packet) { Chat.sendPrivateMessageToSelfError(packet.displayMessage); - BBsentials.connection = null; + BBsentials.connection.close(); for (int i = 0; i < packet.waitBeforeReconnect.length; i++) { int finalI = i; BBsentials.executionService.schedule(() -> { -- cgit