2022-10-27 03:31:55 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Date: Wed, 26 Oct 2022 13:13:12 -0700
Subject: [PATCH] Fix EntityArgument suggestion permissions to align with
EntitySelector#checkPermissions
Fixes where the user has permission for selectors but not their
suggestions, which especially matters when we force suggestions to
the server for this type
diff --git a/src/main/java/net/minecraft/commands/arguments/EntityArgument.java b/src/main/java/net/minecraft/commands/arguments/EntityArgument.java
2024-01-18 22:00:40 +01:00
index d93698fd814683d451a3c8e8bcbb9cd475c79515..8d79cfa371546996ef65f94232c1d344e7c590ec 100644
2022-10-27 03:31:55 +02:00
--- a/src/main/java/net/minecraft/commands/arguments/EntityArgument.java
+++ b/src/main/java/net/minecraft/commands/arguments/EntityArgument.java
@@ -128,7 +128,12 @@ public class EntityArgument implements ArgumentType<EntitySelector> {
StringReader stringreader = new StringReader(suggestionsbuilder.getInput());
stringreader.setCursor(suggestionsbuilder.getStart());
2024-01-18 22:00:40 +01:00
- EntitySelectorParser argumentparserselector = new EntitySelectorParser(stringreader, icompletionprovider.hasPermission(2), true); // Paper - tell clients to ask server for suggestions for EntityArguments
2024-01-16 12:41:40 +01:00
+ // Paper start - Fix EntityArgument suggestion permissions
2022-10-27 03:31:55 +02:00
+ final boolean permission = object instanceof CommandSourceStack stack
2022-11-23 05:53:50 +01:00
+ ? stack.bypassSelectorPermissions || stack.hasPermission(2, "minecraft.command.selector")
2022-10-27 03:31:55 +02:00
+ : icompletionprovider.hasPermission(2);
2024-01-18 22:00:40 +01:00
+ EntitySelectorParser argumentparserselector = new EntitySelectorParser(stringreader, permission, true); // Paper - tell clients to ask server for suggestions for EntityArguments
2024-01-16 12:41:40 +01:00
+ // Paper end - Fix EntityArgument suggestion permissions
2022-10-27 03:31:55 +02:00
try {
argumentparserselector.parse();