fixes #1186 added carpetCommandPermissionLevel to allow admins to control who has access to /carpet command.
This commit is contained in:
1 parent
f5900cffc6
commit
7a4c094607
2 files changed
+22
-1
No files matched your search
@@ -127,6 +127,27 @@ public class CarpetSettings
|
||||
public static String commandDistance = "true";
|
||||
*/
|
||||
|
||||
private static class CarpetPermissionLevel extends Validator<String> {
|
||||
@Override public String validate(ServerCommandSource source, ParsedRule<String> currentRule, String newValue, String string) {
|
||||
if (source.hasPermissionLevel(4))
|
||||
return newValue;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description()
|
||||
{
|
||||
return "This setting can only be set by admins with op level 4";
|
||||
}
|
||||
}
|
||||
@Rule(
|
||||
desc = "Carpet command permission level. Can only be set via .conf file",
|
||||
category = CREATIVE,
|
||||
validate = CarpetPermissionLevel.class,
|
||||
options = {"ops", "2", "4"}
|
||||
)
|
||||
public static String carpetCommandPermissionLevel = "ops";
|
||||
|
||||
|
||||
|
||||
@Rule(desc = "Gbhs sgnf sadsgras fhskdpri!!!", category = EXPERIMENTAL)
|
||||
|
||||
@@ -588,7 +588,7 @@ public class SettingsManager
|
||||
}
|
||||
|
||||
LiteralArgumentBuilder<ServerCommandSource> literalargumentbuilder = literal(identifier).requires((player) ->
|
||||
player.hasPermissionLevel(2) && !locked);
|
||||
canUseCommand(player, CarpetSettings.carpetCommandPermissionLevel) && !locked);
|
||||
|
||||
literalargumentbuilder.executes((context)-> listAllSettings(context.getSource())).
|
||||
then(literal("list").
|
||||
|
||||
Reference in new issue
Block a user