diff options
author | HacktheTime <l4bg0jb7@duck.com> | 2023-12-15 19:06:11 +0100 |
---|---|---|
committer | HacktheTime <l4bg0jb7@duck.com> | 2023-12-15 19:06:11 +0100 |
commit | 2a22b024361e195819337b736e57a68742029a5a (patch) | |
tree | 2c37c7f89f6f4ccbc3dc8ec80765451ea235c36f | |
parent | 595bb1aca851f8ab4eb216fadbd0e15f7831e4f5 (diff) | |
download | BBsentials-2a22b024361e195819337b736e57a68742029a5a.tar.gz BBsentials-2a22b024361e195819337b736e57a68742029a5a.tar.bz2 BBsentials-2a22b024361e195819337b736e57a68742029a5a.zip |
added toggles for the Splash Overlay.
5 files changed, 57 insertions, 31 deletions
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 5f7fb29..5b4f4a3 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 @@ -15,14 +15,14 @@ public class Config implements Serializable { public static int apiVersion = 1; public static List<String> partyMembers = new ArrayList<>(); public transient final Sender sender = new Sender(); + public boolean devMode = false; + public boolean detailedDevMode = false; // Gson object for serialization private final transient Gson GSON = new GsonBuilder().setPrettyPrinting().create(); // File object for storing the config private final transient File CONFIG_FILE = new File(EnvironmentCore.mcUtils.getConfigPath(), "BBsential_settings.json"); //You can change again public boolean allowServerPartyInvite = true; - public boolean devMode = false; - public boolean detailedDevMode = false; public boolean devSecurity = true; public transient String overwriteActionBar = ""; public transient String alreadyReported = ""; @@ -46,6 +46,8 @@ public class Config implements Serializable { public boolean allowBBinviteMe = true; public boolean doDesktopNotifications = false; public boolean showSplashStatusUpdates = true; + public boolean useSplashLeecherOverlayHud = true; + public boolean showMusicPants = true; public boolean doGammaOverride = true; public boolean acceptReparty; public boolean autoSplashStatusUpdates; @@ -58,6 +60,7 @@ public class Config implements Serializable { // set automatically private transient boolean isPartyLeader; private transient String username; + // Constructor public Config() { setDefaults(); 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 f214629..7f96681 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 @@ -24,6 +24,7 @@ public class SplashStatusUpdateListener implements Runnable { } public boolean showSplashOverlay() { + if (!BBsentials.config.useSplashLeecherOverlayHud) return false; return splashLobby.get() || showSplashOverlayOverrideDisplay; } diff --git a/fabric/src/main/java/de/hype/bbsentials/fabric/BBsentialsConfigScreemFactory.java b/fabric/src/main/java/de/hype/bbsentials/fabric/BBsentialsConfigScreemFactory.java index 3154377..4579c69 100644 --- a/fabric/src/main/java/de/hype/bbsentials/fabric/BBsentialsConfigScreemFactory.java +++ b/fabric/src/main/java/de/hype/bbsentials/fabric/BBsentialsConfigScreemFactory.java @@ -322,12 +322,27 @@ public class BBsentialsConfigScreemFactory { .build()); } if (BBsentials.config.hasBBRoles("splasher")) { - ConfigCategory dev = builder.getOrCreateCategory(Text.of("§dSplashes")); - dev.addEntry(entryBuilder.startBooleanToggle(Text.of("Auto Update Statuses"), BBsentials.config.autoSplashStatusUpdates) + ConfigCategory splasher = builder.getOrCreateCategory(Text.of("§dSplashes")); + BooleanListEntry updateSplashStatus = entryBuilder.startBooleanToggle(Text.of("Auto Update Statuses"), BBsentials.config.autoSplashStatusUpdates) .setDefaultValue(true) .setTooltip(Text.of("Automatically updates the Status of the Splash by sending packets to the Server")) .setSaveConsumer(newValue -> BBsentials.config.autoSplashStatusUpdates = newValue) - .build()); + .build(); + splasher.addEntry(updateSplashStatus); + BooleanListEntry showLeecherHud = entryBuilder.startBooleanToggle(Text.of("Do not show Splash Leecher Overlay"), BBsentials.config.autoSplashStatusUpdates) + .setDefaultValue(true) + .setTooltip(Text.of("Optional disabler for the Splash Leecher Overlay. Is normally automatically enabled when you announce a splash.\nAutomatically gets disabled when its marked done.")) + .setSaveConsumer(newValue -> BBsentials.config.autoSplashStatusUpdates = newValue) + .setRequirement(updateSplashStatus::getValue) + .build(); + splasher.addEntry(showLeecherHud); + entryBuilder.startBooleanToggle(Text.of("Show Music Pants Users"), BBsentials.config.autoSplashStatusUpdates) + .setDefaultValue(true) + .setTooltip(Text.of("Displays a small red note in front of the username if they wear music pants. Displays everybody with it not just non Bingos")) + .setRequirement(showLeecherHud::getValue) + .setSaveConsumer(newValue -> BBsentials.config.autoSplashStatusUpdates = newValue) + .build(); + } return builder.build(); } diff --git a/fabric/src/main/java/de/hype/bbsentials/fabric/MCUtils.java b/fabric/src/main/java/de/hype/bbsentials/fabric/MCUtils.java index 2b2b229..c45a468 100644 --- a/fabric/src/main/java/de/hype/bbsentials/fabric/MCUtils.java +++ b/fabric/src/main/java/de/hype/bbsentials/fabric/MCUtils.java @@ -142,22 +142,26 @@ public class MCUtils implements de.hype.bbsentials.common.mclibraries.MCUtils { List<PlayerEntity> musicPants = new ArrayList<>(); List<Text> toDisplay = new ArrayList<>(); toDisplay.add(Text.of("§6Total: " + allParticipiants.size() + " | Bingos: " + (allParticipiants.size() - splashLeechers.size()) + " | Leechers: " + splashLeechers.size())); + boolean doPants = BBsentials.config.showMusicPants; for (PlayerEntity participiant : allParticipiants) { - boolean hasPants = false; - for (ItemStack armorItem : participiant.getArmorItems()) { - try { - if (armorItem.getNbt().get("ExtraAttributes").asString().contains("MUSIC_PANTS")) { - musicPants.add(participiant); - hasPants = true; + if (doPants) { + + boolean hasPants = false; + for (ItemStack armorItem : participiant.getArmorItems()) { + try { + if (armorItem.getNbt().get("ExtraAttributes").asString().contains("MUSIC_PANTS")) { + musicPants.add(participiant); + hasPants = true; + } + } catch (Exception ignored) { + continue; } - } catch (Exception ignored) { - continue; } - } - if (hasPants) { - String pantsAddition = Text.Serializer.toJson(Text.of("§4[♪]§ ")); - String normal = Text.Serializer.toJson(participiant.getDisplayName()); - toDisplay.add(Text.Serializer.fromJson("[" + pantsAddition + "," + normal + "]")); + if (hasPants) { + String pantsAddition = Text.Serializer.toJson(Text.of("§4[♪]§ ")); + String normal = Text.Serializer.toJson(participiant.getDisplayName()); + toDisplay.add(Text.Serializer.fromJson("[" + pantsAddition + "," + normal + "]")); + } } } toDisplay.addAll(splashLeechers.stream().map(PlayerEntity::getDisplayName).toList()); diff --git a/forge/src/main/java/de/hype/bbsentials/forge/MCUtils.java b/forge/src/main/java/de/hype/bbsentials/forge/MCUtils.java index 66e92b6..6376cb5 100644 --- a/forge/src/main/java/de/hype/bbsentials/forge/MCUtils.java +++ b/forge/src/main/java/de/hype/bbsentials/forge/MCUtils.java @@ -132,22 +132,25 @@ public class MCUtils implements de.hype.bbsentials.common.mclibraries.MCUtils { List<IChatComponent> toDisplay = new ArrayList<>(); toDisplay.add(new ChatComponentText("§6Total: " + allParticipants.size() + " | Bingos: " + (allParticipants.size() - splashLeechers.size()) + " | Leechers: " + splashLeechers.size())); + boolean doPants = BBsentials.config.showMusicPants; for (EntityPlayer participant : allParticipants) { - boolean hasPants = false; - for (ItemStack armorItem : participant.inventory.armorInventory) { - try { - if (armorItem.getTagCompound().getCompoundTag("ExtraAttributes").getString("display").contains("MUSIC_PANTS")) { - musicPants.add(participant); - hasPants = true; + if (doPants) { + boolean hasPants = false; + for (ItemStack armorItem : participant.inventory.armorInventory) { + try { + if (armorItem.getTagCompound().getCompoundTag("ExtraAttributes").getString("display").contains("MUSIC_PANTS")) { + musicPants.add(participant); + hasPants = true; + } + } catch (Exception ignored) { + continue; } - } catch (Exception ignored) { - continue; } - } - if (hasPants) { - String pantsAddition = IChatComponent.Serializer.componentToJson(new ChatComponentText("§4[♪]§ ")); - String normal = IChatComponent.Serializer.componentToJson(participant.getDisplayName()); - toDisplay.add(IChatComponent.Serializer.jsonToComponent("[" + pantsAddition + "," + normal + "]")); + if (hasPants) { + String pantsAddition = IChatComponent.Serializer.componentToJson(new ChatComponentText("§4[♪]§ ")); + String normal = IChatComponent.Serializer.componentToJson(participant.getDisplayName()); + toDisplay.add(IChatComponent.Serializer.jsonToComponent("[" + pantsAddition + "," + normal + "]")); + } } } toDisplay.addAll(splashLeechers.stream().map(EntityPlayer::getDisplayName).collect(Collectors.toList())); |