From 10c24a8e61e854afefb5ad671637197e648155a4 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> Date: Sat, 27 Apr 2019 19:23:53 -0400 Subject: [PATCH] More patches for 1.14 Chunk related stuff will need to be revisted later --- ...-get-a-BlockState-without-a-snapshot.patch | 8 +- .../Ability-to-apply-mending-to-XP-API.patch | 18 +-- .../Add-PlayerArmorChangeEvent.patch | 8 +- .../Add-PlayerJumpEvent.patch | 20 +--- ...rages-for-getTileEntity-in-order-to-.patch | 26 ----- ...-a-custom-authentication-servers-dow.patch | 8 +- .../AsyncTabCompleteEvent.patch | 14 +-- .../Avoid-NPE-in-PathfinderGoalTempt.patch | 2 +- ...player-logins-during-server-shutdown.patch | 6 +- ...urable-Chunks-Sends-per-Tick-setting.patch | 41 ------- ...Configurable-Max-Chunk-Gens-per-Tick.patch | 109 ------------------ ...refix-for-various-plugins-bypassing-.patch | 2 +- .../Entity-fromMobSpawner.patch | 10 +- .../ExperienceOrbMergeEvent.patch | 2 +- ...nt-protocol-version-and-virtual-host.patch | 12 +- .../Fix-Anvil-Level-sync-to-client.patch | 44 ------- .../Fix-MC-117075-TE-Unload-Lag-Spike.patch | 6 +- .../Fix-block-break-desync.patch | 4 +- .../Fix-this-stupid-bullshit.patch | 4 +- ...aving-disabled-before-unloading-all-.patch | 24 ---- ...n-prefixes-using-Log4J-configuration.patch | 6 +- ...mplement-ensureServerConversions-API.patch | 2 +- .../Implement-getI18NDisplayName.patch | 4 +- .../Improve-the-Saddle-API-for-Horses.patch | 6 +- .../Include-Log4J2-SLF4J-implementation.patch | 2 +- .../LivingEntity-setKiller.patch | 2 +- ...-max-squid-spawn-height-configurable.patch | 18 ++- ...awns-should-honor-nametags-and-leash.patch | 16 +-- ...-maximum-exp-value-when-merging-orbs.patch | 4 +- .../PlayerPickupExperienceEvent.patch | 14 +-- ...rom-being-processed-when-the-player-.patch | 8 +- .../Profile-Lookup-Events.patch | 2 +- .../ProfileWhitelistVerifyEvent.patch | 8 +- ...with-fastutil-s-ObjectOpenHashSet-in.patch | 2 +- ...imer-when-spawner-event-is-cancelled.patch | 4 +- ...dEffects-only-to-players-who-can-see.patch | 44 ++++--- .../Shoulder-Entities-Release-API.patch | 47 ++++---- ...ams-to-redirect-System.out-err-to-lo.patch | 4 +- .../handle-PacketPlayInKeepAlive-async.patch | 10 +- ...rt-serverside-behavior-of-keepalives.patch | 31 +++-- ...e-implementations-for-captured-block.patch | 4 +- 41 files changed, 173 insertions(+), 433 deletions(-) delete mode 100644 Spigot-Server-Patches/Add-missing-coverages-for-getTileEntity-in-order-to-.patch delete mode 100644 Spigot-Server-Patches/Configurable-Chunks-Sends-per-Tick-setting.patch delete mode 100644 Spigot-Server-Patches/Configurable-Max-Chunk-Gens-per-Tick.patch delete mode 100644 Spigot-Server-Patches/Fix-Anvil-Level-sync-to-client.patch delete mode 100644 Spigot-Server-Patches/GH-806-Respect-saving-disabled-before-unloading-all-.patch diff --git a/Spigot-Server-Patches/API-to-get-a-BlockState-without-a-snapshot.patch b/Spigot-Server-Patches/API-to-get-a-BlockState-without-a-snapshot.patch index 1f17b8d57c..37a32293e1 100644 --- a/Spigot-Server-Patches/API-to-get-a-BlockState-without-a-snapshot.patch +++ b/Spigot-Server-Patches/API-to-get-a-BlockState-without-a-snapshot.patch @@ -13,7 +13,7 @@ also Avoid NPE during CraftBlockEntityState load if could not get TE If Tile Entity was null, correct Sign to return empty lines instead of null diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index b3c5766a27..29fe031d85 100644 +index d8cc35352..4ac97a59c 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java @@ -0,0 +0,0 @@ public abstract class TileEntity implements KeyedObject { // Paper @@ -39,7 +39,7 @@ index b3c5766a27..29fe031d85 100644 return null; } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index 4b4fdf93f6..7ae4b7952f 100644 +index 8eabf8602..69b449507 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -0,0 +0,0 @@ public class CraftBlock implements Block { @@ -64,7 +64,7 @@ index 4b4fdf93f6..7ae4b7952f 100644 switch (material) { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java -index 4f4121adca..082a1b6e20 100644 +index 4f4121adc..082a1b6e2 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java @@ -0,0 +0,0 @@ public class CraftBlockEntityState extends CraftBlockState @@ -114,7 +114,7 @@ index 4f4121adca..082a1b6e20 100644 private T createSnapshot(T tileEntity, World world) { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java -index e6f86cc4b1..3a8f643609 100644 +index e6f86cc4b..3a8f64360 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java @@ -0,0 +0,0 @@ public class CraftSign extends CraftBlockEntityState implements diff --git a/Spigot-Server-Patches/Ability-to-apply-mending-to-XP-API.patch b/Spigot-Server-Patches/Ability-to-apply-mending-to-XP-API.patch index 636d825b56..d65cd3afa0 100644 --- a/Spigot-Server-Patches/Ability-to-apply-mending-to-XP-API.patch +++ b/Spigot-Server-Patches/Ability-to-apply-mending-to-XP-API.patch @@ -10,19 +10,23 @@ of giving the player experience points. Both an API To standalone mend, and apply mending logic to .giveExp has been added. diff --git a/src/main/java/net/minecraft/server/EnchantmentManager.java b/src/main/java/net/minecraft/server/EnchantmentManager.java -index 108ec49aa5..72f0bec4e1 100644 +index 6f64b8db3..b6a40e22a 100644 --- a/src/main/java/net/minecraft/server/EnchantmentManager.java +++ b/src/main/java/net/minecraft/server/EnchantmentManager.java @@ -0,0 +0,0 @@ public class EnchantmentManager { return getEnchantmentLevel(Enchantments.CHANNELING, itemstack) > 0; } -+ public static ItemStack getRandomEquippedItemWithEnchant(Enchantment enchantment, EntityLiving entityliving) { return b(enchantment, entityliving); } // Paper - OBFHELPER - public static ItemStack b(Enchantment enchantment, EntityLiving entityliving) { - List list = enchantment.a(entityliving); - ++ // Paper - OBFHELPER ++ public static @Nullable ItemStack getRandomEquippedItemWithEnchant(Enchantment enchantment, EntityLiving entityliving) { ++ Entry entry = b(enchantment, entityliving); ++ return entry != null ? entry.getValue() : null; ++ } + @Nullable + public static Entry b(Enchantment enchantment, EntityLiving entityliving) { + Map map = enchantment.a(entityliving); diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java -index 4bcae2c21b..09d85764b0 100644 +index 704a48c8e..64d71a9a2 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 { @@ -39,7 +43,7 @@ index 4bcae2c21b..09d85764b0 100644 return i * 2; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index dafc2948c0..e6dadde80f 100644 +index bb50ae1ac..bea3ddf31 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/Spigot-Server-Patches/Add-PlayerArmorChangeEvent.patch b/Spigot-Server-Patches/Add-PlayerArmorChangeEvent.patch index 20ec19e7b7..88e7453cf7 100644 --- a/Spigot-Server-Patches/Add-PlayerArmorChangeEvent.patch +++ b/Spigot-Server-Patches/Add-PlayerArmorChangeEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerArmorChangeEvent diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 138a224e04..02fcfc449c 100644 +index 121925046..9ef605ba3 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -0,0 +0,0 @@ @@ -13,8 +13,8 @@ index 138a224e04..02fcfc449c 100644 +import com.destroystokyo.paper.event.player.PlayerArmorChangeEvent; import com.google.common.base.Objects; + import com.google.common.collect.ImmutableList; import com.google.common.collect.Maps; - import java.util.Collection; @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { ItemStack itemstack1 = this.getEquipment(enumitemslot); @@ -26,11 +26,11 @@ index 138a224e04..02fcfc449c 100644 + new PlayerArmorChangeEvent((Player) this.getBukkitEntity(), PlayerArmorChangeEvent.SlotType.valueOf(enumitemslot.name()), oldItem, newItem).callEvent(); + } + // Paper end - ((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new PacketPlayOutEntityEquipment(this.getId(), enumitemslot, itemstack1))); + ((WorldServer) this.world).getChunkProvider().broadcast(this, new PacketPlayOutEntityEquipment(this.getId(), enumitemslot, itemstack1)); if (!itemstack.isEmpty()) { this.getAttributeMap().a(itemstack.a(enumitemslot)); diff --git a/src/main/java/net/minecraft/server/EnumItemSlot.java b/src/main/java/net/minecraft/server/EnumItemSlot.java -index a9a1339933..8f4b5dca94 100644 +index 02a7ae678..60b235f16 100644 --- a/src/main/java/net/minecraft/server/EnumItemSlot.java +++ b/src/main/java/net/minecraft/server/EnumItemSlot.java @@ -0,0 +0,0 @@ public enum EnumItemSlot { diff --git a/Spigot-Server-Patches/Add-PlayerJumpEvent.patch b/Spigot-Server-Patches/Add-PlayerJumpEvent.patch index 7d6862b07d..2d6d03bba0 100644 --- a/Spigot-Server-Patches/Add-PlayerJumpEvent.patch +++ b/Spigot-Server-Patches/Add-PlayerJumpEvent.patch @@ -4,20 +4,8 @@ Date: Thu, 28 Sep 2017 17:21:44 -0400 Subject: [PATCH] Add PlayerJumpEvent -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 298012f37c..bfae875ebb 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { - return 0; - } - -+ public void jump() { this.cH(); } // Paper - OBFHELPER - public void cH() { - super.cH(); - this.a(StatisticList.JUMP); diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index ac64fcfb31..5fa3268b59 100644 +index c07bb9b74..82dad99ef 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -0,0 +0,0 @@ import org.bukkit.inventory.CraftingInventory; @@ -29,11 +17,11 @@ index ac64fcfb31..5fa3268b59 100644 import co.aikar.timings.MinecraftTimings; // Paper // CraftBukkit end -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { d8 = d5 - this.p; d9 = d6 - this.q; if (this.player.onGround && !packetplayinflying.b() && d8 > 0.0D) { -- this.player.cH(); +- this.player.jump(); + // Paper start - Add player jump event + Player player = this.getPlayer(); + Location from = new Location(player.getWorld(), lastPosX, lastPosY, lastPosZ, lastYaw, lastPitch); // Get the Players previous Event location. @@ -64,5 +52,5 @@ index ac64fcfb31..5fa3268b59 100644 + // Paper end } - this.player.move(EnumMoveType.PLAYER, d7, d8, d9); + this.player.move(EnumMoveType.PLAYER, new Vec3D(d7, d8, d9)); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Add-missing-coverages-for-getTileEntity-in-order-to-.patch b/Spigot-Server-Patches/Add-missing-coverages-for-getTileEntity-in-order-to-.patch deleted file mode 100644 index 2f989ab315..0000000000 --- a/Spigot-Server-Patches/Add-missing-coverages-for-getTileEntity-in-order-to-.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shane Freeder -Date: Sat, 22 Jul 2017 15:22:59 +0100 -Subject: [PATCH] Add missing coverages for getTileEntity in order to attempt - to avoid exeptions when calling getTileEntity - - -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 15736f7575..ee09f4c5a0 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 implements IAsyncTaskHandler { - result = fixTileEntity(pos, type, result); - } - } -+ // Paper Start - add TE fix checks for shulkers, see nms.BlockShulkerBox -+ else if (type instanceof BlockShulkerBox) { -+ if (!(result instanceof TileEntityShulkerBox)) { -+ result = fixTileEntity(pos, type, result); -+ } -+ } -+ // Paper end - - return result; - } --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Allow-specifying-a-custom-authentication-servers-dow.patch b/Spigot-Server-Patches/Allow-specifying-a-custom-authentication-servers-dow.patch index 8f7286fb4a..9c8a63c41f 100644 --- a/Spigot-Server-Patches/Allow-specifying-a-custom-authentication-servers-dow.patch +++ b/Spigot-Server-Patches/Allow-specifying-a-custom-authentication-servers-dow.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Allow specifying a custom "authentication servers down" kick diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index d10d60921b..2b5dde6d99 100644 +index 1adbb2480..a9cf1b8e8 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -0,0 +0,0 @@ @@ -27,10 +27,10 @@ index d10d60921b..2b5dde6d99 100644 + } } diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index 852dc7162a..74bc08f85c 100644 +index 91b6f1de8..398f67f4b 100644 --- a/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, ITickable { +@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener { LoginListener.this.i = LoginListener.this.a(gameprofile); LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT; } else { @@ -39,6 +39,6 @@ index 852dc7162a..74bc08f85c 100644 + LoginListener.this.disconnect(new ChatComponentText(com.destroystokyo.paper.PaperConfig.authenticationServersDownKickMessage)); + } else // Paper end LoginListener.this.disconnect(new ChatMessage("multiplayer.disconnect.authservers_down", new Object[0])); - LoginListener.c.error("Couldn't verify username because servers are unavailable"); + LoginListener.LOGGER.error("Couldn't verify username because servers are unavailable"); } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/AsyncTabCompleteEvent.patch b/Spigot-Server-Patches/AsyncTabCompleteEvent.patch index 8e9c128837..b65f0d3f63 100644 --- a/Spigot-Server-Patches/AsyncTabCompleteEvent.patch +++ b/Spigot-Server-Patches/AsyncTabCompleteEvent.patch @@ -14,12 +14,12 @@ completion, such as offline players. Also adds isCommand and getLocation to the sync TabCompleteEvent diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 551740ec6c..2f00929f63 100644 +index 9a981a608..25c86b53e 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { - } +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { + @Override public void a(PacketPlayInTabComplete packetplayintabcomplete) { - PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); + // PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); // Paper - run this async @@ -30,7 +30,7 @@ index 551740ec6c..2f00929f63 100644 return; } // CraftBukkit end -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { stringreader.skip(); } @@ -68,9 +68,9 @@ index 551740ec6c..2f00929f63 100644 + } - public void a(PacketPlayInSetCommandBlock packetplayinsetcommandblock) { + @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 1e8c4a85cb..8315f63775 100644 +index cfcb7a4fd..2173f34fe 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 { @@ -83,7 +83,7 @@ index 1e8c4a85cb..8315f63775 100644 return tabEvent.isCancelled() ? Collections.EMPTY_LIST : tabEvent.getCompletions(); diff --git a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java -index 1e3aae3b8f..95d13c146b 100644 +index 24f4a16a6..a01d793e7 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java +++ b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java @@ -0,0 +0,0 @@ public class ConsoleCommandCompleter implements Completer { diff --git a/Spigot-Server-Patches/Avoid-NPE-in-PathfinderGoalTempt.patch b/Spigot-Server-Patches/Avoid-NPE-in-PathfinderGoalTempt.patch index f77308f06c..75616e48a2 100644 --- a/Spigot-Server-Patches/Avoid-NPE-in-PathfinderGoalTempt.patch +++ b/Spigot-Server-Patches/Avoid-NPE-in-PathfinderGoalTempt.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Avoid NPE in PathfinderGoalTempt diff --git a/src/main/java/net/minecraft/server/PathfinderGoalTempt.java b/src/main/java/net/minecraft/server/PathfinderGoalTempt.java -index 5cf9b18963..1f3ae55a00 100644 +index fb395bcde..d1164dd68 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalTempt.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalTempt.java @@ -0,0 +0,0 @@ public class PathfinderGoalTempt extends PathfinderGoal { diff --git a/Spigot-Server-Patches/Block-player-logins-during-server-shutdown.patch b/Spigot-Server-Patches/Block-player-logins-during-server-shutdown.patch index a3d3cac805..e079c7dcfa 100644 --- a/Spigot-Server-Patches/Block-player-logins-during-server-shutdown.patch +++ b/Spigot-Server-Patches/Block-player-logins-during-server-shutdown.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Block player logins during server shutdown diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index e901c066ac..852dc7162a 100644 +index 22d5c7d20..91b6f1de8 100644 --- a/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, ITickable { +@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener { } public void tick() { @@ -19,6 +19,6 @@ index e901c066ac..852dc7162a 100644 + } + // Paper end if (this.g == LoginListener.EnumProtocolState.READY_TO_ACCEPT) { - this.b(); + this.c(); } else if (this.g == LoginListener.EnumProtocolState.DELAY_ACCEPT) { -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-Chunks-Sends-per-Tick-setting.patch b/Spigot-Server-Patches/Configurable-Chunks-Sends-per-Tick-setting.patch deleted file mode 100644 index 0a34ed8b1b..0000000000 --- a/Spigot-Server-Patches/Configurable-Chunks-Sends-per-Tick-setting.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Mon, 1 Jan 2018 15:41:59 -0500 -Subject: [PATCH] Configurable Chunks Sends per Tick setting - -Vanilla already had this limited, make it configurable. - -Limit how much exploration lags the server - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index c9422d545a..6a8b1c5e03 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -0,0 +0,0 @@ public class PaperWorldConfig { - expMergeMaxValue = getInt("experience-merge-max-value", -1); - log("Experience Merge Max Value: " + expMergeMaxValue); - } -+ -+ public int maxChunkSendsPerTick = 81; -+ private void maxChunkSendsPerTick() { -+ maxChunkSendsPerTick = getInt("max-chunk-sends-per-tick", maxChunkSendsPerTick); -+ if (maxChunkSendsPerTick <= 0) { -+ maxChunkSendsPerTick = 81; -+ } -+ log("Max Chunk Sends Per Tick: " + maxChunkSendsPerTick); -+ } - } -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index e428d4485b..f481e5a4ff 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -0,0 +0,0 @@ public class PlayerChunkMap { - } - - if (!this.g.isEmpty()) { -- j = 81; -+ j = world.paperConfig.maxChunkSendsPerTick; // Paper - try (Timing ignored = world.timings.doChunkMapPendingSendToPlayers.startTiming()) { // Paper - Iterator iterator2 = this.g.iterator(); - --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-Max-Chunk-Gens-per-Tick.patch b/Spigot-Server-Patches/Configurable-Max-Chunk-Gens-per-Tick.patch deleted file mode 100644 index ed1d847ee7..0000000000 --- a/Spigot-Server-Patches/Configurable-Max-Chunk-Gens-per-Tick.patch +++ /dev/null @@ -1,109 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Mon, 1 Jan 2018 16:10:24 -0500 -Subject: [PATCH] Configurable Max Chunk Gens per Tick - -Limit the number of generations that can occur in a single tick, forcing them -to be spread out more. - -Defaulting to 10 as an average generation is going to be 3-6ms, which means 10 will -likely cause the server to lose TPS, but constrain how much. - -This should result in no noticeable speed reduction in generation for servers not -lagging, and let larger servers reduce this value according to their own desires. - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 6a8b1c5e03..99d6ccc598 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -0,0 +0,0 @@ public class PaperWorldConfig { - } - log("Max Chunk Sends Per Tick: " + maxChunkSendsPerTick); - } -+ -+ public int maxChunkGensPerTick = 10; -+ private void maxChunkGensPerTick() { -+ maxChunkGensPerTick = getInt("max-chunk-gens-per-tick", maxChunkGensPerTick); -+ if (maxChunkGensPerTick <= 0) { -+ maxChunkGensPerTick = Integer.MAX_VALUE; -+ log("Max Chunk Gens Per Tick: Unlimited (NOT RECOMMENDED)"); -+ } else { -+ log("Max Chunk Gens Per Tick: " + maxChunkGensPerTick); -+ } -+ } - } -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index b9d90c4fb8..7d3f846a19 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java -@@ -0,0 +0,0 @@ public class PlayerChunk { - private int h; - private long i; - private boolean done; -+ boolean chunkExists; // Paper - - public PlayerChunk(PlayerChunkMap playerchunkmap, int i, int j) { - this.playerChunkMap = playerchunkmap; -@@ -0,0 +0,0 @@ public class PlayerChunk { - - chunkproviderserver.a(i, j); - this.chunk = chunkproviderserver.getChunkAt(i, j, true, false); -+ this.chunkExists = this.chunk != null || org.bukkit.craftbukkit.chunkio.ChunkIOExecutor.hasQueuedChunkLoad(playerChunkMap.getWorld(), i, j); // Paper - markChunkUsed(); // Paper - delay chunk unloads - } - -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index f481e5a4ff..679488a3cf 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -0,0 +0,0 @@ public class PlayerChunkMap { - // Spigot start - org.spigotmc.SlackActivityAccountant activityAccountant = this.world.getMinecraftServer().slackActivityAccountant; - activityAccountant.startActivity(0.5); -+ int chunkGensAllowed = world.paperConfig.maxChunkGensPerTick; // Paper - // Spigot end - - Iterator iterator1 = this.h.iterator(); -@@ -0,0 +0,0 @@ public class PlayerChunkMap { - - if (playerchunk1.f() == null) { - boolean flag = playerchunk1.a(PlayerChunkMap.b); -+ // Paper start -+ if (flag && !playerchunk1.chunkExists && chunkGensAllowed-- <= 0) { -+ continue; -+ } -+ // Paper end - - if (playerchunk1.a(flag)) { - iterator1.remove(); -diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java -index 7ffb8f6172..33d5fc7d5e 100644 ---- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java -+++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java -@@ -0,0 +0,0 @@ public class ChunkIOExecutor { - public static void tick() { - instance.finishActive(); - } -+ -+ // Paper start -+ public static boolean hasQueuedChunkLoad(World world, int x, int z) { -+ return instance.hasTask(new QueuedChunk(x, z, null, world, null)); -+ } -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/craftbukkit/util/AsynchronousExecutor.java b/src/main/java/org/bukkit/craftbukkit/util/AsynchronousExecutor.java -index 193c3621c6..cf1258c559 100644 ---- a/src/main/java/org/bukkit/craftbukkit/util/AsynchronousExecutor.java -+++ b/src/main/java/org/bukkit/craftbukkit/util/AsynchronousExecutor.java -@@ -0,0 +0,0 @@ public final class AsynchronousExecutor { - public void setActiveThreads(final int coreSize) { - pool.setCorePoolSize(coreSize); - } -+ -+ // Paper start -+ public boolean hasTask(P parameter) throws IllegalStateException { -+ return tasks.get(parameter) != null; -+ } -+ // Paper end - } --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Disable-logger-prefix-for-various-plugins-bypassing-.patch b/Spigot-Server-Patches/Disable-logger-prefix-for-various-plugins-bypassing-.patch index 2a30a18c72..627c592f62 100644 --- a/Spigot-Server-Patches/Disable-logger-prefix-for-various-plugins-bypassing-.patch +++ b/Spigot-Server-Patches/Disable-logger-prefix-for-various-plugins-bypassing-.patch @@ -11,7 +11,7 @@ log. Disable the logger prefix for these plugins so the messages show up correctly. diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml -index 9f8334376f..6711e6dff9 100644 +index 9f8334376..6711e6dff 100644 --- a/src/main/resources/log4j2.xml +++ b/src/main/resources/log4j2.xml @@ -0,0 +0,0 @@ diff --git a/Spigot-Server-Patches/Entity-fromMobSpawner.patch b/Spigot-Server-Patches/Entity-fromMobSpawner.patch index 9e0178fcd4..7b4952f3e4 100644 --- a/Spigot-Server-Patches/Entity-fromMobSpawner.patch +++ b/Spigot-Server-Patches/Entity-fromMobSpawner.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Entity#fromMobSpawner() diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 291a304172..92a15ba947 100644 +index ee7fe30c7..c28b498a2 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 @@ -37,19 +37,19 @@ index 291a304172..92a15ba947 100644 } catch (Throwable throwable) { diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index ce43b4bc52..98065d6b02 100644 +index 6499d27e6..2b2af2daa 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { - if (this.spawnData.b().d() == 1 && this.spawnData.b().hasKeyOfType("id", 8) && entity instanceof EntityInsentient) { - ((EntityInsentient) entity).prepare(world.getDamageScaler(new BlockPosition(entity)), (GroupDataEntity) null, (NBTTagCompound) null); + ((EntityInsentient) entity).prepare(world, world.getDamageScaler(new BlockPosition(entity)), EnumMobSpawn.SPAWNER, (GroupDataEntity) null, (NBTTagCompound) null); + } } + entity.spawnedViaMobSpawner = true; // Paper // Spigot Start if ( entity.world.spigotConfig.nerfSpawnerMobs ) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 466750f779..84a58c7dcd 100644 +index 5d9b4a58e..e0ae72bbc 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -0,0 +0,0 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { diff --git a/Spigot-Server-Patches/ExperienceOrbMergeEvent.patch b/Spigot-Server-Patches/ExperienceOrbMergeEvent.patch index c387705390..20a9834838 100644 --- a/Spigot-Server-Patches/ExperienceOrbMergeEvent.patch +++ b/Spigot-Server-Patches/ExperienceOrbMergeEvent.patch @@ -8,7 +8,7 @@ Plugins can cancel this if they want to ensure experience orbs do not lose impor metadata such as spawn reason, or conditionally move data from source to target. diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 2985c76f37..c02619bb57 100644 +index 8fca14243..8d3dca2a9 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 @@ public class CraftEventFactory { diff --git a/Spigot-Server-Patches/Expose-client-protocol-version-and-virtual-host.patch b/Spigot-Server-Patches/Expose-client-protocol-version-and-virtual-host.patch index c0c25fb9a5..8ca0b3be9e 100644 --- a/Spigot-Server-Patches/Expose-client-protocol-version-and-virtual-host.patch +++ b/Spigot-Server-Patches/Expose-client-protocol-version-and-virtual-host.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Expose client protocol version and virtual host diff --git a/src/main/java/com/destroystokyo/paper/network/PaperNetworkClient.java b/src/main/java/com/destroystokyo/paper/network/PaperNetworkClient.java new file mode 100644 -index 0000000000..5caca6439d +index 000000000..5caca6439 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/network/PaperNetworkClient.java @@ -0,0 +0,0 @@ @@ -61,7 +61,7 @@ index 0000000000..5caca6439d + +} diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java -index 93ca93b640..e732d55f9f 100644 +index 60be2fa99..da88978db 100644 --- a/src/main/java/net/minecraft/server/HandshakeListener.java +++ b/src/main/java/net/minecraft/server/HandshakeListener.java @@ -0,0 +0,0 @@ public class HandshakeListener implements PacketHandshakingInListener { @@ -82,9 +82,9 @@ index 93ca93b640..e732d55f9f 100644 + // Paper end } - public void a(IChatBaseComponent ichatbasecomponent) {} + @Override diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index e2fc41d6d1..2ff2549d0e 100644 +index 2db7229e9..5d5e23c18 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java @@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler> { @@ -99,7 +99,7 @@ index e2fc41d6d1..2ff2549d0e 100644 public NetworkManager(EnumProtocolDirection enumprotocoldirection) { this.h = enumprotocoldirection; diff --git a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java -index 7acdac55e5..f1a3be69d0 100644 +index 4f008e472..8545146fb 100644 --- a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java +++ b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java @@ -0,0 +0,0 @@ public class PacketHandshakingInSetProtocol implements Packet -Date: Tue, 11 Jul 2017 23:17:57 -0400 -Subject: [PATCH] Fix Anvil Level sync to client - -https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/763827668e6e5cddc111f3c93a0d718fec21ff51 - -Was done incorrectly and is now causing level desyncs to client. - -Always send current level to the client, and instead make setWindowProperty set the level. - -diff --git a/src/main/java/net/minecraft/server/ContainerAnvil.java b/src/main/java/net/minecraft/server/ContainerAnvil.java -index a6ac516147..1560dd382a 100644 ---- a/src/main/java/net/minecraft/server/ContainerAnvil.java -+++ b/src/main/java/net/minecraft/server/ContainerAnvil.java -@@ -0,0 +0,0 @@ public class ContainerAnvil extends Container { - for (int i = 0; i < this.listeners.size(); ++i) { - ICrafting icrafting = (ICrafting) this.listeners.get(i); - -- if (this.lastLevelCost != this.levelCost) { -+ //if (this.lastLevelCost != this.levelCost) { // Paper - this was the wrong solution to this, fixing it correctly in CraftPlayer - icrafting.setContainerData(this, 0, this.levelCost); -- } -+ //} // Paper - } - - this.lastLevelCost = this.levelCost; -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index c5f2284553..d85e622525 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - if (container.getBukkitView().getType() != prop.getType()) { - return false; - } -+ // Paper start -+ if (prop == Property.REPAIR_COST && container instanceof net.minecraft.server.ContainerAnvil) { -+ ((net.minecraft.server.ContainerAnvil) container).levelCost = value; -+ } -+ // Paper end - getHandle().setContainerData(container, prop.getId(), value); - return true; - } --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Fix-MC-117075-TE-Unload-Lag-Spike.patch b/Spigot-Server-Patches/Fix-MC-117075-TE-Unload-Lag-Spike.patch index eecaa18b35..085713fdd7 100644 --- a/Spigot-Server-Patches/Fix-MC-117075-TE-Unload-Lag-Spike.patch +++ b/Spigot-Server-Patches/Fix-MC-117075-TE-Unload-Lag-Spike.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Fix MC-117075: TE Unload Lag Spike diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 5e1ab431dc..cdb430ef4f 100644 +index 1286703bf..c9fc001f2 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 IEntityAccess, GeneratorAccess, IIBlockAc - this.methodProfiler.exitEnter("blockEntities"); +@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose + gameprofilerfiller.enter("blockEntities"); timings.tileEntityTick.startTiming(); // Spigot if (!this.tileEntityListUnload.isEmpty()) { - this.tileEntityListTick.removeAll(this.tileEntityListUnload); diff --git a/Spigot-Server-Patches/Fix-block-break-desync.patch b/Spigot-Server-Patches/Fix-block-break-desync.patch index 52b8b4a668..8e634a7346 100644 --- a/Spigot-Server-Patches/Fix-block-break-desync.patch +++ b/Spigot-Server-Patches/Fix-block-break-desync.patch @@ -5,14 +5,14 @@ Subject: [PATCH] Fix block break desync diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 6874563e4..37caa2a70 100644 +index 6874563e4..868d0e98b 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { double d3 = d0 * d0 + d1 * d1 + d2 * d2; if (d3 > 36.0D) { -+ if (worldserver.isChunkLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4, true)) // Paper - Fix block break desync - Don't send for unloaded chunks ++ if (worldserver.isChunkLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4)) // Paper - Fix block break desync - Don't send for unloaded chunks + this.sendPacket(new PacketPlayOutBlockChange(worldserver, blockposition)); // Paper - Fix block break desync return; } else if (blockposition.getY() >= this.minecraftServer.getMaxBuildHeight()) { diff --git a/Spigot-Server-Patches/Fix-this-stupid-bullshit.patch b/Spigot-Server-Patches/Fix-this-stupid-bullshit.patch index 201dc4a5a3..0b1e814917 100644 --- a/Spigot-Server-Patches/Fix-this-stupid-bullshit.patch +++ b/Spigot-Server-Patches/Fix-this-stupid-bullshit.patch @@ -9,12 +9,12 @@ modified in order to prevent merge conflicts when Spigot changes/disables the wa and to provide some level of hint without being disruptive. diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 4102e19700..b145b55bc7 100644 +index e3d163ac4..a991cda1f 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 { Calendar deadline = Calendar.getInstance(); - deadline.add(Calendar.DAY_OF_YEAR, -21); + deadline.add(Calendar.DAY_OF_YEAR, -3); if (buildDate.before(deadline.getTime())) { - System.err.println("*** Error, this build is outdated ***"); + // Paper start - This is some stupid bullshit diff --git a/Spigot-Server-Patches/GH-806-Respect-saving-disabled-before-unloading-all-.patch b/Spigot-Server-Patches/GH-806-Respect-saving-disabled-before-unloading-all-.patch deleted file mode 100644 index e09ea99412..0000000000 --- a/Spigot-Server-Patches/GH-806-Respect-saving-disabled-before-unloading-all-.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Thu, 27 Jul 2017 00:06:43 -0400 -Subject: [PATCH] GH-806: Respect saving disabled before unloading all chunks - in a world - -This behavior causes a save to occur even though saving was supposed to be turned off. - -It's triggered when Hell/End worlds are empty of players. - -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index ab4f3b7223..e428d4485b 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -0,0 +0,0 @@ public class PlayerChunkMap { - try (Timing ignored = world.timings.doChunkMapUnloadChunks.startTiming()) { // Paper - WorldProvider worldprovider = this.world.worldProvider; - -- if (!worldprovider.canRespawn()) { -+ if (!worldprovider.canRespawn() && !this.world.savingDisabled) { // Paper - respect saving disabled setting - this.world.getChunkProvider().b(); - } - } // Paper timing --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Handle-plugin-prefixes-using-Log4J-configuration.patch b/Spigot-Server-Patches/Handle-plugin-prefixes-using-Log4J-configuration.patch index 0f582b9881..6dd043b386 100644 --- a/Spigot-Server-Patches/Handle-plugin-prefixes-using-Log4J-configuration.patch +++ b/Spigot-Server-Patches/Handle-plugin-prefixes-using-Log4J-configuration.patch @@ -15,7 +15,7 @@ This may cause additional prefixes to be disabled for plugins bypassing the plugin logger. diff --git a/pom.xml b/pom.xml -index 0a6e81b680..82b9cae166 100644 +index 183c3c4c8..c18a7f5ca 100644 --- a/pom.xml +++ b/pom.xml @@ -0,0 +0,0 @@ @@ -28,7 +28,7 @@ index 0a6e81b680..82b9cae166 100644 org.apache.logging.log4j diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index fe3bad5830..56f135f244 100644 +index b171bdfaa..0d827815c 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -0,0 +0,0 @@ public class SpigotConfig @@ -41,7 +41,7 @@ index fe3bad5830..56f135f244 100644 public static int playerShuffle; diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml -index 08b6bb7f97..9f8334376f 100644 +index 08b6bb7f9..9f8334376 100644 --- a/src/main/resources/log4j2.xml +++ b/src/main/resources/log4j2.xml @@ -0,0 +0,0 @@ diff --git a/Spigot-Server-Patches/Implement-ensureServerConversions-API.patch b/Spigot-Server-Patches/Implement-ensureServerConversions-API.patch index 2be6cb1b9f..541cce5d64 100644 --- a/Spigot-Server-Patches/Implement-ensureServerConversions-API.patch +++ b/Spigot-Server-Patches/Implement-ensureServerConversions-API.patch @@ -7,7 +7,7 @@ This will take a Bukkit ItemStack and run it through any conversions a server pr to ensure it meets latest minecraft expectations. diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java -index 52041caedc..f5fa58d6cc 100644 +index f529367c8..2a51fa41a 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java @@ -0,0 +0,0 @@ public final class CraftItemFactory implements ItemFactory { diff --git a/Spigot-Server-Patches/Implement-getI18NDisplayName.patch b/Spigot-Server-Patches/Implement-getI18NDisplayName.patch index e9c7d7da60..9be7fc4faf 100644 --- a/Spigot-Server-Patches/Implement-getI18NDisplayName.patch +++ b/Spigot-Server-Patches/Implement-getI18NDisplayName.patch @@ -8,7 +8,7 @@ Currently the server only supports the English language. To override this, You must replace the language file embedded in the server jar. diff --git a/src/main/java/net/minecraft/server/LocaleLanguage.java b/src/main/java/net/minecraft/server/LocaleLanguage.java -index 747b8ad4de..4c5556a096 100644 +index 8fe8e28aa..295c01b28 100644 --- a/src/main/java/net/minecraft/server/LocaleLanguage.java +++ b/src/main/java/net/minecraft/server/LocaleLanguage.java @@ -0,0 +0,0 @@ public class LocaleLanguage { @@ -25,7 +25,7 @@ index 747b8ad4de..4c5556a096 100644 return this.c(s); } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java -index f5fa58d6cc..3a6e6f687d 100644 +index 2a51fa41a..dd02fb95a 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java @@ -0,0 +0,0 @@ public final class CraftItemFactory implements ItemFactory { diff --git a/Spigot-Server-Patches/Improve-the-Saddle-API-for-Horses.patch b/Spigot-Server-Patches/Improve-the-Saddle-API-for-Horses.patch index d983166db5..0d2b41aea7 100644 --- a/Spigot-Server-Patches/Improve-the-Saddle-API-for-Horses.patch +++ b/Spigot-Server-Patches/Improve-the-Saddle-API-for-Horses.patch @@ -7,7 +7,7 @@ Not all horses with Saddles have armor. This lets us break up the horses with sa and access their saddle state separately from an interface shared with Armor. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java -index 14d0416802..e56bef3340 100644 +index 14d041680..e56bef334 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java @@ -0,0 +0,0 @@ import net.minecraft.server.EntityHorseAbstract; @@ -27,7 +27,7 @@ index 14d0416802..e56bef3340 100644 } } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryHorse.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryHorse.java -index 173818e682..2f68524049 100644 +index 173818e68..2f6852404 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryHorse.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryHorse.java @@ -0,0 +0,0 @@ import net.minecraft.server.IInventory; @@ -41,7 +41,7 @@ index 173818e682..2f68524049 100644 super(inventory); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSaddledInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSaddledInventory.java new file mode 100644 -index 0000000000..99cfbaf90b +index 000000000..99cfbaf90 --- /dev/null +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSaddledInventory.java @@ -0,0 +0,0 @@ diff --git a/Spigot-Server-Patches/Include-Log4J2-SLF4J-implementation.patch b/Spigot-Server-Patches/Include-Log4J2-SLF4J-implementation.patch index 2f2129c62e..b6607fed75 100644 --- a/Spigot-Server-Patches/Include-Log4J2-SLF4J-implementation.patch +++ b/Spigot-Server-Patches/Include-Log4J2-SLF4J-implementation.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Include Log4J2 SLF4J implementation diff --git a/pom.xml b/pom.xml -index 82b9cae166..3ad5af3463 100644 +index c18a7f5ca..16799b4cd 100644 --- a/pom.xml +++ b/pom.xml @@ -0,0 +0,0 @@ diff --git a/Spigot-Server-Patches/LivingEntity-setKiller.patch b/Spigot-Server-Patches/LivingEntity-setKiller.patch index f78948b758..516687c294 100644 --- a/Spigot-Server-Patches/LivingEntity-setKiller.patch +++ b/Spigot-Server-Patches/LivingEntity-setKiller.patch @@ -5,7 +5,7 @@ Subject: [PATCH] LivingEntity#setKiller diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 716eda9902..2f96842bb9 100644 +index 424b2b708..f95347df0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/Spigot-Server-Patches/Make-max-squid-spawn-height-configurable.patch b/Spigot-Server-Patches/Make-max-squid-spawn-height-configurable.patch index 2e59bf9416..e532b1a553 100644 --- a/Spigot-Server-Patches/Make-max-squid-spawn-height-configurable.patch +++ b/Spigot-Server-Patches/Make-max-squid-spawn-height-configurable.patch @@ -7,12 +7,12 @@ I don't know why upstream made only the minimum height configurable but whatever diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 99d6ccc598..07a8ef697f 100644 +index 2a50d6bab..c3e61bdfe 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { - log("Max Chunk Gens Per Tick: " + maxChunkGensPerTick); - } + expMergeMaxValue = getInt("experience-merge-max-value", -1); + log("Experience Merge Max Value: " + expMergeMaxValue); } + + public double squidMaxSpawnHeight; @@ -21,19 +21,17 @@ index 99d6ccc598..07a8ef697f 100644 + } } diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java -index 1a347bae37..b9c76325db 100644 +index 815844dab..d5dff4b88 100644 --- a/src/main/java/net/minecraft/server/EntitySquid.java +++ b/src/main/java/net/minecraft/server/EntitySquid.java @@ -0,0 +0,0 @@ public class EntitySquid extends EntityWaterAnimal { - } - public boolean a(GeneratorAccess generatoraccess, boolean flag) { + @Override + public boolean a(GeneratorAccess generatoraccess, EnumMobSpawn enummobspawn) { - return this.locY > this.world.spigotConfig.squidSpawnRangeMin && this.locY < (double) generatoraccess.getSeaLevel(); // Spigot -+ // Paper - Make max spawn height configurable + final double maxHeight = world.paperConfig.squidMaxSpawnHeight > 0 ? world.paperConfig.squidMaxSpawnHeight : world.getSeaLevel(); -+ return this.locY > this.world.spigotConfig.squidSpawnRangeMin && this.locY < maxHeight; // Spigot -+ // Paper end ++ return this.locY > this.world.spigotConfig.squidSpawnRangeMin && this.locY < maxHeight; // Spigot // Paper } - public void c(float f, float f1, float f2) { + public void a(float f, float f1, float f2) { -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Ocelot-despawns-should-honor-nametags-and-leash.patch b/Spigot-Server-Patches/Ocelot-despawns-should-honor-nametags-and-leash.patch index 05a39c5339..ba57189ed9 100644 --- a/Spigot-Server-Patches/Ocelot-despawns-should-honor-nametags-and-leash.patch +++ b/Spigot-Server-Patches/Ocelot-despawns-should-honor-nametags-and-leash.patch @@ -5,16 +5,16 @@ Subject: [PATCH] Ocelot despawns should honor nametags and leash diff --git a/src/main/java/net/minecraft/server/EntityOcelot.java b/src/main/java/net/minecraft/server/EntityOcelot.java -index 47aac5b057..ba074c10c6 100644 +index af1ff9518..1713bead2 100644 --- a/src/main/java/net/minecraft/server/EntityOcelot.java +++ b/src/main/java/net/minecraft/server/EntityOcelot.java -@@ -0,0 +0,0 @@ public class EntityOcelot extends EntityTameableAnimal { +@@ -0,0 +0,0 @@ public class EntityOcelot extends EntityAnimal { + + @Override + public boolean isTypeNotPersistent(double d0) { +- return !this.isTrusting() /*&& this.ticksLived > 2400*/; // CraftBukkit ++ return !this.isTrusting() && !this.hasCustomName() && !this.isLeashed() /*&& this.ticksLived > 2400*/; // CraftBukkit // Paper - honor name and leash } - public boolean isTypeNotPersistent() { -- return !this.isTamed() /*&& this.ticksLived > 2400*/; // CraftBukkit -+ return !this.isTamed() && !this.hasCustomName() && !this.isLeashed() /*&& this.ticksLived > 2400*/; // CraftBukkit - Paper (honor name and leash) - } - - protected void initAttributes() { + @Override -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Option-for-maximum-exp-value-when-merging-orbs.patch b/Spigot-Server-Patches/Option-for-maximum-exp-value-when-merging-orbs.patch index 3e63bccded..82e30abcf3 100644 --- a/Spigot-Server-Patches/Option-for-maximum-exp-value-when-merging-orbs.patch +++ b/Spigot-Server-Patches/Option-for-maximum-exp-value-when-merging-orbs.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Option for maximum exp value when merging orbs diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 3baf0380c0..c9422d545a 100644 +index abc967d3f..2a50d6bab 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -20,7 +20,7 @@ index 3baf0380c0..c9422d545a 100644 + } } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 9cbbfed4fe..2985c76f37 100644 +index b75369275..8fca14243 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 @@ public class CraftEventFactory { diff --git a/Spigot-Server-Patches/PlayerPickupExperienceEvent.patch b/Spigot-Server-Patches/PlayerPickupExperienceEvent.patch index 45183a7feb..75c3da1f09 100644 --- a/Spigot-Server-Patches/PlayerPickupExperienceEvent.patch +++ b/Spigot-Server-Patches/PlayerPickupExperienceEvent.patch @@ -6,16 +6,16 @@ Subject: [PATCH] PlayerPickupExperienceEvent Allows plugins to cancel a player picking up an experience orb diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java -index 404a222b45..4bcae2c21b 100644 +index 49668f2c2..704a48c8e 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 { - - public void d(EntityHuman entityhuman) { + @Override + public void pickup(EntityHuman entityhuman) { if (!this.world.isClientSide) { -- if (this.c == 0 && entityhuman.bJ == 0) { -+ if (this.c == 0 && entityhuman.bJ == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(((EntityPlayer) entityhuman).getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper - entityhuman.bJ = 2; +- if (this.d == 0 && entityhuman.bF == 0) { ++ if (this.d == 0 && entityhuman.bF == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(((EntityPlayer) entityhuman).getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper + entityhuman.bF = 2; entityhuman.receive(this, 1); - ItemStack itemstack = EnchantmentManager.b(Enchantments.MENDING, (EntityLiving) entityhuman); + Entry entry = EnchantmentManager.b(Enchantments.MENDING, (EntityLiving) entityhuman); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Prevent-logins-from-being-processed-when-the-player-.patch b/Spigot-Server-Patches/Prevent-logins-from-being-processed-when-the-player-.patch index 45361b94dd..aace5d01ae 100644 --- a/Spigot-Server-Patches/Prevent-logins-from-being-processed-when-the-player-.patch +++ b/Spigot-Server-Patches/Prevent-logins-from-being-processed-when-the-player-.patch @@ -6,17 +6,17 @@ Subject: [PATCH] Prevent logins from being processed when the player has diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index 74bc08f85c..15c01333e7 100644 +index 398f67f4b..fe912e0eb 100644 --- a/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, ITickable { +@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener { } // Paper end if (this.g == LoginListener.EnumProtocolState.READY_TO_ACCEPT) { -- this.b(); +- this.c(); + // Paper start - prevent logins to be processed even though disconnect was called + if (networkManager.isConnected()) { -+ this.b(); ++ this.c(); + } + // Paper end } else if (this.g == LoginListener.EnumProtocolState.DELAY_ACCEPT) { diff --git a/Spigot-Server-Patches/Profile-Lookup-Events.patch b/Spigot-Server-Patches/Profile-Lookup-Events.patch index 8aa926e60a..1707dabd5b 100644 --- a/Spigot-Server-Patches/Profile-Lookup-Events.patch +++ b/Spigot-Server-Patches/Profile-Lookup-Events.patch @@ -7,7 +7,7 @@ Adds a Pre Lookup Event and a Post Lookup Event so that plugins may prefill in p profiles that had to be looked up. diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java b/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java -index 3bcdb8f93f..bb9894318e 100644 +index 3bcdb8f93..bb9894318 100644 --- a/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java +++ b/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java @@ -0,0 +0,0 @@ diff --git a/Spigot-Server-Patches/ProfileWhitelistVerifyEvent.patch b/Spigot-Server-Patches/ProfileWhitelistVerifyEvent.patch index 1bf9dad9fa..9bd6c271e1 100644 --- a/Spigot-Server-Patches/ProfileWhitelistVerifyEvent.patch +++ b/Spigot-Server-Patches/ProfileWhitelistVerifyEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] ProfileWhitelistVerifyEvent diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 8bb3fef21e..96eff10ffa 100644 +index 52b2f4874..b855e7968 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { @@ -28,7 +28,7 @@ index 8bb3fef21e..96eff10ffa 100644 public boolean isWhitelisted(GameProfile gameprofile) { - return !this.hasWhitelist || this.operators.d(gameprofile) || this.whitelist.d(gameprofile); + return isWhitelisted(gameprofile, null); -+ } + } + public boolean isWhitelisted(GameProfile gameprofile, org.bukkit.event.player.PlayerLoginEvent loginEvent) { + boolean isOp = this.operators.d(gameprofile); + boolean isWhitelisted = !this.hasWhitelist || isOp || this.whitelist.d(gameprofile); @@ -42,9 +42,9 @@ index 8bb3fef21e..96eff10ffa 100644 + return false; + } + return true; - } ++ } + // Paper end public boolean isOp(GameProfile gameprofile) { - return this.operators.d(gameprofile) || this.server.H() && this.server.getWorldServer(DimensionManager.OVERWORLD).getWorldData().u() && this.server.G().equalsIgnoreCase(gameprofile.getName()) || this.u; + return this.operators.d(gameprofile) || this.server.b(gameprofile) && this.server.getWorldServer(DimensionManager.OVERWORLD).getWorldData().u() || this.u; -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Replace-HashSet-with-fastutil-s-ObjectOpenHashSet-in.patch b/Spigot-Server-Patches/Replace-HashSet-with-fastutil-s-ObjectOpenHashSet-in.patch index 3c20eb3e0b..437f318c97 100644 --- a/Spigot-Server-Patches/Replace-HashSet-with-fastutil-s-ObjectOpenHashSet-in.patch +++ b/Spigot-Server-Patches/Replace-HashSet-with-fastutil-s-ObjectOpenHashSet-in.patch @@ -13,7 +13,7 @@ ObjectOpenHashSet never uses compareTo(), so the inconsistencies of NextTickList Fixes https://github.com/PaperMC/Paper/issues/588 diff --git a/src/main/java/org/bukkit/craftbukkit/util/HashTreeSet.java b/src/main/java/org/bukkit/craftbukkit/util/HashTreeSet.java -index 80a5c29f3b..cd864c4047 100644 +index 80a5c29f3..cd864c404 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/HashTreeSet.java +++ b/src/main/java/org/bukkit/craftbukkit/util/HashTreeSet.java @@ -0,0 +0,0 @@ import java.util.TreeSet; diff --git a/Spigot-Server-Patches/Reset-spawner-timer-when-spawner-event-is-cancelled.patch b/Spigot-Server-Patches/Reset-spawner-timer-when-spawner-event-is-cancelled.patch index 364e5e2f36..3eb81ead2a 100644 --- a/Spigot-Server-Patches/Reset-spawner-timer-when-spawner-event-is-cancelled.patch +++ b/Spigot-Server-Patches/Reset-spawner-timer-when-spawner-event-is-cancelled.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Reset spawner timer when spawner event is cancelled diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index 98065d6b02..027ba71918 100644 +index 2b2af2daa..d8ae336e9 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { @@ -19,7 +19,7 @@ index 98065d6b02..027ba71918 100644 Entity vehicle = entity.getVehicle(); if (vehicle != null) { @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { - entityinsentient.doSpawnEffect(); + ((EntityInsentient) entity).doSpawnEffect(); } - flag = true; diff --git a/Spigot-Server-Patches/Send-attack-SoundEffects-only-to-players-who-can-see.patch b/Spigot-Server-Patches/Send-attack-SoundEffects-only-to-players-who-can-see.patch index 842b7efac4..2751a76ae2 100644 --- a/Spigot-Server-Patches/Send-attack-SoundEffects-only-to-players-who-can-see.patch +++ b/Spigot-Server-Patches/Send-attack-SoundEffects-only-to-players-who-can-see.patch @@ -6,11 +6,11 @@ Subject: [PATCH] Send attack SoundEffects only to players who can see the diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index bfae875ebb..259f73f66e 100644 +index 0f8100a05..a30d88af8 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { - this.k = 0; + return super.isFrozen() || this.isSleeping(); } + // Paper start - send SoundEffect to everyone who can see fromEntity @@ -23,14 +23,14 @@ index bfae875ebb..259f73f66e 100644 + // Paper end + public void attack(Entity entity) { - if (entity.bk()) { + if (entity.br()) { if (!entity.t(this)) { @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { int i = b0 + EnchantmentManager.b((EntityLiving) this); if (this.isSprinting() && flag) { -- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_KNOCKBACK, this.bV(), 1.0F, 1.0F); -+ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_KNOCKBACK, this.bV(), 1.0F, 1.0F); // Paper - send while respecting visibility +- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_KNOCKBACK, this.getSoundCategory(), 1.0F, 1.0F); ++ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_KNOCKBACK, this.getSoundCategory(), 1.0F, 1.0F); // Paper - send while respecting visibility ++i; flag1 = true; } @@ -38,27 +38,27 @@ index bfae875ebb..259f73f66e 100644 } } -- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_SWEEP, this.bV(), 1.0F, 1.0F); -+ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_SWEEP, this.bV(), 1.0F, 1.0F); // Paper - send while respecting visibility - this.dl(); +- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_SWEEP, this.getSoundCategory(), 1.0F, 1.0F); ++ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_SWEEP, this.getSoundCategory(), 1.0F, 1.0F); // Paper - send while respecting visibility + this.dE(); } @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { } if (flag2) { -- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_CRIT, this.bV(), 1.0F, 1.0F); -+ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_CRIT, this.bV(), 1.0F, 1.0F); // Paper - send while respecting visibility +- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_CRIT, this.getSoundCategory(), 1.0F, 1.0F); ++ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_CRIT, this.getSoundCategory(), 1.0F, 1.0F); // Paper - send while respecting visibility this.a(entity); } if (!flag2 && !flag3) { if (flag) { -- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_STRONG, this.bV(), 1.0F, 1.0F); -+ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_STRONG, this.bV(), 1.0F, 1.0F); // Paper - send while respecting visibility +- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_STRONG, this.getSoundCategory(), 1.0F, 1.0F); ++ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_STRONG, this.getSoundCategory(), 1.0F, 1.0F); // Paper - send while respecting visibility } else { -- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_WEAK, this.bV(), 1.0F, 1.0F); -+ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_WEAK, this.bV(), 1.0F, 1.0F); // Paper - send while respecting visibility +- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_WEAK, this.getSoundCategory(), 1.0F, 1.0F); ++ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_WEAK, this.getSoundCategory(), 1.0F, 1.0F); // Paper - send while respecting visibility } } @@ -66,16 +66,16 @@ index bfae875ebb..259f73f66e 100644 this.applyExhaustion(world.spigotConfig.combatExhaustion); // Spigot - Change to use configurable value } else { -- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_NODAMAGE, this.bV(), 1.0F, 1.0F); -+ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_NODAMAGE, this.bV(), 1.0F, 1.0F); // Paper - send while respecting visibility +- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_NODAMAGE, this.getSoundCategory(), 1.0F, 1.0F); ++ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_NODAMAGE, this.getSoundCategory(), 1.0F, 1.0F); // Paper - send while respecting visibility if (flag4) { entity.extinguish(); } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index cdb430ef4f..cdef374c61 100644 +index c9fc001f2..4d86e7849 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 IEntityAccess, GeneratorAccess, IIBlockAc +@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose this.a(entityhuman, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, soundeffect, soundcategory, f, f1); } @@ -83,9 +83,7 @@ index cdb430ef4f..cdef374c61 100644 + public final void sendSoundEffect(@Nullable EntityHuman fromEntity, double x, double y, double z, SoundEffect soundeffect, SoundCategory soundcategory, float volume, float pitch) { + this.a(fromEntity, x, y, z, soundeffect, soundcategory, volume, pitch); + } -+ // Paper end -+ - public void a(@Nullable EntityHuman entityhuman, double d0, double d1, double d2, SoundEffect soundeffect, SoundCategory soundcategory, float f, float f1) { - for (int i = 0; i < this.v.size(); ++i) { - ((IWorldAccess) this.v.get(i)).a(entityhuman, soundeffect, soundcategory, d0, d1, d2, f, f1); + public abstract void a(@Nullable EntityHuman entityhuman, double d0, double d1, double d2, SoundEffect soundeffect, SoundCategory soundcategory, float f, float f1); + + public abstract void a(@Nullable EntityHuman entityhuman, Entity entity, SoundEffect soundeffect, SoundCategory soundcategory, float f, float f1); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Shoulder-Entities-Release-API.patch b/Spigot-Server-Patches/Shoulder-Entities-Release-API.patch index f7393bd590..7e548e2aa1 100644 --- a/Spigot-Server-Patches/Shoulder-Entities-Release-API.patch +++ b/Spigot-Server-Patches/Shoulder-Entities-Release-API.patch @@ -5,13 +5,13 @@ Subject: [PATCH] Shoulder Entities Release API diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 23e7cdfe88..298012f37c 100644 +index 5df763d92..0f8100a05 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { - } // CraftBukkit end } + + // Paper start + public Entity releaseLeftShoulderEntity() { + Entity entity = this.spawnEntityFromShoulder0(this.getShoulderEntityLeft()); @@ -20,9 +20,7 @@ index 23e7cdfe88..298012f37c 100644 + } + return entity; + } - -- private boolean spawnEntityFromShoulder(@Nullable NBTTagCompound nbttagcompound) { // CraftBukkit void->boolean -- if (!this.world.isClientSide && !nbttagcompound.isEmpty()) { ++ + public Entity releaseRightShoulderEntity() { + Entity entity = this.spawnEntityFromShoulder0(this.getShoulderEntityRight()); + if (entity != null) { @@ -31,38 +29,37 @@ index 23e7cdfe88..298012f37c 100644 + return entity; + } + -+ // Paper - incase any plugins used NMS to call this... old method signature to avoid other diff -+ private boolean spawnEntityFromShoulder(@Nullable NBTTagCompound nbttagcompound) { ++ // Paper - maintain old signature + private boolean spawnEntityFromShoulder(@Nullable NBTTagCompound nbttagcompound) { // CraftBukkit void->boolean +- if (!this.world.isClientSide && !nbttagcompound.isEmpty()) { + return spawnEntityFromShoulder0(nbttagcompound) != null; + } -+ // Paper - Moved to new method that now returns entity, and properly null checks -+ private Entity spawnEntityFromShoulder0(@Nullable NBTTagCompound nbttagcompound) { // CraftBukkit void->boolean - Paper - return Entity -+ if (!this.world.isClientSide && nbttagcompound != null && !nbttagcompound.isEmpty()) { // Paper - null check - Entity entity = EntityTypes.a(nbttagcompound, this.world); -+ if (entity == null) { // Paper - null check -+ return null; -+ } ++ ++ // Paper - return entity ++ private Entity spawnEntityFromShoulder0(@Nullable NBTTagCompound nbttagcompound) { ++ if (!this.world.isClientSide && nbttagcompound != null && !nbttagcompound.isEmpty()) { + return EntityTypes.a(nbttagcompound, this.world).map((entity) -> { // CraftBukkit + if (entity instanceof EntityTameableAnimal) { + ((EntityTameableAnimal) entity).setOwnerUUID(this.uniqueID); + } - if (entity instanceof EntityTameableAnimal) { - ((EntityTameableAnimal) entity).setOwnerUUID(this.uniqueID); - } - - entity.setPosition(this.locX, this.locY + 0.699999988079071D, this.locZ); -- return this.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SHOULDER_ENTITY); // CraftBukkit -+ if (this.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SHOULDER_ENTITY)) { // CraftBukkit -+ return entity; -+ } + entity.setPosition(this.locX, this.locY + 0.699999988079071D, this.locZ); +- return ((WorldServer) this.world).addEntitySerialized(entity, CreatureSpawnEvent.SpawnReason.SHOULDER_ENTITY); // CraftBukkit +- }).orElse(true); // CraftBukkit ++ boolean addedToWorld = ((WorldServer) this.world).addEntitySerialized(entity, CreatureSpawnEvent.SpawnReason.SHOULDER_ENTITY); // CraftBukkit ++ return addedToWorld ? entity : null; ++ }).orElse(null); // CraftBukkit // Paper - false -> null } - return true; // CraftBukkit -+ return null; ++ return null; // Paper - return null } + // Paper end public abstract boolean isSpectator(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index 79d1255676..d5dbc4ca81 100644 +index a7b495c7a..c2b6e792a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -0,0 +0,0 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { diff --git a/Spigot-Server-Patches/Use-Log4j-IOStreams-to-redirect-System.out-err-to-lo.patch b/Spigot-Server-Patches/Use-Log4j-IOStreams-to-redirect-System.out-err-to-lo.patch index 1b7f766874..6a0cfc4cc5 100644 --- a/Spigot-Server-Patches/Use-Log4j-IOStreams-to-redirect-System.out-err-to-lo.patch +++ b/Spigot-Server-Patches/Use-Log4j-IOStreams-to-redirect-System.out-err-to-lo.patch @@ -12,7 +12,7 @@ results in a separate line, even though it should not result in a line break. Log4j's implementation handles it correctly. diff --git a/pom.xml b/pom.xml -index 2b73ec28a1..0a6e81b680 100644 +index 108c8c05e..183c3c4c8 100644 --- a/pom.xml +++ b/pom.xml @@ -0,0 +0,0 @@ @@ -28,7 +28,7 @@ index 2b73ec28a1..0a6e81b680 100644 org.ow2.asm asm diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 5bb1ea880a..0d2c7a6dc4 100644 +index 3d0cb874d..d9f1c2205 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 diff --git a/Spigot-Server-Patches/handle-PacketPlayInKeepAlive-async.patch b/Spigot-Server-Patches/handle-PacketPlayInKeepAlive-async.patch index 79135724a1..78c27441cf 100644 --- a/Spigot-Server-Patches/handle-PacketPlayInKeepAlive-async.patch +++ b/Spigot-Server-Patches/handle-PacketPlayInKeepAlive-async.patch @@ -15,12 +15,12 @@ also adding some additional logging in order to help work out what is causing random disconnections for clients. diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 5fa3268b59..0d87ddc0f5 100644 +index 82dad99ef..62c0137a7 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { - } +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { + @Override public void a(PacketPlayInKeepAlive packetplayinkeepalive) { - PlayerConnectionUtils.ensureMainThread(packetplayinkeepalive, this, this.player.getWorldServer()); // CraftBukkit + //PlayerConnectionUtils.ensureMainThread(packetplayinkeepalive, this, this.player.getWorldServer()); // CraftBukkit // Paper - This shouldn't be on the main thread @@ -29,11 +29,11 @@ index 5fa3268b59..0d87ddc0f5 100644 this.player.ping = (this.player.ping * 3 + i) / 4; this.awaitingKeepAlive = false; - } else if (!this.player.getDisplayName().getString().equals(this.minecraftServer.G())) { + } else if (!this.isExemptPlayer()) { - this.disconnect(new ChatMessage("disconnect.timeout", new Object[0])); + // Paper start - This needs to be handled on the main thread for plugins + minecraftServer.postToMainThread(() -> { -+ this.disconnect(new ChatMessage("disconnect.timeout", new Object[0])); ++ this.disconnect(new ChatMessage("disconnect.timeout")); + }); + // Paper end } diff --git a/Spigot-Server-Patches/revert-serverside-behavior-of-keepalives.patch b/Spigot-Server-Patches/revert-serverside-behavior-of-keepalives.patch index 1d4f2237c1..78c7b88582 100644 --- a/Spigot-Server-Patches/revert-serverside-behavior-of-keepalives.patch +++ b/Spigot-Server-Patches/revert-serverside-behavior-of-keepalives.patch @@ -17,10 +17,10 @@ from networking or during connections flood of chunk packets on slower clients, at the cost of dead connections being kept open for longer. diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 0d87ddc0f5..551740ec6c 100644 +index 62c0137a7..9a981a608 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { private final MinecraftServer minecraftServer; public EntityPlayer player; private int e; @@ -29,7 +29,7 @@ index 0d87ddc0f5..551740ec6c 100644 private boolean awaitingKeepAlive; private void setPendingPing(boolean isPending) { this.awaitingKeepAlive = isPending;}; private boolean isPendingPing() { return this.awaitingKeepAlive;}; // Paper - OBFHELPER private long h; private void setKeepAliveID(long keepAliveID) { this.h = keepAliveID;}; private long getKeepAliveID() {return this.h; }; // Paper - OBFHELPER // CraftBukkit start - multithreaded fields -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { private int E; private int receivedMovePackets; private int processedMovePackets; @@ -37,14 +37,11 @@ index 0d87ddc0f5..551740ec6c 100644 public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) { this.minecraftServer = minecraftserver; -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { } - this.minecraftServer.methodProfiler.enter("keepAlive"); + this.minecraftServer.getMethodProfiler().enter("keepAlive"); - long i = SystemUtils.getMonotonicMillis(); -- -- if (i - this.lastKeepAlive >= 25000L) { // CraftBukkit -- if (this.awaitingKeepAlive) { + // Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings + // This should effectively place the keepalive handling back to "as it was" before 1.12.2 + long currentTime = SystemUtils.getMonotonicMillis(); @@ -53,12 +50,6 @@ index 0d87ddc0f5..551740ec6c 100644 + if (this.isPendingPing()) { + if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected + PlayerConnection.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getName()); // more info - this.disconnect(new ChatMessage("disconnect.timeout", new Object[0])); -- } else { -- this.awaitingKeepAlive = true; -- this.lastKeepAlive = i; -- this.h = i; -- this.sendPacket(new PacketPlayOutKeepAlive(this.h)); + } + } else { + if (elapsedTime >= 15000L) { // 15 seconds @@ -66,11 +57,19 @@ index 0d87ddc0f5..551740ec6c 100644 + this.setLastPing(currentTime); + this.setKeepAliveID(currentTime); + this.sendPacket(new PacketPlayOutKeepAlive(this.getKeepAliveID())); -+ + +- if (i - this.lastKeepAlive >= 25000L) { // CraftBukkit +- if (this.awaitingKeepAlive) { +- this.disconnect(new ChatMessage("disconnect.timeout", new Object[0])); +- } else { +- this.awaitingKeepAlive = true; +- this.lastKeepAlive = i; +- this.h = i; +- this.sendPacket(new PacketPlayOutKeepAlive(this.h)); } } + // Paper end - this.minecraftServer.methodProfiler.exit(); + this.minecraftServer.getMethodProfiler().exit(); // CraftBukkit start -- \ No newline at end of file diff --git a/Spigot-Server-Patches/use-CB-BlockState-implementations-for-captured-block.patch b/Spigot-Server-Patches/use-CB-BlockState-implementations-for-captured-block.patch index b7d0b2f62b..b8a1cbbf51 100644 --- a/Spigot-Server-Patches/use-CB-BlockState-implementations-for-captured-block.patch +++ b/Spigot-Server-Patches/use-CB-BlockState-implementations-for-captured-block.patch @@ -18,10 +18,10 @@ the blockstate that will be valid for restoration, as opposed to dropping information on restoration when the event is cancelled. diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index cdef374c61..d87b08a49e 100644 +index 4d86e7849..3737fca81 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 IEntityAccess, GeneratorAccess, IIBlockAc +@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose // CraftBukkit start - capture blockstates CraftBlockState blockstate = null; if (this.captureBlockStates) {