From 6800c24c589e53c140d16abef89389858afad58b Mon Sep 17 00:00:00 2001 From: PepperBell <44146161+PepperCode1@users.noreply.github.com> Date: Sun, 5 Sep 2021 21:14:41 -0700 Subject: [PATCH] Fix command permission requirements - Commands glue, highlight, and replaceInCommandBlocks now require OP level 2 instead of 0 --- .../com/simibubi/create/foundation/command/AllCommands.java | 3 ++- .../create/foundation/command/FabulousWarningCommand.java | 2 +- .../com/simibubi/create/foundation/command/GlueCommand.java | 2 +- .../create/foundation/command/HighlightCommand.java | 2 +- .../simibubi/create/foundation/command/HighlightPacket.java | 6 +++--- .../foundation/command/ReplaceInCommandBlocksCommand.java | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/simibubi/create/foundation/command/AllCommands.java b/src/main/java/com/simibubi/create/foundation/command/AllCommands.java index e8534da84..2e5aa57b7 100644 --- a/src/main/java/com/simibubi/create/foundation/command/AllCommands.java +++ b/src/main/java/com/simibubi/create/foundation/command/AllCommands.java @@ -14,7 +14,7 @@ import net.minecraft.entity.player.PlayerEntity; public class AllCommands { - public static Predicate sourceIsPlayer = (cs) -> cs.getEntity() instanceof PlayerEntity; + public static final Predicate SOURCE_IS_PLAYER = cs -> cs.getEntity() instanceof PlayerEntity; public static void register(CommandDispatcher dispatcher) { @@ -88,4 +88,5 @@ public class AllCommands { } return builder.build(); } + } diff --git a/src/main/java/com/simibubi/create/foundation/command/FabulousWarningCommand.java b/src/main/java/com/simibubi/create/foundation/command/FabulousWarningCommand.java index c85496e46..f8cd53f06 100644 --- a/src/main/java/com/simibubi/create/foundation/command/FabulousWarningCommand.java +++ b/src/main/java/com/simibubi/create/foundation/command/FabulousWarningCommand.java @@ -13,7 +13,7 @@ public class FabulousWarningCommand { public static ArgumentBuilder register() { return Commands.literal("dismissFabulousWarning") - .requires(AllCommands.sourceIsPlayer) + .requires(AllCommands.SOURCE_IS_PLAYER) .executes(ctx -> { ServerPlayerEntity player = ctx.getSource() .getPlayerOrException(); diff --git a/src/main/java/com/simibubi/create/foundation/command/GlueCommand.java b/src/main/java/com/simibubi/create/foundation/command/GlueCommand.java index c3535e5a4..68cc8bc1b 100644 --- a/src/main/java/com/simibubi/create/foundation/command/GlueCommand.java +++ b/src/main/java/com/simibubi/create/foundation/command/GlueCommand.java @@ -13,7 +13,7 @@ import net.minecraft.world.server.ServerWorld; public class GlueCommand { public static ArgumentBuilder register() { return Commands.literal("glue") - .requires(cs -> cs.hasPermission(0)) + .requires(cs -> cs.hasPermission(2)) .then(Commands.argument("pos", BlockPosArgument.blockPos()) //.then(Commands.argument("direction", EnumArgument.enumArgument(Direction.class)) .executes(ctx -> { diff --git a/src/main/java/com/simibubi/create/foundation/command/HighlightCommand.java b/src/main/java/com/simibubi/create/foundation/command/HighlightCommand.java index 44dc55900..44604195a 100644 --- a/src/main/java/com/simibubi/create/foundation/command/HighlightCommand.java +++ b/src/main/java/com/simibubi/create/foundation/command/HighlightCommand.java @@ -28,7 +28,7 @@ public class HighlightCommand { public static ArgumentBuilder register() { return Commands.literal("highlight") - .requires(cs -> cs.hasPermission(0)) + .requires(cs -> cs.hasPermission(2)) .then(Commands.argument("pos", BlockPosArgument.blockPos()) .then(Commands.argument("players", EntityArgument.players()) .executes(ctx -> { diff --git a/src/main/java/com/simibubi/create/foundation/command/HighlightPacket.java b/src/main/java/com/simibubi/create/foundation/command/HighlightPacket.java index 61422c598..06cfddb9a 100644 --- a/src/main/java/com/simibubi/create/foundation/command/HighlightPacket.java +++ b/src/main/java/com/simibubi/create/foundation/command/HighlightPacket.java @@ -24,12 +24,12 @@ public class HighlightPacket extends SimplePacketBase { } public HighlightPacket(PacketBuffer buffer) { - this.pos = BlockPos.of(buffer.readLong()); + this.pos = buffer.readBlockPos(); } @Override public void write(PacketBuffer buffer) { - buffer.writeLong(pos.asLong()); + buffer.writeBlockPos(pos); } @Override @@ -55,6 +55,6 @@ public class HighlightPacket extends SimplePacketBase { .colored(0xEeEeEe) // .colored(0x243B50) .withFaceTexture(AllSpecialTextures.SELECTION); - } + } diff --git a/src/main/java/com/simibubi/create/foundation/command/ReplaceInCommandBlocksCommand.java b/src/main/java/com/simibubi/create/foundation/command/ReplaceInCommandBlocksCommand.java index 02f62bcc5..8bdd9b5ec 100644 --- a/src/main/java/com/simibubi/create/foundation/command/ReplaceInCommandBlocksCommand.java +++ b/src/main/java/com/simibubi/create/foundation/command/ReplaceInCommandBlocksCommand.java @@ -21,7 +21,7 @@ public class ReplaceInCommandBlocksCommand { public static ArgumentBuilder register() { return Commands.literal("replaceInCommandBlocks") - .requires(cs -> cs.hasPermission(0)) + .requires(cs -> cs.hasPermission(2)) .then(Commands.argument("begin", BlockPosArgument.blockPos()) .then(Commands.argument("end", BlockPosArgument.blockPos()) .then(Commands.argument("toReplace", StringArgumentType.string())