aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0753-Fix-EntityArgument-and-EntitySelectorParser-permissi.patch
diff options
context:
space:
mode:
authorNassim Jahnke <[email protected]>2024-10-27 18:11:15 +0100
committerNassim Jahnke <[email protected]>2024-10-27 18:39:30 +0100
commit02bca1e6558bf4ac0cbf928d48e90f497b10b0a3 (patch)
tree1144072e447f4c0b7e80b278fd769106227f016a /patches/server/0753-Fix-EntityArgument-and-EntitySelectorParser-permissi.patch
parent12ed02105177f54906a7d4422b235929426bc264 (diff)
downloadPaper-02bca1e6558bf4ac0cbf928d48e90f497b10b0a3.tar.gz
Paper-02bca1e6558bf4ac0cbf928d48e90f497b10b0a3.zip
Remove timings impl
Diffstat (limited to 'patches/server/0753-Fix-EntityArgument-and-EntitySelectorParser-permissi.patch')
-rw-r--r--patches/server/0753-Fix-EntityArgument-and-EntitySelectorParser-permissi.patch41
1 files changed, 41 insertions, 0 deletions
diff --git a/patches/server/0753-Fix-EntityArgument-and-EntitySelectorParser-permissi.patch b/patches/server/0753-Fix-EntityArgument-and-EntitySelectorParser-permissi.patch
new file mode 100644
index 0000000000..2fe35c8b32
--- /dev/null
+++ b/patches/server/0753-Fix-EntityArgument-and-EntitySelectorParser-permissi.patch
@@ -0,0 +1,41 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Jason Penilla <[email protected]>
+Date: Wed, 26 Oct 2022 13:13:12 -0700
+Subject: [PATCH] Fix EntityArgument and EntitySelectorParser 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
+index a327939abe2cce22747366051b6b7aaa2db3a8cc..3281ea4dca20d2bb22b2b1c6b9abb1329bc829c1 100644
+--- a/src/main/java/net/minecraft/commands/arguments/EntityArgument.java
++++ b/src/main/java/net/minecraft/commands/arguments/EntityArgument.java
+@@ -135,7 +135,12 @@ public class EntityArgument implements ArgumentType<EntitySelector> {
+ StringReader stringreader = new StringReader(suggestionsbuilder.getInput());
+
+ stringreader.setCursor(suggestionsbuilder.getStart());
+- EntitySelectorParser argumentparserselector = new EntitySelectorParser(stringreader, EntitySelectorParser.allowSelectors(icompletionprovider));
++ // Paper start - Fix EntityArgument permissions
++ final boolean permission = object instanceof CommandSourceStack stack
++ ? stack.bypassSelectorPermissions || stack.hasPermission(2, "minecraft.command.selector")
++ : icompletionprovider.hasPermission(2);
++ EntitySelectorParser argumentparserselector = new EntitySelectorParser(stringreader, permission);
++ // Paper end - Fix EntityArgument permissions
+
+ try {
+ argumentparserselector.parse();
+diff --git a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelectorParser.java b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelectorParser.java
+index dd50a530439576f56f245ff0b7eb090f9f0c9180..9d31e29ec62f437e642ed60da69c4b106bd9e770 100644
+--- a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelectorParser.java
++++ b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelectorParser.java
+@@ -133,7 +133,7 @@ public class EntitySelectorParser {
+ boolean flag;
+
+ if (source instanceof SharedSuggestionProvider icompletionprovider) {
+- if (icompletionprovider.hasPermission(2)) {
++ if (source instanceof net.minecraft.commands.CommandSourceStack stack ? stack.bypassSelectorPermissions || stack.hasPermission(2, "minecraft.command.selector") : icompletionprovider.hasPermission(2)) { // Paper - Fix EntityArgument permissions
+ flag = true;
+ return flag;
+ }