SPIGOT-8055: Fix minecraft.command.selector permission

This commit is contained in:
md_5 2025-06-02 19:59:40 +10:00
parent 3d4bff8827
commit 8a61686f98
No known key found for this signature in database
GPG key ID: E8E901AC7C617C11

View file

@ -1,6 +1,29 @@
--- a/net/minecraft/commands/arguments/selector/ArgumentParserSelector.java
+++ b/net/minecraft/commands/arguments/selector/ArgumentParserSelector.java
@@ -215,8 +215,10 @@
@@ -31,6 +31,10 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.Vec3D;
+// CraftBukkit start
+import net.minecraft.commands.CommandListenerWrapper;
+// CraftBukkit end
+
public class ArgumentParserSelector {
public static final char SYNTAX_SELECTOR_START = '@';
@@ -133,6 +137,11 @@
boolean flag;
if (s0 instanceof ICompletionProvider icompletionprovider) {
+ // CraftBukkit start
+ if (s0 instanceof CommandListenerWrapper wrapper && wrapper.hasPermission(2, "minecraft.command.selector")) {
+ return true;
+ }
+ // CraftBukkit end
if (icompletionprovider.hasPermission(2)) {
flag = true;
return flag;
@@ -215,8 +224,10 @@
};
}
@ -13,7 +36,7 @@
this.suggestions = this::suggestSelector;
if (!this.reader.canRead()) {
throw ArgumentParserSelector.ERROR_MISSING_SELECTOR_TYPE.createWithContext(this.reader);
@@ -505,6 +507,12 @@
@@ -505,6 +516,12 @@
}
public EntitySelector parse() throws CommandSyntaxException {
@ -26,7 +49,7 @@
this.startPosition = this.reader.getCursor();
this.suggestions = this::suggestNameOrSelector;
if (this.reader.canRead() && this.reader.peek() == '@') {
@@ -513,7 +521,7 @@
@@ -513,7 +530,7 @@
}
this.reader.skip();