-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathServerRuleModule.java
More file actions
201 lines (183 loc) · 7.62 KB
/
Copy pathServerRuleModule.java
File metadata and controls
201 lines (183 loc) · 7.62 KB
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
/*
* This file is part of Apollo, licensed under the MIT License.
*
* Copyright (c) 2023 Moonsworth
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.lunarclient.apollo.module.serverrule;
import com.lunarclient.apollo.module.ApolloModule;
import com.lunarclient.apollo.module.ModuleDefinition;
import com.lunarclient.apollo.option.ListOption;
import com.lunarclient.apollo.option.NumberOption;
import com.lunarclient.apollo.option.Option;
import com.lunarclient.apollo.option.SimpleOption;
import io.leangen.geantyref.TypeToken;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Represents the server rule module.
*
* @since 1.0.0
*/
@ModuleDefinition(id = "server_rule", name = "Server Rule")
public final class ServerRuleModule extends ApolloModule {
/**
* Whether the player should see a popup prior to disconnecting.
*
* @since 1.0.0
*/
public static final SimpleOption<Boolean> COMPETITIVE_GAME = Option.<Boolean>builder()
.comment("Set to 'true' to enable leaving game warning, otherwise 'false'.")
.node("competitive-game").type(TypeToken.get(Boolean.class))
.defaultValue(false).notifyClient().build();
/**
* A list of commands that will trigger the competitive popup.
*
* @since 1.0.0
*/
public static final ListOption<String> COMPETITIVE_COMMANDS = Option.<String>list()
.comment("A list of commands that will trigger the competitive popup.")
.node("competitive-commands").type(new TypeToken<List<String>>() {})
.defaultValue(new ArrayList<>(Arrays.asList("/server", "/servers", "/hub")))
.notifyClient().build();
/**
* Disables shaders.
*
* @since 1.0.0
*/
public static final SimpleOption<Boolean> DISABLE_SHADERS = Option.<Boolean>builder()
.comment("Set to 'true' to disable shaders, otherwise 'false'.")
.node("disable-shaders").type(TypeToken.get(Boolean.class))
.defaultValue(false).notifyClient().build();
/**
* Disables chunk reloading (F3 + A) and disables shaders reload while using Iris (R).
*
* @since 1.0.0
*/
public static final SimpleOption<Boolean> DISABLE_CHUNK_RELOADING = Option.<Boolean>builder()
.comment("Set to 'true' to disable chunk reloading, otherwise 'false'.")
.node("disable-chunk-reloading").type(TypeToken.get(Boolean.class))
.defaultValue(false).notifyClient().build();
/**
* Disables broadcast menu (F6).
*
* @since 1.0.0
*/
public static final SimpleOption<Boolean> DISABLE_BROADCASTING = Option.<Boolean>builder()
.comment("Set to 'true' to disable broadcasting, otherwise 'false'.")
.node("disable-broadcasting").type(TypeToken.get(Boolean.class))
.defaultValue(false).notifyClient().build();
/**
* Anti portal traps.
*
* <p>Allows players to open their chat while in a portal.</p>
*
* @since 1.0.0
*/
public static final SimpleOption<Boolean> ANTI_PORTAL_TRAPS = Option.<Boolean>builder()
.comment("Set to 'true' to enable anti portal traps, otherwise 'false'.")
.node("anti-portal-traps").type(TypeToken.get(Boolean.class))
.defaultValue(true).notifyClient().build();
/**
* Override brightness.
*
* @since 1.0.0
*/
public static final SimpleOption<Boolean> OVERRIDE_BRIGHTNESS = Option.<Boolean>builder()
.comment("Set to 'true' to override brightness, otherwise 'false'.")
.node("override-brightness").type(TypeToken.get(Boolean.class))
.defaultValue(false).notifyClient().build();
/**
* Sets brightness amount.
*
* @since 1.0.0
*/
public static final NumberOption<Integer> BRIGHTNESS = Option.<Integer>number()
.comment("Set the brightness amount.")
.node("brightness").type(TypeToken.get(Integer.class))
.defaultValue(50).min(1).max(10000).notifyClient().build();
/**
* Override nametag render distance.
*
* @since 1.0.0
*/
public static final SimpleOption<Boolean> OVERRIDE_NAMETAG_RENDER_DISTANCE = Option.<Boolean>builder()
.comment("Set to 'true' to override nametag render distance, otherwise 'false'.")
.node("override-nametag-render-distance").type(TypeToken.get(Boolean.class))
.defaultValue(false).notifyClient().build();
/**
* Sets the nametag render distance amount.
*
* @since 1.0.0
*/
public static final NumberOption<Integer> NAMETAG_RENDER_DISTANCE = Option.<Integer>number()
.comment("Set the nametag render distance amount.")
.node("nametag-render-distance").type(TypeToken.get(Integer.class))
.defaultValue(64).min(1).max(96).notifyClient().build();
/**
* Override max chat length.
*
* @since 1.0.0
*/
public static final SimpleOption<Boolean> OVERRIDE_MAX_CHAT_LENGTH = Option.<Boolean>builder()
.comment("Set to 'true' to override max chat length, otherwise 'false'.")
.node("override-max-chat-length").type(TypeToken.get(Boolean.class))
.defaultValue(false).notifyClient().build();
/**
* Sets the max chat length amount.
*
* @since 1.0.0
*/
public static final NumberOption<Integer> MAX_CHAT_LENGTH = Option.<Integer>number()
.comment("Set the nametag render distance amount.")
.node("max-chat-length").type(TypeToken.get(Integer.class))
.defaultValue(256).min(1).max(256).notifyClient().build();
/**
* Whether to enable crystal optimizer.
*
* @since 1.2.4
*/
public static final SimpleOption<Boolean> CRYSTAL_OPTIMIZER = Option.<Boolean>builder()
.comment("Set to 'true' to enable the crystal optimizer, otherwise 'false'.")
.node("crystal-optimizer").type(TypeToken.get(Boolean.class))
.defaultValue(false).notifyClient().build();
ServerRuleModule() {
this.registerOptions(
ServerRuleModule.COMPETITIVE_GAME,
ServerRuleModule.COMPETITIVE_COMMANDS,
ServerRuleModule.DISABLE_SHADERS,
ServerRuleModule.DISABLE_CHUNK_RELOADING,
ServerRuleModule.DISABLE_BROADCASTING,
ServerRuleModule.ANTI_PORTAL_TRAPS,
ServerRuleModule.OVERRIDE_BRIGHTNESS,
ServerRuleModule.BRIGHTNESS,
ServerRuleModule.OVERRIDE_NAMETAG_RENDER_DISTANCE,
ServerRuleModule.NAMETAG_RENDER_DISTANCE,
ServerRuleModule.OVERRIDE_MAX_CHAT_LENGTH,
ServerRuleModule.MAX_CHAT_LENGTH,
ServerRuleModule.CRYSTAL_OPTIMIZER
);
}
@Override
public boolean isClientNotify() {
return true;
}
}