diff options
| author | HacktheTime <l4bg0jb7@duck.com> | 2023-10-12 20:17:28 +0200 |
|---|---|---|
| committer | HacktheTime <l4bg0jb7@duck.com> | 2023-10-12 20:17:28 +0200 |
| commit | dba4a297e295d68980da31264b0069fe9b18a13e (patch) | |
| tree | c7e0a99968ef34509037f969ab7b1beba04a996d /src/main/java/de/hype/bbsentials/client | |
| parent | e111619d66346a2309b86a00420681f4cddf3cea (diff) | |
| download | BBsentials-dba4a297e295d68980da31264b0069fe9b18a13e.tar.gz BBsentials-dba4a297e295d68980da31264b0069fe9b18a13e.tar.bz2 BBsentials-dba4a297e295d68980da31264b0069fe9b18a13e.zip | |
preperations to have a common code and different implementations for forge and fabric to ease up maintaining both versions
Diffstat (limited to 'src/main/java/de/hype/bbsentials/client')
11 files changed, 0 insertions, 1518 deletions
diff --git a/src/main/java/de/hype/bbsentials/client/BBUtils.java b/src/main/java/de/hype/bbsentials/client/BBUtils.java deleted file mode 100644 index 1b35fa6..0000000 --- a/src/main/java/de/hype/bbsentials/client/BBUtils.java +++ /dev/null @@ -1,66 +0,0 @@ -package de.hype.bbsentials.client; - -import com.google.common.collect.Lists; -import de.hype.bbsentials.chat.Chat; -import de.hype.bbsentials.constants.enviromentShared.Islands; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.network.PlayerListEntry; - -import java.util.Iterator; -import java.util.List; - -public class BBUtils { - public static Islands getCurrentIsland() { - try { - String string = MinecraftClient.getInstance().player.networkHandler.getPlayerListEntry("!C-b").getDisplayName().getString(); - if (!string.startsWith("Area: ")) { - Chat.sendPrivateMessageToSelfError("Could not get Area data. Are you in Skyblock?"); - } - else { - return Islands.getByDisplayName(string.replace("Area: ", "").trim()); - } - } catch (Exception e) { - } - return null; - } - - public static int getPlayerCount() { - return Integer.parseInt(MinecraftClient.getInstance().player.networkHandler.getPlayerListEntry("!B-a").getDisplayName().getString().trim().replaceAll("[^0-9]", "")); - } - - public static String getServer() { - return MinecraftClient.getInstance().player.networkHandler.getPlayerListEntry("!C-c").getDisplayName().getString().replace("Server:", "").trim(); - } - - public static boolean isOnMegaServer() { - return getServer().toLowerCase().startsWith("mega"); - } - - public static boolean isOnMiniServer() { - return getServer().toLowerCase().startsWith("mini"); - } - - public static int getMaximumPlayerCount() { - boolean mega = isOnMegaServer(); - Islands island = getCurrentIsland(); - if (island == null) return 100; - if (island.equals(Islands.HUB)) { - if (mega) return 80; - else return 24; - } - return 24; - } - - public List<String> getPlayers() { - List<String> list = Lists.newArrayList(); - Iterator var2 = MinecraftClient.getInstance().getNetworkHandler().getPlayerList().iterator(); - while (var2.hasNext()) { - PlayerListEntry playerListEntry = (PlayerListEntry) var2.next(); - String playerName = playerListEntry.getProfile().getName(); - if (!playerName.startsWith("!")) { - list.add(playerName); - } - } - return list; - } -} diff --git a/src/main/java/de/hype/bbsentials/client/BBsentials.java b/src/main/java/de/hype/bbsentials/client/BBsentials.java deleted file mode 100644 index fe51139..0000000 --- a/src/main/java/de/hype/bbsentials/client/BBsentials.java +++ /dev/null @@ -1,261 +0,0 @@ -package de.hype.bbsentials.client; - -import com.mojang.brigadier.arguments.StringArgumentType; -import de.hype.bbsentials.api.Options; -import de.hype.bbsentials.chat.Chat; -import de.hype.bbsentials.client.Commands.CommandsOLD; -import de.hype.bbsentials.communication.BBsentialConnection; -import net.fabricmc.api.ClientModInitializer; -import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager; -import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback; -import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; -import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; -import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.InputUtil; -import net.minecraft.command.CommandSource; -import org.lwjgl.glfw.GLFW; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; - -import static de.hype.bbsentials.chat.Chat.*; - -public class BBsentials implements ClientModInitializer { - public static Config config; - public static BBsentialConnection connection; - public static CommandsOLD coms; - public static ScheduledExecutorService executionService = Executors.newScheduledThreadPool(1000); - public static boolean splashLobby; - private static Thread bbthread; - private boolean initialised = false; - public static SplashStatusUpdateListener splashStatusUpdateListener; - - public static Config getConfig() { - return config; - } - - public static void connectToBBserver() { - connectToBBserver(config.connectToBeta); - } - - /** - * Checks if still connected to the Server. - * - * @return true if it connected; false if old connection is kept. - */ - public static boolean conditionalReconnectToBBserver() { - if (!connection.isConnected()) { - Chat.sendPrivateMessageToSelfInfo("Reconnecting"); - connectToBBserver(config.connectToBeta); - return true; - } - return false; - } - - public static void connectToBBserver(boolean beta) { - if (connection != null) { - connection.sendHiddenMessage("exit"); - } - if (bbthread != null) { - if (bbthread.isAlive()) { - bbthread.interrupt(); - } - } - bbthread = new Thread(() -> { - connection = new BBsentialConnection(); - coms = new CommandsOLD(); - connection.setMessageReceivedCallback(message -> executionService.execute(() -> connection.onMessageReceived(message))); - if (beta) { - connection.connect(config.getBBServerURL(), 5011); - } - else { - connection.connect(config.getBBServerURL(), 5000); - } - executionService.scheduleAtFixedRate(new DebugThread(), 0, 20, TimeUnit.SECONDS); - }); - bbthread.start(); - } - - /** - * Runs the mod initializer on the client environment. - */ - - @Override - public void onInitializeClient() { - ClientPlayConnectionEvents.JOIN.register((a, b, c) -> { - splashLobby = false; - if (!initialised) { - config = Config.load(); - if (config.doGammaOverride) Options.setGamma(10); - Chat chat = new Chat(); - if (Config.isBingoTime() || config.overrideBingoTime()) { - connectToBBserver(); - } - initialised = true; - } - }); - } - - { - ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> { - dispatcher.register(ClientCommandManager.literal("bbi") - .then(ClientCommandManager.literal("reconnect") - .executes((context) -> { - connectToBBserver(); - return 1; - })) - .then(ClientCommandManager.literal("reconnect-stable-server") - .executes((context) -> { - connectToBBserver(false); - return 1; - })) - .then(ClientCommandManager.literal("reconnect-test-server") - .executes((context) -> { - connectToBBserver(true); - return 1; - })) - .then(ClientCommandManager.literal("config") - .then(ClientCommandManager.argument("category", StringArgumentType.string()) - .suggests((context, builder) -> { - // Provide tab-completion options for config subfolder - return CommandSource.suggestMatching(new String[]{"save", "reset", "load"}, builder); - }).executes((context) -> { - String category = StringArgumentType.getString(context, "category"); - switch (category) { - case "save": - getConfig().save(); - sendPrivateMessageToSelfSuccess("Saved config successfully"); - break; - case "load": - BBsentials.config = Config.load(); - break; - case "reset": - // Reset logic here - break; - } - return 1; - })) - .then(ClientCommandManager.literal("set-value") - .then(ClientCommandManager.argument("className", StringArgumentType.string()) - .suggests((context, builder) -> { - // Provide tab-completion options for classes - ArrayList<String> classNames = new ArrayList<>(); - classNames.add("Config"); - // Replace with your own logic to retrieve class names - return CommandSource.suggestMatching(classNames, builder); - }) - .then(ClientCommandManager.argument("variableName", StringArgumentType.string()) - .suggests((context, builder) -> { - // Provide tab-completion options for variable names - List<String> variableNames; - variableNames = List.of(getVariableInfo("de.hype.bbsentials.client", "Config")); - return CommandSource.suggestMatching(variableNames, builder); - }) - .then(ClientCommandManager.argument("variableValue", StringArgumentType.string()) - .executes((context) -> { - // Handle "variableName" and "variableValue" logic here - String variableName = StringArgumentType.getString(context, "variableName"); - String variableValue = StringArgumentType.getString(context, "variableValue"); - try { - if (!variableName.toLowerCase().contains("dev") || config.hasBBRoles("dev")) { - setVariableValue(getConfig(), variableName, variableValue); - } - getConfig().save(); - } catch (ClassNotFoundException | - NoSuchFieldException | - IllegalAccessException | - InstantiationException | - InvocationTargetException | - NoSuchMethodException e) { - Chat.sendPrivateMessageToSelfError("Invalid variable or value"); - } - return 1; - }))))) - .then(ClientCommandManager.literal("get-value") - .then(ClientCommandManager.argument("className", StringArgumentType.string()) - .suggests((context, builder) -> { - // Provide tab-completion options for classes - ArrayList<String> classNames = new ArrayList<>(); - classNames.add("Config"); - // Replace with your own logic to retrieve class names - return CommandSource.suggestMatching(classNames, builder); - }) - .then(ClientCommandManager.argument("variableName", StringArgumentType.string()) - .suggests((context, builder) -> { - // Provide tab-completion options for variable names - List<String> variableNames; - variableNames = List.of(getVariableInfo("de.hype.bbsentials.client", "Config")); - return CommandSource.suggestMatching(variableNames, builder); - }) - .executes((context) -> { - // Handle "variableName" and "variableValue" logic here - String variableName = StringArgumentType.getString(context, "variableName"); - try { - Chat.getVariableValue(getConfig(), variableName); - } catch (Exception e) { - e.printStackTrace(); - } - return 1; - }))).executes((context) -> { - // Handle the case when "config" argument is not provided - // ... - return 1; - }))) - ); - }); //bbi - - KeyBinding devKeyBind = new KeyBinding("Open Mod Menu Config", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_KP_ADD, "BBsentials: Developing Tools"); - KeyBindingHelper.registerKeyBinding(devKeyBind); - ClientTickEvents.END_CLIENT_TICK.register(client -> { - if (devKeyBind.wasPressed()) { - MinecraftClient.getInstance().setScreen(BBsentialsConfigScreemFactory.create(MinecraftClient.getInstance().currentScreen)); - } - }); - - KeyBinding promptKeyBind = new KeyBinding("Chat Prompt Yes / Open Menu", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_R, "BBsentials"); - KeyBindingHelper.registerKeyBinding(promptKeyBind); - ClientTickEvents.END_CLIENT_TICK.register(client -> { - if (promptKeyBind.wasPressed()) { - if (config.getLastChatPromptAnswer() != null) { - if (config.isDetailedDevModeEnabled()) { - Chat.sendPrivateMessageToSelfDebug(config.getLastChatPromptAnswer()); - } - MinecraftClient.getInstance().getNetworkHandler().sendChatMessage(config.getLastChatPromptAnswer()); - } - config.setLastChatPromptAnswer(null); - } - }); - KeyBinding craftKeyBind = new KeyBinding("Craft", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_V, "BBsentials"); - KeyBindingHelper.registerKeyBinding(craftKeyBind); - ClientTickEvents.END_CLIENT_TICK.register(client -> { - if (craftKeyBind.wasPressed()) MinecraftClient.getInstance().getNetworkHandler().sendChatMessage("/craft"); - }); - KeyBinding petKeyBind = new KeyBinding("Open Pet Menu", InputUtil.Type.KEYSYM, -1, "BBsentials"); - KeyBindingHelper.registerKeyBinding(petKeyBind); - ClientTickEvents.END_CLIENT_TICK.register(client -> { - if (petKeyBind.wasPressed()) MinecraftClient.getInstance().getNetworkHandler().sendChatMessage("/pets"); - }); - for (int i = 1; i <= 9; i++) { - KeyBinding ecPageKeyBind = new KeyBinding("Ender Chest Page " + i, InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_KP_1 + (i - 1), "BBsentials"); - KeyBindingHelper.registerKeyBinding(ecPageKeyBind); - int pageNum = i; // Capture the page number for lambda - ClientTickEvents.END_CLIENT_TICK.register(client -> { - if (ecPageKeyBind.wasPressed()) { - BBsentials.getConfig().sender.addImmediateSendTask("/ec " + pageNum); - } - }); - } - } // KeyBinds - - public void manualLoad() { - initialised = true; - config = Config.load(); - connectToBBserver(); - } -}
\ No newline at end of file diff --git a/src/main/java/de/hype/bbsentials/client/BBsentialsConfigScreemFactory.java b/src/main/java/de/hype/bbsentials/client/BBsentialsConfigScreemFactory.java deleted file mode 100644 index d078b46..0000000 --- a/src/main/java/de/hype/bbsentials/client/BBsentialsConfigScreemFactory.java +++ /dev/null @@ -1,304 +0,0 @@ -package de.hype.bbsentials.client; - -import de.hype.bbsentials.constants.enviromentShared.Islands; -import me.shedaniel.clothconfig2.api.ConfigBuilder; -import me.shedaniel.clothconfig2.api.ConfigCategory; -import me.shedaniel.clothconfig2.api.ConfigEntryBuilder; -import me.shedaniel.clothconfig2.api.Requirement; -import me.shedaniel.clothconfig2.gui.entries.BooleanListEntry; -import me.shedaniel.clothconfig2.gui.entries.DropdownBoxEntry; -import me.shedaniel.clothconfig2.gui.entries.StringListEntry; -import me.shedaniel.clothconfig2.impl.builders.SubCategoryBuilder; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.screen.NoticeScreen; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.text.Text; - -import java.util.List; - -import static de.hype.bbsentials.client.BBsentials.config; - -public class BBsentialsConfigScreemFactory { - public static Screen create(Screen parent) { - if (BBsentials.config == null) { - return new NoticeScreen(() -> MinecraftClient.getInstance().setScreen(parent), Text.of("BBsentials"), Text.of("You need to login to a Server for the Config to be loaded.")); - } - else { - ConfigBuilder builder = ConfigBuilder.create() - .setParentScreen(parent) - .setTitle(Text.of("BBsentials Config")); - builder.setSavingRunnable(BBsentials.getConfig()::save); - ConfigEntryBuilder entryBuilder = builder.entryBuilder(); - ConfigCategory server = builder.getOrCreateCategory(Text.of("Server")); - if (config.getUsername().equalsIgnoreCase("Hype_the_Time")) { - server.addEntry(entryBuilder.startTextField(Text.of("Server URL"), config.getBBServerURL().replaceAll(".", "*")) - .setDefaultValue("localhost") - .setTooltip(Text.of("Place the Server URL of the BBsentials Server here")) - .setSaveConsumer((newValue) -> { - if (newValue.replace("*", "").trim().isEmpty()) { - return; - } - else { - config.bbServerURL = newValue; - } - }) - .build()); - } - else { - server.addEntry(entryBuilder.startTextField(Text.of("Server URL"), config.getBBServerURL()) - .setDefaultValue("localhost") - .setTooltip(Text.of("Place the Server URL of the BBsentials Server here")) - .setSaveConsumer(newValue -> config.bbServerURL = newValue) - .build()); - } - server.addEntry(entryBuilder.startStrField(Text.of("BBsentials API key"), config.apiKey.replaceAll(".", "*")) - .setDefaultValue("unset") - .setTooltip(Text.of("Put you API Key here (the one generated in the Discord! with /link). §cThe Text is visually censored. Not saved unless you changed it.")) - .setSaveConsumer((newValue) -> { - if (newValue.replace("*", "").trim().isEmpty()) { - return; - } - else { - config.apiKey = newValue; - } - }) - .build()); - server.addEntry(entryBuilder.startBooleanToggle(Text.of("Connect to Test Server"), config.connectToBeta) - .setDefaultValue(false) - .setTooltip(Text.of("Makes you connect to the Test Server instead of the Main Server. Keep in mind that all announces may be tests and the main announces are not transferred over to here!")) // Optional: Shown when the user hover over this option - .setSaveConsumer(newValue -> config.connectToBeta = newValue) - .build()); - server.addEntry(entryBuilder.startBooleanToggle(Text.of("Override Bingo Time"), config.overrideBingoTime) - .setDefaultValue(false) - .setTooltip(Text.of("Override the Bingo Time and connect always to the Server. (Bingo time is 14 days cause Extreme Bingo)")) - .setSaveConsumer(newValue -> config.overrideBingoTime = newValue) - .build()); - server.addEntry(entryBuilder.startBooleanToggle(Text.of("Allow Server Partying"), config.allowServerPartyInvite) - .setDefaultValue(true) - .setTooltip(Text.of("Allow the Server to party players for you automatically. (Convenience Feature. Is used for example for services to automatically party the persons which joined it)")) - .setSaveConsumer(newValue -> config.allowServerPartyInvite = newValue) - .build()); - //Visual - ConfigCategory visual = builder.getOrCreateCategory(Text.of("Visual")); - visual.addEntry(entryBuilder.startBooleanToggle(Text.of("Show Bingo Chat"), config.showBingoChat) - .setDefaultValue(true) - .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")); - BooleanListEntry doNotifications = entryBuilder.startBooleanToggle(Text.of("Do Desktop Notifications"), config.doDesktopNotifications) - .setDefaultValue(true) - .setTooltip(Text.of("Select if you want BBsentials to automatically accept reparties")) - .setSaveConsumer(newValue -> config.doDesktopNotifications = newValue) - .build(); - DropdownBoxEntry<String> notificationOn = entryBuilder.startStringDropdownMenu(Text.of("Notification on"), config.notifForMessagesType) // Start the StringDropdownMenu entry - .setSelections(List.of("all", "nick", "none")) - .setTooltip(Text.of("When do you want to receive Desktop Notifications? on all party, messages containing nickname")) - .setDefaultValue("all") - .setRequirement(Requirement.isTrue(doNotifications)) - .setSuggestionMode(false) - .setSaveConsumer(newValue -> config.notifForMessagesType = newValue) - .build(); - StringListEntry nickname = entryBuilder.startStrField(Text.of("Nickname"), config.nickname) - .setDefaultValue("") - .setTooltip(Text.of("Nickname. you will get send desktop notifications if a message contains one")) - .setRequirement(() -> { - return doNotifications.getValue() && notificationOn.getValue().equals("nick"); - }) - .setSaveConsumer(newValue -> config.nickname = newValue) - .build(); - - notifications.addEntry(doNotifications); - notifications.addEntry(notificationOn); - notifications.addEntry(nickname); - //other - ConfigCategory other = builder.getOrCreateCategory(Text.of("Other")); - other.addEntry(entryBuilder.startBooleanToggle(Text.of("Gamma Override"), config.doGammaOverride) - .setDefaultValue(true) - .setTooltip(Text.of("Select if you want BBsentials to enable full bright")) - .setSaveConsumer(newValue -> config.doGammaOverride = newValue) - .build()); - other.addEntry(entryBuilder.startBooleanToggle(Text.of("Accept Reparties"), config.acceptReparty) - .setDefaultValue(true) - .setTooltip(Text.of("Select if you want BBsentials to automatically accept reparties")) - .setSaveConsumer(newValue -> config.showBingoChat = newValue) - .build()); - other.addEntry(entryBuilder.startBooleanToggle(Text.of("Accept auto invite"), config.allowBBinviteMe) - .setDefaultValue(true) - .setTooltip(Text.of("Do you want that whenever someone sends you a msg ending with 'bb:party me' to send them a party invite automatically?")) - .setSaveConsumer(newValue -> config.allowBBinviteMe = newValue) - .build()); - ConfigCategory chChestItems = builder.getOrCreateCategory(Text.of("Ch Chest Items")); - { - BooleanListEntry allItems = entryBuilder.startBooleanToggle(Text.of("All Chest Items"), config.toDisplayConfig.allChChestItem) - .setDefaultValue(true) - .setTooltip(Text.of("Select to receive notifications when an any Item is found")) - .setSaveConsumer(newValue -> config.toDisplayConfig.allChChestItem = newValue) - .build(); - chChestItems.addEntry(allItems); - Requirement notAllItemsRequirement = () -> !allItems.getValue(); - chChestItems.addEntry(entryBuilder.startBooleanToggle(Text.of("ALL Robo Parts "), config.toDisplayConfig.allRoboPart) - .setDefaultValue(false) - .setTooltip(Text.of("Select to receive notifications when an allRoboPartCustomChChestItem is found")) - .setSaveConsumer(newValue -> config.toDisplayConfig.allRoboPart = newValue) - .setRequirement(notAllItemsRequirement) - .build()); - BooleanListEntry allRoboParts = (entryBuilder.startBooleanToggle(Text.of("Custom (Other) Items"), config.toDisplayConfig.customChChestItem) - .setDefaultValue(false) - .setTooltip(Text.of("Select to receive notifications when any not already defined Item is found")) - .setSaveConsumer(newValue -> config.toDisplayConfig.customChChestItem = newValue) - .setRequirement(notAllItemsRequirement) - .build()); - chChestItems.addEntry(allRoboParts); - Requirement notAllRoboPartsRequirement = () -> !allRoboParts.getValue(); - chChestItems.addEntry(entryBuilder.startBooleanToggle(Text.of("Prehistoric Egg"), config.toDisplayConfig.prehistoricEgg) - .setDefaultValue(false) - .setTooltip(Text.of("Select to receive notifications when a Prehistoric Egg is found")) - .setSaveConsumer(newValue -> config.toDisplayConfig.prehistoricEgg = newValue) - .setRequirement(notAllItemsRequirement) - .build()); - - chChestItems.addEntry(entryBuilder.startBooleanToggle(Text.of("Pickonimbus 2000"), config.toDisplayConfig.pickonimbus2000) - .setDefaultValue(false) - .setTooltip(Text.of("Select to receive notifications when a Pickonimbus 2000 is found")) - .setSaveConsumer(newValue -> config.toDisplayConfig.pickonimbus2000 = newValue) - .setRequirement(notAllItemsRequirement) - .build()); - SubCategoryBuilder roboParts = entryBuilder.startSubCategory(Text.of("Robo Parts")).setRequirement(Requirement.all(notAllRoboPartsRequirement, notAllItemsRequirement)).setExpanded(true); - roboParts.add(entryBuilder.startBooleanToggle(Text.of("Control Switch"), config.toDisplayConfig.controlSwitch) - .setDefaultValue(false) - .setTooltip(Text.of("Select to receive notifications when a Control Switch is found")) - .setSaveConsumer(newValue -> config.toDisplayConfig.controlSwitch = newValue) - .build()); - - roboParts.add(entryBuilder.startBooleanToggle(Text.of("Electron Transmitter"), config.toDisplayConfig.electronTransmitter) - .setDefaultValue(false) - .setTooltip(Text.of("Select to receive notifications when an Electron Transmitter is found")) - .setSaveConsumer(newValue -> config.toDisplayConfig.electronTransmitter = newValue) - .build()); - - roboParts.add(entryBuilder.startBooleanToggle(Text.of("FTX 3070"), config.toDisplayConfig.ftx3070) - .setDefaultValue(false) - .setTooltip(Text.of("Select to receive notifications when a FTX 3070 is found")) - .setSaveConsumer(newValue -> config.toDisplayConfig.ftx3070 = newValue) - .build()); - - roboParts.add(entryBuilder.startBooleanToggle(Text.of("Robotron Reflector"), config.toDisplayConfig.robotronReflector) - .setDefaultValue(false) - .setTooltip(Text.of("Select to receive notifications when a Robotron Reflector is found")) - .setSaveConsumer(newValue -> config.toDisplayConfig.robotronReflector = newValue) - .build()); - - roboParts.add(entryBuilder.startBooleanToggle(Text.of("Superlite Motor"), config.toDisplayConfig.superliteMotor) - .setDefaultValue(false) - .setTooltip(Text.of("Select to receive notifications when a Superlite Motor is found")) - .setSaveConsumer(newValue -> config.toDisplayConfig.superliteMotor = newValue) - .build()); - - roboParts.add(entryBuilder.startBooleanToggle(Text.of("Synthetic Heart"), config.toDisplayConfig.syntheticHeart) - .setDefaultValue(false) - .setTooltip(Text.of("Select to receive notifications when a Synthetic Heart is found")) - .setSaveConsumer(newValue -> config.toDisplayConfig.syntheticHeart = newValue) - .build()); - chChestItems.addEntry(roboParts.build()); - chChestItems.addEntry(entryBuilder.startBooleanToggle(Text.of("Flawless Gemstone"), config.toDisplayConfig.flawlessGemstone) - .setDefaultValue(false) - .setTooltip(Text.of("Select to receive notifications when any Flawless Gemstone is found")) - .setSaveConsumer(newValue -> config.toDisplayConfig.flawlessGemstone = newValue) - .setRequirement(notAllItemsRequirement) - .build()); - chChestItems.addEntry(entryBuilder.startBooleanToggle(Text.of("Jungle Heart"), config.toDisplayConfig.jungleHeart) - .setDefaultValue(false) - .setTooltip(Text.of("Select to receive notifications when a JungleHeart is found")) - .setSaveConsumer(newValue -> config.toDisplayConfig.jungleHeart = newValue) - .setRequirement(notAllItemsRequirement) - .build()); - }//CHChestItems - ConfigCategory miningEvents = builder.getOrCreateCategory(Text.of("Mining Events")); - { - BooleanListEntry allEvents = entryBuilder.startBooleanToggle(Text.of("All Events"), config.toDisplayConfig.allEvents) - .setDefaultValue(true) - .setTooltip(Text.of("Get updated for any Mining Event")) - .setSaveConsumer(newValue -> config.toDisplayConfig.allEvents = newValue) - .build(); - miningEvents.addEntry(allEvents); - miningEvents.addEntry(entryBuilder.startBooleanToggle(Text.of("§cBlock Crystal Hollow Events"), config.toDisplayConfig.blockChEvents) - .setDefaultValue(false) - .setTooltip(Text.of("Block getting Crystal Hollow Events. Maybe if you haven't accessed Crystal Hollows yet ")) - .setSaveConsumer(newValue -> config.toDisplayConfig.blockChEvents = newValue) - .build()); - miningEvents.addEntry(entryBuilder.startStringDropdownMenu(Text.of("Gone with the Wind"), config.toDisplayConfig.goneWithTheWind) // Start the StringDropdownMenu entry - .setSelections(List.of("both", Islands.DWARVEN_MINES.getDisplayName(), Islands.CRYSTAL_HOLLOWS.getDisplayName(), "none")) - .setTooltip(Text.of("Get notified when a Gone with the Wind happens in the specified Island")) - .setDefaultValue("none") - .setSuggestionMode(false) - .setRequirement(() -> !allEvents.getValue()) - .setSaveConsumer(newValue -> config.toDisplayConfig.goneWithTheWind = newValue) - .build()); - miningEvents.addEntry(entryBuilder.startStringDropdownMenu(Text.of("Better Together"), config.toDisplayConfig.betterTogether) // Start the StringDropdownMenu entry - .setSelections(List.of("both", Islands.DWARVEN_MINES.getDisplayName(), Islands.CRYSTAL_HOLLOWS.getDisplayName(), "none")) - .setTooltip(Text.of("Get notified when a Better Together happens in the specified Island")) - .setDefaultValue("none") - .setSuggestionMode(false) - .setRequirement(() -> !allEvents.getValue()) - .setSaveConsumer(newValue -> config.toDisplayConfig.betterTogether = newValue) - .build()); - miningEvents.addEntry(entryBuilder.startStringDropdownMenu(Text.of("Double Powder"), config.toDisplayConfig.doublePowder) // Start the StringDropdownMenu entry - .setSelections(List.of("both", Islands.DWARVEN_MINES.getDisplayName(), Islands.CRYSTAL_HOLLOWS.getDisplayName(), "none")) - .setTooltip(Text.of("Get notified when a Double Powder happens in the specified Island")) - .setDefaultValue("none") - .setRequirement(() -> !allEvents.getValue()) - .setSuggestionMode(false) - .setSaveConsumer(newValue -> config.toDisplayConfig.doublePowder = newValue) - .build()); - miningEvents.addEntry(entryBuilder.startBooleanToggle(Text.of("Mithril Gourmand"), config.toDisplayConfig.mithrilGourmand) - .setDefaultValue(false) - .setTooltip(Text.of("Get notified when a Mithril Gourmand happens")) - .setRequirement(() -> !allEvents.getValue()) - .setSaveConsumer(newValue -> config.toDisplayConfig.mithrilGourmand = newValue) - .build()); - miningEvents.addEntry(entryBuilder.startBooleanToggle(Text.of("Raffle"), config.toDisplayConfig.raffle) |
