aboutsummaryrefslogtreecommitdiff
path: root/features/globalSettings/index.js
blob: 422754f06bd48eeea30a4b3cca08830834fb1547 (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
/// <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";

class Hud extends Feature {
    constructor() {
        super()
    
        this.initVariables()
    }

    initVariables(){

        this.apiKeySetting = 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.verifyKey, undefined)

        this.notifyNewVersion = new ToggleSetting("Notify when there is a new update", "Will notify you when there is a new version of soopyv2 avalible for download", true, "notify_update", this) //TODO: Make false by default when uploaded on ct website

        this.registerChat("&aYour new API key is &r&b${key}&r", this.newKey)
    }

    verifyKey(){
        if(this.module.apiKeySetting.getValue() == ""){
            ChatLib.chat("&c[SOOPY V2] You need to set an api key first!")
            return
        }

        var url = "https://api.hypixel.net/key?key=" + this.module.apiKeySetting.getValue()
        
        ChatLib.chat("&c[SOOPY V2] The rest of checking is yet to be coded!")
    }

    newKey(key){
        ChatLib.chat("&c[SOOPY V2] Copied api key!")
        this.apiKeySetting.setValue(key)
    }

    onDisable(){
        this.fpsEnabledSetting.delete()

        this.initVariables()
    }
}

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