|
1 |
| -package net.sssssssthedev.SmartClient.module; |
2 |
| - |
3 |
| -import net.minecraft.client.Minecraft; |
4 |
| -import net.sssssssthedev.SmartClient.Main; |
5 |
| -import net.sssssssthedev.SmartClient.ui.notification.Notification; |
6 |
| -import net.sssssssthedev.SmartClient.ui.notification.NotificationManager; |
7 |
| -import net.sssssssthedev.SmartClient.ui.notification.NotificationType; |
8 |
| -import net.sssssssthedev.SmartClient.utils.Wrapper; |
9 |
| - |
10 |
| -public class Module { |
11 |
| - |
12 |
| - protected Minecraft mc = Minecraft.getMinecraft(); |
13 |
| - |
14 |
| - private String name, displayname; |
15 |
| - private int key; |
16 |
| - private Category category; |
17 |
| - private boolean toggled; |
18 |
| - |
19 |
| - public Module(String name, int key, Category category) { |
20 |
| - this.name = name; |
21 |
| - this.key = key; |
22 |
| - this.category = category; |
23 |
| - toggled = false; |
24 |
| - |
25 |
| - setup(); |
26 |
| - } |
27 |
| - |
28 |
| - public void onEnable() { |
29 |
| - Main.instance.eventManager.register(this); |
30 |
| - } |
31 |
| - |
32 |
| - public void onDisable() { |
33 |
| - Main.instance.eventManager.unregister(this); |
34 |
| - } |
35 |
| - |
36 |
| - public void onToggle() { |
37 |
| - } |
38 |
| - |
39 |
| - public void toggle() { |
40 |
| - toggled = !toggled; |
41 |
| - onToggle(); |
42 |
| - if(toggled) { |
43 |
| - onEnable(); |
44 |
| - if (!getDisplayName().equals("ClickGUI")) |
45 |
| - NotificationManager.show(new Notification(NotificationType.INFO, getDisplayName(), "Turned On", 1)); |
46 |
| - } else { |
47 |
| - onDisable(); |
48 |
| - if (!getDisplayName().equals("ClickGUI")) { |
49 |
| - NotificationManager.show(new Notification(NotificationType.INFO, getDisplayName(), "Turned Off", 1)); |
50 |
| - } |
51 |
| - } |
52 |
| - |
53 |
| - } |
54 |
| - |
55 |
| - public String getName() { |
56 |
| - return name; |
57 |
| - } |
58 |
| - |
59 |
| - public void setName(String name) { |
60 |
| - this.name = name; |
61 |
| - } |
62 |
| - |
63 |
| - public int getKey() { |
64 |
| - return key; |
65 |
| - } |
66 |
| - |
67 |
| - public void setKey(int key) { |
68 |
| - this.key = key; |
69 |
| - } |
70 |
| - |
71 |
| - public Category getCategory() { |
72 |
| - return category; |
73 |
| - } |
74 |
| - |
75 |
| - public void setCategory(Category category) { |
76 |
| - this.category = category; |
77 |
| - } |
78 |
| - |
79 |
| - public boolean isToggled() { |
80 |
| - return toggled; |
81 |
| - } |
82 |
| - |
83 |
| - public String getDisplayName() { |
84 |
| - return displayname == null ? name : displayname; |
85 |
| - } |
86 |
| - |
87 |
| - public void setDisplayName(String displayName) { |
88 |
| - this.displayname = displayName; |
89 |
| - } |
90 |
| - |
91 |
| - public void setup() { |
92 |
| - |
93 |
| - } |
94 |
| - |
95 |
| - public String getKeyName() { |
96 |
| - return Wrapper.getKeyName(key); |
97 |
| - } |
98 |
| -} |
| 1 | +package net.sssssssthedev.SmartClient.annotations.modules; |
| 2 | + |
| 3 | +import net.minecraft.client.Minecraft; |
| 4 | +import net.sssssssthedev.SmartClient.Main; |
| 5 | +import net.sssssssthedev.SmartClient.annotations.version.IVersion; |
| 6 | +import net.sssssssthedev.SmartClient.module.Category; |
| 7 | +import net.sssssssthedev.SmartClient.ui.notification.Notification; |
| 8 | +import net.sssssssthedev.SmartClient.ui.notification.NotificationManager; |
| 9 | +import net.sssssssthedev.SmartClient.ui.notification.NotificationType; |
| 10 | +import net.sssssssthedev.SmartClient.utils.Wrapper; |
| 11 | + |
| 12 | +public class Module { |
| 13 | + |
| 14 | + protected Minecraft mc = Minecraft.getMinecraft(); |
| 15 | + |
| 16 | + private String name, displayname; |
| 17 | + private int key; |
| 18 | + private Category category; |
| 19 | + private boolean toggled; |
| 20 | + |
| 21 | + public Module() { |
| 22 | + this.name = (getClass().getAnnotation(IModule.class)).name(); |
| 23 | + this.key = (getClass().getAnnotation(IModule.class)).key(); |
| 24 | + this.category = (getClass().getAnnotation(IModule.class)).category(); |
| 25 | + toggled = false; |
| 26 | + |
| 27 | + setup(); |
| 28 | + } |
| 29 | + |
| 30 | + public void onEnable() { |
| 31 | + Main.instance.eventManager.register(this); |
| 32 | + } |
| 33 | + |
| 34 | + public void onDisable() { |
| 35 | + Main.instance.eventManager.unregister(this); |
| 36 | + } |
| 37 | + |
| 38 | + public void onToggle() { |
| 39 | + } |
| 40 | + |
| 41 | + public void toggle() { |
| 42 | + toggled = !toggled; |
| 43 | + onToggle(); |
| 44 | + if(toggled) { |
| 45 | + onEnable(); |
| 46 | + if (!getDisplayName().equals("ClickGUI")) |
| 47 | + NotificationManager.show(new Notification(NotificationType.INFO, getDisplayName(), "Turned On", 1)); |
| 48 | + } else { |
| 49 | + onDisable(); |
| 50 | + if (!getDisplayName().equals("ClickGUI")) { |
| 51 | + NotificationManager.show(new Notification(NotificationType.INFO, getDisplayName(), "Turned Off", 1)); |
| 52 | + } |
| 53 | + } |
| 54 | + |
| 55 | + } |
| 56 | + |
| 57 | + public String getName() { |
| 58 | + return name; |
| 59 | + } |
| 60 | + |
| 61 | + public void setName(String name) { |
| 62 | + this.name = name; |
| 63 | + } |
| 64 | + |
| 65 | + public int getKey() { |
| 66 | + return key; |
| 67 | + } |
| 68 | + |
| 69 | + public void setKey(int key) { |
| 70 | + this.key = key; |
| 71 | + } |
| 72 | + |
| 73 | + public Category getCategory() { |
| 74 | + return category; |
| 75 | + } |
| 76 | + |
| 77 | + public void setCategory(Category category) { |
| 78 | + this.category = category; |
| 79 | + } |
| 80 | + |
| 81 | + public boolean isToggled() { |
| 82 | + return toggled; |
| 83 | + } |
| 84 | + |
| 85 | + public String getDisplayName() { |
| 86 | + return displayname == null ? name : displayname; |
| 87 | + } |
| 88 | + |
| 89 | + public void setDisplayName(String displayName) { |
| 90 | + this.displayname = displayName; |
| 91 | + } |
| 92 | + |
| 93 | + public void setup() { |
| 94 | + |
| 95 | + } |
| 96 | + |
| 97 | + public String getKeyName() { |
| 98 | + return Wrapper.getKeyName(key); |
| 99 | + } |
| 100 | +} |
0 commit comments