Fix command permission requirements
- Commands glue, highlight, and replaceInCommandBlocks now require OP level 2 instead of 0
This commit is contained in:
parent
aa3d656445
commit
6800c24c58
6 changed files with 9 additions and 8 deletions
|
@ -14,7 +14,7 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||
|
||||
public class AllCommands {
|
||||
|
||||
public static Predicate<CommandSource> sourceIsPlayer = (cs) -> cs.getEntity() instanceof PlayerEntity;
|
||||
public static final Predicate<CommandSource> SOURCE_IS_PLAYER = cs -> cs.getEntity() instanceof PlayerEntity;
|
||||
|
||||
public static void register(CommandDispatcher<CommandSource> dispatcher) {
|
||||
|
||||
|
@ -88,4 +88,5 @@ public class AllCommands {
|
|||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ public class FabulousWarningCommand {
|
|||
|
||||
public static ArgumentBuilder<CommandSource, ?> register() {
|
||||
return Commands.literal("dismissFabulousWarning")
|
||||
.requires(AllCommands.sourceIsPlayer)
|
||||
.requires(AllCommands.SOURCE_IS_PLAYER)
|
||||
.executes(ctx -> {
|
||||
ServerPlayerEntity player = ctx.getSource()
|
||||
.getPlayerOrException();
|
||||
|
|
|
@ -13,7 +13,7 @@ import net.minecraft.world.server.ServerWorld;
|
|||
public class GlueCommand {
|
||||
public static ArgumentBuilder<CommandSource, ?> 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 -> {
|
||||
|
|
|
@ -28,7 +28,7 @@ public class HighlightCommand {
|
|||
|
||||
public static ArgumentBuilder<CommandSource, ?> 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 -> {
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public class ReplaceInCommandBlocksCommand {
|
|||
|
||||
public static ArgumentBuilder<CommandSource, ?> 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())
|
||||
|
|
Loading…
Reference in a new issue