13
0
geforkt von Mirrors/Paper

Updated Upstream (Bukkit/CraftBukkit) (#7776)

Dieser Commit ist enthalten in:
Shane Freeder 2022-04-30 17:27:41 +01:00
Ursprung 8d72e2dfb2
Commit 655a3cf961
10 geänderte Dateien mit 71 neuen und 59 gelöschten Zeilen

Datei anzeigen

@ -8,20 +8,12 @@ diff --git a/src/main/java/org/bukkit/entity/Vex.java b/src/main/java/org/bukkit
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/entity/Vex.java
+++ b/src/main/java/org/bukkit/entity/Vex.java
@@ -0,0 +0,0 @@
package org.bukkit.entity;
+import org.jetbrains.annotations.Nullable;
+
/**
* Represents a Vex.
*/
@@ -0,0 +0,0 @@ public interface Vex extends Monster {
* @param charging new state
* @return true if the entity has limited life
*/
void setCharging(boolean charging);
+
boolean hasLimitedLife();
+ // Paper start
+
+ /**
+ * Get the Mob that summoned this vex
+ *

Datei anzeigen

@ -565,6 +565,37 @@ diff --git a/src/main/java/org/bukkit/entity/Vex.java b/src/main/java/org/bukkit
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/entity/Vex.java
+++ b/src/main/java/org/bukkit/entity/Vex.java
@@ -0,0 +0,0 @@ public interface Vex extends Monster {
* Gets the remaining lifespan of this entity.
*
* @return life in ticks
+ * @deprecated This API duplicates existing API which uses the more
+ * preferable name due to mirroring internals better
*/
+ @Deprecated
int getLifeTicks();
/**
* Sets the remaining lifespan of this entity.
*
* @param lifeTicks life in ticks, or negative for unlimited lifepan
+ * @deprecated This API duplicates existing API which uses the more
+ * preferable name due to mirroring internals better
*/
+ @Deprecated
void setLifeTicks(int lifeTicks);
/**
* Gets if the entity has a limited life.
*
* @return true if the entity has limited life
+ * @deprecated This API duplicates existing API which uses the more
+ * preferable name due to mirroring internals better
*/
+ @Deprecated
boolean hasLimitedLife();
// Paper start
@@ -0,0 +0,0 @@ public interface Vex extends Monster {
* @param summoner New summoner
*/

Datei anzeigen

@ -22,30 +22,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
protected FileConfigurationOptions(@NotNull MemoryConfiguration configuration) {
super(configuration);
diff --git a/src/main/java/org/bukkit/configuration/file/YamlRepresenter.java b/src/main/java/org/bukkit/configuration/file/YamlRepresenter.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/configuration/file/YamlRepresenter.java
+++ b/src/main/java/org/bukkit/configuration/file/YamlRepresenter.java
@@ -0,0 +0,0 @@ import org.yaml.snakeyaml.representer.Representer;
public class YamlRepresenter extends Representer {
public YamlRepresenter() {
+ this.multiRepresenters.put(org.bukkit.configuration.ConfigurationSection.class, new RepresentConfigurationSection()); // Paper - restore old yaml config section representer
this.multiRepresenters.put(ConfigurationSerializable.class, new RepresentConfigurationSerializable());
// SPIGOT-6234: We could just switch YamlConstructor to extend Constructor rather than SafeConstructor, however there is a very small risk of issues with plugins treating config as untrusted input
// So instead we will just allow future plugins to have their enums extend ConfigurationSerializable
this.multiRepresenters.remove(Enum.class);
}
+ // Paper start - restore old yaml config section representer
+ private class RepresentConfigurationSection extends RepresentMap {
+
+ @NotNull
+ @Override
+ public Node representData(@NotNull Object data) {
+ return super.representData(((org.bukkit.configuration.ConfigurationSection) data).getValues(false));
+ }
+ }
+ // Paper end
private class RepresentConfigurationSerializable extends RepresentMap {

Datei anzeigen

@ -65,9 +65,9 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/sr
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
@@ -0,0 +0,0 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.Villager;
@@ -0,0 +0,0 @@ import org.bukkit.entity.Villager;
import org.bukkit.entity.ZombieVillager;
import org.bukkit.event.entity.CreatureSpawnEvent;
+// Paper start
+import com.destroystokyo.paper.entity.villager.Reputation;

Datei anzeigen

@ -21,7 +21,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - Don't suggest if the requirement isn't met
+ if (parent != this.root || node.canUse(context.getSource())) {
try {
future = node.listSuggestions(context.build(truncatedInput), new SuggestionsBuilder(truncatedInput, truncatedInputLowerCase, start));
- if (node.canUse(parse.getContext().getSource())) future = node.listSuggestions(context.build(truncatedInput), new SuggestionsBuilder(truncatedInput, truncatedInputLowerCase, start)); // CraftBukkit
+ future = node.listSuggestions(context.build(truncatedInput), new SuggestionsBuilder(truncatedInput, truncatedInputLowerCase, start)); // CraftBukkit
} catch (final CommandSyntaxException ignored) {
}
+ }

Datei anzeigen

@ -14,7 +14,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public class DefaultDispenseItemBehavior implements DispenseItemBehavior {
+ private Direction enumdirection; // Paper
public DefaultDispenseItemBehavior() {}
// CraftBukkit start
private boolean dropper;
@@ -0,0 +0,0 @@ public class DefaultDispenseItemBehavior implements DispenseItemBehavior {
@Override
public final ItemStack dispense(BlockSource pointer, ItemStack stack) {

Datei anzeigen

@ -3,6 +3,9 @@ From: Nassim Jahnke <nassim@njahnke.dev>
Date: Fri, 4 Mar 2022 20:35:19 +0100
Subject: [PATCH] Fix falling block spawn methods
Restores the API behavior from previous versions of the server
- Do not call API events
- Do not replace the existing block in the world
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@ -25,17 +28,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
Validate.notNull(material, "Material cannot be null");
Validate.isTrue(material.isBlock(), "Material must be a block");
- FallingBlockEntity entity = FallingBlockEntity.fall(world, new BlockPos(location.getX(), location.getY(), location.getZ()), CraftMagicNumbers.getBlock(material).defaultBlockState());
- FallingBlockEntity entity = FallingBlockEntity.fall(world, new BlockPos(location.getX(), location.getY(), location.getZ()), CraftMagicNumbers.getBlock(material).defaultBlockState(), SpawnReason.CUSTOM);
+ // Paper start - restore API behavior for spawning falling blocks
+ FallingBlockEntity entity = new FallingBlockEntity(this.world, location.getX(), location.getY(), location.getZ(), CraftMagicNumbers.getBlock(material).defaultBlockState()); // Paper
entity.time = 1;
+ entity.time = 1;
+
+ this.world.addFreshEntity(entity, SpawnReason.CUSTOM);
+ // Paper end
return (FallingBlock) entity.getBukkitEntity();
}
this.world.addFreshEntity(entity, SpawnReason.CUSTOM);
@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
Validate.notNull(location, "Location cannot be null");
Validate.notNull(data, "Material cannot be null");
Validate.notNull(data, "BlockData cannot be null");
- FallingBlockEntity entity = FallingBlockEntity.fall(world, new BlockPos(location.getX(), location.getY(), location.getZ()), ((CraftBlockData) data).getState());
+ FallingBlockEntity entity = new FallingBlockEntity(this.world, location.getX(), location.getY(), location.getZ(), ((CraftBlockData) data).getState()); // Paper
entity.time = 1;
- FallingBlockEntity entity = FallingBlockEntity.fall(world, new BlockPos(location.getX(), location.getY(), location.getZ()), ((CraftBlockData) data).getState(), SpawnReason.CUSTOM);
+ // Paper start - restore API behavior for spawning falling blocks
+ FallingBlockEntity entity = new FallingBlockEntity(this.world, location.getX(), location.getY(), location.getZ(), ((CraftBlockData) data).getState());
+ entity.time = 1;
+
+ this.world.addFreshEntity(entity, SpawnReason.CUSTOM);
+ // Paper end
return (FallingBlock) entity.getBukkitEntity();
}
this.world.addFreshEntity(entity, SpawnReason.CUSTOM);

Datei anzeigen

@ -8,20 +8,20 @@ diff --git a/src/main/java/com/mojang/brigadier/tree/CommandNode.java b/src/main
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/com/mojang/brigadier/tree/CommandNode.java
+++ b/src/main/java/com/mojang/brigadier/tree/CommandNode.java
@@ -0,0 +0,0 @@ import java.util.stream.Collectors;
@@ -0,0 +0,0 @@ import java.util.function.Predicate;
import net.minecraft.commands.CommandSourceStack;
public abstract class CommandNode<S> implements Comparable<CommandNode<S>> {
- private Map<String, CommandNode<S>> children = Maps.newLinkedHashMap();
+ private Map<String, CommandNode<S>> children = Maps.newTreeMap(); // Paper - Switch to tree map for automatic sorting
private Map<String, LiteralCommandNode<S>> literals = Maps.newLinkedHashMap();
private Map<String, ArgumentCommandNode<S, ?>> arguments = Maps.newLinkedHashMap();
- private final Map<String, CommandNode<S>> children = new LinkedHashMap<>();
+ private Map<String, CommandNode<S>> children = com.google.common.collect.Maps.newTreeMap(); // Paper - Switch to tree map for automatic sorting
private final Map<String, LiteralCommandNode<S>> literals = new LinkedHashMap<>();
private final Map<String, ArgumentCommandNode<S, ?>> arguments = new LinkedHashMap<>();
public Predicate<S> requirement;
@@ -0,0 +0,0 @@ public abstract class CommandNode<S> implements Comparable<CommandNode<S>> {
this.arguments.put(node.getName(), (ArgumentCommandNode<S, ?>) node);
}
}
- this.children = this.children.entrySet().stream().sorted(Map.Entry.comparingByValue()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));
+
+ // Paper - Remove manual sorting, it is no longer needed
}

@ -1 +1 @@
Subproject commit fc460d1bb8d5f2bc9ff07dad1b7b402eed06d7c4
Subproject commit 31514774479a17c4a8cfb2d44f392a590a2b282c

@ -1 +1 @@
Subproject commit a459f4d4f5f89e6266be8db2e7facea1cb00b5d0
Subproject commit 9cc7d766dc36bf5f565381f0d1be885911895c1a