Fix CommandSourceStack#bypassSelectorPermissions (#10837)

The previous implementation would throw a command exception if the
CommandSourceStack had its bypassSelectorPermissions flag set to true,
which is the incorrect behaviour.

Instead, it should only throw an exception if the flag is set to false
and all its other checks "fail" too.
This commit is contained in:
Bjarne Koll 2024-06-01 16:26:11 +02:00
parent 3a135ada91
commit 97ed3762cf

View File

@ -2213,7 +2213,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private void checkPermissions(CommandSourceStack source) throws CommandSyntaxException { private void checkPermissions(CommandSourceStack source) throws CommandSyntaxException {
- if (this.usesSelector && !source.hasPermission(2, "minecraft.command.selector")) { // CraftBukkit - if (this.usesSelector && !source.hasPermission(2, "minecraft.command.selector")) { // CraftBukkit
+ if (source.bypassSelectorPermissions || (this.usesSelector && !source.hasPermission(2, "minecraft.command.selector"))) { // CraftBukkit // Paper - add bypass for selector perms + 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(); throw EntityArgument.ERROR_SELECTORS_NOT_ALLOWED.create();
} }
} }