From 82f6fcb0e3324d112e7050e8c5ee96daddb34686 Mon Sep 17 00:00:00 2001 From: rhysdh540 Date: Sun, 5 Nov 2023 14:36:25 -0500 Subject: [PATCH] disable permissions for now --- .../config/command/CUCommands.java | 52 ++++++++++--------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/common/src/main/java/dev/rdh/createunlimited/config/command/CUCommands.java b/common/src/main/java/dev/rdh/createunlimited/config/command/CUCommands.java index a785976..59e12e4 100644 --- a/common/src/main/java/dev/rdh/createunlimited/config/command/CUCommands.java +++ b/common/src/main/java/dev/rdh/createunlimited/config/command/CUCommands.java @@ -115,21 +115,22 @@ else if (value instanceof DoubleValue dValue) } if(Util.isDevEnv()) { - base.then(literal("disableEverything").requires(CUCommands::perms).executes(context -> { - CUConfigs.server().placementChecks.set(CUServer.PlacementCheck.OFF); - CUConfigs.server().extendedDriving.set(0.01); - CUConfigs.server().maxTrainRelocationDistance.set(128d); - CUConfigs.server().maxAllowedStress.set(-1d); - CUConfigs.server().trainAssemblyChecks.set(false); - CUConfigs.server().maxGlueConnectionRange.set(128d); - //CUConfigs.server().physicalBlockConnection.set(false); - CUConfigs.server().singleExtendoGripRange.set(128); - CUConfigs.server().doubleExtendoGripRange.set(128); - CUConfigs.server().allowAllCopycatBlocks.set(true); - CUConfigs.server().singleExtendoGripRange.set(128); - CUConfigs.server().doubleExtendoGripRange.set(128); - return Command.SINGLE_SUCCESS; - })); + base.then(literal("disableEverything")//.requires(CUCommands::perms) + .executes(context -> { + CUConfigs.server().placementChecks.set(CUServer.PlacementCheck.OFF); + CUConfigs.server().extendedDriving.set(0.01); + CUConfigs.server().maxTrainRelocationDistance.set(128d); + CUConfigs.server().maxAllowedStress.set(-1d); + CUConfigs.server().trainAssemblyChecks.set(false); + CUConfigs.server().maxGlueConnectionRange.set(128d); + //CUConfigs.server().physicalBlockConnection.set(false); + CUConfigs.server().singleExtendoGripRange.set(128); + CUConfigs.server().doubleExtendoGripRange.set(128); + CUConfigs.server().allowAllCopycatBlocks.set(true); + CUConfigs.server().singleExtendoGripRange.set(128); + CUConfigs.server().doubleExtendoGripRange.set(128); + return Command.SINGLE_SUCCESS; + })); } if (category != null) @@ -137,11 +138,11 @@ else if (value instanceof DoubleValue dValue) Util.registerCommand(base); } - private static boolean perms(Object o) { - if(!(o instanceof CommandSourceStack source)) return false; - Entity e = source.getEntity(); - return e != null && e.hasPermissions(4); - } +// private static boolean perms(Object o) { +// if(!(o instanceof CommandSourceStack source)) return false; +// Entity e = source.getEntity(); +// return e != null && e.hasPermissions(4); +// } private static void gdr(LiteralArgumentBuilder category, String name, ConfigValue value) { category.then(literal(name) @@ -151,7 +152,7 @@ private static void gdr(LiteralArgumentBuilder category, context.message("Default value: " + value.getDefault()); return Command.SINGLE_SUCCESS; }) - .then(literal("reset").requires(CUCommands::perms) + .then(literal("reset")//.requires(CUCommands::perms) .executes(context -> { if(value.get().equals(value.getDefault())) { context.error("Value is already default!"); @@ -167,7 +168,7 @@ private static void gdr(LiteralArgumentBuilder category, private static void setBoolean(LiteralArgumentBuilder category, String name, BooleanValue value) { category.then(literal(name) - .then(argument("value", BoolArgumentType.bool()).requires(CUCommands::perms) + .then(argument("value", BoolArgumentType.bool())//.requires(CUCommands::perms) .executes(context -> { boolean set = BoolArgumentType.getBool(context, "value"); if(set == value.get()) { @@ -184,7 +185,7 @@ private static void setBoolean(LiteralArgumentBuilder catego private static void setInt(LiteralArgumentBuilder category, String name, IntValue value) { category.then(literal(name) - .then(argument("value", IntegerArgumentType.integer()).requires(CUCommands::perms) + .then(argument("value", IntegerArgumentType.integer())//.requires(CUCommands::perms) .executes(context -> { int set = IntegerArgumentType.getInteger(context, "value"); if(set == value.get()) { @@ -201,7 +202,7 @@ private static void setInt(LiteralArgumentBuilder category, private static void setDouble(LiteralArgumentBuilder category, String name, DoubleValue value) { category.then(literal(name) - .then(argument("value", DoubleArgumentType.doubleArg()).requires(CUCommands::perms) + .then(argument("value", DoubleArgumentType.doubleArg())//.requires(CUCommands::perms) .executes(context -> { double set = DoubleArgumentType.getDouble(context, "value"); if(set == value.get()) { @@ -219,7 +220,8 @@ private static void setDouble(LiteralArgumentBuilder categor @SuppressWarnings("unchecked") private static > void setEnum(LiteralArgumentBuilder category, String name, EnumValue value) { category.then(literal(name) - .then(argument("value", EnumArgument.enumArg(value.getDefault().getClass(), true)).requires(CUCommands::perms) + .then(argument("value", EnumArgument.enumArg(value.getDefault().getClass(), true)) + //.requires(CUCommands::perms) .executes(context -> { T set = EnumArgument.getEnum(context, "value", (Class) value.getDefault().getClass()); if(set == value.get()) {