aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/hype/bbsentials/client/BBsentialsConfigScreemFactory.java
blob: 555c42dcace2d689e534154ff9f786ae6a976c54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
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 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) {
        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());
        //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());
        //Notifications
        ConfigCategory notifications = builder.getOrCreateCategory(Text.of("Notifications"));
        notifications.addEntry(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());
        notifications.addEntry(entryBuilder.startStrField(Text.of("Nickname"), config.nickname)
                .setDefaultValue("")
                .setTooltip(Text.of("Nickname. you will get send desktop notifications if a message contains one"))
                .setSaveConsumer(newValue -> config.nickname = newValue)
                .build());
        notifications.addEntry(entryBuilder.startStringDropdownMenu(Text.of("Notification on"), config.NotifForPartyMessagesType) // Start the StringDropdownMenu entry
                .setSelections(List.of("all", "nick", "none"))
                .setTooltip(Text.of("When do you want to receive Desktop Notifications? on all party, party messages containing nickname or no party messages"))
                .setDefaultValue("all")
                .setSuggestionMode(false)
                .setSaveConsumer(newValue -> config.NotifForPartyMessagesType = newValue)
                .build());
        //other
        ConfigCategory other = builder.getOrCreateCategory(Text.of("Other"));
        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"));
        {
            chChestItems.addEntry(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(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)
                    .build());
            chChestItems.addEntry(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)
                    .build());
            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)
                    .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)
                    .build());

            chChestItems.addEntry(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());

            chChestItems.addEntry(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());

            chChestItems.addEntry(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());

            chChestItems.addEntry(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());

            chChestItems.addEntry(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());

            chChestItems.addEntry(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(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)
                    .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)
                    .build());
        }//CHChestItems
        ConfigCategory miningEvents = builder.getOrCreateCategory(Text.of("Mining Events"));
        {
            miningEvents.addEntry(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(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)
                    .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)
                    .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")
                    .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"))
                    .setSaveConsumer(newValue -> config.toDisplayConfig.mithrilGourmand = newValue)
                    .build());
            miningEvents.addEntry(entryBuilder.startBooleanToggle(Text.of("Raffle"), config.toDisplayConfig.raffle)
                    .setDefaultValue(false)
                    .setTooltip(Text.of("Get notified when a Raffle happens"))
                    .setSaveConsumer(newValue -> config.toDisplayConfig.raffle = newValue)
                    .build());
            miningEvents.addEntry(entryBuilder.startBooleanToggle(Text.of("Goblin Raid"), config.toDisplayConfig.goblinRaid)
                    .setDefaultValue(false)
                    .setTooltip(Text.of("Get notified when a Goblin Raid happens"))
                    .setSaveConsumer(newValue -> config.toDisplayConfig.goblinRaid = newValue)
                    .build());
        } //Mining Events
        if (config.hasBBRoles("dev")){
            ConfigCategory dev = builder.getOrCreateCategory(Text.of("§3Developing"));
            dev.addEntry(entryBuilder.startBooleanToggle(Text.of("Dev Mode"), config.devMode)
                    .setDefaultValue(false)
                    .setTooltip(Text.of("Dev Mode"))
                    .setSaveConsumer(newValue -> config.devMode = newValue)
                    .build());
            dev.addEntry(entryBuilder.startBooleanToggle(Text.of("Detailed Dev Mode"), config.detailedDevMode)
                    .setDefaultValue(false)
                    .setTooltip(Text.of("Detailed Dev Mode"))
                    .setSaveConsumer(newValue -> config.detailedDevMode = newValue)
                    .build());
        }
        if (config.hasBBRoles("splasher")){
            ConfigCategory dev = builder.getOrCreateCategory(Text.of("§dSplashes"));
            dev.addEntry(entryBuilder.startBooleanToggle(Text.of("Dev Mode"), config.devMode)
                    .setDefaultValue(true)
                    .setTooltip(Text.of("Auto Update Statuses"))
                    .setSaveConsumer(newValue -> config.autoSplashStatusUpdates = newValue)
                    .build());
        }

        return builder.build();
    }
}