-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClient.java
90 lines (80 loc) · 3.65 KB
/
Client.java
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
package cat;
import java.util.Arrays;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import org.lwjgl.opengl.Display;
import com.google.common.eventbus.EventBus;
import cat.client.ConfigManager;
import cat.client.HWID;
import cat.command.CommandManager;
import cat.events.EventManager;
import cat.module.ModuleManager;
import cat.module.modules.render.ClickGUI;
import cat.ui.GuiMain;
import cat.ui.clickgui.ClickGui;
import cat.ui.notifications.NotificationManager;
import cat.ui.notifications.NotificationType;
import cat.util.ClientUtils;
public class BlueZenith {
private static final String[] devs = {"b37a1f28a445269e1b861df5ddf35c29742aa4764d32173c166ad9b2a2fc7546"};
public static String currentServerIP;
public static String name = "t";
public static String version = "b1.0";
public static boolean useExperimentalEventBus = true;
public static EventManager eventManager;
public static EventBus eventBus;
public static ModuleManager moduleManager;
public static CommandManager commandManager;
public static GuiMain guiMain;
public static ExecutorService executorService = Executors.newSingleThreadExecutor();
public static ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1);
private static long startTime;
private static boolean isDeveloper = false;
private BlueZenith() {}
public static void start() {
startTime = System.currentTimeMillis();
HWID.getHWID();
isDeveloper = Arrays.stream(devs).anyMatch(hwid -> hwid.equalsIgnoreCase(HWID.hwid));
ClientUtils.getLogger().info("Starting " + name + " " + version);
if(useExperimentalEventBus)
eventBus = new EventBus();
eventManager = new EventManager();
ClientUtils.getLogger().info("Started event manager.");
moduleManager = new ModuleManager();
ClientUtils.getLogger().info("Loaded " + moduleManager.getModules().size() + " modules.");
commandManager = new CommandManager();
ClientUtils.getLogger().info("Loaded " + commandManager.commands.size() + " commands.");
hook();
ClientUtils.getLogger().info("Added a shutdown hook.");
ConfigManager.load("default", false, false);
ConfigManager.loadBinds();
ClientUtils.getLogger().info("Loaded the default config and binds.");
guiMain = new GuiMain();
ClickGUI.clickGui = new ClickGui();
ConfigManager.loadClickGUIPanels();
ClientUtils.getLogger().info("Created ClickGUI.");
Display.setTitle(name + " | 1.8.9 | " + version + (isDeveloper ? " | Developer" : " Beta"));
ClientUtils.getLogger().info("Started in " + (System.currentTimeMillis() - startTime) + " ms.");
NotificationManager.addNoti("Started in " + (System.currentTimeMillis() - startTime) + " ms.", "", NotificationType.SUCCESS, 5000);
}
private static void hook() {
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
moduleManager.getModule(ClickGUI.class).setState(false);
eventManager.shutdown();
ConfigManager.save("default");
ConfigManager.saveBinds();
ConfigManager.saveClickGUIPanels();
}));
}
public static void register(Object listener) {
if(useExperimentalEventBus)
eventBus.register(listener);
else eventManager.registerListener(listener);
}
public static void unregister(Object listener) {
if(useExperimentalEventBus)
eventBus.unregister(listener);
else eventManager.unregisterListener(listener);
}
}