aboutsummaryrefslogtreecommitdiff
path: root/src/index.js
blob: ef29e2123a2181d1fcf639f6ff7f81d76ba9ef38 (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
/// <reference types="../../CTAutocomplete" />

import NonPooledThread from "./utils/nonPooledThread.js"

/// <reference lib="es2015" />

if (net.minecraftforge.fml.common.Loader.isModLoaded("soopyv2forge")) {
    new NonPooledThread(() => {
        while (!Java.type("me.soopyboo32.soopyv2forge.SoopyV2Forge").INSTANCE) {
            Thread.sleep(1000)
        }

        Java.type("me.soopyboo32.soopyv2forge.SoopyV2Forge").INSTANCE.soopyIsInstalled()
    }).start()
}

const File = Java.type("java.io.File")
class SoopyAddons {
    constructor() {
        this.FeatureManager = require("./featureClass/featureManager.js")

        this.FeatureManager.parent = this
    }
}
if (FileLib.read("soopyAddonsData", "deletesoopyv1please.txt") === "true") {
    new Thread(() => {
        Thread.sleep(2000)
        FileLib.deleteDirectory(new File("./config/ChatTriggers/modules/soopyAddons"))

        FileLib.write("soopyAddonsData", "deletesoopyv1please.txt", "false")

        ChatLib.command("ct reload", true)
    }).start()
} else {
    let a = register("worldLoad", () => {
        if (FileLib.read("soopyAddonsData", "firstload.txt") !== "true") {
            b = register("tick", () => {
                new Thread(() => {
                    ChatLib.chat("&7Loading SoopyV2 required modules...") //idk what to say to chat, but it requires an extra ct load after starting to load stuff like mappings (maby this should be part of mappings module, but i put it here so it doesent try to load the first load page thingo)
                    FileLib.write("soopyAddonsData", "firstload.txt", "true")
                    Thread.sleep(2000)

                    ChatLib.command("ct reload", true)
                }).start()

                b.unregister()
            })
        } else {
            new SoopyAddons()
        }
        a.unregister()
    })
}

if (new File("./config/ChatTriggers/modules/SoopyV2UpdateButtonPatcher").exists()) {
    new Thread(() => {
        Thread.sleep(2000)
        ChatLib.chat("&7Deleting SoopyV2UpdateButtonPatcher as its no longer needed")
        FileLib.deleteDirectory(new File("./config/ChatTriggers/modules/SoopyV2UpdateButtonPatcher"))
    }).start()
}