aboutsummaryrefslogtreecommitdiff
path: root/features/globalSettings/index.js
blob: a1c6a3c96e2d5a0d81ce63de86ccaa45140a639a (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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
/// <reference types="../../../CTAutocomplete" />
/// <reference lib="es2015" />
import Feature from "../../featureClass/class";
import ButtonSetting from "../settings/settingThings/button";
import TextSetting from "../settings/settingThings/textSetting";
import ToggleSetting from "../settings/settingThings/toggle";
import HudTextElement from "../hud/HudTextElement";
import LocationSetting from "../settings/settingThings/location";
import firstLoadPages from "./firstLoadPages";
import GuiPage from "../soopyGui/GuiPage"
import Notification from "../../../guimanager/Notification";
import logger from "../../logger";
import { numberWithCommas } from "../../utils/numberUtils";
import { firstLetterCapital } from "../../utils/stringUtils";
import { fetch } from "../../utils/networkUtils";
import socketConnection from "../../socketConnection";
import renderLibs from "../../../guimanager/renderLibs";
import { f, m } from "../../../mappings/mappings";
import { addLore, getSBUUID, toMessageWithLinks } from "../../utils/utils";
import { delay } from "../../utils/delayUtils";
import { SoopyGui } from "../../../guimanager";
import SoopyImageElement from "../../../guimanager/GuiElement/SoopyImageElement";
const Files = Java.type("java.nio.file.Files")
const Paths = Java.type("java.nio.file.Paths")
const JavaString = Java.type("java.lang.String")
const JavaLong = Java.type("java.lang.Long")

let hecatombLevels = [2, 5, 10, 20, 30, 40, 60, 80, 100]
let championLevels = [50000, 100000, 250000, 500000, 1000000, 1500000, 2000000, 2500000, 3000000]

class GlobalSettings extends Feature {
    constructor() {
        super()

        this.initVariables()
    }

    initVariables() {
        this.apiKeySetting = undefined
        this.GuiPage = undefined
    }

    onEnable() {
        this.apiKeySetting = new TextSetting("Api Key", "Your hypixel api key", "", "api_key", this, "Run /api new to load", true)
        this.verifyApiKey = new ButtonSetting("Verify api key", "Click this to make sure the api key is working", "verify_key", this, "Click!", this.verifyKey2, undefined)
        this.newApiKey = new ButtonSetting("Run /api new", "This is here so u dont need to exit and re-enter", "api_new_command", this, "Click!", this.apiNewCommand, undefined)
        this.findApiKey = new ButtonSetting("Attempt to load api key from other mods", "This will scan other mods configs to attempt to find your key", "find_key", this, "Click!", () => { this.findKey() }, undefined)

        this.alertAllUpdates = new ToggleSetting("Send chat update avalible for all updates", "If disabled itll notify for new updates less", false, "alert_all_updates", this)

        this.fixNeuNetworth = new ToggleSetting("Change networth in NEU pv to soopynw", "This should make it a lot more accurate", true, "neu_nw_override", this)
        this.darkTheme = new ToggleSetting("Dark theme", "This might be scuffed because guis are still made in light theme", false, "dark_theme", this)
        // this.linkPreview = new ToggleSetting("Link preview", "Shows a preview of where a link will take you", true, "link_preview", this)

        // this.reportErrorsSetting = new ToggleSetting("Send module errors to soopy server", "This will allow me to more effectivly fix them", false, "privacy_send_errors", this)

        this.hideFallingBlocks = new ToggleSetting("Hide falling blocks", "NOTE: This setting is a bit laggy", false, "hide_falling_sand", this)
        this.twitchCommands = new ToggleSetting("Ingame twitch bot commands", "Allows u to use twitch bot commands ingame (eg -sa)", true, "twitch_commands_ingame", this)
        this.handChat = new ToggleSetting("Replace [hand] with ur currently held item", "Idea from Synthesis im only adding cus i dont have D:", true, "hand_chat", this)
        this.itemWorth = new ToggleSetting("(Approximate) Item worth in lore", "Accounts for stuff like enchants/recombs ect", false, "item_worth", this)
        this.showHecatomb = new ToggleSetting("Show hecatomb enchant info in lore", "", true, "show_hecatomb", this)
        this.showChampion = new ToggleSetting("Show champion enchant info in lore", "", true, "show_champion", this)
        this.warpCompletions = new ToggleSetting("Autocomplete warp locations with tab", "", true, "show_champion", this)

        this.thunderBottle = new ToggleSetting("Thunder Bottle Progress Display", "shows you the progress of thunder bottle in your inventory", false, "thunder_bottle", this);
        this.thunderBottleElement = new HudTextElement()
            .setText("")
            .setToggleSetting(this.thunderBottle)
            .setLocationSetting(new LocationSetting("Thunder Bottle Progress location", "Allows you to change location of this display", "thunder_bottle_location", this, [20, 100, 1, 1]).requires(this.thunderBottle).editTempText(`&6Thunder Charge&7> &f49,999&7/&750,000`));
        this.hudElements.push(this.thunderBottleElement);
        this.thunderBottleFull = new ToggleSetting("Thunder Bottle Full Alert", "Alert when your thunder bottle is fully charged", false, "thunder_bottle_full", this);

        this.oldMasterStars = new ToggleSetting("Use Old Master Stars", "replaces the ugly new master star on item name with the old fashion one", false, "old_master_star", this)
        this.sbaItemPickUpLog = new ToggleSetting("Sba Item Pick Up Log", "Same as sba item pick up log, but fixes old master stars making it go brrr", false, "sba_item_log", this);
        this.sbaItemPickUpLogElement = new HudTextElement()
            .setText("")
            .setToggleSetting(this.sbaItemPickUpLog)
            .setLocationSetting(new LocationSetting("Sba Item Pick Up Log location", "Allows you to change location of this display", "sba_item_log_location", this, [10, 100, 1, 1]).requires(this.sbaItemPickUpLog).editTempText(`&a+ 1x &dHeroic Hyperion &c✪✪✪✪✪\n&c- 1x &dHeroic Hyperion &6✪✪✪✪✪`));
        this.hudElements.push(this.sbaItemPickUpLogElement);
        this.maxAmount = new TextSetting("Pickup Log Line Limit", "Basically after this length it doesn't log anymore", "20", "item_log_max_amount", this, "20", false).requires(this.sbaItemPickUpLog);

        this.fancyVanquisherAlert = new ToggleSetting("Fancy Vanquisher Alert", "Alert when a Vanquisher spawned", false, "fancy_vanquisher_alert", this);
        this.fancySeaCreaturesAlert = new ToggleSetting("Fancy Sea Creatures Alert", "Alert when you caught x creature (this is the main toggle)", false, "fancy_sc_alert", this);
        this.fancySeaCreaturesAlertThunder = new ToggleSetting("Fancy Thunder Alert", "Alert when you caught Thunder creature", false, "fancy_thunder_alert", this).requires(this.fancySeaCreaturesAlert);
        this.fancySeaCreaturesAlertJawbus = new ToggleSetting("Fancy Jawbus Alert", "Alert when you caught Lord Jawbus creature", false, "fancy_jawbus_alert", this).requires(this.fancySeaCreaturesAlert);

        this.registerEvent('itemTooltip', (lore, i, e) => {
            if (!this.oldMasterStars.getValue()) return
            if (!i) return
            let itemName = i.getName()
            let itemNameReformat = itemName.removeFormatting()
            if (itemNameReformat.endsWith("➊")) {
                let newItemName = itemName.replace("§6✪§6✪§6✪§6✪§6✪§c➊", "§c✪§6✪✪✪✪")
                i.setName(newItemName)
                this.saveItemData(getSBUUID(i), newItemName)
                return
            }
            if (itemNameReformat.endsWith("➋")) {
                let newItemName = itemName.replace("§6✪§6✪§6✪§6✪§6✪§c➋", "§c✪✪§6✪✪✪")
                i.setName(newItemName)
                this.saveItemData(getSBUUID(i), newItemName)
                return
            }
            if (itemNameReformat.endsWith("➌")) {
                let newItemName = itemName.replace("§6✪§6✪§6✪§6✪§6✪§c➌", "§c✪✪✪§6✪✪")
                i.setName(newItemName)
                this.saveItemData(getSBUUID(i), newItemName)
                return
            }
            if (itemNameReformat.endsWith("➍")) {
                let newItemName = itemName.replace("§6✪§6✪§6✪§6✪§6✪§c➍", "§c✪✪✪✪§6✪")
                i.setName(newItemName)
                this.saveItemData(getSBUUID(i), newItemName)
                return
            }
            if (itemNameReformat.endsWith("➎")) {
                let newItemName = itemName.replace("§6✪§6✪§6✪§6✪§6✪§c➎", "§c✪✪✪✪✪")
                i.setName(newItemName)
                this.saveItemData(getSBUUID(i), newItemName)
                return
            }
        })

        this.registerEvent('worldLoad', this.worldLoad)

        this.itemData = {};
        this.oldItemData = {};
        this.initOldItemData();
        this.todoPickUpLog = {};
        this.clearLog = false;

        this.registerStep(true, 5, this.step5Fps)
        //4 chat registeries below prevents pickup log to go brrr when warping
        this.registerChat("&r&c ☠ ${info} and became a ghost&r&7.&r", (info, e) => {
            if (info.includes("You")) this.preventGoingBrrr();
        });
        this.registerChat("${info}You were revived by ${info2}", this.preventGoingBrrr);

        this.registerChat("&r&e> Your bottle of thunder has fully charged!&r", () => {
            if (this.thunderBottleFull.getValue()) {
                Client.showTitle("&6Bottle of Thunder Fully Charged", "", 0, 100, 10);
            }
        })

        this.warps = JSON.parse(FileLib.read("SoopyV2", "features/globalSettings/warps.json"))
        
        this.registerCommand("warp", (...name) => {
                //send command to server
                ChatLib.command("warp " + (name[0] || ""));
        }, (args) => {
            if (this.warpCompletions.getValue())
            {
                return this.warps.filter(v => v.toLowerCase().startsWith(args[0]))
            } else return []
        })

        this.registerStep(true, 4, this.mobThings)

        this.firstPageSettings = [this.darkTheme]

        this.firstLoadPageData = JSON.parse(FileLib.read("soopyAddonsData", "soopyv2firstloaddata.json") || "{}") || {}

        this.GuiPage = new FirstLoadingPage(this)

        // soopyV2Server.reportErrorsSetting = this.reportErrorsSetting
        this.registerEvent("itemTooltip", this.itemTooltipEvent).registeredWhen(() => this.itemWorth.getValue() || this.showChampion.getValue() || this.showHecatomb.getValue())


        this.registerChat("&aYour new API key is &r&b${key}&r", this.newKey)
        const EntityFallingBlock = Java.type("net.minecraft.entity.item.EntityFallingBlock");

        this.registerEvent('renderEntity', (entity, posVec, partialTicks, event) => {
            if (entity.getEntity() instanceof EntityFallingBlock) {
                cancel(event);
            }
        }).registeredWhen(() => this.hideFallingBlocks.getValue())

        this.ranFirstLoadThing = false

        if (!this.firstLoadPageData.shown) {
            new Thread(() => {
                while (!World.isLoaded() || !this.FeatureManager.finishedLoading) {
                    Thread.sleep(100)
                }
                Thread.sleep(500)
                this.showFirstLoadPage.call(this)
            }).start()
        }

        if (net.minecraftforge.fml.common.Loader.isModLoaded("notenoughupdates")) {
            this.GuiProfileViewer = Java.type("io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer")
            this.currentPlayerOpen = undefined
            this.currentPlayerNetworth = {}
            this.registerEvent("tick", this.fixNEU)
        }

        this.requestingPrices = new Set()
        this.registerStep(false, 1, this.updateItemLores)

        try { //This enables links from soopy.dev to be shown in patcher image preview
            let hasHost = false

            for (let host of Java.type("gg.essential.util.TrustedHostsUtil").INSTANCE.getTrustedHosts()) {
                if (host.getName() === "soopy.dev") {
                    hasHost = true
                }
            }

            if (!hasHost) {
                let TrustedHost = Java.type("gg.essential.api.utils.TrustedHostsUtil").TrustedHost
                let TreeSet = Java.type("java.util.TreeSet")
                let hosts = new TreeSet()
                hosts.add("soopy.dev")

                let host = new TrustedHost(124123, "soopy.dev", hosts)

                Java.type("gg.essential.util.TrustedHostsUtil").INSTANCE.addTrustedHost(host)
            }
        } catch (e) { }

        this.registerCommand("soopyweight", (user = Player.getName()) => {
            this.soopyWeight(user)
        })
        this.registerCommand("sweight", (user = Player.getName()) => {
            this.soopyWeight(user)
        })
        this.registerCommand("lobbyday", () => {
            ChatLib.chat(this.FeatureManager.messagePrefix + "Current lobby is day " + (World.getTime() / 20 / 60 / 20).toFixed(2))
        })
        this.registerCommand("tps", (time = "3") => {
            time = parseInt(time)
            ChatLib.chat(this.FeatureManager.messagePrefix + "Loading tps... this will take " + time + "s")

            let packetMoves = 0
            let ticks = 0
            let packetReceived = register("packetReceived", () => {
                packetMoves++
            })

            let tick = register("tick", () => {
                if (packetMoves > 0) ticks++
                packetMoves = 0
            })

            delay(time * 1000, () => {
                packetReceived.unregister()
                tick.unregister()
                ChatLib.chat(this.FeatureManager.messagePrefix + "Tps: " + Math.min(20, ticks / time).toFixed(1))
            })
        })

        this.lastCookies = 0

        this.registerEvent("postGuiRender", () => {
            if (Player.getContainer() && Player.getContainer().getName() === "Cookie Clicker v0.01" && Player.getContainer().getStackInSlot(13)) this.renderCookie()
            // if (this.linkPreview.getValue() && Client.currentGui && Client.currentGui.get() && Client.currentGui.get().toString().startsWith("net.minecraft.client.gui.GuiConfirmOpenLink")) this.renderWebpage()
        })
        this.registerStep(false, 1, () => {
            if (Player.getContainer() && Player.getContainer().getName() === "Cookie Clicker v0.01" && Player.getContainer().getStackInSlot(13)) this.tickCookie()

            global.guiManagerSoopyGuisSetDarkThemeEnabled(this.darkTheme.getValue())
        })

        this.registerEvent("guiMouseClick", this.guiClicked)

        this.partyChatEnabled = true

        this.registerChat("&r&9Party &8> ${*}", (e) => {
            if (!this.partyChatEnabled) {
                cancel(e)
            }
        })

        this.registerEvent("messageSent", (message, event) => {
            if (this.twitchCommands.getValue() && message.startsWith("-") && message[1].toLowerCase().match(/[a-z]/)) {
                cancel(event)
                ChatLib.addToSentMessageHistory(message)
                fetch("http://soopy.dev/api/soopyv2/botcommand?m=" + encodeURIComponent(message.replace("-", "")) + "&u=" + Player.getName()).text(text => {
                    ChatLib.chat(this.FeatureManager.messagePrefix + "&7" + message)
                    toMessageWithLinks(this.FeatureManager.messagePrefix + text, "7").chat()
                })
                return;
            }

            if (this.handChat.getValue() && message.toLowerCase().includes("[hand]")) {
                cancel(event)
                ChatLib.addToSentMessageHistory(message)

                fetch("http://soopy.dev/api/soopyv2/itemup", {
                    postData: {
                        name: Player.getHeldItem().getName(),
                        lore: Player.getHeldItem().getLore().join("\n")
                    }
                }).text(text => {
                    if (text.length > 20) {
                        ChatLib.chat(this.FeatureManager.messagePrefix + "There was an error uploading the item data!")
                        return
                    }

                    ChatLib.say(message.replace(/\[hand\]/gi, "[ITEM:" + text + "]"))
                })
                return;
            }
        })

        let ev = this.registerChat("${*}[ITEM:${*}", (event) => {
            cancel(event)
            let message = new Message(event)

            let [_] = message.getUnformattedText().match(/\[ITEM:([0-9]+)\]/g)
            let id = _.replace("[ITEM:", "").replace(/\]$/g, "")

            fetch("http://soopy.dev/api/soopyv2/itemdown/" + id).json(([name, lore]) => {
                for (let i = 0; i < message.getMessageParts().length; i++) {
                    let component = message.getMessageParts()[i]

                    if (component.getText().match(/\[ITEM:([0-9]+)\]/g)) {
                        let [_] = component.getText().match(/\[ITEM:([0-9]+)\]/g)
                        let id = _.replace("[ITEM:", "").replace(/\]$/g, "")

                        message.setTextComponent(i, new TextComponent(component.getText().replace("[ITEM:" + id + "]", name + "&r")).setHover("show_text", lore))
                    }
                }
                message.setRecursive(true)
                message.chat()
            }).error(() => {
                ChatLib.chat(this.FeatureManager.messagePrefix + "There was an error downloading the item data!")
                message.chat()
            })

        })
        ev.trigger.setPriority(Priority.HIGHEST)

        this.ahAlerts = [
            // { //TODO: add a command/gui to add these
            //     id: "ATTRIBUTE_SHARD",
            //     maxPrice: 1300000,
            //     nbt: [
            //         "tag.ExtraAttributes.attributes.mana_pool"
            //     ]
            // }
        ]

        this.registerStep(false, 60, () => {
            if (this.ahAlerts.length === 0) return
            fetch("https://moulberry.codes/auction.json").json(data => { //TODO: use https://moulberry.codes/auction.json.gz
                if (!data.success) return

                data.new_auctions.forEach(a => {
                    let itemData = decompress(a.item_bytes)
                    let itemJSON = itemData.toObject().i[0]
                    let itemId = itemJSON.tag.ExtraAttributes.id

                    if (a.bin && this.ahAlerts.some(al => {
                        let ret = al.id === itemId && a.starting_bid <= al.maxPrice

                        if (ret && al.nbt) {
                            if (al.nbt.some(nbtr => {
                                let steps = nbtr.split(".")
                                let o = itemJSON
                                steps.forEach(s => {
                                    o = o?.[s]
                                })

                                return !o
                            })) ret = false
                        }

                        return ret
                    })) {
                        Client.showTitle("SNIPE THING", "CHECK CHAT", 20, 60, 20)

                        new TextComponent(this.FeatureManager.messagePrefix + "Bin found " + numberWithCommas(a.starting_bid) + " " + a.item_name).setClick("run_command", "/viewauction " + a.uuid).chat()
                    }
                })
            })
        })

        this.registerCommand("price", () => {

            fetch("http://soopy.dev/api/soopyv2/itemPriceDetailed", {
                postData: {
                    item: Player.getHeldItem().getNBT().toObject()
                }
            }).json(json => {
                ChatLib.chat(this.FeatureManager.messagePrefix + "PRICE ANALYSIS (Total: $" + numberWithCommas(Math.round(json.price)) + ")")
                // json.details.sort((a, b) => {
                //     if (typeof (a) === "string") return 1
                //     if (typeof (b) === "string") return -1
                //     return a[1] - b[1]
                // }).forEach(d => {
                //     if (typeof (d) === "string") {
                //         ChatLib.chat(d)
                //     } else {
                //         ChatLib.chat("&f" + d[0] + "&7: &6" + numberWithCommas(Math.round(d[1])))
                //     }
                // })
                // ChatLib.chat(this.FeatureManager.messagePrefix + "Final price: " + numberWithCommas(Math.round(json.price)))
                json.details.sort((b, a) => {
                    if (typeof (a) === "string") return 1
                    if (typeof (b) === "string") return -1
                    return a.price - b.price
                }).forEach(d => {
                    if (typeof (d) === "string") {
                        ChatLib.chat(d)
                    } else {
                        if (!d.price) return
                        let lore = []
                        d.items.sort((b, a) => {
                            if (typeof (a) === "string") return 1
                            if (typeof (b) === "string") return -1
                            return a[1] - b[1]
                        }).forEach(d2 => {
                            if (typeof (d2) === "string") {
                                lore.push(d2)
                            } else {
                                lore.push("&f" + d2[0] + "&7: $&6" + numberWithCommas(Math.round(d2[1])))
                            }
                        })
                        new TextComponent("&d" + d.name + "&7: $&6" + numberWithCommas(Math.round(d.price))).setHover("show_text", lore.join("\n")).chat()
                    }
                })
            })
        })

        let zoogui = new SoopyGui().setOpenCommand("zoo")

        zoogui.element.addChild(new SoopyImageElement().setImage("https://img.freepik.com/premium-photo/portrait-monkey-wild_397170-44.jpg?w=1380").setLocation(0, 0, 1, 1))
    }

    worldLoad() {
        this.requestingPrices.clear();
        this.initOldItemData();
        this.preventGoingBrrr();
        if (!this.oldMasterStars.getValue()) return
        let j = 0;
        [...Player.getInventory().getItems()].forEach(i => {
            j++;
            if (j > 8) return //only do the 1-8 hot bar slots
            if (!i) return
            let itemName = i.getName()
            let itemNameReformat = itemName.removeFormatting()
            if (itemNameReformat.endsWith("➊")) {
                let newItemName = itemName.replace("§6✪§6✪§6✪§6✪§6✪§c➊", "§c✪§6✪✪✪✪")
                i.setName(newItemName)
                this.saveItemData(getSBUUID(i), newItemName)
                return
            }
            if (itemNameReformat.endsWith("➋")) {
                let newItemName = itemName.replace("§6✪§6✪§6✪§6✪§6✪§c➋", "§c✪✪§6✪✪✪")
                i.setName(newItemName)
                this.saveItemData(getSBUUID(i), newItemName)
                return
            }
            if (itemNameReformat.endsWith("➌")) {
                let newItemName = itemName.replace("§6✪§6✪§6✪§6✪§6✪§c➌", "§c✪✪✪§6✪✪")
                i.setName(newItemName)
                this.saveItemData(getSBUUID(i), newItemName)
                return
            }
            if (itemNameReformat.endsWith("➍")) {
                let newItemName = itemName.replace("§6✪§6✪§6✪§6✪§6✪§c➍", "§c✪✪✪✪§6✪")
                i.setName(newItemName)
                this.saveItemData(getSBUUID(i), newItemName)
                return
            }
            if (itemNameReformat.endsWith("➎")) {
                let newItemName = itemName.replace("§6✪§6✪§6✪§6✪§6✪§c➎", "§c✪✪✪✪✪")
                i.setName(newItemName)
                this.saveItemData(getSBUUID(i), newItemName)
                return
            }
        })
    }

    step5Fps() {
        let old = this.oldMasterStars.getValue();
        let pick = this.sbaItemPickUpLog.getValue();
        let thunder = this.thunderBottle.getValue();
        let max = this.maxAmount.getValue();
        if (max) {
            max = Number(max)
            if (max < 0 || isNaN(max)) this.maxAmount.setValue("0");
        }
        let inGui = Client.isInGui()
        if (!old && !pick && !thunder) return
        if (inGui) {
            this.todoPickUpLog = {};
        }
        let j = 0;
        let now = Date.now();
        let thunderText = [];
        [...Player.getInventory().getItems()].forEach(i => {
            j++;
            if (i) {
                let uuid = getSBUUID(i)
                let ItemName = i.getName()
                if (old) {
                    if (uuid && this.itemData.hasOwnProperty(uuid)) {
                        let newName = this.itemData[uuid]
                        if (ItemName != newName) {
                            i.setName(newName)
                        }
                    }
                }
                if (thunder) {
                    if (ItemName.removeFormatting().includes("Empty Thunder Bottle")) {
                        let charges = i?.getNBT()?.getCompoundTag("tag")?.getCompoundTag("ExtraAttributes")?.getDouble("thunder_charge")
                        thunderText.push(`&6Thunder Charge&7> &f${numberWithCommas(charges)}&7/&750,000`)
                    }
                }
            }
            if (pick && !inGui) {
                let oldItem = this.oldItemData[j]
                let newItem = i
                if (!oldItem && !newItem) return //they both are air
                if (j > 36 || j == 9) return //sbmenu and armors (when switching wardrobe it goes brrr w/o this)
                let oldItemAmount = oldItem ? oldItem.getNBT().getDouble("Count") : undefined
                let oldItemName = oldItem ? oldItem.getName().replace(/ §8x\d+$/, "") : ""
                let newItemAmount = newItem ? newItem.getNBT().getDouble("Count") : undefined
                let newItemName = newItem ? newItem.getName().replace(/ §8x\d+$/, "") : ""
                this.oldItemData[j] = newItem
                if (oldItemName === newItemName) { //only amount is changed
                    if (oldItemAmount === newItemAmount || !newItemAmount || !oldItemAmount) return
                    this.addToTodoPickUpLog(now, oldItemName, newItemAmount - oldItemAmount)
                    return //so it doesn't provide duplicate message
                }
                let olduuid = getSBUUID(oldItem)
                let newuuid = getSBUUID(newItem)
                if (oldItemAmount == 1 && olduuid == newuuid) return // fixes using old master star making sba go brrr
                if (oldItemName) { //thing removed from that inventory slot
                    if (!oldItemAmount) return
                    this.addToTodoPickUpLog(now, oldItemName, (-1) * oldItemAmount)
                }
                if (newItemName) { //thing being placed into that inventory slot
                    if (!newItemAmount) return
                    this.addToTodoPickUpLog(now, newItemName, newItemAmount)
                }
            }
        })
        if (thunder) {
            if (thunderText.length > 0) {
                this.thunderBottleElement.setText(thunderText.join("\n"))
            } else {
                this.thunderBottleElement.setText("")
            }
        }
        let todoText = [];
        if (pick) {
            Object.keys(this.todoPickUpLog).forEach((i) => {
                if (Math.abs(this.todoPickUpLog[i].timeStamp - now) > 5000 || !this.todoPickUpLog[i].Amount || this.todoPickUpLog[i].Amount == 0) {
                    delete this.todoPickUpLog[i]
                    return
                }
                //positive and negative prefix colors
                if (todoText.length < max) todoText.push((this.todoPickUpLog[i].Amount > 0 ? "&r&a+ " : "&r&c- ") + Math.abs(this.todoPickUpLog[i].Amount) + "x &f" + i)
            })
        } else {
            this.todoPickUpLog = {};
        }
        // doesn't need to put setText() in if (pick) cuz if (!pick) it clears the todo log list
        this.sbaItemPickUpLogElement.setText((inGui || this.clearLog) ? "" : (todoText.join("\n")))
    }

    mobThings() {
        if (!this.fancyVanquisherAlert.getValue()) return
        World.getAllEntitiesOfType(net.minecraft.entity.item.EntityArmorStand).forEach(entity => {
            let name = entity.getName()
            if (name.includes("'s")) return
            let LowerName = name.removeFormatting().toLowerCase()
            let existedTicks = entity.getTicksExisted()
            if (this.fancyVanquisherAlert.getValue()) {
                if (LowerName.includes("vanq")) {
                    if (existedTicks <= 20) {
                        Client.showTitle("&r&5&l[&b&l&kO&5&l] VANQUISHER &5[&b&l&kO&5&l]", "", 0, 50, 10);
                    }
                }
            }
            if (this.fancySeaCreaturesAlertThunder.getValue()) {
                if (LowerName.includes("thunder")) {
                    if (existedTicks <= 20) {
                        Client.showTitle("&r&6&l[&b&l&kO&6&l] THUNDER [&b&l&kO&6&l]", "", 0, 50, 10)
                    }
                }
            }
            if (this.fancySeaCreaturesAlertJawbus.getValue()) {
                if (LowerName.includes("jawbus")) {
                    if (existedTicks <= 20) {
                        Client.showTitle("&r&6&l[&b&l&kO&6&l] LORD JAWBUS [&b&l&kO&6&l]", "", 0, 50, 10)
                    }
                }
            }
        })
    }

    preventGoingBrrr() {
        this.clearLog = true
        delay(8000, () => {
            if (this.clearLog) {
                this.clearLog = false
            }
        })
    }

    itemTooltipEvent(lore, i, event) {
        let uuid = getSBUUID(i)
        if (!uuid) return

        if (this.itemWorth.getValue()) {
            let a = socketConnection.itemPricesCache.get(uuid)

            if (!a && socketConnection.itemPricesCache2.get(uuid)) {
                a = socketConnection.itemPricesCache2.get(uuid)
                socketConnection.itemPricesCache.set(uuid, a)
            }

            if (a) {
                addLore(i, "§eWorth: ", "§6$" + numberWithCommas(Math.round(a)))
            }
        }

        if (this.showChampion.getValue() && i?.getNBT()?.getCompoundTag("tag")?.getCompoundTag("ExtraAttributes")?.getDouble("champion_combat_xp")) {
            let xp = i?.getNBT()?.getCompoundTag("tag")?.getCompoundTag("ExtraAttributes")?.getDouble("champion_combat_xp")

            let level = 1
            championLevels.forEach(l => {
                if (xp >= l) level++
            })
            let xpNext = championLevels[level - 1]

            addLore(i, "§eChampion: ", "§d" + level + " §6" + numberWithCommas(Math.round(xp)) + (xpNext ? " §7/ §6" + numberWithCommas(Math.round(xpNext)) : ""))
        }
        if (this.showHecatomb.getValue() && i?.getNBT()?.getCompoundTag("tag")?.getCompoundTag("ExtraAttributes")?.getInteger("hecatomb_s_runs")) {
            let runs = i?.getNBT()?.getCompoundTag("tag")?.getCompoundTag("ExtraAttributes")?.getInteger("hecatomb_s_runs")

            let level = 1
            hecatombLevels.forEach(l => {
                if (runs >= l) level++
            })
            let xpNext = hecatombLevels[level - 1]

            addLore(i, "§eHecatomb: ", "§d" + level + " §6" + numberWithCommas(Math.round(runs)) + (xpNext ? " §7/ §6" + numberWithCommas(Math.round(xpNext)) : ""))
        }
    }

    updateItemLores() {
        if (!this.itemWorth.getValue()) return;

        if (!Player.getInventory()) return

        let items = [...Player.getInventory().getItems(), ...Player.getContainer().getItems()]

        items.forEach(i => {
            let uuid = getSBUUID(i)
            if (!uuid) return

            if (this.itemWorth.getValue()) {
                let a = socketConnection.itemPricesCache.get(uuid)

                if (!a && socketConnection.itemPricesCache2.get(uuid)) {
                    a = socketConnection.itemPricesCache2.get(uuid)
                    socketConnection.itemPricesCache.set(uuid, a)
                }

                if (!a) {
                    if (!this.requestingPrices.has(uuid)) {
                        this.requestingPrices.add(uuid)

                        let json = i.getNBT().toObject()
                        socketConnection.requestItemPrice(json, uuid)
                    }
                }

            }

        })
    }

    addToTodoPickUpLog(timestamp, itemname, amount) {
        let basicValue = 0
        if (this.todoPickUpLog[itemname]) {
            if (this.todoPickUpLog[itemname].Amount != 0) {
                basicValue = this.todoPickUpLog[itemname].Amount
            }
        }
        this.todoPickUpLog[itemname] = {
            timeStamp: timestamp,
            Amount: basicValue + amount
        }
    }

    initOldItemData() {
        let j = 0;
        [...Player.getInventory().getItems()].forEach(i => {
            j++;
            this.oldItemData[j] = i
        })
    }

    saveItemData(uuid, newName) {
        if (!this.itemData[uuid]) {
            this.itemData[uuid] = newName
        }
    }

    // renderWebpage() {
    //     let url = this.getField(Client.currentGui.get(), f.linkText)

    //     let image = renderLibs.getImage("https://soopy.dev/api/soopyv2/webpage?webpage=" + url)

    //     if (image) {
    //         let scale = Renderer.screen.getHeight() * 0.5 / image.getTextureHeight()
    //         image.draw(Renderer.screen.getWidth() / 2 - image.getTextureWidth() * scale / 2, Renderer.screen.getHeight() / 2, scale * image.getTextureWidth(), scale * image.getTextureHeight())
    //     } else {
    //         Renderer.drawString("Loading website preview...", Renderer.screen.getWidth() / 2 - Renderer.getStringWidth("Loading website preview...") / 2, Renderer.screen.getHeight() * 3 / 4)
    //     }
    // }

    guiClicked(mouseX, mouseY, button, gui, event) {
        if (gui.class.toString() === "class net.minecraft.client.gui.inventory.GuiChest" && Player.getContainer().getName() === "Cookie Clicker v0.01") {

            let hoveredSlot = gui.getSlotUnderMouse()
            if (!hoveredSlot) return

            let hoveredSlotId = hoveredSlot[f.slotNumber]

            // logger.logMessage(hoveredSlotId, 4)

            Player.getContainer().click(hoveredSlotId, false, "MIDDLE")
            cancel(event)
        }
    }

    tickCookie() {
        let cookies = parseInt(ChatLib.removeFormatting(Player.getContainer().getStackInSlot(13).getName().split(" ")[0]))

        let cookiesGained = cookies - this.lastCookies
        this.lastCookies = cookies
        if (cookiesGained > 50) cookiesGained = 0
        if (cookiesGained < 1) cookiesGained = 0
        if (!cookiesGained) cookiesGained = 0

        socketConnection.cookiesGained(cookiesGained)
    }

    renderCookie() {
        let cookies = parseInt(ChatLib.removeFormatting(Player.getContainer().getStackInSlot(13).getName().split(" ")[0]))

        let cookiesGained = cookies - this.lastCookies
        let cookieCount = socketConnection.cookieCount + ((cookiesGained < 50 && cookiesGained > 0) ? cookiesGained : 0)

        renderLibs.drawString("Lifetime Cookies: " + numberWithCommas(cookieCount), 10, 10, 1)

        if (socketConnection.cookieData) {
            // this.cookieData = {
            //     cookieLeaderboard: data.cookieLeaderboard,
            //     clickingNow: data.clickingNow
            // }

            let linesOfText = []

            linesOfText.push("---- CURRENTLY CLICKING ----")
            for (let data of socketConnection.cookieData.clickingNow) {
                linesOfText.push(data[0] + ": " + numberWithCommas(data[1]))

                if (linesOfText.length * 10 > Renderer.screen.getHeight() / 2) break
            }
            linesOfText.push("------- LEADERBOARD -------")
            let i = 0
            for (let data of socketConnection.cookieData.cookieLeaderboard) {
                i++

                linesOfText.push("#" + i + " " + data[0] + ": " + numberWithCommas(data[1]))

                if (linesOfText.length * 10 > Renderer.screen.getHeight() - 50) break
            }

            for (let i = 0; i < linesOfText.length; i++) {
                renderLibs.drawString(linesOfText[i], 10, 20 + 10 * i, 1)
            }
        }
    }

    fixNEU() {
        if (Client.currentGui && Client.currentGui.get() instanceof (this.GuiProfileViewer) && this.fixNeuNetworth.getValue()) {
            let guiProfileViewer = Client.currentGui.get()
            if (!guiProfileViewer.profile || !guiProfileViewer.profile.getHypixelProfile()) return
            let uuid = guiProfileViewer.profile.getHypixelProfile().get("uuid").getAsString().replace(/-/g, "")

            if (this.currentPlayerOpen != uuid) {
                this.currentPlayerOpen = uuid
                this.currentPlayerNetworth = {}

                fetch("http://soopy.dev/api/v2/player_skyblock/" + uuid).json(data => {
                    if (!data.success) return

                    if (this.currentPlayerOpen === data.data.uuid) {
                        Object.keys(data.data.profiles).forEach(profileId => {
                            if (!data.data.profiles[profileId].members[uuid].soopyNetworth.networth) return
                            this.currentPlayerNetworth[data.data.profiles[profileId].stats.cute_name] = JavaLong.valueOf(data.data.profiles[profileId].members[uuid].soopyNetworth.networth)
                        })
                    }
                })
            }

            let map = this.getField(guiProfileViewer.profile, "networth")
            Object.keys(this.currentPlayerNetworth).forEach(key => {
                map.put(new JavaString(key), new JavaLong(this.currentPlayerNetworth[key]))
            })
        }
    }

    getField(e, field) {
        let field2 = e.class.getDeclaredField(field);

        field2.setAccessible(true)

        return field2.get(e)
    }

    soopyWeight(user) {

        ChatLib.chat(this.FeatureManager.messagePrefix + "Finding senither weight for " + user)

        fetch("http://soopy.dev/api/v2/player/" + user).json(userData => {
            if (!userData.success) {
                ChatLib.chat(this.FeatureManager.messagePrefix + "&cError loading data: " + userData.error.description)
                return
            }

            fetch("http://soopy.dev/api/v2/player_skyblock/" + userData.data.uuid).json(sbData => {

                if (!sbData.success) {
                    ChatLib.chat(this.FeatureManager.messagePrefix + "&cError loading data: " + sbData.error.description)
                    return
                }

                ChatLib.chat("&c" + ChatLib.getChatBreak("-"))
                ChatLib.chat(userData.data.stats.nameWithPrefix + "'s senither weight (best profile):")
                ChatLib.chat("&aTotal: &b" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.total)))
                new Message(new TextComponent("&aSkills: &b" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.skill.total)))
                    .setHover("show_text", Object.keys(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.skill).map(skill => {
                        if (skill === "total") {
                            return null
                        }
                        return "&a" + firstLetterCapital(skill) + ": &b" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.skill[skill].total)) + " &7(" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.skill[skill].weight)) + " | " + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.skill[skill].overflow)) + ")"
                    }).filter(a => a).join("\n"))).chat()
                new Message(new TextComponent("&aSlayer: &b" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.slayer.total)))
                    .setHover("show_text", Object.keys(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.slayer).map(slayer => {
                        if (slayer === "total") {
                            return null
                        }
                        return "&a" + firstLetterCapital(slayer) + ": &b" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.slayer[slayer].total)) + " &7(" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.slayer[slayer].weight)) + " | " + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.slayer[slayer].overflow)) + ")"
                    }).filter(a => a).join("\n"))).chat()
                new Message(new TextComponent("&aDungeon: &b" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.dungeons.total)))
                    .setHover("show_text", Object.keys(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.dungeons).map(dungeons => {
                        if (dungeons === "total") {
                            return null
                        }
                        return "&a" + firstLetterCapital(dungeons) + ": &b" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.dungeons[dungeons].total)) + " &7(" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.dungeons[dungeons].weight)) + " | " + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.dungeons[dungeons].overflow)) + ")"
                    }).filter(a => a).join("\n"))).chat()
                if (sbData.data.stats.bestProfileId !== sbData.data.stats.currentProfileId) {
                    ChatLib.chat(userData.data.stats.nameWithPrefix + "'s senither weight (current profile):")
                    ChatLib.chat("&aTotal: &b" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.total)))
                    new Message(new TextComponent("&aSkills: &b" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.skill.total)))
                        .setHover("show_text", Object.keys(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.skill).map(skill => {
                            if (skill === "total") {
                                return null
                            }
                            return "&a" + firstLetterCapital(skill) + ": &b" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.skill[skill].total)) + " &7(" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.skill[skill].weight)) + " | " + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.skill[skill].overflow)) + ")"
                        }).filter(a => a).join("\n"))).chat()
                    new Message(new TextComponent("&aSlayer: &b" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.slayer.total)))
                        .setHover("show_text", Object.keys(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.slayer).map(slayer => {
                            if (slayer === "total") {
                                return null
                            }
                            return "&a" + firstLetterCapital(slayer) + ": &b" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.slayer[slayer].total)) + " &7(" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.slayer[slayer].weight)) + " | " + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.slayer[slayer].overflow)) + ")"
                        }).filter(a => a).join("\n"))).chat()
                    new Message(new TextComponent("&aDungeon: &b" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.dungeons.total)))
                        .setHover("show_text", Object.keys(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.dungeons).map(dungeons => {
                            if (dungeons === "total") {
                                return null
                            }
                            return "&a" + firstLetterCapital(dungeons) + ": &b" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.dungeons[dungeons].total)) + " &7(" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.dungeons[dungeons].weight)) + " | " + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.dungeons[dungeons].overflow)) + ")"
                        }).filter(a => a).join("\n"))).chat()
                }
                ChatLib.chat("&c" + ChatLib.getChatBreak("-"))

            })
        })
    }

    showFirstLoadPage() {
        if (!this.ranFirstLoadThing && World.isLoaded() && !this.firstLoadPageData.shown) {
            ChatLib.chat(this.FeatureManager.messagePrefix + "Opening first load page, if you accidentally close it run /soopyv2 and click the button")
            ChatLib.command("soopyv2 first_load_thing", true)
            this.ranFirstLoadThing = true
            this.firstLoadPageData.shown = true
            this.firstLoadPageData.version = 1
            FileLib.write("soopyAddonsData", "soopyv2firstloaddata.json", JSON.stringify(this.firstLoadPageData))
        }
    }
    verifyKey(key) {
        // console.log(key)
        if (key) {
            try {
                var url = "https://api.hypixel.net/key?key=" + key
                let data = fetch(url).json()

                // console.log(data)

                if (data.success) {
                    return true
                } else {
                    return false
                }
            } catch (e) {
                return false
            }
        } else {
            return false
        }
    }
    findKey() {
        new Notification("Finding key...", [])
        new Thread(() => {

            //       NEU
            try {
                let testKey = JSON.parse(new JavaString(Files.readAllBytes(Paths.get("./config/notenoughupdates/configNew.json")))).apiKey.apiKey
                if (testKey) {
                    if (this.verifyKey(testKey)) {
                        this.apiKeySetting.setValue(testKey)
                        new Notification("§aSuccess!", ["Found api key in NotEnoughUpdates!"])
                        return;
                    } else {
                        logger.logMessage("Found invalid key in NotEnoughUpdates", 3)
                    }
                }
            } catch (_) { }

            //       SBE
            try {
                let testKey = JSON.parse(new JavaString(Files.readAllBytes(Paths.get("./config/SkyblockExtras.cfg")))).values.apiKey
                if (testKey) {
                    if (this.verifyKey(testKey)) {
                        this.apiKeySetting.setValue(testKey)
                        new Notification("§aSuccess!", ["Found api key in SkyblockExtras!"])
                        return;
                    } else {
                        logger.logMessage("Found invalid key in SkyblockExtras", 3)
                    }
                }
            } catch (_) { }
            //       SKYTILS
            try {
                let testKey2 = new JavaString(Files.readAllBytes(Paths.get("./config/skytils/config.toml")))
                let testKey = undefined
                testKey2.split("\n").forEach(line => {
                    if (line.startsWith("		hypixel_api_key = \"")) {
                        testKey = line.split("\"")[1]
                    }
                })
                if (testKey) {
                    if (this.verifyKey(testKey)) {
                        this.apiKeySetting.setValue(testKey)
                        new Notification("§aSuccess!", ["Found api key in Skytils!"])
                        return;
                    } else {
                        logger.logMessage("Found invalid key in Skytils", 3)
                    }
                }
            } catch (_) { }

            //       SOOPYADDONS DATA
            try {
                let testKey = FileLib.read("soopyAddonsData", "apikey.txt")
                if (testKey) {
                    if (this.verifyKey(testKey)) {
                        this.apiKeySetting.setValue(testKey)
                        new Notification("§aSuccess!", ["Found api key in old soopyaddons version!"])
                        return;
                    } else {
                        logger.logMessage("Found invalid key in soopyaddonsData", 3)
                    }
                }
            } catch (_) { }

            //       HypixelApiKeyManager
            try {
                let testKey = JSON.parse(FileLib.read("HypixelApiKeyManager", "localdata.json")).key
                if (testKey) {
                    if (this.verifyKey(testKey)) {
                        this.apiKeySetting.setValue(testKey)
                        new Notification("§aSuccess!", ["Found api key in HypixelApiKeyManager!"])
                        return;
                    } else {
                        logger.logMessage("Found invalid key in HypixelApiKeyManager", 3)
                    }
                }
            } catch (_) { }


            new Notification("§cUnable to find api key", [])
        }).start()
    }

    apiNewCommand() {
        ChatLib.command("api new")
    }

    verifyKey2(key) {
        if (key) {
            try {
                var url = "https://api.hypixel.net/key?key=" + key
                let data = fetch(url).json()

                if (data.success) {
                    return true
                } else {
                    return false
                }
            } catch (e) {
                return false
            }
        }
        if (this.module.apiKeySetting.getValue() == "") {
            new Notification("§cError!", ["You need to set an api key first!"])
            return
        }


        new Thread(() => {
            try {
                var url = "https://api.hypixel.net/key?key=" + this.module.apiKeySetting.getValue()
                let data = fetch(url).json()

                if (data.success) {
                    new Notification("§aSuccess!", ["Your api key is valid!"])
                    return
                } else {
                    new Notification("§cError!", ["Your api key is invalid!"])
                    return
                }
            } catch (e) {
                new Notification("§cError!", ["Your api key is invalid!"])
                return
            }
        }).start()
    }

    newKey(key, event) {
        ChatLib.chat(this.FeatureManager.messagePrefix + "Copied api key!")
        this.apiKeySetting.setValue(key)
    }

    initVariables() {
        this.hudElements = [];
    }

    onDisable() {
        this.hudElements.forEach(h => h.delete())
        this.initVariables()
    }
}

class FirstLoadingPage extends GuiPage {
    constructor(mainThing) {
        super(-10)

        this.showBackButton = false

        this.name = "First load thing"

        this.mainThing = mainThing

        this.pageThings = []

        firstLoadPages.forEach((page, i) => {
            let newPage = this.newPage()

            newPage.addChild(page)

            page.setLoc(i !== 0, i !== firstLoadPages.length - 1)
            page.guiPage = this

            this.pageThings.push(newPage)
        })

        this.pageNum = 0

        this.finaliseLoading()
    }

    nextPage() {
        this.pageNum++

        this.goToPage(this.pageNum)
    }

    prevPage() {
        this.pageNum--

        this.goToPage(this.pageNum)
    }

    onOpen() {
        this.pageNum = 0

        firstLoadPages.forEach((page, i) => {
            page.load()
        })
    }
}

module.exports = {
    class: new GlobalSettings()
}


const ByteArrayInputStream = Java.type("java.io.ByteArrayInputStream")
const Base64 = Java.type("java.util.Base64")
const CompressedStreamTools = Java.type("net.minecraft.nbt.CompressedStreamTools")
function decompress(compressed) {
    if (compressed === null || compressed.length == 0) {
        return null
    }

    return new NBTTagCompound(CompressedStreamTools.func_74796_a(new ByteArrayInputStream(Base64.getDecoder().decode(compressed))))
}