Skip to content
This repository was archived by the owner on Dec 12, 2025. It is now read-only.

Commit 9d673ac

Browse files
committed
added the System hiding already known full splashes.
bug fixes
1 parent 851724c commit 9d673ac

File tree

4 files changed

+70
-16
lines changed

4 files changed

+70
-16
lines changed

src/main/java/de/hype/bbsentials/client/BBsentialsConfigScreemFactory.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ public static Screen create(Screen parent) {
7070
.setTooltip(Text.of("Select if you want the Bingo Chat to be show"))
7171
.setSaveConsumer(newValue -> config.showBingoChat = newValue)
7272
.build());
73+
visual.addEntry(entryBuilder.startBooleanToggle(Text.of("Show Splash Status Updates"), config.showSplashStatusUpdates)
74+
.setDefaultValue(true)
75+
.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"))
76+
.setSaveConsumer(newValue -> config.showSplashStatusUpdates = newValue)
77+
.build());
7378
//Notifications
7479
ConfigCategory notifications = builder.getOrCreateCategory(Text.of("Notifications"));
7580
notifications.addEntry(entryBuilder.startBooleanToggle(Text.of("Do Desktop Notifications"), config.doDesktopNotifications)
@@ -242,9 +247,9 @@ public static Screen create(Screen parent) {
242247
}
243248
if (config.hasBBRoles("splasher")){
244249
ConfigCategory dev = builder.getOrCreateCategory(Text.of("§dSplashes"));
245-
dev.addEntry(entryBuilder.startBooleanToggle(Text.of("Dev Mode"), config.devMode)
250+
dev.addEntry(entryBuilder.startBooleanToggle(Text.of("Auto Update Statuses"), config.autoSplashStatusUpdates)
246251
.setDefaultValue(true)
247-
.setTooltip(Text.of("Auto Update Statuses"))
252+
.setTooltip(Text.of("Automatically updates the Status of the Splash by sending packets to the Server"))
248253
.setSaveConsumer(newValue -> config.autoSplashStatusUpdates = newValue)
249254
.build());
250255
}

src/main/java/de/hype/bbsentials/client/Config.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public class Config implements Serializable {
3838
public boolean showBingoChat = true;
3939
public boolean allowBBinviteMe = true;
4040
public boolean doDesktopNotifications = false;
41+
public boolean showSplashStatusUpdates = true;
4142
public boolean acceptReparty;
4243
public boolean autoSplashStatusUpdates;
4344
public String nickname;
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
package de.hype.bbsentials.client;
2+
3+
import de.hype.bbsentials.chat.Chat;
4+
import de.hype.bbsentials.constants.enviromentShared.Islands;
5+
import de.hype.bbsentials.packets.packets.SplashNotifyPacket;
6+
import de.hype.bbsentials.packets.packets.SplashUpdatePacket;
7+
8+
import java.util.HashMap;
9+
import java.util.Map;
10+
11+
public class SplashManager {
12+
public static Map<Integer, DisplaySplash> splashPool = new HashMap<>();
13+
14+
public SplashManager() {
15+
16+
}
17+
18+
public static void addSplash(SplashNotifyPacket packet) {
19+
splashPool.put(packet.splashId, new DisplaySplash(packet));
20+
}
21+
22+
public static void updateSplash(SplashUpdatePacket packet) {
23+
DisplaySplash splash = splashPool.get(packet.splashId);
24+
if (splash != null) {
25+
if (splash.alreadyDisplayed) {
26+
if (BBsentials.config.showSplashStatusUpdates) {
27+
Chat.sendPrivateMessageToSelf(splash.hubType.getDisplayName() + " #" + splash.hub + " is " + packet.status);
28+
}
29+
}
30+
else {
31+
splashPool.remove(splash.splashId);
32+
}
33+
}
34+
}
35+
36+
public static void display(int splashId) {
37+
SplashNotifyPacket splash = splashPool.get(splashId);
38+
if (splash == null) return;
39+
String where;
40+
if (splash.hubType.equals(Islands.DUNGEON_HUB)) {
41+
where = "§5DUNGEON HUB§6";
42+
}
43+
else {
44+
where = "Hub";
45+
}
46+
BBsentials.bbserver.splashHighlightItem("HUB #" + splash.hub, 20);
47+
Chat.sendPrivateMessageToSelf("§6" + splash.splasherUsername + " is Splashing in " + where + " #" + splash.hub + " at " + splash.location + ":" + splash.extraMessage);
48+
}
49+
50+
private static class DisplaySplash extends SplashNotifyPacket {
51+
public boolean alreadyDisplayed;
52+
53+
public DisplaySplash(SplashNotifyPacket packet) {
54+
super(packet.splashId, packet.hub, packet.splasherUsername, packet.location, packet.hubType, packet.extraMessage, packet.lessWaste);
55+
alreadyDisplayed = false;
56+
}
57+
}
58+
}

src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import de.hype.bbsentials.chat.Chat;
44
import de.hype.bbsentials.client.BBsentials;
5+
import de.hype.bbsentials.client.SplashManager;
56
import de.hype.bbsentials.client.SplashStatusUpdateListener;
67
import de.hype.bbsentials.constants.enviromentShared.*;
78
import de.hype.bbsentials.packets.AbstractPacket;
@@ -352,27 +353,16 @@ public void onSplashNotifyPacket(SplashNotifyPacket packet) {
352353
executionService.submit(splashStatusUpdateListener);
353354
}
354355
else {
356+
SplashManager.addSplash(packet);
355357
if (packet.lessWaste) {
356358
waitTime = Math.min(((getPotTime() * 1000) / 80), 25 * 1000);
357359
}
358360
else {
359361
waitTime = 0;
360362
}
361-
String where;
362-
if (packet.hubType.equals(Islands.DUNGEON_HUB)) {
363-
where = "§5DUNGEON HUB§6";
364-
}
365-
else {
366-
where = "Hub";
367-
}
368363
BBsentials.executionService.schedule(() -> {
369-
splashHighlightItem("HUB #" + packet.hub, 20);
370-
String timeLoss = "";
371-
if (packet.lessWaste) {
372-
timeLoss = "§c(" + waitTime + ")";
373-
}
374-
Chat.sendPrivateMessageToSelf("§6" + packet.splasherUsername + " is Splashing in " + where + " #" + packet.hub + " at " + packet.location + ":" + packet.extraMessage + " | " + timeLoss);
375-
}, waitTime, TimeUnit.MILLISECONDS);
364+
SplashManager.display(packet.splashId);
365+
}, waitTime, TimeUnit.MILLISECONDS);
376366
}
377367
}
378368

0 commit comments

Comments
 (0)