ExperienceOrb award methods were consolidated to avoid this large of a
conflict in future versions for what is a single override.
Callers are expected to now pass null to the 3rd overload param as well.
This commit is contained in:
Bjarne Koll
2025-05-29 17:46:55 +02:00
parent 0795cbed25
commit ca8da0e3ca
12 changed files with 356 additions and 449 deletions

View File

@@ -0,0 +1,11 @@
--- a/net/minecraft/commands/arguments/selector/EntitySelector.java
+++ b/net/minecraft/commands/arguments/selector/EntitySelector.java
@@ -105,7 +_,7 @@
}
private void checkPermissions(CommandSourceStack source) throws CommandSyntaxException {
- if (this.usesSelector && !source.allowsSelectors()) {
+ if (!source.bypassSelectorPermissions && (this.usesSelector && !source.hasPermission(2, "minecraft.command.selector"))) { // CraftBukkit // Paper - add bypass for selector perms
throw EntityArgument.ERROR_SELECTORS_NOT_ALLOWED.create();
}
}

View File

@@ -0,0 +1,49 @@
--- a/net/minecraft/commands/arguments/selector/EntitySelectorParser.java
+++ b/net/minecraft/commands/arguments/selector/EntitySelectorParser.java
@@ -122,6 +_,11 @@
}
public static <S> boolean allowSelectors(S suggestionProvider) {
+ // Paper start - Fix EntityArgument permissions
+ if (suggestionProvider instanceof net.minecraft.commands.CommandSourceStack stack) {
+ return stack.bypassSelectorPermissions || stack.hasPermission(2, "minecraft.command.selector");
+ }
+ // Paper end - Fix EntityArgument permissions
return suggestionProvider instanceof PermissionSource permissionSource && permissionSource.allowsSelectors();
}
@@ -198,8 +_,10 @@
};
}
- protected void parseSelector() throws CommandSyntaxException {
- this.usesSelectors = true;
+ // CraftBukkit start
+ protected void parseSelector(boolean overridePermissions) throws CommandSyntaxException {
+ this.usesSelectors = !overridePermissions;
+ // CraftBukkit end
this.suggestions = this::suggestSelector;
if (!this.reader.canRead()) {
throw ERROR_MISSING_SELECTOR_TYPE.createWithContext(this.reader);
@@ -467,6 +_,12 @@
}
public EntitySelector parse() throws CommandSyntaxException {
+ // CraftBukkit start
+ return this.parse(false);
+ }
+
+ public EntitySelector parse(boolean overridePermissions) throws CommandSyntaxException {
+ // CraftBukkit end
this.startPosition = this.reader.getCursor();
this.suggestions = this::suggestNameOrSelector;
if (this.reader.canRead() && this.reader.peek() == '@') {
@@ -475,7 +_,7 @@
}
this.reader.skip();
- this.parseSelector();
+ this.parseSelector(overridePermissions); // CraftBukkit
} else {
this.parseNameOrUUID();
}