@@ -158,6 +158,56 @@ internal object PermissionsCommand {
158
158
)
159
159
}
160
160
161
+ private fun groupCommandExecute (c : CommandContext <CommandSource >): Int {
162
+ if (c.isPlayerSender() &&
163
+ ! PermissionsAPI .hasPermission(c.playerName(), " ess.perm.group" )
164
+ ) {
165
+ sendMsg(c.source, " perm.group.restricted" )
166
+ return 0
167
+ }
168
+ when {
169
+ c.isPlayerSender() -> sendMsg(c.source, " perm.group.example" )
170
+ else -> logger.info(" Usage example: /ess permissions group <group> [set|remove] <node>" )
171
+ }
172
+ return 0
173
+ }
174
+
175
+ private fun groupCommandSetExecute (c : CommandContext <CommandSource >): Int {
176
+ if (c.isPlayerSender() &&
177
+ ! PermissionsAPI .hasPermission(c.playerName(), " ess.perm.group" )
178
+ ) {
179
+ sendMsg(c.source, " perm.group.restricted" )
180
+ return 0
181
+ }
182
+ val targetGroup = StringArgumentType .getString(c, " name" )
183
+ val targetNode = StringArgumentType .getString(c, " node" )
184
+ PermissionsAPI .setGroupPermissionNode(targetGroup, targetNode)
185
+ if (c.isPlayerSender()) {
186
+ sendMsg(c.source, " perm.group.success" , targetNode, targetGroup)
187
+ } else {
188
+ logger.info(" Permission $targetNode added to group $targetGroup ." )
189
+ }
190
+ return 0
191
+ }
192
+
193
+ private fun groupCommandRemoveExecute (c : CommandContext <CommandSource >): Int {
194
+ if (c.isPlayerSender() &&
195
+ ! PermissionsAPI .hasPermission(c.playerName(), " ess.perm.group" )
196
+ ) {
197
+ sendMsg(c.source, " perm.group.restricted" )
198
+ return 0
199
+ }
200
+ val targetGroup = StringArgumentType .getString(c, " name" )
201
+ val targetNode = StringArgumentType .getString(c, " node" )
202
+ PermissionsAPI .removeGroupPermission(targetGroup, targetNode)
203
+ if (c.isPlayerSender()) {
204
+ sendMsg(c.source, " perm.group.remove.success" , targetNode, targetGroup)
205
+ } else {
206
+ logger.info(" Permission $targetNode removed from group $targetGroup ." )
207
+ }
208
+ return 0
209
+ }
210
+
161
211
private fun buildUserCommand (): LiteralArgumentBuilder <CommandSource > {
162
212
return Commands .literal(" user" ).executes {
163
213
return @executes userCommandExecute(it)
@@ -203,20 +253,6 @@ internal object PermissionsCommand {
203
253
)
204
254
}
205
255
206
- private fun groupCommandExecute (c : CommandContext <CommandSource >): Int {
207
- if (c.isPlayerSender() &&
208
- ! PermissionsAPI .hasPermission(c.playerName(), " ess.perm.group" )
209
- ) {
210
- sendMsg(c.source, " perm.group.restricted" )
211
- return 0
212
- }
213
- when {
214
- c.isPlayerSender() -> sendMsg(c.source, " perm.group.example" )
215
- else -> logger.info(" Usage example: /ess permissions group <group> [set|remove] <node>" )
216
- }
217
- return 0
218
- }
219
-
220
256
private fun userCommandExecute (c : CommandContext <CommandSource >): Int {
221
257
if (c.isPlayerSender() &&
222
258
! PermissionsAPI .hasPermission(c.playerName(), " ess.perm.user" )
@@ -233,24 +269,6 @@ internal object PermissionsCommand {
233
269
return 0
234
270
}
235
271
236
- private fun groupCommandSetExecute (c : CommandContext <CommandSource >): Int {
237
- if (c.isPlayerSender() &&
238
- ! PermissionsAPI .hasPermission(c.playerName(), " ess.perm.group" )
239
- ) {
240
- sendMsg(c.source, " perm.group.restricted" )
241
- return 0
242
- }
243
- val targetGroup = StringArgumentType .getString(c, " name" )
244
- val targetNode = StringArgumentType .getString(c, " node" )
245
- PermissionsAPI .setGroupPermissionNode(targetGroup, targetNode)
246
- if (c.isPlayerSender()) {
247
- sendMsg(c.source, " perm.group.success" , targetNode, targetGroup)
248
- } else {
249
- logger.info(" Permission $targetNode added to group $targetGroup ." )
250
- }
251
- return 0
252
- }
253
-
254
272
private fun userCommandSetExecute (c : CommandContext <CommandSource >): Int {
255
273
if (c.isPlayerSender() &&
256
274
! PermissionsAPI .hasPermission(c.playerName(), " ess.perm.user" )
@@ -296,24 +314,6 @@ internal object PermissionsCommand {
296
314
return 0
297
315
}
298
316
299
- private fun groupCommandRemoveExecute (c : CommandContext <CommandSource >): Int {
300
- if (c.isPlayerSender() &&
301
- ! PermissionsAPI .hasPermission(c.playerName(), " ess.perm.group" )
302
- ) {
303
- sendMsg(c.source, " perm.group.restricted" )
304
- return 0
305
- }
306
- val targetGroup = StringArgumentType .getString(c, " name" )
307
- val targetNode = StringArgumentType .getString(c, " node" )
308
- PermissionsAPI .removeGroupPermission(targetGroup, targetNode)
309
- if (c.isPlayerSender()) {
310
- sendMsg(c.source, " perm.group.remove.success" , targetNode, targetGroup)
311
- } else {
312
- logger.info(" Permission $targetNode removed from group $targetGroup ." )
313
- }
314
- return 0
315
- }
316
-
317
317
private fun userCommandRemoveExecute (c : CommandContext <CommandSource >): Int {
318
318
if (c.isPlayerSender() &&
319
319
! PermissionsAPI .hasPermission(c.playerName(), " ess.perm.user" )
0 commit comments