diff --git a/src/main/java/org/teacon/powertool/network/attachment/Permission.java b/src/main/java/org/teacon/powertool/network/attachment/Permission.java index 90cc191..98ea3f6 100644 --- a/src/main/java/org/teacon/powertool/network/attachment/Permission.java +++ b/src/main/java/org/teacon/powertool/network/attachment/Permission.java @@ -21,7 +21,7 @@ public class Permission { private Boolean canUseGameMasterBlock; private Boolean canSwitchGameMode; - private Boolean canUseSelector; + // canUseSelector is superseded by NeoForgeMod.USE_SELECTORS_PERMISSION public Optional isCanUseGameMasterBlock() { return Optional.ofNullable(canUseGameMasterBlock); @@ -39,14 +39,6 @@ public void setCanSwitchGameMode(boolean canSwitchGameMode) { this.canSwitchGameMode = canSwitchGameMode; } - public Optional isCanUseSelector() { - return Optional.ofNullable(canUseSelector); - } - - public void setCanUseSelector(Boolean canUseSelector) { - this.canUseSelector = canUseSelector; - } - @EventBusSubscriber public static class Provider { @@ -58,14 +50,11 @@ public static class Provider { "minecraft", "use_gamemaster_block", PermissionTypes.BOOLEAN, (player, uuid, context) -> player != null && player.getAbilities().instabuild && player.hasPermissions(2) ); - private static final PermissionNode ENTITY_SELECTOR = new PermissionNode<>( - "minecraft", "command.selector", PermissionTypes.BOOLEAN, - (player, uuid, context) -> player != null && player.hasPermissions(2) - ); + // ENTITY_SELECTOR is replaced by NeoForgeMod.USE_SELECTORS_PERMISSION @SubscribeEvent public static void on(PermissionGatherEvent.Nodes event) { - event.addNodes(GAMEMODE, COMMAND_BLOCK, ENTITY_SELECTOR); + event.addNodes(GAMEMODE, COMMAND_BLOCK); } } @@ -73,8 +62,7 @@ public static void updatePermission(ServerPlayer player) { PacketDistributor.sendToPlayer(player, new UpdatePermissionPacket( PermissionAPI.getPermission(player, Provider.COMMAND_BLOCK), - PermissionAPI.getPermission(player, Provider.GAMEMODE), - PermissionAPI.getPermission(player, Provider.ENTITY_SELECTOR) + PermissionAPI.getPermission(player, Provider.GAMEMODE) ) ); } diff --git a/src/main/java/org/teacon/powertool/network/client/UpdatePermissionPacket.java b/src/main/java/org/teacon/powertool/network/client/UpdatePermissionPacket.java index 72f9735..f68b625 100644 --- a/src/main/java/org/teacon/powertool/network/client/UpdatePermissionPacket.java +++ b/src/main/java/org/teacon/powertool/network/client/UpdatePermissionPacket.java @@ -11,14 +11,13 @@ import org.teacon.powertool.utils.VanillaUtils; @MethodsReturnNonnullByDefault -public record UpdatePermissionPacket(boolean canUseGameMasterBlock, boolean canSwitchGameMode, boolean canUseSelector) implements CustomPacketPayload { +public record UpdatePermissionPacket(boolean canUseGameMasterBlock, boolean canSwitchGameMode) implements CustomPacketPayload { public static final CustomPacketPayload.Type TYPE = new Type<>(VanillaUtils.modResourceLocation("update_permission")); public static final StreamCodec STREAM_CODEC = StreamCodec.composite( ByteBufCodecs.BOOL,UpdatePermissionPacket::canUseGameMasterBlock, ByteBufCodecs.BOOL,UpdatePermissionPacket::canSwitchGameMode, - ByteBufCodecs.BOOL,UpdatePermissionPacket::canUseSelector, UpdatePermissionPacket::new ); @@ -29,7 +28,6 @@ public void handle(IPayloadContext context) { var permission = minecraft.player.getData(PowerToolAttachments.PERMISSION); permission.setCanSwitchGameMode(canSwitchGameMode); permission.setCanUseGameMasterBlock(canUseGameMasterBlock); - permission.setCanUseSelector(canUseSelector); } }); }