From a6e5dbc60e0a2217f6912ef459637cda434e0184 Mon Sep 17 00:00:00 2001 From: themode Date: Sat, 9 Jan 2021 02:20:55 +0100 Subject: [PATCH] Fix permission level to use the target selector --- .../java/net/minestom/server/command/CommandManager.java | 7 +++---- .../builder/arguments/minecraft/ArgumentEntities.java | 6 ++---- src/main/java/net/minestom/server/entity/Player.java | 6 ++++++ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/minestom/server/command/CommandManager.java b/src/main/java/net/minestom/server/command/CommandManager.java index 0f0d4f6dd..18c7d2714 100644 --- a/src/main/java/net/minestom/server/command/CommandManager.java +++ b/src/main/java/net/minestom/server/command/CommandManager.java @@ -443,10 +443,9 @@ public final class CommandManager { if (lastNodes != null) { final int[] children = ArrayUtils.toArray(argChildren); - lastNodes.forEach(n -> - n.children = n.children == null ? - children : - ArrayUtils.concatenateIntArrays(n.children, children)); + lastNodes.forEach(n -> n.children = n.children == null ? + children : + ArrayUtils.concatenateIntArrays(n.children, children)); } nodes.add(node); diff --git a/src/main/java/net/minestom/server/command/builder/arguments/minecraft/ArgumentEntities.java b/src/main/java/net/minestom/server/command/builder/arguments/minecraft/ArgumentEntities.java index 7302fbe13..bacbce720 100644 --- a/src/main/java/net/minestom/server/command/builder/arguments/minecraft/ArgumentEntities.java +++ b/src/main/java/net/minestom/server/command/builder/arguments/minecraft/ArgumentEntities.java @@ -66,8 +66,6 @@ public class ArgumentEntities extends Argument { @NotNull @Override public EntityFinder parse(@NotNull String input) throws ArgumentSyntaxException { - System.out.println("check: " + input); - // Check for raw player name if (input.length() <= 16) { if (CONNECTION_MANAGER.getPlayer(input) != null) { @@ -120,13 +118,13 @@ public class ArgumentEntities extends Argument { // Remove brackets final String structureData = structure.substring(1, structure.length() - 1); - System.out.println("structure data: " + structureData); + //System.out.println("structure data: " + structureData); String currentArgument = ""; for (int i = 0; i < structureData.length(); i++) { final char c = structureData.charAt(i); if (c == '=') { - System.out.println("type: " + currentArgument); + //System.out.println("type: " + currentArgument); if (!validArguments.contains(currentArgument)) throw new ArgumentSyntaxException("Argument name '" + currentArgument + "' does not exist", input, INVALID_ARGUMENT_NAME); diff --git a/src/main/java/net/minestom/server/entity/Player.java b/src/main/java/net/minestom/server/entity/Player.java index 098812de1..23dfea365 100644 --- a/src/main/java/net/minestom/server/entity/Player.java +++ b/src/main/java/net/minestom/server/entity/Player.java @@ -313,6 +313,12 @@ public class Player extends LivingEntity implements CommandSender { } // Tags end + // Permission + { + // Required to use the target selector argument + setPermissionLevel(2); + } + // Some client update this.playerConnection.sendPacket(getPropertiesPacket()); // Send default properties refreshHealth(); // Heal and send health packet