mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-29 08:27:03 +01:00
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 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) {
|
public static void register(CommandDispatcher<CommandSource> dispatcher) {
|
||||||
|
|
||||||
|
@ -88,4 +88,5 @@ public class AllCommands {
|
||||||
}
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ public class FabulousWarningCommand {
|
||||||
|
|
||||||
public static ArgumentBuilder<CommandSource, ?> register() {
|
public static ArgumentBuilder<CommandSource, ?> register() {
|
||||||
return Commands.literal("dismissFabulousWarning")
|
return Commands.literal("dismissFabulousWarning")
|
||||||
.requires(AllCommands.sourceIsPlayer)
|
.requires(AllCommands.SOURCE_IS_PLAYER)
|
||||||
.executes(ctx -> {
|
.executes(ctx -> {
|
||||||
ServerPlayerEntity player = ctx.getSource()
|
ServerPlayerEntity player = ctx.getSource()
|
||||||
.getPlayerOrException();
|
.getPlayerOrException();
|
||||||
|
|
|
@ -13,7 +13,7 @@ import net.minecraft.world.server.ServerWorld;
|
||||||
public class GlueCommand {
|
public class GlueCommand {
|
||||||
public static ArgumentBuilder<CommandSource, ?> register() {
|
public static ArgumentBuilder<CommandSource, ?> register() {
|
||||||
return Commands.literal("glue")
|
return Commands.literal("glue")
|
||||||
.requires(cs -> cs.hasPermission(0))
|
.requires(cs -> cs.hasPermission(2))
|
||||||
.then(Commands.argument("pos", BlockPosArgument.blockPos())
|
.then(Commands.argument("pos", BlockPosArgument.blockPos())
|
||||||
//.then(Commands.argument("direction", EnumArgument.enumArgument(Direction.class))
|
//.then(Commands.argument("direction", EnumArgument.enumArgument(Direction.class))
|
||||||
.executes(ctx -> {
|
.executes(ctx -> {
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class HighlightCommand {
|
||||||
|
|
||||||
public static ArgumentBuilder<CommandSource, ?> register() {
|
public static ArgumentBuilder<CommandSource, ?> register() {
|
||||||
return Commands.literal("highlight")
|
return Commands.literal("highlight")
|
||||||
.requires(cs -> cs.hasPermission(0))
|
.requires(cs -> cs.hasPermission(2))
|
||||||
.then(Commands.argument("pos", BlockPosArgument.blockPos())
|
.then(Commands.argument("pos", BlockPosArgument.blockPos())
|
||||||
.then(Commands.argument("players", EntityArgument.players())
|
.then(Commands.argument("players", EntityArgument.players())
|
||||||
.executes(ctx -> {
|
.executes(ctx -> {
|
||||||
|
|
|
@ -24,12 +24,12 @@ public class HighlightPacket extends SimplePacketBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public HighlightPacket(PacketBuffer buffer) {
|
public HighlightPacket(PacketBuffer buffer) {
|
||||||
this.pos = BlockPos.of(buffer.readLong());
|
this.pos = buffer.readBlockPos();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(PacketBuffer buffer) {
|
public void write(PacketBuffer buffer) {
|
||||||
buffer.writeLong(pos.asLong());
|
buffer.writeBlockPos(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -55,6 +55,6 @@ public class HighlightPacket extends SimplePacketBase {
|
||||||
.colored(0xEeEeEe)
|
.colored(0xEeEeEe)
|
||||||
// .colored(0x243B50)
|
// .colored(0x243B50)
|
||||||
.withFaceTexture(AllSpecialTextures.SELECTION);
|
.withFaceTexture(AllSpecialTextures.SELECTION);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ public class ReplaceInCommandBlocksCommand {
|
||||||
|
|
||||||
public static ArgumentBuilder<CommandSource, ?> register() {
|
public static ArgumentBuilder<CommandSource, ?> register() {
|
||||||
return Commands.literal("replaceInCommandBlocks")
|
return Commands.literal("replaceInCommandBlocks")
|
||||||
.requires(cs -> cs.hasPermission(0))
|
.requires(cs -> cs.hasPermission(2))
|
||||||
.then(Commands.argument("begin", BlockPosArgument.blockPos())
|
.then(Commands.argument("begin", BlockPosArgument.blockPos())
|
||||||
.then(Commands.argument("end", BlockPosArgument.blockPos())
|
.then(Commands.argument("end", BlockPosArgument.blockPos())
|
||||||
.then(Commands.argument("toReplace", StringArgumentType.string())
|
.then(Commands.argument("toReplace", StringArgumentType.string())
|
||||||
|
|
Loading…
Reference in a new issue