Paper/nms-patches/ArgumentParserSelector.patch

64 lines
2.3 KiB
Diff

--- a/net/minecraft/server/ArgumentParserSelector.java
+++ b/net/minecraft/server/ArgumentParserSelector.java
@@ -98,8 +98,14 @@
}
public ArgumentParserSelector(StringReader stringreader, boolean flag) {
- this.q = CriterionConditionValue.c.e;
- this.r = CriterionConditionValue.d.e;
+ // CraftBukkit start - decompile error
+ try {
+ this.q = (CriterionConditionValue.c) Class.forName("net.minecraft.server.CriterionConditionValue$c").getDeclaredField("e").get(null);
+ this.r = (CriterionConditionValue.d) Class.forName("net.minecraft.server.CriterionConditionValue$d").getDeclaredField("e").get(null);
+ } catch (Exception ex) {
+ throw new AssertionError(ex);
+ }
+ // CraftBukkit end
this.y = CriterionConditionRange.a;
this.z = CriterionConditionRange.a;
this.A = (entity) -> {
@@ -126,7 +132,7 @@
axisalignedbb = this.a(this.v == null ? 0.0D : this.v, this.w == null ? 0.0D : this.w, this.x == null ? 0.0D : this.x);
}
- Function function;
+ Function<Vec3D, Vec3D> function; // CraftBukkit - decompile error
if (this.s == null && this.t == null && this.u == null) {
function = (vec3d) -> {
@@ -187,8 +193,10 @@
};
}
- protected void b() throws CommandSyntaxException {
- this.T = true;
+ // CraftBukkit start
+ protected void b(boolean overridePermissions) throws CommandSyntaxException {
+ this.T = !overridePermissions;
+ // CraftBukkit end
this.G = this::d;
if (!this.l.canRead()) {
throw ArgumentParserSelector.d.createWithContext(this.l);
@@ -431,6 +439,12 @@
}
public EntitySelector s() throws CommandSyntaxException {
+ // CraftBukkit start
+ return s(false);
+ }
+
+ public EntitySelector s(boolean overridePermissions) throws CommandSyntaxException {
+ // CraftBukkit end
this.E = this.l.getCursor();
this.G = this::b;
if (this.l.canRead() && this.l.peek() == '@') {
@@ -439,7 +453,7 @@
}
this.l.skip();
- this.b();
+ this.b(overridePermissions); // CraftBukkit
} else {
this.c();
}