diff options
author | HacktheTime <l4bg0jb7@duck.com> | 2023-09-22 21:47:32 +0200 |
---|---|---|
committer | HacktheTime <l4bg0jb7@duck.com> | 2023-09-22 21:47:32 +0200 |
commit | 9d673ac2a30da174b17978b78a1af49a915df677 (patch) | |
tree | 3b4e7dccfd07ea5e09efd17af557c499a153c77e /src/main/java/de/hype/bbsentials/client/SplashManager.java | |
parent | 851724c65a6553b53be0582c4411dd173829df69 (diff) | |
download | BBsentials-9d673ac2a30da174b17978b78a1af49a915df677.tar.gz BBsentials-9d673ac2a30da174b17978b78a1af49a915df677.tar.bz2 BBsentials-9d673ac2a30da174b17978b78a1af49a915df677.zip |
added the System hiding already known full splashes.
bug fixes
Diffstat (limited to 'src/main/java/de/hype/bbsentials/client/SplashManager.java')
-rw-r--r-- | src/main/java/de/hype/bbsentials/client/SplashManager.java | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/main/java/de/hype/bbsentials/client/SplashManager.java b/src/main/java/de/hype/bbsentials/client/SplashManager.java new file mode 100644 index 0000000..8077c4c --- /dev/null +++ b/src/main/java/de/hype/bbsentials/client/SplashManager.java @@ -0,0 +1,58 @@ +package de.hype.bbsentials.client; + +import de.hype.bbsentials.chat.Chat; +import de.hype.bbsentials.constants.enviromentShared.Islands; +import de.hype.bbsentials.packets.packets.SplashNotifyPacket; +import de.hype.bbsentials.packets.packets.SplashUpdatePacket; + +import java.util.HashMap; +import java.util.Map; + +public class SplashManager { + public static Map<Integer, DisplaySplash> splashPool = new HashMap<>(); + + public SplashManager() { + + } + + public static void addSplash(SplashNotifyPacket packet) { + splashPool.put(packet.splashId, new DisplaySplash(packet)); + } + + public static void updateSplash(SplashUpdatePacket packet) { + DisplaySplash splash = splashPool.get(packet.splashId); + if (splash != null) { + if (splash.alreadyDisplayed) { + if (BBsentials.config.showSplashStatusUpdates) { + Chat.sendPrivateMessageToSelf(splash.hubType.getDisplayName() + " #" + splash.hub + " is " + packet.status); + } + } + else { + splashPool.remove(splash.splashId); + } + } + } + + public static void display(int splashId) { + SplashNotifyPacket splash = splashPool.get(splashId); + if (splash == null) return; + String where; + if (splash.hubType.equals(Islands.DUNGEON_HUB)) { + where = "§5DUNGEON HUB§6"; + } + else { + where = "Hub"; + } + BBsentials.bbserver.splashHighlightItem("HUB #" + splash.hub, 20); + Chat.sendPrivateMessageToSelf("§6" + splash.splasherUsername + " is Splashing in " + where + " #" + splash.hub + " at " + splash.location + ":" + splash.extraMessage); + } + + private static class DisplaySplash extends SplashNotifyPacket { + public boolean alreadyDisplayed; + + public DisplaySplash(SplashNotifyPacket packet) { + super(packet.splashId, packet.hub, packet.splasherUsername, packet.location, packet.hubType, packet.extraMessage, packet.lessWaste); + alreadyDisplayed = false; + } + } +} |