13
0
geforkt von Mirrors/Paper
Paper/paper-server/patches/sources/net/minecraft/commands/arguments/EntityArgument.java.patch
2024-12-14 20:30:36 +01:00

33 Zeilen
1.9 KiB
Diff

--- a/net/minecraft/commands/arguments/EntityArgument.java
+++ b/net/minecraft/commands/arguments/EntityArgument.java
@@ -105,9 +_,14 @@
}
private EntitySelector parse(StringReader reader, boolean allowSelectors) throws CommandSyntaxException {
+ // CraftBukkit start
+ return this.parse(reader, allowSelectors, true);
+ }
+ private EntitySelector parse(StringReader reader, boolean allowSelectors, boolean overridePermissions) throws CommandSyntaxException {
+ // CraftBukkit end
int i = 0;
EntitySelectorParser entitySelectorParser = new EntitySelectorParser(reader, allowSelectors);
- EntitySelector entitySelector = entitySelectorParser.parse();
+ EntitySelector entitySelector = entitySelectorParser.parse(overridePermissions); // CraftBukkit
if (entitySelector.getMaxResults() > 1 && this.single) {
if (this.playersOnly) {
reader.setCursor(0);
@@ -129,7 +_,12 @@
if (context.getSource() instanceof SharedSuggestionProvider sharedSuggestionProvider) {
StringReader stringReader = new StringReader(builder.getInput());
stringReader.setCursor(builder.getStart());
- EntitySelectorParser entitySelectorParser = new EntitySelectorParser(stringReader, EntitySelectorParser.allowSelectors(sharedSuggestionProvider));
+ // Paper start - Fix EntityArgument permissions
+ final boolean permission = sharedSuggestionProvider instanceof CommandSourceStack stack
+ ? stack.bypassSelectorPermissions || stack.hasPermission(2, "minecraft.command.selector")
+ : sharedSuggestionProvider.hasPermission(2);
+ EntitySelectorParser entitySelectorParser = new EntitySelectorParser(stringReader, permission);
+ // Paper end - Fix EntityArgument permissions
try {
entitySelectorParser.parse();