Move CraftBukkit per-file patches

By: Initial <noreply+automated@papermc.io>
This commit is contained in:
CraftBukkit/Spigot
2024-12-11 22:26:36 +01:00
parent a4de181b77
commit a265d64138
583 changed files with 71 additions and 857 deletions

View File

@@ -0,0 +1,19 @@
--- a/net/minecraft/commands/arguments/ArgumentEntity.java
+++ b/net/minecraft/commands/arguments/ArgumentEntity.java
@@ -102,9 +102,15 @@
}
private EntitySelector parse(StringReader stringreader, boolean flag) throws CommandSyntaxException {
+ // CraftBukkit start
+ return parse(stringreader, flag, false);
+ }
+
+ public EntitySelector parse(StringReader stringreader, boolean flag, boolean overridePermissions) throws CommandSyntaxException {
+ // CraftBukkit end
boolean flag1 = false;
ArgumentParserSelector argumentparserselector = new ArgumentParserSelector(stringreader, flag);
- EntitySelector entityselector = argumentparserselector.parse();
+ EntitySelector entityselector = argumentparserselector.parse(overridePermissions); // CraftBukkit
if (entityselector.getMaxResults() > 1 && this.single) {
if (this.playersOnly) {

View File

@@ -0,0 +1,38 @@
--- a/net/minecraft/commands/arguments/blocks/ArgumentBlock.java
+++ b/net/minecraft/commands/arguments/blocks/ArgumentBlock.java
@@ -67,7 +67,7 @@
private final StringReader reader;
private final boolean forTesting;
private final boolean allowNbt;
- private final Map<IBlockState<?>, Comparable<?>> properties = Maps.newHashMap();
+ private final Map<IBlockState<?>, Comparable<?>> properties = Maps.newLinkedHashMap(); // CraftBukkit - stable
private final Map<String, String> vagueProperties = Maps.newHashMap();
private MinecraftKey id = MinecraftKey.withDefaultNamespace("");
@Nullable
@@ -275,7 +275,7 @@
Iterator iterator = iblockstate.getPossibleValues().iterator();
while (iterator.hasNext()) {
- T t0 = (Comparable) iterator.next();
+ T t0 = (T) iterator.next(); // CraftBukkit - decompile error
if (t0 instanceof Integer integer) {
suggestionsbuilder.suggest(integer);
@@ -545,7 +545,7 @@
Optional<T> optional = iblockstate.getValue(s);
if (optional.isPresent()) {
- this.state = (IBlockData) this.state.setValue(iblockstate, (Comparable) optional.get());
+ this.state = (IBlockData) this.state.setValue(iblockstate, (T) optional.get()); // CraftBukkit - decompile error
this.properties.put(iblockstate, (Comparable) optional.get());
} else {
this.reader.setCursor(i);
@@ -581,7 +581,7 @@
private static <T extends Comparable<T>> void appendProperty(StringBuilder stringbuilder, IBlockState<T> iblockstate, Comparable<?> comparable) {
stringbuilder.append(iblockstate.getName());
stringbuilder.append('=');
- stringbuilder.append(iblockstate.getName(comparable));
+ stringbuilder.append(iblockstate.getName((T) comparable)); // CraftBukkit - decompile error
}
public static record a(IBlockData blockState, Map<IBlockState<?>, Comparable<?>> properties, @Nullable NBTTagCompound nbt) {

View File

@@ -0,0 +1,46 @@
--- a/net/minecraft/commands/arguments/selector/ArgumentParserSelector.java
+++ b/net/minecraft/commands/arguments/selector/ArgumentParserSelector.java
@@ -158,7 +158,7 @@
axisalignedbb = this.createAabb(this.deltaX == null ? 0.0D : this.deltaX, this.deltaY == null ? 0.0D : this.deltaY, this.deltaZ == null ? 0.0D : this.deltaZ);
}
- Function function;
+ Function<Vec3D, Vec3D> function; // CraftBukkit - decompile error
if (this.x == null && this.y == null && this.z == null) {
function = (vec3d) -> {
@@ -215,8 +215,10 @@
};
}
- protected void parseSelector() throws CommandSyntaxException {
- this.usesSelectors = true;
+ // CraftBukkit start
+ protected void parseSelector(boolean overridePermissions) throws CommandSyntaxException {
+ this.usesSelectors = !overridePermissions;
+ // CraftBukkit end
this.suggestions = this::suggestSelector;
if (!this.reader.canRead()) {
throw ArgumentParserSelector.ERROR_MISSING_SELECTOR_TYPE.createWithContext(this.reader);
@@ -505,6 +507,12 @@
}
public EntitySelector parse() throws CommandSyntaxException {
+ // CraftBukkit start
+ return parse(false);
+ }
+
+ public EntitySelector parse(boolean overridePermissions) throws CommandSyntaxException {
+ // CraftBukkit end
this.startPosition = this.reader.getCursor();
this.suggestions = this::suggestNameOrSelector;
if (this.reader.canRead() && this.reader.peek() == '@') {
@@ -513,7 +521,7 @@
}
this.reader.skip();
- this.parseSelector();
+ this.parseSelector(overridePermissions); // CraftBukkit
} else {
this.parseNameOrUUID();
}

View File

@@ -0,0 +1,11 @@
--- a/net/minecraft/commands/arguments/selector/EntitySelector.java
+++ b/net/minecraft/commands/arguments/selector/EntitySelector.java
@@ -93,7 +93,7 @@
}
private void checkPermissions(CommandListenerWrapper commandlistenerwrapper) throws CommandSyntaxException {
- if (this.usesSelector && !commandlistenerwrapper.hasPermission(2)) {
+ if (this.usesSelector && !commandlistenerwrapper.hasPermission(2, "minecraft.command.selector")) { // CraftBukkit
throw ArgumentEntity.ERROR_SELECTORS_NOT_ALLOWED.create();
}
}