aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/de/hype/bbsentials/client/BBsentialsConfigScreemFactory.java9
-rw-r--r--src/main/java/de/hype/bbsentials/client/Config.java1
-rw-r--r--src/main/java/de/hype/bbsentials/client/SplashManager.java58
-rw-r--r--src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java18
4 files changed, 70 insertions, 16 deletions
diff --git a/src/main/java/de/hype/bbsentials/client/BBsentialsConfigScreemFactory.java b/src/main/java/de/hype/bbsentials/client/BBsentialsConfigScreemFactory.java
index 555c42d..39da980 100644
--- a/src/main/java/de/hype/bbsentials/client/BBsentialsConfigScreemFactory.java
+++ b/src/main/java/de/hype/bbsentials/client/BBsentialsConfigScreemFactory.java
@@ -70,6 +70,11 @@ public class BBsentialsConfigScreemFactory {
.setTooltip(Text.of("Select if you want the Bingo Chat to be show"))
.setSaveConsumer(newValue -> config.showBingoChat = newValue)
.build());
+ visual.addEntry(entryBuilder.startBooleanToggle(Text.of("Show Splash Status Updates"), config.showSplashStatusUpdates)
+ .setDefaultValue(true)
+ .setTooltip(Text.of("Select if you want to see Splash Staus updates. Keep in mind that this will only send you status updates for the Splashes which you were shown.\nThose hidden due too too high Splash Time will still remain invisible"))
+ .setSaveConsumer(newValue -> config.showSplashStatusUpdates = newValue)
+ .build());
//Notifications
ConfigCategory notifications = builder.getOrCreateCategory(Text.of("Notifications"));
notifications.addEntry(entryBuilder.startBooleanToggle(Text.of("Do Desktop Notifications"), config.doDesktopNotifications)
@@ -242,9 +247,9 @@ public class BBsentialsConfigScreemFactory {
}
if (config.hasBBRoles("splasher")){
ConfigCategory dev = builder.getOrCreateCategory(Text.of("§dSplashes"));
- dev.addEntry(entryBuilder.startBooleanToggle(Text.of("Dev Mode"), config.devMode)
+ dev.addEntry(entryBuilder.startBooleanToggle(Text.of("Auto Update Statuses"), config.autoSplashStatusUpdates)
.setDefaultValue(true)
- .setTooltip(Text.of("Auto Update Statuses"))
+ .setTooltip(Text.of("Automatically updates the Status of the Splash by sending packets to the Server"))
.setSaveConsumer(newValue -> config.autoSplashStatusUpdates = newValue)
.build());
}
diff --git a/src/main/java/de/hype/bbsentials/client/Config.java b/src/main/java/de/hype/bbsentials/client/Config.java
index 31e794c..f0d4dcf 100644
--- a/src/main/java/de/hype/bbsentials/client/Config.java
+++ b/src/main/java/de/hype/bbsentials/client/Config.java
@@ -38,6 +38,7 @@ public class Config implements Serializable {
public boolean showBingoChat = true;
public boolean allowBBinviteMe = true;
public boolean doDesktopNotifications = false;
+ public boolean showSplashStatusUpdates = true;
public boolean acceptReparty;
public boolean autoSplashStatusUpdates;
public String nickname;
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;
+ }
+ }
+}
diff --git a/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java b/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java
index d458724..53e534c 100644
--- a/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java
+++ b/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java
@@ -2,6 +2,7 @@ package de.hype.bbsentials.communication;
import de.hype.bbsentials.chat.Chat;
import de.hype.bbsentials.client.BBsentials;
+import de.hype.bbsentials.client.SplashManager;
import de.hype.bbsentials.client.SplashStatusUpdateListener;
import de.hype.bbsentials.constants.enviromentShared.*;
import de.hype.bbsentials.packets.AbstractPacket;
@@ -352,27 +353,16 @@ public class BBsentialConnection {
executionService.submit(splashStatusUpdateListener);
}
else {
+ SplashManager.addSplash(packet);
if (packet.lessWaste) {
waitTime = Math.min(((getPotTime() * 1000) / 80), 25 * 1000);
}
else {
waitTime = 0;
}
- String where;
- if (packet.hubType.equals(Islands.DUNGEON_HUB)) {
- where = "§5DUNGEON HUB§6";
- }
- else {
- where = "Hub";
- }
BBsentials.executionService.schedule(() -> {
- splashHighlightItem("HUB #" + packet.hub, 20);
- String timeLoss = "";
- if (packet.lessWaste) {
- timeLoss = "§c(" + waitTime + ")";
- }
- Chat.sendPrivateMessageToSelf("§6" + packet.splasherUsername + " is Splashing in " + where + " #" + packet.hub + " at " + packet.location + ":" + packet.extraMessage + " | " + timeLoss);
- }, waitTime, TimeUnit.MILLISECONDS);
+ SplashManager.display(packet.splashId);
+ }, waitTime, TimeUnit.MILLISECONDS);
}
}