From a17bbb45602cdc8a64eb31137aa0d9308f1ca5a3 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Thu, 9 May 2019 08:20:01 +0100 Subject: [PATCH] Updated Upstream (Bukkit/CraftBukkit) Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: fe0cadf0 Add BlockShearEntityEvent for Dispensers shearing Sheep 90e5cca3 SPIGOT-4892: Allow to set the currently viewed page of a book on a lectern inventory a30337f7 SPIGOT-4887: Villager level minimum is 1 d88d828c SPIGOT-4886: Villager type SNOWY should be named SNOW CraftBukkit Changes: 6ceffb0d SPIGOT-4895: Bed doesn't explode in Nether and The End ee881847 SPIGOT-4888: setSleepingIgnored resets the night even when there is no one in a bed 15e02b40 SPIGOT-4890: EntityDeathEvent fires twice when breaking an armor stand in survival mode b38a3c33 Add BlockShearEntityEvent for Dispensers shearing Sheep 70ebefca SPIGOT-4891: LecternInventory.getType() should return InventoryType.LECTERN 0036d1b7 SPIGOT-4887: Villager level minimum is 1 --- ...dd-an-asterisk-to-legacy-API-plugins.patch | 4 ++-- ...-MinecraftKey-Information-to-Objects.patch | 12 +++++----- .../Add-source-to-PlayerExpChangeEvent.patch | 6 ++--- ...ead-Entities-in-entityList-iteration.patch | 12 +++++----- .../Inventory-removeItemAnySlot.patch | 2 +- .../Paper-config-files.patch | 22 +++++++++---------- ...rovide-E-TE-Chunk-count-stat-methods.patch | 17 ++++++++++++-- work/Bukkit | 2 +- work/CraftBukkit | 2 +- 9 files changed, 46 insertions(+), 33 deletions(-) diff --git a/Spigot-API-Patches/Add-an-asterisk-to-legacy-API-plugins.patch b/Spigot-API-Patches/Add-an-asterisk-to-legacy-API-plugins.patch index bcec8454e3..65c0bb57eb 100644 --- a/Spigot-API-Patches/Add-an-asterisk-to-legacy-API-plugins.patch +++ b/Spigot-API-Patches/Add-an-asterisk-to-legacy-API-plugins.patch @@ -7,7 +7,7 @@ Not here to name and shame, only so server admins can be aware of which plugins have and haven't been updated. diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 72c5501e..71da4a79 100644 +index 72c5501e..9e96e12c 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java @@ -0,0 +0,0 @@ public interface UnsafeValues { @@ -16,7 +16,7 @@ index 72c5501e..71da4a79 100644 String getTimingsServerName(); + + static boolean isLegacyPlugin(org.bukkit.plugin.Plugin plugin) { -+ return !"1.13".equals(plugin.getDescription().getAPIVersion()) && !"1.14".equals(plugin.getDescription().getAPIVersion()); ++ return !("1.13".equals(plugin.getDescription().getAPIVersion())); + } // Paper end } diff --git a/Spigot-Server-Patches/Add-MinecraftKey-Information-to-Objects.patch b/Spigot-Server-Patches/Add-MinecraftKey-Information-to-Objects.patch index 518ba7e48f..7d720bca4c 100644 --- a/Spigot-Server-Patches/Add-MinecraftKey-Information-to-Objects.patch +++ b/Spigot-Server-Patches/Add-MinecraftKey-Information-to-Objects.patch @@ -6,12 +6,12 @@ Subject: [PATCH] Add MinecraftKey Information to Objects Stores the reference to the objects respective MinecraftKey diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index b5f318c00d..ce190d88d6 100644 +index 841edd010..3354fdd60 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -0,0 +0,0 @@ public class PaperCommand extends Command { - Collection entities = world.entitiesById.values(); + List entities = world.globalEntityList; entities.forEach(e -> { - MinecraftKey key = new MinecraftKey(""); // TODO: update in next patch + MinecraftKey key = e.getMinecraftKey(); @@ -19,7 +19,7 @@ index b5f318c00d..ce190d88d6 100644 MutablePair> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap())); ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.getChunkX(), e.getChunkZ()); diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 77015bc06e..01e4863899 100644 +index 77015bc06..01e486389 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -0,0 +0,0 @@ import org.bukkit.event.player.PlayerTeleportEvent; @@ -65,7 +65,7 @@ index 77015bc06e..01e4863899 100644 protected abstract void a(NBTTagCompound nbttagcompound); diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java -index 3217a8ed18..c7fb8f513b 100644 +index 3217a8ed1..c7fb8f513 100644 --- a/src/main/java/net/minecraft/server/EntityTypes.java +++ b/src/main/java/net/minecraft/server/EntityTypes.java @@ -0,0 +0,0 @@ public class EntityTypes { @@ -78,7 +78,7 @@ index 3217a8ed18..c7fb8f513b 100644 } diff --git a/src/main/java/net/minecraft/server/KeyedObject.java b/src/main/java/net/minecraft/server/KeyedObject.java new file mode 100644 -index 0000000000..743142d030 +index 000000000..743142d03 --- /dev/null +++ b/src/main/java/net/minecraft/server/KeyedObject.java @@ -0,0 +0,0 @@ @@ -92,7 +92,7 @@ index 0000000000..743142d030 + } +} diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index 080fd819b6..77d77fcb8b 100644 +index 080fd819b..77d77fcb8 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java @@ -0,0 +0,0 @@ import org.bukkit.inventory.InventoryHolder; diff --git a/Spigot-Server-Patches/Add-source-to-PlayerExpChangeEvent.patch b/Spigot-Server-Patches/Add-source-to-PlayerExpChangeEvent.patch index f47824580d..66031a7785 100644 --- a/Spigot-Server-Patches/Add-source-to-PlayerExpChangeEvent.patch +++ b/Spigot-Server-Patches/Add-source-to-PlayerExpChangeEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add source to PlayerExpChangeEvent diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java -index b20813be64..bfba08fb24 100644 +index b20813be6..bfba08fb2 100644 --- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java +++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java @@ -0,0 +0,0 @@ public class EntityExperienceOrb extends Entity { @@ -18,10 +18,10 @@ index b20813be64..bfba08fb24 100644 this.die(); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 1632969249..451d4f030c 100644 +index e67b4cbac..0441afce9 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -0,0 +0,0 @@ import org.bukkit.entity.Projectile; +@@ -0,0 +0,0 @@ import org.bukkit.entity.Sheep; import org.bukkit.entity.ThrownExpBottle; import org.bukkit.entity.ThrownPotion; import org.bukkit.entity.Vehicle; diff --git a/Spigot-Server-Patches/Ignore-Dead-Entities-in-entityList-iteration.patch b/Spigot-Server-Patches/Ignore-Dead-Entities-in-entityList-iteration.patch index 7b76bfb3a1..ca1e1c0a49 100644 --- a/Spigot-Server-Patches/Ignore-Dead-Entities-in-entityList-iteration.patch +++ b/Spigot-Server-Patches/Ignore-Dead-Entities-in-entityList-iteration.patch @@ -11,11 +11,11 @@ This will ensure that dead entities are skipped from iteration since they shouldn't of been in the list in the first place. diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index ce190d88d6..352a39dcb3 100644 +index 3354fdd60..ab0910454 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -0,0 +0,0 @@ public class PaperCommand extends Command { - Collection entities = world.entitiesById.values(); + List entities = world.globalEntityList; entities.forEach(e -> { MinecraftKey key = e.getMinecraftKey(); + if (e.shouldBeRemoved) return; // Paper @@ -23,7 +23,7 @@ index ce190d88d6..352a39dcb3 100644 MutablePair> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap())); ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.getChunkX(), e.getChunkZ()); diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index d787a4ab30..d313b9b3ca 100644 +index d787a4ab3..d313b9b3c 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { @@ -51,7 +51,7 @@ index d787a4ab30..d313b9b3ca 100644 if (oclass.isInstance(t0) && t0.getBoundingBox().c(axisalignedbb) && (predicate == null || predicate.test(t0))) { // Spigot - instance check list.add(t0); diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index f8e837faec..aac0146fd2 100644 +index f8e837fae..aac0146fd 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -63,7 +63,7 @@ index f8e837faec..aac0146fd2 100644 private float av; private float aw; diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index d9f8223fec..fc04e736a4 100644 +index 402aac677..219c71ff6 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World { @@ -91,7 +91,7 @@ index d9f8223fec..fc04e736a4 100644 } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 19fa15d793..79a5adf482 100644 +index 209e72648..3b0f9c86f 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -0,0 +0,0 @@ public class CraftWorld implements World { diff --git a/Spigot-Server-Patches/Inventory-removeItemAnySlot.patch b/Spigot-Server-Patches/Inventory-removeItemAnySlot.patch index 202a3b0cbd..555f5a78d8 100644 --- a/Spigot-Server-Patches/Inventory-removeItemAnySlot.patch +++ b/Spigot-Server-Patches/Inventory-removeItemAnySlot.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Inventory#removeItemAnySlot diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java -index 9fbedcede8..b7e08b55f9 100644 +index 7e0a20d1d..c3516de7f 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java @@ -0,0 +0,0 @@ public class CraftInventory implements Inventory { diff --git a/Spigot-Server-Patches/Paper-config-files.patch b/Spigot-Server-Patches/Paper-config-files.patch index a1b76d4610..7569dfca68 100644 --- a/Spigot-Server-Patches/Paper-config-files.patch +++ b/Spigot-Server-Patches/Paper-config-files.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Paper config files diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java new file mode 100644 -index 0000000000..b5f318c00d +index 000000000..841edd010 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -0,0 +0,0 @@ @@ -185,7 +185,7 @@ index 0000000000..b5f318c00d + } + WorldServer world = ((CraftWorld) Bukkit.getWorld(worldName)).getHandle(); + -+ Collection entities = world.entitiesById.values(); ++ List entities = world.globalEntityList; + entities.forEach(e -> { + MinecraftKey key = new MinecraftKey(""); // TODO: update in next patch + @@ -253,7 +253,7 @@ index 0000000000..b5f318c00d +} diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java new file mode 100644 -index 0000000000..db79fe41b9 +index 000000000..db79fe41b --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -0,0 +0,0 @@ @@ -443,7 +443,7 @@ index 0000000000..db79fe41b9 +} diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java new file mode 100644 -index 0000000000..a738657394 +index 000000000..a73865739 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ @@ -515,7 +515,7 @@ index 0000000000..a738657394 + } +} diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index e1ba833f3e..b60956218d 100644 +index e1ba833f3..b60956218 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer @@ -535,7 +535,7 @@ index e1ba833f3e..b60956218d 100644 this.setSpawnAnimals(dedicatedserverproperties.spawnAnimals); this.setSpawnNPCs(dedicatedserverproperties.spawnNpcs); diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index fd8397bd4d..77015bc06e 100644 +index fd8397bd4..77015bc06 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener { @@ -552,7 +552,7 @@ index fd8397bd4d..77015bc06e 100644 public boolean impulse; public int portalCooldown; diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java -index ee43aa24d2..01d9ed69c5 100644 +index ee43aa24d..01d9ed69c 100644 --- a/src/main/java/net/minecraft/server/EntityTypes.java +++ b/src/main/java/net/minecraft/server/EntityTypes.java @@ -0,0 +0,0 @@ import com.mojang.datafixers.DataFixUtils; @@ -575,7 +575,7 @@ index ee43aa24d2..01d9ed69c5 100644 + // Paper end } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 84155573df..83fdea893c 100644 +index 84155573d..83fdea893 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose @@ -596,7 +596,7 @@ index 84155573df..83fdea893c 100644 this.world = new CraftWorld((WorldServer) this, gen, env); this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index be03fe24b8..5dc2bb1246 100644 +index be03fe24b..5dc2bb124 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -0,0 +0,0 @@ public final class CraftServer implements Server { @@ -651,7 +651,7 @@ index be03fe24b8..5dc2bb1246 100644 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index e17d914185..f406464ef8 100644 +index e17d91418..f406464ef 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -0,0 +0,0 @@ public class Main { @@ -670,7 +670,7 @@ index e17d914185..f406464ef8 100644 }; diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 6bceeb120b..9a51c0ef7a 100644 +index 6bceeb120..9a51c0ef7 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -0,0 +0,0 @@ public class SpigotWorldConfig diff --git a/Spigot-Server-Patches/Provide-E-TE-Chunk-count-stat-methods.patch b/Spigot-Server-Patches/Provide-E-TE-Chunk-count-stat-methods.patch index 4a12b1a006..276c6412bc 100644 --- a/Spigot-Server-Patches/Provide-E-TE-Chunk-count-stat-methods.patch +++ b/Spigot-Server-Patches/Provide-E-TE-Chunk-count-stat-methods.patch @@ -6,8 +6,21 @@ Subject: [PATCH] Provide E/TE/Chunk count stat methods Provides counts without the ineffeciency of using .getEntities().size() which creates copy of the collections. +diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +index ff75bb3c6..5ed0fbe5a 100644 +--- a/src/main/java/net/minecraft/server/WorldServer.java ++++ b/src/main/java/net/minecraft/server/WorldServer.java +@@ -0,0 +0,0 @@ import org.bukkit.event.weather.LightningStrikeEvent; + public class WorldServer extends World { + + private static final Logger LOGGER = LogManager.getLogger(); +- private final List globalEntityList = Lists.newArrayList(); ++ public final List globalEntityList = Lists.newArrayList(); // Paper - private -> public + public final Int2ObjectMap entitiesById = new Int2ObjectLinkedOpenHashMap(); + private final Map entitiesByUUID = Maps.newHashMap(); + private final Queue entitiesToAdd = Queues.newArrayDeque(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index b8de760079..b3a77ec3c5 100644 +index b8de76007..c79b0f42a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -0,0 +0,0 @@ public class CraftWorld implements World { @@ -17,7 +30,7 @@ index b8de760079..b3a77ec3c5 100644 + // Paper start - Provide fast information methods + // TODO review these changes + public int getEntityCount() { -+ return world.entitiesById.size(); ++ return world.globalEntityList.size(); + } + public int getTileEntityCount() { + // We don't use the full world tile entity list, so we must iterate chunks diff --git a/work/Bukkit b/work/Bukkit index 91b0487aed..fe0cadf055 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit 91b0487aed3000a9db40120e8c7c5605c28d1d51 +Subproject commit fe0cadf0559d68852de1122f4c5e31f9bd4d4cef diff --git a/work/CraftBukkit b/work/CraftBukkit index d20328368c..6ceffb0d2a 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit d20328368cdc37b8b0ef563b97192e22a13126d1 +Subproject commit 6ceffb0d2aa1d4118b70274c5b7603fb2e32ab35