@@ -343,15 +343,6 @@ class SettingGui {
343
343
344
344
this . addToggle ( "Spirit leap overlay" , "spiritLeapOverlay" , this . currentSettings . spiritLeapOverlay ) [ 1 ] . setLore ( [ "You can click on player heads in overlay!" , "Most people probs wont like the design though." ] )
345
345
346
- this . addSidebarElement ( new ButtonWithArrow ( ) . setText ( "&0Load api key from other mods" ) . addEvent ( new SoopyMouseClickEvent ( ) . setHandler ( ( ) => {
347
- findKey ( key => {
348
- this . setApiKey ( key )
349
- } )
350
- } ) ) , 0.3 , 0.4 , 0.075 )
351
- this . addSidebarElement ( ) // Adds a gap because the button diddnt auto add one
352
-
353
- this . apiKeySetting = this . addHiddenString ( "Api key" , "apiKey" , this . currentSettings . apiKey ) [ 0 ]
354
-
355
346
this . addToggle ( "Show dev info" , "devInfo" , this . currentSettings . devInfo )
356
347
357
348
// END OF SETTINGS
@@ -402,21 +393,9 @@ class SettingGui {
402
393
Renderer . drawRect ( Renderer . color ( 0 , 0 , 0 , this . backgroundOpacity . get ( ) ) , 0 , 0 , Renderer . screen . getWidth ( ) , Renderer . screen . getHeight ( ) )
403
394
}
404
395
405
- register ( "chat" , ( key , event ) => { // Api key detection
406
- ChatLib . chat ( MESSAGE_PREFIX + "Copied api key!" )
407
-
408
- this . setApiKey ( key )
409
- } ) . setChatCriteria ( "&aYour new API key is &r&b${key}&r" )
410
-
411
396
this . generateChangelog ( )
412
397
}
413
398
414
- setApiKey ( key ) {
415
- this . apiKeySetting . setText ( key )
416
-
417
- this . changed ( "apiKey" , key )
418
- }
419
-
420
399
/**
421
400
* Will add a gear to the right of the last added setting
422
401
* @param {function():Boolean } shouldShowFun
@@ -738,126 +717,6 @@ class SettingGui {
738
717
739
718
export default SettingGui
740
719
741
-
742
- function verifyApiKeySync ( key ) {
743
- if ( key ) {
744
- try {
745
- var url = "https://api.hypixel.net/key?key=" + key
746
- let data = fetch ( url ) . json ( )
747
-
748
- return ! ! data . success
749
- } catch ( e ) {
750
- return false
751
- }
752
- } else {
753
- return false
754
- }
755
- }
756
-
757
- const JavaString = Java . type ( "java.lang.String" )
758
- const JavaLong = Java . type ( "java.lang.Long" )
759
- const Files = Java . type ( "java.nio.file.Files" )
760
- const Paths = Java . type ( "java.nio.file.Paths" )
761
- /**
762
- * NOTE: this will display a notification with key finding information
763
- */
764
- function findKey ( callback = ( ) => { } ) {
765
- new Thread ( ( ) => {
766
-
767
- // NEU
768
- try {
769
- let testKey = JSON . parse ( new JavaString ( Files . readAllBytes ( Paths . get ( "./config/notenoughupdates/configNew.json" ) ) ) ) . apiKey . apiKey
770
- if ( testKey ) {
771
- if ( verifyApiKeySync ( testKey ) ) {
772
- new Notification ( "§aSuccess!" , [ "Found api key in NotEnoughUpdates!" ] )
773
- callback ( testKey )
774
- return ;
775
- } else {
776
- console . log ( "[BETERMAP] Found invalid key in NotEnoughUpdates" )
777
- }
778
- }
779
- } catch ( _ ) { }
780
-
781
- // SBE
782
- try {
783
- let testKey = JSON . parse ( new JavaString ( Files . readAllBytes ( Paths . get ( "./config/SkyblockExtras.cfg" ) ) ) ) . values . apiKey
784
- if ( testKey ) {
785
- if ( verifyApiKeySync ( testKey ) ) {
786
- new Notification ( "§aSuccess!" , [ "Found api key in SkyblockExtras!" ] )
787
- callback ( testKey )
788
- return ;
789
- } else {
790
- console . log ( "[BETERMAP] Found invalid key in SkyblockExtras" )
791
- }
792
- }
793
- } catch ( _ ) { }
794
- // SKYTILS
795
- try {
796
- let testKey2 = new JavaString ( Files . readAllBytes ( Paths . get ( "./config/skytils/config.toml" ) ) )
797
- let testKey = undefined
798
- testKey2 . split ( "\n" ) . forEach ( line => {
799
- if ( line . startsWith ( " hypixel_api_key = \"" ) ) {
800
- testKey = line . split ( "\"" ) [ 1 ]
801
- }
802
- } )
803
- if ( testKey ) {
804
- if ( verifyApiKeySync ( testKey ) ) {
805
- new Notification ( "§aSuccess!" , [ "Found api key in Skytils!" ] )
806
- callback ( testKey )
807
- return ;
808
- } else {
809
- console . log ( "[BETERMAP] Found invalid key in Skytils" )
810
- }
811
- }
812
- } catch ( _ ) { }
813
-
814
- // SOOPYADDONS DATA
815
- try {
816
- let testKey = FileLib . read ( "soopyAddonsData" , "apikey.txt" )
817
- if ( testKey ) {
818
- if ( verifyApiKeySync ( testKey ) ) {
819
- new Notification ( "§aSuccess!" , [ "Found api key in old soopyaddons version!" ] )
820
- callback ( testKey )
821
- return ;
822
- } else {
823
- console . log ( "[BETERMAP] Found invalid key in soopyaddonsData" )
824
- }
825
- }
826
- } catch ( _ ) { }
827
-
828
- // SOOPYV2
829
- try {
830
- let testKey = JSON . parse ( FileLib . read ( "soopyAddonsData" , "soopyaddonsbetafeaturesdata.json" ) ) . globalSettings . subSettings . api_key . value
831
- if ( testKey ) {
832
- if ( verifyApiKeySync ( testKey ) ) {
833
- new Notification ( "§aSuccess!" , [ "Found api key in old soopyaddons version!" ] )
834
- callback ( testKey )
835
- return ;
836
- } else {
837
- console . log ( "[BETERMAP] Found invalid key in soopyaddonsData" )
838
- }
839
- }
840
- } catch ( _ ) { }
841
-
842
- // HypixelApiKeyManager
843
- try {
844
- let testKey = JSON . parse ( FileLib . read ( "HypixelApiKeyManager" , "localdata.json" ) ) . key
845
- if ( testKey ) {
846
- if ( verifyApiKeySync ( testKey ) ) {
847
- new Notification ( "§aSuccess!" , [ "Found api key in HypixelApiKeyManager!" ] )
848
- callback ( testKey )
849
- return ;
850
- } else {
851
- console . log ( "[BETERMAP] Found invalid key in HypixelApiKeyManager" )
852
- }
853
- }
854
- } catch ( _ ) { }
855
-
856
-
857
- new Notification ( "§cUnable to find api key" , [ ] )
858
- } ) . start ( )
859
- }
860
-
861
720
function isNumber ( val ) {
862
721
if ( val . includes ( "." ) ) return false
863
722
val = "" + val ; // Coerce num to be a string
0 commit comments