|
10 | 10 |
|
11 | 11 | public class Mod { |
12 | 12 |
|
13 | | - public Minecraft mc = Minecraft.getMinecraft(); |
14 | | - public FontRenderer fr = mc.fontRendererObj; |
15 | | - |
16 | | - private TranslateText nameTranslate, descriptionTranslate; |
17 | | - private boolean toggled, hide; |
18 | | - private SimpleAnimation animation = new SimpleAnimation(); |
19 | | - private ModCategory category; |
20 | | - private String alias = "\u200B"; // zerowidth space |
21 | | - private Boolean restricted = false; |
22 | | - |
23 | | - public Mod(TranslateText nameTranslate, TranslateText descriptionTranslate, ModCategory category) { |
24 | | - |
25 | | - this.nameTranslate = nameTranslate; |
26 | | - this.descriptionTranslate = descriptionTranslate; |
27 | | - this.toggled = false; |
28 | | - this.category = category; |
29 | | - |
30 | | - this.setup(); |
31 | | - } |
32 | | - |
33 | | - public Mod(TranslateText nameTranslate, TranslateText descriptionTranslate, ModCategory category, String alias) { |
34 | | - |
35 | | - this.nameTranslate = nameTranslate; |
36 | | - this.descriptionTranslate = descriptionTranslate; |
37 | | - this.toggled = false; |
38 | | - this.category = category; |
39 | | - this.alias = alias; |
40 | | - |
41 | | - this.setup(); |
42 | | - } |
43 | | - |
44 | | - public Mod(TranslateText nameTranslate, TranslateText descriptionTranslate, ModCategory category, String alias, boolean restricted) { |
45 | | - |
46 | | - this.nameTranslate = nameTranslate; |
47 | | - this.descriptionTranslate = descriptionTranslate; |
48 | | - this.toggled = false; |
49 | | - this.category = category; |
50 | | - this.alias = alias; |
51 | | - this.restricted = restricted; |
52 | | - |
53 | | - this.setup(); |
54 | | - } |
55 | | - |
56 | | - public void setup() {} |
57 | | - |
58 | | - public void onEnable() { |
59 | | - if(Glide.getInstance().getRestrictedMod().checkAllowed(this)){ |
60 | | - Glide.getInstance().getEventManager().register(this); |
61 | | - GlideLogger.info("[MODULE] " + getName() + " was enabled"); |
62 | | - } else { |
63 | | - this.setToggled(false); |
64 | | - Glide.getInstance().getNotificationManager().post(this.nameTranslate.getText(), "Disabled due to serverside blacklist" , NotificationType.INFO); |
65 | | - } |
66 | | - } |
67 | | - |
68 | | - public void onDisable() { |
69 | | - Glide.getInstance().getEventManager().unregister(this); |
70 | | - GlideLogger.info("[MODULE] " + getName() + " was disabled"); |
71 | | - } |
72 | | - |
73 | | - public void toggle() { |
74 | | - setToggled(!toggled, true); |
75 | | - } |
76 | | - |
77 | | - public void setToggled(boolean toggled) { |
78 | | - setToggled(toggled, false); |
79 | | - } |
80 | | - |
81 | | - public void setToggled(boolean toggled, boolean sound) { |
82 | | - |
83 | | - this.toggled = toggled; |
84 | | - |
85 | | - if(toggled) { |
86 | | - onEnable(); |
87 | | - if (sound) Glide.getInstance().getModManager().playToggleSound(true); |
88 | | - }else { |
89 | | - onDisable(); |
90 | | - if (sound) Glide.getInstance().getModManager().playToggleSound(false); |
91 | | - } |
92 | | - } |
93 | | - |
94 | | - public String getName() { |
95 | | - return nameTranslate.getText(); |
96 | | - } |
97 | | - |
98 | | - public String getDescription() { |
99 | | - return descriptionTranslate.getText(); |
100 | | - } |
101 | | - |
102 | | - public String getNameKey() { |
103 | | - return nameTranslate.getKey(); |
104 | | - } |
105 | | - |
106 | | - public boolean isHide() { |
107 | | - return hide; |
108 | | - } |
109 | | - |
110 | | - public void setHide(boolean hide) { |
111 | | - this.hide = hide; |
112 | | - } |
113 | | - |
114 | | - public boolean isToggled() { |
115 | | - return toggled; |
116 | | - } |
117 | | - |
118 | | - public ModCategory getCategory() { |
119 | | - return category; |
120 | | - } |
121 | | - |
122 | | - public void setCategory(ModCategory category) { |
123 | | - this.category = category; |
124 | | - } |
125 | | - |
126 | | - public SimpleAnimation getAnimation() { |
127 | | - return animation; |
128 | | - } |
129 | | - |
130 | | - public String getAlias() { |
131 | | - return this.alias; |
132 | | - } |
133 | | - |
134 | | - public Boolean isRestricted() {return this.restricted;} |
| 13 | + public Minecraft mc = Minecraft.getMinecraft(); |
| 14 | + public FontRenderer fr = mc.fontRendererObj; |
| 15 | + |
| 16 | + private TranslateText nameTranslate, descriptionTranslate; |
| 17 | + private boolean toggled, hide; |
| 18 | + private SimpleAnimation animation = new SimpleAnimation(); |
| 19 | + private ModCategory category; |
| 20 | + private String alias = "\u200B"; // zerowidth space |
| 21 | + private Boolean restricted = false, allowed = true; |
| 22 | + |
| 23 | + public Mod(TranslateText nameTranslate, TranslateText descriptionTranslate, ModCategory category) { |
| 24 | + |
| 25 | + this.nameTranslate = nameTranslate; |
| 26 | + this.descriptionTranslate = descriptionTranslate; |
| 27 | + this.toggled = false; |
| 28 | + this.category = category; |
| 29 | + |
| 30 | + this.setup(); |
| 31 | + } |
| 32 | + |
| 33 | + public Mod(TranslateText nameTranslate, TranslateText descriptionTranslate, ModCategory category, String alias) { |
| 34 | + |
| 35 | + this.nameTranslate = nameTranslate; |
| 36 | + this.descriptionTranslate = descriptionTranslate; |
| 37 | + this.toggled = false; |
| 38 | + this.category = category; |
| 39 | + this.alias = alias; |
| 40 | + |
| 41 | + this.setup(); |
| 42 | + } |
| 43 | + |
| 44 | + public Mod(TranslateText nameTranslate, TranslateText descriptionTranslate, ModCategory category, String alias, boolean restricted) { |
| 45 | + |
| 46 | + this.nameTranslate = nameTranslate; |
| 47 | + this.descriptionTranslate = descriptionTranslate; |
| 48 | + this.toggled = false; |
| 49 | + this.category = category; |
| 50 | + this.alias = alias; |
| 51 | + this.restricted = restricted; |
| 52 | + |
| 53 | + this.setup(); |
| 54 | + } |
| 55 | + |
| 56 | + public void setup() { |
| 57 | + } |
| 58 | + |
| 59 | + public void onEnable() { |
| 60 | + if (Glide.getInstance().getRestrictedMod().checkAllowed(this)) { |
| 61 | + Glide.getInstance().getEventManager().register(this); |
| 62 | + GlideLogger.info("[MODULE] " + getName() + " was enabled"); |
| 63 | + } else { |
| 64 | + this.setToggled(false); |
| 65 | + Glide.getInstance().getNotificationManager().post(this.nameTranslate.getText(), "Disabled due to serverside blacklist", NotificationType.INFO); |
| 66 | + } |
| 67 | + } |
| 68 | + |
| 69 | + public void onDisable() { |
| 70 | + Glide.getInstance().getEventManager().unregister(this); |
| 71 | + GlideLogger.info("[MODULE] " + getName() + " was disabled"); |
| 72 | + } |
| 73 | + |
| 74 | + public void toggle() { |
| 75 | + setToggled(!toggled, true); |
| 76 | + } |
| 77 | + |
| 78 | + public void setToggled(boolean toggled) { |
| 79 | + setToggled(toggled, false); |
| 80 | + } |
| 81 | + |
| 82 | + public void setToggled(boolean toggled, boolean sound) { |
| 83 | + |
| 84 | + this.toggled = toggled; |
| 85 | + |
| 86 | + if (toggled) { |
| 87 | + onEnable(); |
| 88 | + if (sound) Glide.getInstance().getModManager().playToggleSound(true); |
| 89 | + } else { |
| 90 | + onDisable(); |
| 91 | + if (sound) Glide.getInstance().getModManager().playToggleSound(false); |
| 92 | + } |
| 93 | + } |
| 94 | + |
| 95 | + public String getName() { |
| 96 | + return nameTranslate.getText(); |
| 97 | + } |
| 98 | + |
| 99 | + public String getDescription() { |
| 100 | + return descriptionTranslate.getText(); |
| 101 | + } |
| 102 | + |
| 103 | + public String getNameKey() { |
| 104 | + return nameTranslate.getKey(); |
| 105 | + } |
| 106 | + |
| 107 | + public boolean isHide() { |
| 108 | + return hide; |
| 109 | + } |
| 110 | + |
| 111 | + public void setHide(boolean hide) { |
| 112 | + this.hide = hide; |
| 113 | + } |
| 114 | + |
| 115 | + public boolean isToggled() { |
| 116 | + return toggled; |
| 117 | + } |
| 118 | + |
| 119 | + public ModCategory getCategory() { |
| 120 | + return category; |
| 121 | + } |
| 122 | + |
| 123 | + public void setCategory(ModCategory category) { |
| 124 | + this.category = category; |
| 125 | + } |
| 126 | + |
| 127 | + public SimpleAnimation getAnimation() { |
| 128 | + return animation; |
| 129 | + } |
| 130 | + |
| 131 | + public String getAlias() { |
| 132 | + return this.alias; |
| 133 | + } |
| 134 | + |
| 135 | + public Boolean isRestricted() { |
| 136 | + return this.restricted; |
| 137 | + } |
| 138 | + |
| 139 | + public Boolean getAllowed() { |
| 140 | + return allowed; |
| 141 | + } |
| 142 | + |
| 143 | + public void setAllowed(boolean modAllowed) { |
| 144 | + this.allowed = modAllowed; |
| 145 | + } |
| 146 | + |
135 | 147 | } |
0 commit comments