From b15c43a38971a92fff66282e937923cfad488a71 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 23 Oct 2018 19:03:32 -0400 Subject: Update upstream for minecart spawner improvement --- Spigot-API-Patches/0008-Check-Paper-versions.patch | 14 +- ...95-Add-version-history-to-version-command.patch | 15 +- ...5-Add-MinecraftKey-Information-to-Objects.patch | 12 +- ...ence-to-current-Chunk-for-Entity-and-Bloc.patch | 14 +- Spigot-Server-Patches/0008-MC-Utils.patch | 24 +- Spigot-Server-Patches/0009-Timings-v2.patch | 16 +- ...g-block-and-tnt-entities-at-the-specified.patch | 14 +- Spigot-Server-Patches/0025-Entity-Origin-API.patch | 22 +- ...27-Configurable-top-of-nether-void-damage.patch | 16 +- .../0051-Ensure-commands-are-not-ran-async.patch | 16 +- ...le-Scoreboards-for-non-players-by-default.patch | 12 +- .../0067-Complete-resource-pack-API.patch | 10 +- .../0086-Don-t-teleport-dead-entities.patch | 8 +- .../0102-Add-PlayerUseUnknownEntityEvent.patch | 10 +- ...se-vanilla-per-world-scoreboard-coloring-.patch | 14 +- .../0122-Vehicle-Event-Cancellation-Changes.patch | 10 +- .../0136-Optional-TNT-doesn-t-move-in-water.patch | 14 +- ...informative-vehicle-moved-wrongly-message.patch | 8 +- .../0153-Fix-AIOOBE-in-inventory-handling.patch | 8 +- ...154-Configurable-packet-in-spam-threshold.patch | 10 +- .../0185-IllegalPacketEvent.patch | 16 +- .../0186-Properly-fix-item-duplication-bug.patch | 10 +- ...n-t-allow-entities-to-ride-themselves-572.patch | 8 +- .../0196-Fix-block-break-desync.patch | 8 +- ...to-make-parrots-stay-on-shoulders-despite.patch | 12 +- .../0220-Entity-fromMobSpawner.patch | 14 +- .../0240-Add-PlayerJumpEvent.patch | 10 +- .../0241-handle-PacketPlayInKeepAlive-async.patch | 8 +- .../0252-AsyncTabCompleteEvent.patch | 12 +- ...-that-allowed-colored-signs-to-be-created.patch | 8 +- ...rly-remove-entities-on-dimension-teleport.patch | 10 +- .../0325-InventoryCloseEvent-Reason-API.patch | 22 +- ...yer-inventory-when-cancelling-PlayerInter.patch | 8 +- ...2-add-more-information-to-Entity.toString.patch | 8 +- .../0338-Duplicate-UUID-Resolve-Option.patch | 16 +- ...s-process-chunk-registration-after-moving.patch | 67 ---- .../0344-MC-111480-Start-Entity-ID-s-at-1.patch | 24 ++ ...-up-and-make-tab-spam-limits-configurable.patch | 71 ++++ .../0345-MC-111480-Start-Entity-ID-s-at-1.patch | 24 -- ...-up-and-make-tab-spam-limits-configurable.patch | 71 ---- ...135506-Experience-should-save-as-Integers.patch | 30 ++ .../0347-Entity-add-to-world-fixes.patch | 87 +++++ ...135506-Experience-should-save-as-Integers.patch | 30 -- ...348-Add-Early-Warning-Feature-to-WatchDog.patch | 167 +++++++++ .../0348-Entity-add-to-world-fixes.patch | 87 ----- ...349-Add-Early-Warning-Feature-to-WatchDog.patch | 167 --------- .../0349-Use-ConcurrentHashMap-in-JsonList.patch | 114 ++++++ .../0350-Use-ConcurrentHashMap-in-JsonList.patch | 114 ------ .../0350-Use-a-Queue-for-Queueing-Commands.patch | 36 ++ ...0351-Allow-disabling-armour-stand-ticking.patch | 73 ++++ .../0351-Use-a-Queue-for-Queueing-Commands.patch | 36 -- ...0352-Allow-disabling-armour-stand-ticking.patch | 73 ---- ...352-Optimize-BlockPosition-helper-methods.patch | 125 ++++++ ...ks-are-always-loaded-on-hard-position-set.patch | 33 -- ...-packets-from-world-player-list-not-serve.patch | 136 +++++++ .../0354-Improve-death-events.patch | 417 +++++++++++++++++++++ ...354-Optimize-BlockPosition-helper-methods.patch | 125 ------ ...-packets-from-world-player-list-not-serve.patch | 136 ------- .../0355-isChunkGenerated-API.patch | 44 +++ ...356-Add-source-block-to-BlockPhysicsEvent.patch | 22 ++ .../0356-Improve-death-events.patch | 417 --------------------- .../0357-Optimize-Region-File-Cache.patch | 67 ++++ .../0357-isChunkGenerated-API.patch | 44 --- ...358-Add-source-block-to-BlockPhysicsEvent.patch | 22 -- ...s-with-entity-loss-due-to-unloaded-chunks.patch | 44 +++ .../0359-Backport-Village-Door-fix-from-1.13.patch | 48 +++ .../0359-Optimize-Region-File-Cache.patch | 67 ---- ...60-Backport-light-queue-changes-from-1.13.patch | 111 ++++++ .../0360-Sync-Player-Position-to-Vehicles.patch | 38 -- .../0361-Backport-Water-Activation-Range.patch | 130 +++++++ ...s-with-entity-loss-due-to-unloaded-chunks.patch | 44 --- ...event-mob-spawning-from-loading-generatin.patch | 34 ++ .../0362-Backport-Village-Door-fix-from-1.13.patch | 48 --- ...63-Backport-light-queue-changes-from-1.13.patch | 111 ------ ...63-Detect-and-repair-corrupt-Region-Files.patch | 125 ++++++ .../0364-Backport-Water-Activation-Range.patch | 130 ------- ...port-the-dupe-uuid-and-entity-log-changes.patch | 144 +++++++ ...event-mob-spawning-from-loading-generatin.patch | 34 -- ...ckport-1.13-client-desync-fix-on-fast-too.patch | 21 ++ ...66-Detect-and-repair-corrupt-Region-Files.patch | 125 ------ ...port-the-dupe-uuid-and-entity-log-changes.patch | 144 ------- ...ckport-1.13-client-desync-fix-on-fast-too.patch | 21 -- scripts/upstreamMerge.sh | 8 +- work/Bukkit | 2 +- work/CraftBukkit | 2 +- work/Spigot | 2 +- 86 files changed, 2298 insertions(+), 2431 deletions(-) delete mode 100644 Spigot-Server-Patches/0344-Always-process-chunk-registration-after-moving.patch create mode 100644 Spigot-Server-Patches/0344-MC-111480-Start-Entity-ID-s-at-1.patch create mode 100644 Spigot-Server-Patches/0345-Break-up-and-make-tab-spam-limits-configurable.patch delete mode 100644 Spigot-Server-Patches/0345-MC-111480-Start-Entity-ID-s-at-1.patch delete mode 100644 Spigot-Server-Patches/0346-Break-up-and-make-tab-spam-limits-configurable.patch create mode 100644 Spigot-Server-Patches/0346-MC-135506-Experience-should-save-as-Integers.patch create mode 100644 Spigot-Server-Patches/0347-Entity-add-to-world-fixes.patch delete mode 100644 Spigot-Server-Patches/0347-MC-135506-Experience-should-save-as-Integers.patch create mode 100644 Spigot-Server-Patches/0348-Add-Early-Warning-Feature-to-WatchDog.patch delete mode 100644 Spigot-Server-Patches/0348-Entity-add-to-world-fixes.patch delete mode 100644 Spigot-Server-Patches/0349-Add-Early-Warning-Feature-to-WatchDog.patch create mode 100644 Spigot-Server-Patches/0349-Use-ConcurrentHashMap-in-JsonList.patch delete mode 100644 Spigot-Server-Patches/0350-Use-ConcurrentHashMap-in-JsonList.patch create mode 100644 Spigot-Server-Patches/0350-Use-a-Queue-for-Queueing-Commands.patch create mode 100644 Spigot-Server-Patches/0351-Allow-disabling-armour-stand-ticking.patch delete mode 100644 Spigot-Server-Patches/0351-Use-a-Queue-for-Queueing-Commands.patch delete mode 100644 Spigot-Server-Patches/0352-Allow-disabling-armour-stand-ticking.patch create mode 100644 Spigot-Server-Patches/0352-Optimize-BlockPosition-helper-methods.patch delete mode 100644 Spigot-Server-Patches/0353-Ensure-chunks-are-always-loaded-on-hard-position-set.patch create mode 100644 Spigot-Server-Patches/0353-Send-nearby-packets-from-world-player-list-not-serve.patch create mode 100644 Spigot-Server-Patches/0354-Improve-death-events.patch delete mode 100644 Spigot-Server-Patches/0354-Optimize-BlockPosition-helper-methods.patch delete mode 100644 Spigot-Server-Patches/0355-Send-nearby-packets-from-world-player-list-not-serve.patch create mode 100644 Spigot-Server-Patches/0355-isChunkGenerated-API.patch create mode 100644 Spigot-Server-Patches/0356-Add-source-block-to-BlockPhysicsEvent.patch delete mode 100644 Spigot-Server-Patches/0356-Improve-death-events.patch create mode 100644 Spigot-Server-Patches/0357-Optimize-Region-File-Cache.patch delete mode 100644 Spigot-Server-Patches/0357-isChunkGenerated-API.patch delete mode 100644 Spigot-Server-Patches/0358-Add-source-block-to-BlockPhysicsEvent.patch create mode 100644 Spigot-Server-Patches/0358-Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch create mode 100644 Spigot-Server-Patches/0359-Backport-Village-Door-fix-from-1.13.patch delete mode 100644 Spigot-Server-Patches/0359-Optimize-Region-File-Cache.patch create mode 100644 Spigot-Server-Patches/0360-Backport-light-queue-changes-from-1.13.patch delete mode 100644 Spigot-Server-Patches/0360-Sync-Player-Position-to-Vehicles.patch create mode 100644 Spigot-Server-Patches/0361-Backport-Water-Activation-Range.patch delete mode 100644 Spigot-Server-Patches/0361-Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch create mode 100644 Spigot-Server-Patches/0362-Backport-Prevent-mob-spawning-from-loading-generatin.patch delete mode 100644 Spigot-Server-Patches/0362-Backport-Village-Door-fix-from-1.13.patch delete mode 100644 Spigot-Server-Patches/0363-Backport-light-queue-changes-from-1.13.patch create mode 100644 Spigot-Server-Patches/0363-Detect-and-repair-corrupt-Region-Files.patch delete mode 100644 Spigot-Server-Patches/0364-Backport-Water-Activation-Range.patch create mode 100644 Spigot-Server-Patches/0364-Backport-the-dupe-uuid-and-entity-log-changes.patch delete mode 100644 Spigot-Server-Patches/0365-Backport-Prevent-mob-spawning-from-loading-generatin.patch create mode 100644 Spigot-Server-Patches/0365-MC-54026-Backport-1.13-client-desync-fix-on-fast-too.patch delete mode 100644 Spigot-Server-Patches/0366-Detect-and-repair-corrupt-Region-Files.patch delete mode 100644 Spigot-Server-Patches/0367-Backport-the-dupe-uuid-and-entity-log-changes.patch delete mode 100644 Spigot-Server-Patches/0368-MC-54026-Backport-1.13-client-desync-fix-on-fast-too.patch diff --git a/Spigot-API-Patches/0008-Check-Paper-versions.patch b/Spigot-API-Patches/0008-Check-Paper-versions.patch index 18acf62395..2168ec4264 100644 --- a/Spigot-API-Patches/0008-Check-Paper-versions.patch +++ b/Spigot-API-Patches/0008-Check-Paper-versions.patch @@ -1,11 +1,11 @@ -From 5a25f66a6e73b622258aeee69d25128aed24693a Mon Sep 17 00:00:00 2001 +From 20265a5d5266c8df40625c55cee8dc01201174b3 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Mon, 29 Feb 2016 17:58:01 -0600 Subject: [PATCH] Check Paper versions diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java -index 760d58eb..044361af 100644 +index 386d841b..3005b099 100644 --- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java +++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java @@ -28,6 +28,11 @@ import org.json.simple.JSONObject; @@ -20,7 +20,7 @@ index 760d58eb..044361af 100644 public class VersionCommand extends BukkitCommand { public VersionCommand(String name) { super(name); -@@ -151,7 +156,7 @@ public class VersionCommand extends BukkitCommand { +@@ -152,7 +157,7 @@ public class VersionCommand extends BukkitCommand { private void sendVersion(CommandSender sender) { if (hasVersion) { @@ -29,7 +29,7 @@ index 760d58eb..044361af 100644 lastCheck = System.currentTimeMillis(); hasVersion = false; } else { -@@ -182,24 +187,28 @@ public class VersionCommand extends BukkitCommand { +@@ -183,24 +188,28 @@ public class VersionCommand extends BukkitCommand { } } @@ -70,7 +70,7 @@ index 760d58eb..044361af 100644 version = version.substring("git-Bukkit-".length()); int cbVersions = getDistance("craftbukkit", version.substring(0, version.indexOf(' '))); if (cbVersions == -1) { -@@ -232,8 +241,16 @@ public class VersionCommand extends BukkitCommand { +@@ -233,8 +242,16 @@ public class VersionCommand extends BukkitCommand { } } @@ -88,7 +88,7 @@ index 760d58eb..044361af 100644 BufferedReader reader = Resources.asCharSource( new URL("https://hub.spigotmc.org/stash/rest/api/1.0/projects/SPIGOT/repos/" + repo + "/commits?since=" + URLEncoder.encode(hash, "UTF-8") + "&withCounts=true"), Charsets.UTF_8 -@@ -247,9 +264,58 @@ public class VersionCommand extends BukkitCommand { +@@ -248,9 +265,58 @@ public class VersionCommand extends BukkitCommand { } finally { reader.close(); } @@ -148,5 +148,5 @@ index 760d58eb..044361af 100644 + // Paper end } -- -2.17.0 +2.19.1 diff --git a/Spigot-API-Patches/0095-Add-version-history-to-version-command.patch b/Spigot-API-Patches/0095-Add-version-history-to-version-command.patch index 8423eafcc1..3f0e7e804f 100644 --- a/Spigot-API-Patches/0095-Add-version-history-to-version-command.patch +++ b/Spigot-API-Patches/0095-Add-version-history-to-version-command.patch @@ -1,4 +1,4 @@ -From 2b7db879b8f87e7539717559348c34dfcee58f70 Mon Sep 17 00:00:00 2001 +From 2ff79db56c78840998852477b7dc767ccf310a9c Mon Sep 17 00:00:00 2001 From: Kyle Wood Date: Thu, 1 Mar 2018 19:37:52 -0600 Subject: [PATCH] Add version history to version command @@ -154,7 +154,7 @@ index 00000000..1daaca2f + } +} diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java -index 044361af..c45faf4c 100644 +index 3005b099..6bb7607d 100644 --- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java +++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java @@ -31,6 +31,7 @@ import org.json.simple.parser.ParseException; @@ -165,15 +165,18 @@ index 044361af..c45faf4c 100644 // Paper end public class VersionCommand extends BukkitCommand { -@@ -49,6 +50,7 @@ public class VersionCommand extends BukkitCommand { +@@ -49,8 +50,8 @@ public class VersionCommand extends BukkitCommand { if (args.length == 0) { sender.sendMessage("This server is running " + Bukkit.getName() + " version " + Bukkit.getVersion() + " (Implementing API version " + Bukkit.getBukkitVersion() + ")"); +- sender.sendMessage(ChatColor.YELLOW + "This is a final build for 1.12.2. Please see https://www.spigotmc.org/ for details about upgrading."); +- // sendVersion(sender); + tellHistory(sender); // Paper - sendVersion(sender); ++ sendVersion(sender); // Paper - We'll say when, thanks } else { StringBuilder name = new StringBuilder(); -@@ -85,6 +87,22 @@ public class VersionCommand extends BukkitCommand { + +@@ -86,6 +87,22 @@ public class VersionCommand extends BukkitCommand { return true; } @@ -197,5 +200,5 @@ index 044361af..c45faf4c 100644 PluginDescriptionFile desc = plugin.getDescription(); sender.sendMessage(ChatColor.GREEN + desc.getName() + ChatColor.WHITE + " version " + ChatColor.GREEN + desc.getVersion()); -- -2.17.1 +2.19.1 diff --git a/Spigot-Server-Patches/0005-Add-MinecraftKey-Information-to-Objects.patch b/Spigot-Server-Patches/0005-Add-MinecraftKey-Information-to-Objects.patch index f327c45af2..0951a3bfd3 100644 --- a/Spigot-Server-Patches/0005-Add-MinecraftKey-Information-to-Objects.patch +++ b/Spigot-Server-Patches/0005-Add-MinecraftKey-Information-to-Objects.patch @@ -1,4 +1,4 @@ -From de17c631c117b92a3cb3256819347d169ed0225b Mon Sep 17 00:00:00 2001 +From 3acadeb8f5cd933fd4103268cc19903601180d7f Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 4 Jul 2018 01:40:13 -0400 Subject: [PATCH] Add MinecraftKey Information to Objects @@ -6,7 +6,7 @@ Subject: [PATCH] Add MinecraftKey Information to Objects Stores the reference to the objects respective MinecraftKey diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index ed39b122ec..06c72b95f3 100644 +index 87e08303..b11bb2a3 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -41,7 +41,7 @@ import org.bukkit.event.entity.EntityPortalEvent; @@ -18,7 +18,7 @@ index ed39b122ec..06c72b95f3 100644 // CraftBukkit start private static final int CURRENT_LEVEL = 2; -@@ -1702,11 +1702,28 @@ public abstract class Entity implements ICommandListener { +@@ -1705,11 +1705,28 @@ public abstract class Entity implements ICommandListener { return true; } @@ -52,7 +52,7 @@ index ed39b122ec..06c72b95f3 100644 protected abstract void a(NBTTagCompound nbttagcompound); 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..61c2b993c9 +index 00000000..61c2b993 --- /dev/null +++ b/src/main/java/net/minecraft/server/KeyedObject.java @@ -0,0 +1,8 @@ @@ -65,7 +65,7 @@ index 0000000000..61c2b993c9 + } +} diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index 5a5a588e7c..0176ca530c 100644 +index 5a5a588e..0176ca53 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java @@ -7,7 +7,7 @@ import org.apache.logging.log4j.Logger; @@ -107,5 +107,5 @@ index 5a5a588e7c..0176ca530c 100644 } -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0006-Store-reference-to-current-Chunk-for-Entity-and-Bloc.patch b/Spigot-Server-Patches/0006-Store-reference-to-current-Chunk-for-Entity-and-Bloc.patch index 6166befb9c..fdd16a62d1 100644 --- a/Spigot-Server-Patches/0006-Store-reference-to-current-Chunk-for-Entity-and-Bloc.patch +++ b/Spigot-Server-Patches/0006-Store-reference-to-current-Chunk-for-Entity-and-Bloc.patch @@ -1,4 +1,4 @@ -From a888d340ea17fc233b7d2e7e47f2eac246a71dbe Mon Sep 17 00:00:00 2001 +From ef9dc7ddc60f9ce5456f7a6e5aa0b5a6e38eb0ed Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 4 Jul 2018 02:10:36 -0400 Subject: [PATCH] Store reference to current Chunk for Entity and Block @@ -8,7 +8,7 @@ This enables us a fast reference to the entities current chunk instead of having to look it up by hashmap lookups. diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 4bbebb25af..f74ed3a143 100644 +index ff030d98..d54cf9f8 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -25,7 +25,7 @@ public class Chunk { @@ -89,7 +89,7 @@ index 4bbebb25af..f74ed3a143 100644 // Do not pass along players, as doing so can get them stuck outside of time. // (which for example disables inventory icon updates and prevents block breaking) diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 06c72b95f3..0e3a94ab8c 100644 +index b11bb2a3..2bb23c7b 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -121,7 +121,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper @@ -101,7 +101,7 @@ index 06c72b95f3..0e3a94ab8c 100644 public int ab; public int getChunkX() { return ab; } // Paper - OBFHELPER public int ac; public int getChunkY() { return ac; } // Paper - OBFHELPER public int ad; public int getChunkZ() { return ad; } // Paper - OBFHELPER -@@ -1703,6 +1703,38 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -1706,6 +1706,38 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper } // Paper start @@ -141,7 +141,7 @@ index 06c72b95f3..0e3a94ab8c 100644 private MinecraftKey entityKey = getMinecraftKey(); diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index 0176ca530c..29069b753e 100644 +index 0176ca53..29069b75 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java @@ -28,6 +28,14 @@ public abstract class TileEntity implements KeyedObject { @@ -160,7 +160,7 @@ index 0176ca530c..29069b753e 100644 private MinecraftKey tileEntityKey = getMinecraftKey(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index c5a194ffea..833e3111de 100644 +index c5a194ff..833e3111 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -9,6 +9,7 @@ import java.util.UUID; @@ -185,5 +185,5 @@ index c5a194ffea..833e3111de 100644 /** * Order is *EXTREMELY* important -- keep it right! =D -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0008-MC-Utils.patch b/Spigot-Server-Patches/0008-MC-Utils.patch index c7fd99a993..354aee9dc4 100644 --- a/Spigot-Server-Patches/0008-MC-Utils.patch +++ b/Spigot-Server-Patches/0008-MC-Utils.patch @@ -1,11 +1,11 @@ -From 5e79bbc7dee8f1a2e42930e6899b7cf8e928b548 Mon Sep 17 00:00:00 2001 +From 314b0b3eeb050f45dc3e9ba4eb41acf52e24e80f Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 28 Mar 2016 20:55:47 -0400 Subject: [PATCH] MC Utils diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 952c96c0c..cbb1f2cae 100644 +index 175ce12b..801dd26d 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -20,7 +20,7 @@ import org.bukkit.Server; // CraftBukkit @@ -26,7 +26,7 @@ index 952c96c0c..cbb1f2cae 100644 public TileEntity a(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) { // CraftBukkit start diff --git a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java -index 239440888..aafd23beb 100644 +index 23944088..aafd23be 100644 --- a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java +++ b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java @@ -15,6 +15,8 @@ public class ChunkCoordIntPair { @@ -39,7 +39,7 @@ index 239440888..aafd23beb 100644 return (long) i & 4294967295L | ((long) j & 4294967295L) << 32; } diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java -index 1f2fe87b6..2cb462b8e 100644 +index 1f2fe87b..2cb462b8 100644 --- a/src/main/java/net/minecraft/server/DataPaletteBlock.java +++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java @@ -5,7 +5,7 @@ import javax.annotation.Nullable; @@ -52,7 +52,7 @@ index 1f2fe87b6..2cb462b8e 100644 protected DataPalette c; private int e; diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java -index ba461ad48..2359b31f4 100644 +index ba461ad4..2359b31f 100644 --- a/src/main/java/net/minecraft/server/EntityTypes.java +++ b/src/main/java/net/minecraft/server/EntityTypes.java @@ -13,6 +13,11 @@ import org.apache.logging.log4j.Logger; @@ -77,7 +77,7 @@ index ba461ad48..2359b31f4 100644 while (EntityTypes.g.size() <= i) { EntityTypes.g.add(null); // Paper - Decompile fix diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index 76bfbaa81..82d72ea15 100644 +index 76bfbaa8..82d72ea1 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java @@ -14,6 +14,7 @@ import org.bukkit.Location; @@ -108,7 +108,7 @@ index 76bfbaa81..82d72ea15 100644 } diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java new file mode 100644 -index 000000000..a4b0901cf +index 00000000..a4b0901c --- /dev/null +++ b/src/main/java/net/minecraft/server/MCUtil.java @@ -0,0 +1,201 @@ @@ -314,7 +314,7 @@ index 000000000..a4b0901cf + } +} diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java -index aa1ca6d91..e15c23367 100644 +index aa1ca6d9..e15c2336 100644 --- a/src/main/java/net/minecraft/server/NBTTagCompound.java +++ b/src/main/java/net/minecraft/server/NBTTagCompound.java @@ -22,7 +22,7 @@ public class NBTTagCompound extends NBTBase { @@ -341,7 +341,7 @@ index aa1ca6d91..e15c23367 100644 public UUID a(String s) { return new UUID(this.getLong(s + "Most"), this.getLong(s + "Least")); diff --git a/src/main/java/net/minecraft/server/NBTTagList.java b/src/main/java/net/minecraft/server/NBTTagList.java -index e0cb6aa6e..bc6383669 100644 +index e0cb6aa6..bc638366 100644 --- a/src/main/java/net/minecraft/server/NBTTagList.java +++ b/src/main/java/net/minecraft/server/NBTTagList.java @@ -13,7 +13,7 @@ import org.apache.logging.log4j.Logger; @@ -354,7 +354,7 @@ index e0cb6aa6e..bc6383669 100644 public NBTTagList() {} diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 8cede938a..cd2d58bfb 100644 +index 25dedb9d..c98dfd26 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -65,9 +65,9 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { @@ -370,7 +370,7 @@ index 8cede938a..cd2d58bfb 100644 // CraftBukkit start - multithreaded fields private volatile int chatThrottle; private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(PlayerConnection.class, "chatThrottle"); -@@ -2158,6 +2158,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -2160,6 +2160,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { } @@ -379,5 +379,5 @@ index 8cede938a..cd2d58bfb 100644 return System.nanoTime() / 1000000L; } -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0009-Timings-v2.patch b/Spigot-Server-Patches/0009-Timings-v2.patch index 81ac89d485..44048cbedd 100644 --- a/Spigot-Server-Patches/0009-Timings-v2.patch +++ b/Spigot-Server-Patches/0009-Timings-v2.patch @@ -1,4 +1,4 @@ -From 4892ce2583def9198563d017a95c06ef0d086e60 Mon Sep 17 00:00:00 2001 +From 4434336cca0aea35c9261dd4abbc5679c8c6a7ca Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 3 Mar 2016 04:00:11 -0600 Subject: [PATCH] Timings v2 @@ -599,7 +599,7 @@ index e1cb96a8..8f2afcc3 100644 return waitable.get(); } catch (java.util.concurrent.ExecutionException e) { diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 0e3a94ab..c8814396 100644 +index 2bb23c7b..375f9d03 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -25,7 +25,8 @@ import org.bukkit.block.BlockFace; @@ -621,7 +621,7 @@ index 0e3a94ab..c8814396 100644 // Spigot start public final byte activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final boolean defaultActivationState; -@@ -531,7 +532,6 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -532,7 +533,6 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper } public void move(EnumMoveType enummovetype, double d0, double d1, double d2) { @@ -629,7 +629,7 @@ index 0e3a94ab..c8814396 100644 if (this.noclip) { this.a(this.getBoundingBox().d(d0, d1, d2)); this.recalcPosition(); -@@ -925,7 +925,6 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -926,7 +926,6 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper this.world.methodProfiler.b(); } @@ -987,7 +987,7 @@ index eeac3499..e4ed2e99 100644 } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index ec3e0833..dacf9261 100644 +index c98dfd26..4174fbfd 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -56,6 +56,7 @@ import org.bukkit.inventory.CraftingInventory; @@ -998,7 +998,7 @@ index ec3e0833..dacf9261 100644 // CraftBukkit end public class PlayerConnection implements PacketListenerPlayIn, ITickable { -@@ -1378,7 +1379,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -1380,7 +1381,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { // CraftBukkit end private void handleCommand(String s) { @@ -1007,7 +1007,7 @@ index ec3e0833..dacf9261 100644 // CraftBukkit start - whole method if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot this.LOGGER.info(this.player.getName() + " issued server command: " + s); -@@ -1389,22 +1390,22 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -1391,22 +1392,22 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { this.server.getPluginManager().callEvent(event); if (event.isCancelled()) { @@ -1909,5 +1909,5 @@ index 2bd690fd..38be7ed7 100644 } } -- -2.16.1.windows.4 +2.19.1 diff --git a/Spigot-Server-Patches/0016-Drop-falling-block-and-tnt-entities-at-the-specified.patch b/Spigot-Server-Patches/0016-Drop-falling-block-and-tnt-entities-at-the-specified.patch index d38c1117f9..3f7de9eba2 100644 --- a/Spigot-Server-Patches/0016-Drop-falling-block-and-tnt-entities-at-the-specified.patch +++ b/Spigot-Server-Patches/0016-Drop-falling-block-and-tnt-entities-at-the-specified.patch @@ -1,11 +1,11 @@ -From 3245f2a838cecf17e9f9a315f5435b8a0c08ae48 Mon Sep 17 00:00:00 2001 +From c92e98c74584715f42cdf0b959f3dae0e77d85b4 Mon Sep 17 00:00:00 2001 From: Byteflux Date: Tue, 1 Mar 2016 14:14:15 -0600 Subject: [PATCH] Drop falling block and tnt entities at the specified height diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 0094d1a87d..4da846719d 100644 +index 0094d1a8..4da84671 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -113,4 +113,14 @@ public class PaperWorldConfig { @@ -24,10 +24,10 @@ index 0094d1a87d..4da846719d 100644 + } } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 459bdbd6ec..335d2ce4cb 100644 +index 375f9d03..c94b3416 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1799,6 +1799,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -1802,6 +1802,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper return this.a(new ItemStack(item, i, 0), f); } @@ -36,7 +36,7 @@ index 459bdbd6ec..335d2ce4cb 100644 public EntityItem a(ItemStack itemstack, float f) { if (itemstack.isEmpty()) { diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java -index 579e51a0aa..2ba5d51a5f 100644 +index 579e51a0..2ba5d51a 100644 --- a/src/main/java/net/minecraft/server/EntityFallingBlock.java +++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java @@ -84,6 +84,17 @@ public class EntityFallingBlock extends Entity { @@ -58,7 +58,7 @@ index 579e51a0aa..2ba5d51a5f 100644 blockposition = new BlockPosition(this); boolean flag = this.block.getBlock() == Blocks.dS; diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -index 44b2d47351..0d70dd1d22 100644 +index 44b2d473..0d70dd1d 100644 --- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java +++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java @@ -57,6 +57,13 @@ public class EntityTNTPrimed extends Entity { @@ -76,5 +76,5 @@ index 44b2d47351..0d70dd1d22 100644 this.motY *= 0.9800000190734863D; this.motZ *= 0.9800000190734863D; -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0025-Entity-Origin-API.patch b/Spigot-Server-Patches/0025-Entity-Origin-API.patch index 2e43462942..9682774229 100644 --- a/Spigot-Server-Patches/0025-Entity-Origin-API.patch +++ b/Spigot-Server-Patches/0025-Entity-Origin-API.patch @@ -1,11 +1,11 @@ -From 40d24e0192a049584a4c70c8474ae23346e50f2d Mon Sep 17 00:00:00 2001 +From dcec603731b64e91c8ea46cffff1039bd69170bf Mon Sep 17 00:00:00 2001 From: Byteflux Date: Tue, 1 Mar 2016 23:45:08 -0600 Subject: [PATCH] Entity Origin API diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 335d2ce4cb..cea987f33e 100644 +index c94b3416..89c36a92 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -149,6 +149,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper @@ -16,7 +16,7 @@ index 335d2ce4cb..cea987f33e 100644 // Spigot start public final byte activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final boolean defaultActivationState; -@@ -1545,6 +1546,11 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -1548,6 +1549,11 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper } } @@ -28,7 +28,7 @@ index 335d2ce4cb..cea987f33e 100644 return nbttagcompound; } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Saving entity NBT"); -@@ -1688,6 +1694,13 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -1691,6 +1697,13 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper } // CraftBukkit end @@ -42,7 +42,7 @@ index 335d2ce4cb..cea987f33e 100644 } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded"); -@@ -1761,6 +1774,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -1764,6 +1777,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper protected abstract void b(NBTTagCompound nbttagcompound); @@ -51,7 +51,7 @@ index 335d2ce4cb..cea987f33e 100644 NBTTagList nbttaglist = new NBTTagList(); double[] adouble1 = adouble; diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java -index 2ba5d51a5f..abdc2dea9b 100644 +index 2ba5d51a..abdc2dea 100644 --- a/src/main/java/net/minecraft/server/EntityFallingBlock.java +++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java @@ -267,6 +267,14 @@ public class EntityFallingBlock extends Entity { @@ -70,7 +70,7 @@ index 2ba5d51a5f..abdc2dea9b 100644 public void a(boolean flag) { diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -index 0d70dd1d22..bb0904f865 100644 +index 0d70dd1d..bb0904f8 100644 --- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java +++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java @@ -109,6 +109,14 @@ public class EntityTNTPrimed extends Entity { @@ -89,7 +89,7 @@ index 0d70dd1d22..bb0904f865 100644 @Nullable diff --git a/src/main/java/net/minecraft/server/NBTTagList.java b/src/main/java/net/minecraft/server/NBTTagList.java -index bc6383669e..ca9eb2f3b2 100644 +index bc638366..ca9eb2f3 100644 --- a/src/main/java/net/minecraft/server/NBTTagList.java +++ b/src/main/java/net/minecraft/server/NBTTagList.java @@ -153,6 +153,7 @@ public class NBTTagList extends NBTBase { @@ -101,7 +101,7 @@ index bc6383669e..ca9eb2f3b2 100644 if (i >= 0 && i < this.list.size()) { NBTBase nbtbase = (NBTBase) this.list.get(i); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 26d4bd690b..31b765deaf 100644 +index 26d4bd69..31b765de 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -1071,6 +1071,12 @@ public abstract class World implements IBlockAccess { @@ -118,7 +118,7 @@ index 26d4bd690b..31b765deaf 100644 flag = true; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 833e3111de..6c23e88a54 100644 +index 833e3111..6c23e88a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -761,4 +761,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @@ -135,5 +135,5 @@ index 833e3111de..6c23e88a54 100644 + // Paper end } -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0027-Configurable-top-of-nether-void-damage.patch b/Spigot-Server-Patches/0027-Configurable-top-of-nether-void-damage.patch index 84c5c75ce7..15b509140c 100644 --- a/Spigot-Server-Patches/0027-Configurable-top-of-nether-void-damage.patch +++ b/Spigot-Server-Patches/0027-Configurable-top-of-nether-void-damage.patch @@ -1,11 +1,11 @@ -From 449eb3fe46c8082e18636765fd22ab8a9be1b4ca Mon Sep 17 00:00:00 2001 +From a53e95b80e0de45aa9c636353c213ae43fedab19 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 1 Mar 2016 23:58:50 -0600 Subject: [PATCH] Configurable top of nether void damage diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index d3484489b..bf7af475c 100644 +index d3484489..bf7af475 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -129,4 +129,10 @@ public class PaperWorldConfig { @@ -20,10 +20,10 @@ index d3484489b..bf7af475c 100644 + } } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 011cf59c0..296bdfba5 100644 +index 89c36a92..6ee359e1 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -450,9 +450,15 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -451,9 +451,15 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper this.fallDistance *= 0.5F; } @@ -39,7 +39,7 @@ index 011cf59c0..296bdfba5 100644 if (!this.world.isClientSide) { this.setFlag(0, this.fireTicks > 0); -@@ -462,6 +468,18 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -463,6 +469,18 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper this.world.methodProfiler.b(); } @@ -58,7 +58,7 @@ index 011cf59c0..296bdfba5 100644 protected void I() { if (this.portalCooldown > 0) { --this.portalCooldown; -@@ -518,6 +536,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -519,6 +537,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper this.fireTicks = 0; } @@ -67,7 +67,7 @@ index 011cf59c0..296bdfba5 100644 this.die(); } diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -index a9412d4e0..1f4025486 100644 +index a9412d4e..1f402548 100644 --- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java +++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java @@ -204,9 +204,15 @@ public abstract class EntityMinecartAbstract extends Entity implements INamableT @@ -87,5 +87,5 @@ index a9412d4e0..1f4025486 100644 int i; -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0051-Ensure-commands-are-not-ran-async.patch b/Spigot-Server-Patches/0051-Ensure-commands-are-not-ran-async.patch index 5fcda5b7a7..7517147dd5 100644 --- a/Spigot-Server-Patches/0051-Ensure-commands-are-not-ran-async.patch +++ b/Spigot-Server-Patches/0051-Ensure-commands-are-not-ran-async.patch @@ -1,4 +1,4 @@ -From c7b0d45e95bb420f3051f4bde3d28fc8d584a03a Mon Sep 17 00:00:00 2001 +From 39f3432523b5ebe768a66a6939120854f169d185 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 3 Mar 2016 01:17:12 -0600 Subject: [PATCH] Ensure commands are not ran async @@ -14,10 +14,10 @@ big slowdown in execution but throwing an exception at same time to raise awaren that it is happening so that plugin authors can fix their code to stop executing commands async. diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index da25a8bea..48379f414 100644 +index 4174fbfd..44a3776e 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1311,6 +1311,29 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -1313,6 +1313,29 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { } if (!async && s.startsWith("/")) { @@ -48,7 +48,7 @@ index da25a8bea..48379f414 100644 } else if (this.player.getChatFlags() == EntityHuman.EnumChatVisibility.SYSTEM) { // Do nothing, this is coming from a plugin diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index bfddd1685..462ad1024 100644 +index bfddd168..462ad102 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -645,6 +645,29 @@ public final class CraftServer implements Server { @@ -82,7 +82,7 @@ index bfddd1685..462ad1024 100644 return true; } diff --git a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java -index a0cdd2317..984df4083 100644 +index a0cdd231..984df408 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java +++ b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java @@ -14,6 +14,7 @@ public class ServerShutdownThread extends Thread { @@ -94,7 +94,7 @@ index a0cdd2317..984df4083 100644 } catch (ExceptionWorldConflict ex) { ex.printStackTrace(); diff --git a/src/main/java/org/spigotmc/AsyncCatcher.java b/src/main/java/org/spigotmc/AsyncCatcher.java -index 4b3aa85c9..e44c23016 100644 +index 4b3aa85c..e44c2301 100644 --- a/src/main/java/org/spigotmc/AsyncCatcher.java +++ b/src/main/java/org/spigotmc/AsyncCatcher.java @@ -6,6 +6,7 @@ public class AsyncCatcher @@ -106,7 +106,7 @@ index 4b3aa85c9..e44c23016 100644 public static void catchOp(String reason) { diff --git a/src/main/java/org/spigotmc/RestartCommand.java b/src/main/java/org/spigotmc/RestartCommand.java -index 49768734d..947c43a5d 100644 +index 49768734..947c43a5 100644 --- a/src/main/java/org/spigotmc/RestartCommand.java +++ b/src/main/java/org/spigotmc/RestartCommand.java @@ -43,6 +43,7 @@ public class RestartCommand extends Command @@ -118,5 +118,5 @@ index 49768734d..947c43a5d 100644 { if ( script.isFile() ) -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0065-Disable-Scoreboards-for-non-players-by-default.patch b/Spigot-Server-Patches/0065-Disable-Scoreboards-for-non-players-by-default.patch index c1b5b26b68..5ad3950fcc 100644 --- a/Spigot-Server-Patches/0065-Disable-Scoreboards-for-non-players-by-default.patch +++ b/Spigot-Server-Patches/0065-Disable-Scoreboards-for-non-players-by-default.patch @@ -1,4 +1,4 @@ -From e974cc2dc77b8e3ca057231ad712724603872f56 Mon Sep 17 00:00:00 2001 +From 31b9eb4ce4fbadbc9629a9356e3619055f359597 Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 8 Mar 2016 23:25:45 -0500 Subject: [PATCH] Disable Scoreboards for non players by default @@ -11,7 +11,7 @@ So avoid looking up scoreboards and short circuit to the "not on a team" logic which is most likely to be true. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index b241c0380d..a4c94845b8 100644 +index b241c038..a4c94845 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -242,4 +242,9 @@ public class PaperWorldConfig { @@ -25,7 +25,7 @@ index b241c0380d..a4c94845b8 100644 + } } diff --git a/src/main/java/net/minecraft/server/CommandScoreboard.java b/src/main/java/net/minecraft/server/CommandScoreboard.java -index ec9a87239a..b08274d933 100644 +index ec9a8723..b08274d9 100644 --- a/src/main/java/net/minecraft/server/CommandScoreboard.java +++ b/src/main/java/net/minecraft/server/CommandScoreboard.java @@ -492,6 +492,7 @@ public class CommandScoreboard extends CommandAbstract { @@ -37,10 +37,10 @@ index ec9a87239a..b08274d933 100644 if (scoreboard.addPlayerToTeam(s2, s)) { diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 9d6e684d26..a03a809d61 100644 +index 6ee359e1..2e01cef8 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -2128,6 +2128,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -2131,6 +2131,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper @Nullable public ScoreboardTeamBase aY() { @@ -49,5 +49,5 @@ index 9d6e684d26..a03a809d61 100644 } -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0067-Complete-resource-pack-API.patch b/Spigot-Server-Patches/0067-Complete-resource-pack-API.patch index 18f34858e0..448b298379 100644 --- a/Spigot-Server-Patches/0067-Complete-resource-pack-API.patch +++ b/Spigot-Server-Patches/0067-Complete-resource-pack-API.patch @@ -1,14 +1,14 @@ -From 6d5516f22451507fd10a9d2c8d2717f9f6a560f0 Mon Sep 17 00:00:00 2001 +From 2cc03fda9ab1582faf46d09746a90e70a67a6b6f Mon Sep 17 00:00:00 2001 From: Jedediah Smith Date: Sat, 4 Apr 2015 23:17:52 -0400 Subject: [PATCH] Complete resource pack API diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 060301da6..d23fe82db 100644 +index 44a3776e..9f6f93ee 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1067,7 +1067,12 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -1069,7 +1069,12 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { // CraftBukkit start public void a(PacketPlayInResourcePackStatus packetplayinresourcepackstatus) { PlayerConnectionUtils.ensureMainThread(packetplayinresourcepackstatus, this, this.player.x()); @@ -23,7 +23,7 @@ index 060301da6..d23fe82db 100644 // CraftBukkit end diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 18a481f2f..ff4512060 100644 +index 18a481f2..ff451206 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -88,6 +88,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -71,5 +71,5 @@ index 18a481f2f..ff4512060 100644 private final Player.Spigot spigot = new Player.Spigot() { -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0086-Don-t-teleport-dead-entities.patch b/Spigot-Server-Patches/0086-Don-t-teleport-dead-entities.patch index 86f493e500..71812dc943 100644 --- a/Spigot-Server-Patches/0086-Don-t-teleport-dead-entities.patch +++ b/Spigot-Server-Patches/0086-Don-t-teleport-dead-entities.patch @@ -1,4 +1,4 @@ -From 92be596a29c450456eb1ff4aba0306aa090999ff Mon Sep 17 00:00:00 2001 +From da24ab81746b90d16975a35a9be70516fa0da6c9 Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 22 Mar 2016 00:55:23 -0400 Subject: [PATCH] Don't teleport dead entities @@ -7,10 +7,10 @@ Had some issue with this in past, and this is the vanilla logic. Potentially an old CB change that's no longer needed. diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index ff854e1ab9..fd193bbece 100644 +index 44e037e7..a3d4da98 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -2417,7 +2417,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -2420,7 +2420,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper } public Entity teleportTo(Location exit, boolean portal) { @@ -20,5 +20,5 @@ index ff854e1ab9..fd193bbece 100644 WorldServer worldserver1 = ((CraftWorld) exit.getWorld()).getHandle(); int i = worldserver1.dimension; -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0102-Add-PlayerUseUnknownEntityEvent.patch b/Spigot-Server-Patches/0102-Add-PlayerUseUnknownEntityEvent.patch index b6fa875d79..ca088cd915 100644 --- a/Spigot-Server-Patches/0102-Add-PlayerUseUnknownEntityEvent.patch +++ b/Spigot-Server-Patches/0102-Add-PlayerUseUnknownEntityEvent.patch @@ -1,11 +1,11 @@ -From 7ab10243bd61164ab6a53c0753019ad649d244ce Mon Sep 17 00:00:00 2001 +From 7f8b073f31114e50f4270dd03042b5f37019fb3c Mon Sep 17 00:00:00 2001 From: Jedediah Smith Date: Sat, 2 Apr 2016 05:09:16 -0400 Subject: [PATCH] Add PlayerUseUnknownEntityEvent diff --git a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java -index c67cb54a3..521f46262 100644 +index c67cb54a..521f4626 100644 --- a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java +++ b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java @@ -5,7 +5,7 @@ import javax.annotation.Nullable; @@ -18,10 +18,10 @@ index c67cb54a3..521f46262 100644 private Vec3D c; private EnumHand d; diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index e1b85ebae..7c708a0de 100644 +index 9f6f93ee..abb7caa8 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1657,6 +1657,16 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -1659,6 +1659,16 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { } } } @@ -39,5 +39,5 @@ index e1b85ebae..7c708a0de 100644 } -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0109-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch b/Spigot-Server-Patches/0109-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch index 92a61c0641..dde00cf0da 100644 --- a/Spigot-Server-Patches/0109-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch +++ b/Spigot-Server-Patches/0109-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch @@ -1,11 +1,11 @@ -From e460a38fa7693771218e49ab68a7de69492de0e9 Mon Sep 17 00:00:00 2001 +From 46295cf34cd1bef4e4fd5ac70f3f33b714149af3 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Wed, 6 Apr 2016 01:04:23 -0500 Subject: [PATCH] Option to use vanilla per-world scoreboard coloring on names diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index abc1aabdd8..6ea608ba9a 100644 +index abc1aabd..6ea608ba 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -288,4 +288,9 @@ public class PaperWorldConfig { @@ -19,10 +19,10 @@ index abc1aabdd8..6ea608ba9a 100644 + } } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index fd193bbece..89e42c0a46 100644 +index a3d4da98..61d2d91c 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -2140,6 +2140,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -2143,6 +2143,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper return this.getFlag(5); } @@ -31,10 +31,10 @@ index fd193bbece..89e42c0a46 100644 public ScoreboardTeamBase aY() { if (!this.world.paperConfig.nonPlayerEntitiesOnScoreboards && !(this instanceof EntityHuman)) { return null; } // Paper diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index ba1cc267e6..2b81629170 100644 +index abb7caa8..70b59ee9 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1390,7 +1390,14 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -1392,7 +1392,14 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { return; } @@ -51,5 +51,5 @@ index ba1cc267e6..2b81629170 100644 if (((LazyPlayerSet) event.getRecipients()).isLazy()) { for (Object recipient : minecraftServer.getPlayerList().players) { -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0122-Vehicle-Event-Cancellation-Changes.patch b/Spigot-Server-Patches/0122-Vehicle-Event-Cancellation-Changes.patch index 89abe915c8..1c2c6354af 100644 --- a/Spigot-Server-Patches/0122-Vehicle-Event-Cancellation-Changes.patch +++ b/Spigot-Server-Patches/0122-Vehicle-Event-Cancellation-Changes.patch @@ -1,11 +1,11 @@ -From e834b8fc7de6fc3a3460176d2c23e77d3c5afce3 Mon Sep 17 00:00:00 2001 +From 553d60de49239338485f8c345535b4855e14d276 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Fri, 22 Apr 2016 18:20:05 -0500 Subject: [PATCH] Vehicle Event Cancellation Changes diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 89e42c0a46..86b783e73b 100644 +index 61d2d91c..f82c0546 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -83,7 +83,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper @@ -17,7 +17,7 @@ index 89e42c0a46..86b783e73b 100644 public boolean attachedToPlayer; public World world; public double lastX; -@@ -2022,6 +2022,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -2025,6 +2025,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)"); } else { // CraftBukkit start @@ -25,7 +25,7 @@ index 89e42c0a46..86b783e73b 100644 CraftEntity craft = (CraftEntity) entity.getBukkitEntity().getVehicle(); Entity orig = craft == null ? null : craft.getHandle(); if (getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) { -@@ -2037,7 +2038,13 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -2040,7 +2041,13 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper } } // CraftBukkit end @@ -41,5 +41,5 @@ index 89e42c0a46..86b783e73b 100644 entity.j = 60; } -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0136-Optional-TNT-doesn-t-move-in-water.patch b/Spigot-Server-Patches/0136-Optional-TNT-doesn-t-move-in-water.patch index f48cacde84..11e4e59426 100644 --- a/Spigot-Server-Patches/0136-Optional-TNT-doesn-t-move-in-water.patch +++ b/Spigot-Server-Patches/0136-Optional-TNT-doesn-t-move-in-water.patch @@ -1,11 +1,11 @@ -From c75aa93b1c1e98ce0d1f87d73720311182848d68 Mon Sep 17 00:00:00 2001 +From 2f2a111c6c9d153926439214dd99d853f17bc87a Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Sun, 22 May 2016 20:20:55 -0500 Subject: [PATCH] Optional TNT doesn't move in water diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 067cb233e4..06acdaaf04 100644 +index 067cb233..06acdaaf 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -2,7 +2,6 @@ package com.destroystokyo.paper; @@ -32,10 +32,10 @@ index 067cb233e4..06acdaaf04 100644 + } } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 0456cda937..2fbe17ce9d 100644 +index 360ac7b3..7284539f 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1127,6 +1127,11 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -1129,6 +1129,11 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper } public boolean aq() { @@ -47,7 +47,7 @@ index 0456cda937..2fbe17ce9d 100644 if (this.bJ() instanceof EntityBoat) { this.inWater = false; } else if (this.world.a(this.getBoundingBox().grow(0.0D, -0.4000000059604645D, 0.0D).shrink(0.001D), Material.WATER, this)) { -@@ -2605,6 +2610,11 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -2608,6 +2613,11 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper } public boolean bo() { @@ -60,7 +60,7 @@ index 0456cda937..2fbe17ce9d 100644 } diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -index bb0904f865..50811852a3 100644 +index bb0904f8..50811852 100644 --- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java +++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java @@ -147,4 +147,49 @@ public class EntityTNTPrimed extends Entity { @@ -114,5 +114,5 @@ index bb0904f865..50811852a3 100644 + // Paper end } -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0148-More-informative-vehicle-moved-wrongly-message.patch b/Spigot-Server-Patches/0148-More-informative-vehicle-moved-wrongly-message.patch index 3b393c987f..15c5663125 100644 --- a/Spigot-Server-Patches/0148-More-informative-vehicle-moved-wrongly-message.patch +++ b/Spigot-Server-Patches/0148-More-informative-vehicle-moved-wrongly-message.patch @@ -1,11 +1,11 @@ -From 7d692b1b168fdc8a7d3d1394bb6d58f59de98053 Mon Sep 17 00:00:00 2001 +From f9bb45ae0c2d1b8a8dbc7c6b8068e055e479b375 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Thu, 28 Jul 2016 17:58:53 -0500 Subject: [PATCH] More informative vehicle moved wrongly message diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 9eb7b012f..e66584deb 100644 +index 70b59ee9..f4df7902 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -357,7 +357,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { @@ -15,8 +15,8 @@ index 9eb7b012f..e66584deb 100644 - PlayerConnection.LOGGER.warn("{} moved wrongly!", entity.getName()); + PlayerConnection.LOGGER.warn(entity.getName() + " (vehicle of " + this.player.getName() + ") moved wrongly!"); // Paper - More informative } + Location curPos = this.getPlayer().getLocation(); // Spigot - entity.setLocation(d3, d4, d5, f, f1); -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0153-Fix-AIOOBE-in-inventory-handling.patch b/Spigot-Server-Patches/0153-Fix-AIOOBE-in-inventory-handling.patch index 24f979e481..acbf7115ac 100644 --- a/Spigot-Server-Patches/0153-Fix-AIOOBE-in-inventory-handling.patch +++ b/Spigot-Server-Patches/0153-Fix-AIOOBE-in-inventory-handling.patch @@ -1,14 +1,14 @@ -From ccc20dcc8957311e38f8f1d350e01e9f3ec46d9f Mon Sep 17 00:00:00 2001 +From c13cb79830f413ab41f9fa83dd8b7501cb592420 Mon Sep 17 00:00:00 2001 From: Brokkonaut Date: Sun, 4 Sep 2016 16:35:43 -0500 Subject: [PATCH] Fix AIOOBE in inventory handling diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index e66584deb..f5fb86414 100644 +index f4df7902..bace6717 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1849,7 +1849,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -1851,7 +1851,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { case CLONE: if (packetplayinwindowclick.c() == 2) { click = ClickType.MIDDLE; @@ -18,5 +18,5 @@ index e66584deb..f5fb86414 100644 } else { Slot slot = this.player.activeContainer.getSlot(packetplayinwindowclick.b()); -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0154-Configurable-packet-in-spam-threshold.patch b/Spigot-Server-Patches/0154-Configurable-packet-in-spam-threshold.patch index cc040a5c85..7e338bb7a3 100644 --- a/Spigot-Server-Patches/0154-Configurable-packet-in-spam-threshold.patch +++ b/Spigot-Server-Patches/0154-Configurable-packet-in-spam-threshold.patch @@ -1,11 +1,11 @@ -From fc0280fe1ab9b4a8eff7c35bb03792e00440b736 Mon Sep 17 00:00:00 2001 +From 23f7a0764c4d1b7fda2cfe35a2048eca08ac37b6 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Sun, 11 Sep 2016 14:30:57 -0500 Subject: [PATCH] Configurable packet in spam threshold diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index cf06f8ac3..2001175bf 100644 +index cf06f8ac..2001175b 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -235,4 +235,13 @@ public class PaperConfig { @@ -23,10 +23,10 @@ index cf06f8ac3..2001175bf 100644 + } } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index f5fb86414..16c343b54 100644 +index bace6717..50183365 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -909,13 +909,14 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -911,13 +911,14 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { // Spigot start - limit place/interactions private int limitedPackets; private long lastLimitedPacket = -1; @@ -44,5 +44,5 @@ index f5fb86414..16c343b54 100644 limitedPackets = 0; return true; -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0185-IllegalPacketEvent.patch b/Spigot-Server-Patches/0185-IllegalPacketEvent.patch index 26fdf47c5a..75ee184267 100644 --- a/Spigot-Server-Patches/0185-IllegalPacketEvent.patch +++ b/Spigot-Server-Patches/0185-IllegalPacketEvent.patch @@ -1,4 +1,4 @@ -From 95eb029855720de4240a9a73831f7c7ded796d98 Mon Sep 17 00:00:00 2001 +From 4eaf34c47c00a6f0f7fc04ae8e8d01f5855deb52 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 23 Jun 2016 23:33:57 -0400 Subject: [PATCH] IllegalPacketEvent @@ -6,7 +6,7 @@ Subject: [PATCH] IllegalPacketEvent Fired for invalid data from players that represents hacking attempts diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 09f1ef560..cca1c6aa3 100644 +index 79343537..b7a09bb5 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -56,6 +56,7 @@ import org.bukkit.inventory.CraftingInventory; @@ -17,7 +17,7 @@ index 09f1ef560..cca1c6aa3 100644 import co.aikar.timings.MinecraftTimings; // Paper // CraftBukkit end -@@ -2287,8 +2288,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -2289,8 +2290,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { CraftEventFactory.handleEditBookEvent(player, itemstack1); // CraftBukkit } } catch (Exception exception) { @@ -27,7 +27,7 @@ index 09f1ef560..cca1c6aa3 100644 } } else { String s1; -@@ -2337,8 +2337,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -2339,8 +2339,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { CraftEventFactory.handleEditBookEvent(player, itemstack2); // CraftBukkit } } catch (Exception exception1) { @@ -37,7 +37,7 @@ index 09f1ef560..cca1c6aa3 100644 } } else if ("MC|TrSel".equals(s)) { try { -@@ -2349,8 +2348,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -2351,8 +2350,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { ((ContainerMerchant) container).d(j); } } catch (Exception exception2) { @@ -47,7 +47,7 @@ index 09f1ef560..cca1c6aa3 100644 } } else { TileEntity tileentity; -@@ -2491,8 +2489,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -2493,8 +2491,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { iinventory.update(); } } catch (Exception exception5) { @@ -57,7 +57,7 @@ index 09f1ef560..cca1c6aa3 100644 } } } else if ("MC|ItemName".equals(s)) { -@@ -2591,8 +2588,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -2593,8 +2590,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { this.player.playerConnection.sendPacket(new PacketPlayOutSetSlot(-2, k, this.player.inventory.getItem(k))); this.player.playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(this.player.inventory.itemInHandIndex)); } catch (Exception exception7) { @@ -68,5 +68,5 @@ index 09f1ef560..cca1c6aa3 100644 } // CraftBukkit start -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0186-Properly-fix-item-duplication-bug.patch b/Spigot-Server-Patches/0186-Properly-fix-item-duplication-bug.patch index 6ae70642d2..62f0eb5146 100644 --- a/Spigot-Server-Patches/0186-Properly-fix-item-duplication-bug.patch +++ b/Spigot-Server-Patches/0186-Properly-fix-item-duplication-bug.patch @@ -1,4 +1,4 @@ -From bc04820d56bdc51cd13c3a880d50dbac3850c65f Mon Sep 17 00:00:00 2001 +From acbaf8fcb592b2f1002d110b0271ee4031c4cf7d Mon Sep 17 00:00:00 2001 From: Alfie Cleveland Date: Tue, 27 Dec 2016 01:57:57 +0000 Subject: [PATCH] Properly fix item duplication bug @@ -6,7 +6,7 @@ Subject: [PATCH] Properly fix item duplication bug Credit to prplz for figuring out the real issue diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index f8e289475..cce3f98da 100644 +index f8e28947..cce3f98d 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -1500,7 +1500,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @@ -19,10 +19,10 @@ index f8e289475..cce3f98da 100644 @Override diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index cca1c6aa3..3f9e60171 100644 +index b7a09bb5..a6be6fb5 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -2631,6 +2631,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -2633,6 +2633,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { // CraftBukkit start - Add "isDisconnected" method public final boolean isDisconnected() { @@ -31,5 +31,5 @@ index cca1c6aa3..3f9e60171 100644 } } -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0195-Don-t-allow-entities-to-ride-themselves-572.patch b/Spigot-Server-Patches/0195-Don-t-allow-entities-to-ride-themselves-572.patch index 3ca32d8f94..25b7e02ef8 100644 --- a/Spigot-Server-Patches/0195-Don-t-allow-entities-to-ride-themselves-572.patch +++ b/Spigot-Server-Patches/0195-Don-t-allow-entities-to-ride-themselves-572.patch @@ -1,14 +1,14 @@ -From 8b87011bb2c827251749bcd3bb5df2f48244a212 Mon Sep 17 00:00:00 2001 +From 075c1a27679d68e9fa7552be9baf241b136aa74c Mon Sep 17 00:00:00 2001 From: Alfie Cleveland Date: Sun, 8 Jan 2017 04:31:36 +0000 Subject: [PATCH] Don't allow entities to ride themselves - #572 diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 26a76ec972..d156563b08 100644 +index 9bb7b0d8..2fada247 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1999,6 +1999,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -2002,6 +2002,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper } protected void o(Entity entity) { @@ -17,5 +17,5 @@ index 26a76ec972..d156563b08 100644 throw new IllegalStateException("Use x.startRiding(y), not y.addPassenger(x)"); } else { -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0196-Fix-block-break-desync.patch b/Spigot-Server-Patches/0196-Fix-block-break-desync.patch index fa15a2055b..889258d1ad 100644 --- a/Spigot-Server-Patches/0196-Fix-block-break-desync.patch +++ b/Spigot-Server-Patches/0196-Fix-block-break-desync.patch @@ -1,14 +1,14 @@ -From 6b0a93e2ddfdb13b7aff806e071e79173d20b13b Mon Sep 17 00:00:00 2001 +From 4ba4f36afc7374b85dc3b6c4dac442dd3fb05d2c Mon Sep 17 00:00:00 2001 From: Michael Himing Date: Sun, 8 Jan 2017 18:50:35 +1100 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 4f8865d61..802008b4e 100644 +index a6be6fb5..a89fd79b 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -868,6 +868,8 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -870,6 +870,8 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { double d3 = d0 * d0 + d1 * d1 + d2 * d2; if (d3 > 36.0D) { @@ -18,5 +18,5 @@ index 4f8865d61..802008b4e 100644 } else if (blockposition.getY() >= this.minecraftServer.getMaxBuildHeight()) { return; -- -2.17.1 +2.19.1 diff --git a/Spigot-Server-Patches/0208-Add-option-to-make-parrots-stay-on-shoulders-despite.patch b/Spigot-Server-Patches/0208-Add-option-to-make-parrots-stay-on-shoulders-despite.patch index 373736e54a..4b2302d057 100644 --- a/Spigot-Server-Patches/0208-Add-option-to-make-parrots-stay-on-shoulders-despite.patch +++ b/Spigot-Server-Patches/0208-Add-option-to-make-parrots-stay-on-shoulders-despite.patch @@ -1,4 +1,4 @@ -From 0ceac86ec4bac512cd1adfa907020fe976e96fff Mon Sep 17 00:00:00 2001 +From 7c7805f56b85e679f7bb826b9826d2ac6aec352f Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 16 May 2017 21:29:08 -0500 Subject: [PATCH] Add option to make parrots stay on shoulders despite movement @@ -11,7 +11,7 @@ I suspect Mojang may switch to this behavior before full release. To be converted into a Paper-API event at some point in the future? diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 29b4bdb47..31aad03c2 100644 +index 29b4bdb4..31aad03c 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -419,4 +419,10 @@ public class PaperWorldConfig { @@ -26,7 +26,7 @@ index 29b4bdb47..31aad03c2 100644 + } } diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 0f1d99636..9cda8a177 100644 +index 0f1d9963..9cda8a17 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -399,7 +399,7 @@ public abstract class EntityHuman extends EntityLiving { @@ -39,10 +39,10 @@ index 0f1d99636..9cda8a177 100644 } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 802008b4e..6d733e153 100644 +index a89fd79b..ff62ba88 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1515,6 +1515,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -1517,6 +1517,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { switch (packetplayinentityaction.b()) { case START_SNEAKING: this.player.setSneaking(true); @@ -57,5 +57,5 @@ index 802008b4e..6d733e153 100644 case STOP_SNEAKING: -- -2.17.1 +2.19.1 diff --git a/Spigot-Server-Patches/0220-Entity-fromMobSpawner.patch b/Spigot-Server-Patches/0220-Entity-fromMobSpawner.patch index 55e5e37873..3879e2eb83 100644 --- a/Spigot-Server-Patches/0220-Entity-fromMobSpawner.patch +++ b/Spigot-Server-Patches/0220-Entity-fromMobSpawner.patch @@ -1,11 +1,11 @@ -From 69193e9240f2c55715208ca6341f085a2b1cabca Mon Sep 17 00:00:00 2001 +From 60689f54404f25002089240d599fe144e38f4675 Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Sun, 18 Jun 2017 18:17:05 -0500 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 5a4de30fe..2dbb88f2d 100644 +index fe6e4435..f71c2862 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -183,6 +183,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper @@ -16,7 +16,7 @@ index 5a4de30fe..2dbb88f2d 100644 protected int numCollisions = 0; // Paper public void inactiveTick() { } // Spigot end -@@ -1603,6 +1604,10 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -1606,6 +1607,10 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper if (origin != null) { nbttagcompound.set("Paper.Origin", this.createList(origin.getX(), origin.getY(), origin.getZ())); } @@ -27,7 +27,7 @@ index 5a4de30fe..2dbb88f2d 100644 // Paper end return nbttagcompound; } catch (Throwable throwable) { -@@ -1752,6 +1757,8 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -1755,6 +1760,8 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper if (!originTag.isEmpty()) { origin = new Location(world.getWorld(), originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2)); } @@ -37,7 +37,7 @@ index 5a4de30fe..2dbb88f2d 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 a5261d70b..1ed0def1e 100644 +index a5261d70..1ed0def1 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java @@ -107,6 +107,7 @@ public abstract class MobSpawnerAbstract { @@ -49,7 +49,7 @@ index a5261d70b..1ed0def1e 100644 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 3b25b8b73..bf7e6ed3f 100644 +index 3b25b8b7..bf7e6ed3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -800,5 +800,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @@ -64,5 +64,5 @@ index 3b25b8b73..bf7e6ed3f 100644 // Paper end } -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0240-Add-PlayerJumpEvent.patch b/Spigot-Server-Patches/0240-Add-PlayerJumpEvent.patch index e5570e9497..8c9a1ce07a 100644 --- a/Spigot-Server-Patches/0240-Add-PlayerJumpEvent.patch +++ b/Spigot-Server-Patches/0240-Add-PlayerJumpEvent.patch @@ -1,11 +1,11 @@ -From 1ada468a04f4567237b4180c750ed48915b44997 Mon Sep 17 00:00:00 2001 +From 48e6748437a736a6566b09f36fc818ae4c80e74a Mon Sep 17 00:00:00 2001 From: Zach Brown 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 deb0f4a9c..579996d1e 100644 +index deb0f4a9..579996d1 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -1399,6 +1399,7 @@ public abstract class EntityHuman extends EntityLiving { @@ -17,7 +17,7 @@ index deb0f4a9c..579996d1e 100644 super.cu(); this.b(StatisticList.w); diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 3104fc0ea..aa57ff8ed 100644 +index ff62ba88..abce0b6e 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -57,6 +57,7 @@ import org.bukkit.inventory.EquipmentSlot; @@ -28,7 +28,7 @@ index 3104fc0ea..aa57ff8ed 100644 import co.aikar.timings.MinecraftTimings; // Paper // CraftBukkit end -@@ -584,7 +585,34 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -586,7 +587,34 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { d8 = d5 - this.p; d9 = d6 - this.q; if (this.player.onGround && !packetplayinflying.a() && d8 > 0.0D) { @@ -65,5 +65,5 @@ index 3104fc0ea..aa57ff8ed 100644 this.player.move(EnumMoveType.PLAYER, d7, d8, d9); -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0241-handle-PacketPlayInKeepAlive-async.patch b/Spigot-Server-Patches/0241-handle-PacketPlayInKeepAlive-async.patch index 3f12db1cd2..45ab38bacb 100644 --- a/Spigot-Server-Patches/0241-handle-PacketPlayInKeepAlive-async.patch +++ b/Spigot-Server-Patches/0241-handle-PacketPlayInKeepAlive-async.patch @@ -1,4 +1,4 @@ -From cab4c50ff2db0b82c32afadb8075dc5e5b3b5bad Mon Sep 17 00:00:00 2001 +From eced421f5f42625ee8f8d1087cbf773ac680f894 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Thu, 5 Oct 2017 01:54:07 +0100 Subject: [PATCH] handle PacketPlayInKeepAlive async @@ -15,10 +15,10 @@ 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 08211a54c..72474a88e 100644 +index abce0b6e..b6d94816 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -2231,14 +2231,20 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -2233,14 +2233,20 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { } public void a(PacketPlayInKeepAlive packetplayinkeepalive) { @@ -42,5 +42,5 @@ index 08211a54c..72474a88e 100644 } -- -2.17.1 +2.19.1 diff --git a/Spigot-Server-Patches/0252-AsyncTabCompleteEvent.patch b/Spigot-Server-Patches/0252-AsyncTabCompleteEvent.patch index f836cbe4c2..80afeeb251 100644 --- a/Spigot-Server-Patches/0252-AsyncTabCompleteEvent.patch +++ b/Spigot-Server-Patches/0252-AsyncTabCompleteEvent.patch @@ -1,4 +1,4 @@ -From 36595d8506ce4cb19d6e56d941f824b75bb190b7 Mon Sep 17 00:00:00 2001 +From 57a61075e611d4c87c44424c7b8ef23b2a4dcb49 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 26 Nov 2017 13:19:58 -0500 Subject: [PATCH] AsyncTabCompleteEvent @@ -14,7 +14,7 @@ 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 89071db952..2ed59b4088 100644 +index 44eb8ba6..3fa146ae 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -10,6 +10,7 @@ import java.io.IOException; @@ -25,7 +25,7 @@ index 89071db952..2ed59b4088 100644 import java.util.Set; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; -@@ -2277,24 +2278,45 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -2279,24 +2280,45 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { // CraftBukkit end } @@ -82,7 +82,7 @@ index 89071db952..2ed59b4088 100644 public void a(PacketPlayInSettings packetplayinsettings) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 5b1aae5587..d6676074e6 100644 +index 5b1aae55..d6676074 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1643,8 +1643,8 @@ public final class CraftServer implements Server { @@ -97,7 +97,7 @@ index 5b1aae5587..d6676074e6 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 1e3aae3b..95d13c14 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java +++ b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java @@ -28,6 +28,39 @@ public class ConsoleCommandCompleter implements Completer { @@ -141,5 +141,5 @@ index 1e3aae3b8f..95d13c146b 100644 Waitable> waitable = new Waitable>() { @Override -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0293-Fix-exploit-that-allowed-colored-signs-to-be-created.patch b/Spigot-Server-Patches/0293-Fix-exploit-that-allowed-colored-signs-to-be-created.patch index 9a26faad72..a5771ed2fb 100644 --- a/Spigot-Server-Patches/0293-Fix-exploit-that-allowed-colored-signs-to-be-created.patch +++ b/Spigot-Server-Patches/0293-Fix-exploit-that-allowed-colored-signs-to-be-created.patch @@ -1,14 +1,14 @@ -From 79475dad6199107ffc2266fcf17ec6ebaffa7193 Mon Sep 17 00:00:00 2001 +From e1f03de002a4025ff5128a375ff0edd392e04176 Mon Sep 17 00:00:00 2001 From: 0x22 <0x22@futureclient.net> Date: Thu, 26 Apr 2018 04:41:11 -0400 Subject: [PATCH] Fix exploit that allowed colored signs to be created diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 2ed59b4088..08191e9059 100644 +index 3fa146ae..06256662 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -2222,7 +2222,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -2224,7 +2224,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { String[] lines = new String[4]; for (int i = 0; i < astring.length; ++i) { @@ -18,5 +18,5 @@ index 2ed59b4088..08191e9059 100644 SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.server.getPlayer(this.player), lines); this.server.getPluginManager().callEvent(event); -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0307-Properly-remove-entities-on-dimension-teleport.patch b/Spigot-Server-Patches/0307-Properly-remove-entities-on-dimension-teleport.patch index 997c42c766..6cca27f17c 100644 --- a/Spigot-Server-Patches/0307-Properly-remove-entities-on-dimension-teleport.patch +++ b/Spigot-Server-Patches/0307-Properly-remove-entities-on-dimension-teleport.patch @@ -1,4 +1,4 @@ -From e1b60705c11cb4eedbe9ea30504df1012cb58dd9 Mon Sep 17 00:00:00 2001 +From a74d2af6315643fd7eaf2bea943adb90c728d63f Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 10 Jun 2018 20:04:42 -0400 Subject: [PATCH] Properly remove entities on dimension teleport @@ -22,10 +22,10 @@ requirement, but plugins (such as my own) use this method to trigger a "reload" of the entity on the client. diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index ea2502409d..71da8e1e7d 100644 +index f71c2862..6eab1ef8 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -2467,7 +2467,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -2470,7 +2470,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper } // CraftBukkit end */ @@ -35,7 +35,7 @@ index ea2502409d..71da8e1e7d 100644 this.world.methodProfiler.a("reposition"); /* CraftBukkit start - Handled in calculateTarget diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 49019d54d5..bba2e164f2 100644 +index 49019d54..bba2e164 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -1205,6 +1205,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { @@ -47,5 +47,5 @@ index 49019d54d5..bba2e164f2 100644 this.entitiesById.d(entity.getId()); this.entitiesByUUID.remove(entity.getUniqueID()); -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0325-InventoryCloseEvent-Reason-API.patch b/Spigot-Server-Patches/0325-InventoryCloseEvent-Reason-API.patch index 6824311a96..a140950b1d 100644 --- a/Spigot-Server-Patches/0325-InventoryCloseEvent-Reason-API.patch +++ b/Spigot-Server-Patches/0325-InventoryCloseEvent-Reason-API.patch @@ -1,4 +1,4 @@ -From 288bb047a292f3c3fdab66a5f7d40ca413536770 Mon Sep 17 00:00:00 2001 +From 9b5c39be96d08690ed8897ec56ea6055b30f2dad Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 3 Jul 2018 21:56:23 -0400 Subject: [PATCH] InventoryCloseEvent Reason API @@ -7,7 +7,7 @@ Allows you to determine why an inventory was closed, enabling plugin developers to "confirm" things based on if it was player triggered close or not. diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 97485cf89e..d24d45fdd3 100644 +index 2705361a..57addeca 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -869,7 +869,7 @@ public class Chunk { @@ -29,7 +29,7 @@ index 97485cf89e..d24d45fdd3 100644 } } diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 0b51903e23..aa0b27f0e1 100644 +index 0b51903e..aa0b27f0 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -145,7 +145,7 @@ public abstract class EntityHuman extends EntityLiving { @@ -56,7 +56,7 @@ index 0b51903e23..aa0b27f0e1 100644 this.activeContainer = this.defaultContainer; } diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index cce3f98dac..4ff505cfa3 100644 +index cce3f98d..4ff505cf 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -287,7 +287,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @@ -110,10 +110,10 @@ index cce3f98dac..4ff505cfa3 100644 this.r(); } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 08191e9059..d5dda1f595 100644 +index 06256662..3aa50885 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1760,7 +1760,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -1762,7 +1762,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.x()); if (this.player.isFrozen()) return; // CraftBukkit @@ -123,7 +123,7 @@ index 08191e9059..d5dda1f595 100644 this.player.r(); } diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index b478f385a4..eaaa54acd4 100644 +index b478f385..eaaa54ac 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -423,7 +423,7 @@ public abstract class PlayerList { @@ -136,7 +136,7 @@ index b478f385a4..eaaa54acd4 100644 PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.getName() + " left the game"); cserver.getPluginManager().callEvent(playerQuitEvent); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index d85b5defca..05ca403e82 100644 +index d85b5def..05ca403e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -401,8 +401,13 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { @@ -155,7 +155,7 @@ index d85b5defca..05ca403e82 100644 public boolean isBlocking() { return getHandle().isBlocking(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 1874c15ab9..5f480ac06f 100644 +index 1874c15a..5f480ac0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -644,7 +644,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -168,7 +168,7 @@ index 1874c15ab9..5f480ac06f 100644 // Check if the fromWorld and toWorld are the same. diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 248873fb4c..cce4acc0bb 100644 +index 248873fb..cce4acc0 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -927,8 +927,19 @@ public class CraftEventFactory { @@ -193,5 +193,5 @@ index 248873fb4c..cce4acc0bb 100644 human.activeContainer.transferTo(human.defaultContainer, human.getBukkitEntity()); } -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0329-Refresh-player-inventory-when-cancelling-PlayerInter.patch b/Spigot-Server-Patches/0329-Refresh-player-inventory-when-cancelling-PlayerInter.patch index 881cdbcf87..9e66375801 100644 --- a/Spigot-Server-Patches/0329-Refresh-player-inventory-when-cancelling-PlayerInter.patch +++ b/Spigot-Server-Patches/0329-Refresh-player-inventory-when-cancelling-PlayerInter.patch @@ -1,4 +1,4 @@ -From 81be84c666aaf4d1d6aa22d0dbe36f148f6f27a6 Mon Sep 17 00:00:00 2001 +From 02857fd7ffe425a671e4923cab170e40c6ff2296 Mon Sep 17 00:00:00 2001 From: Minecrell Date: Fri, 13 Jul 2018 14:54:43 +0200 Subject: [PATCH] Refresh player inventory when cancelling @@ -16,10 +16,10 @@ Refresh the player inventory when PlayerInteractEntityEvent is cancelled to avoid this problem. diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index d5dda1f595..521c466093 100644 +index 3aa50885..0ba182b1 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1674,6 +1674,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -1676,6 +1676,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { } if (event.isCancelled()) { @@ -28,5 +28,5 @@ index d5dda1f595..521c466093 100644 } // CraftBukkit end -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0332-add-more-information-to-Entity.toString.patch b/Spigot-Server-Patches/0332-add-more-information-to-Entity.toString.patch index bd8bf55850..eb399be892 100644 --- a/Spigot-Server-Patches/0332-add-more-information-to-Entity.toString.patch +++ b/Spigot-Server-Patches/0332-add-more-information-to-Entity.toString.patch @@ -1,4 +1,4 @@ -From 1f2212fa5986435d4cd3bb3f4cd62821d7246d66 Mon Sep 17 00:00:00 2001 +From 7c38b1aa8033f63465aca838f5dad2cb26ee42e1 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 19 Jul 2018 01:13:28 -0400 Subject: [PATCH] add more information to Entity.toString() @@ -6,10 +6,10 @@ Subject: [PATCH] add more information to Entity.toString() UUID, ticks lived, valid, dead diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 71da8e1e7d..28713f045d 100644 +index 6eab1ef8..0197f5ee 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -2366,7 +2366,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -2369,7 +2369,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper } public String toString() { @@ -19,5 +19,5 @@ index 71da8e1e7d..28713f045d 100644 public boolean isInvulnerable(DamageSource damagesource) { -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0338-Duplicate-UUID-Resolve-Option.patch b/Spigot-Server-Patches/0338-Duplicate-UUID-Resolve-Option.patch index ea5d9a5efa..62bb5d1eb8 100644 --- a/Spigot-Server-Patches/0338-Duplicate-UUID-Resolve-Option.patch +++ b/Spigot-Server-Patches/0338-Duplicate-UUID-Resolve-Option.patch @@ -1,4 +1,4 @@ -From 74c33cb76523595192fe9ad81eec4f582dcdcd68 Mon Sep 17 00:00:00 2001 +From fc570ba0b54177e36c1450fddb1e1a97eca04a00 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 21 Jul 2018 14:27:34 -0400 Subject: [PATCH] Duplicate UUID Resolve Option @@ -33,7 +33,7 @@ But for those who are ok with leaving this inconsistent behavior, you may use WA It is recommended you regenerate the entities, as these were legit entities, and deserve your love. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 14c8edeffc..c3bd82692d 100644 +index 14c8edef..c3bd8269 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -541,4 +541,47 @@ public class PaperWorldConfig { @@ -85,7 +85,7 @@ index 14c8edeffc..c3bd82692d 100644 + } } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 4757081090..d29aec7149 100644 +index 0c811805..71d86175 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -1,5 +1,10 @@ @@ -168,10 +168,10 @@ index 4757081090..d29aec7149 100644 this.world.a((Collection) entityslice); } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 7b856cad91..eb8904a728 100644 +index 67967c4e..b761524f 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -2619,6 +2619,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -2622,6 +2622,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper }); } @@ -180,7 +180,7 @@ index 7b856cad91..eb8904a728 100644 this.uniqueID = uuid; this.ar = this.uniqueID.toString(); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index d96126bcf2..5257db1e00 100644 +index d96126bc..5257db1e 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -70,7 +70,7 @@ public abstract class World implements IBlockAccess { @@ -193,7 +193,7 @@ index d96126bcf2..5257db1e00 100644 public final List tileEntityListTick = Lists.newArrayList(); private final List b = Lists.newArrayList(); diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 994d4bbb84..1244baf45a 100644 +index 994d4bbb..1244baf4 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -42,7 +42,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { @@ -239,5 +239,5 @@ index 994d4bbb84..1244baf45a 100644 logger.error("Overwrote an existing entity " + old + " with " + entity); if (DEBUG_ENTITIES) { -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0344-Always-process-chunk-registration-after-moving.patch b/Spigot-Server-Patches/0344-Always-process-chunk-registration-after-moving.patch deleted file mode 100644 index a50d657706..0000000000 --- a/Spigot-Server-Patches/0344-Always-process-chunk-registration-after-moving.patch +++ /dev/null @@ -1,67 +0,0 @@ -From e7b5ab4f8db7b8af7de3f0f2cd3bc23fa2a2c83a Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 29 Jul 2018 11:58:05 -0400 -Subject: [PATCH] Always process chunk registration after moving - -This will help guarantee that entities are always in the -chunk that they are currently located at. - -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 45e149f4a..fce677f9f 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -341,6 +341,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper - this.locX = d0; - this.locY = d1; - this.locZ = d2; -+ if (valid) world.entityJoinedWorld(this, false); // Paper - ensure Entity is moved to its proper chunk - float f = this.width / 2.0F; - float f1 = this.length; - -@@ -986,6 +987,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper - this.locX = (axisalignedbb.a + axisalignedbb.d) / 2.0D; - this.locY = axisalignedbb.b; - this.locZ = (axisalignedbb.c + axisalignedbb.f) / 2.0D; -+ if (valid) world.entityJoinedWorld(this, false); // Paper - ensure Entity is moved to its proper chunk - } - - protected SoundEffect ae() { -diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java -index 8a9e16ad6..0b1d7a086 100644 ---- a/src/main/java/net/minecraft/server/EntityArrow.java -+++ b/src/main/java/net/minecraft/server/EntityArrow.java -@@ -360,6 +360,7 @@ public abstract class EntityArrow extends Entity implements IProjectile { - this.inGround = true; - this.shake = 7; - this.setCritical(false); -+ if (valid) world.entityJoinedWorld(this, false); // Paper - ensure Entity is moved to its proper chunk - if (iblockdata.getMaterial() != Material.AIR) { - this.av.a(this.world, blockposition, iblockdata, (Entity) this); - } -diff --git a/src/main/java/net/minecraft/server/EntityLeash.java b/src/main/java/net/minecraft/server/EntityLeash.java -index 7bd1c73bf..10a507595 100644 ---- a/src/main/java/net/minecraft/server/EntityLeash.java -+++ b/src/main/java/net/minecraft/server/EntityLeash.java -@@ -31,6 +31,7 @@ public class EntityLeash extends EntityHanging { - this.locX = (double) this.blockPosition.getX() + 0.5D; - this.locY = (double) this.blockPosition.getY() + 0.5D; - this.locZ = (double) this.blockPosition.getZ() + 0.5D; -+ if (valid) world.entityJoinedWorld(this, false); // Paper - ensure Entity is moved to its proper chunk - } - - public void setDirection(EnumDirection enumdirection) {} -diff --git a/src/main/java/net/minecraft/server/EntityShulker.java b/src/main/java/net/minecraft/server/EntityShulker.java -index 3ce843199..ad7c95924 100644 ---- a/src/main/java/net/minecraft/server/EntityShulker.java -+++ b/src/main/java/net/minecraft/server/EntityShulker.java -@@ -390,6 +390,7 @@ public class EntityShulker extends EntityGolem implements IMonster { - this.locX = (double) blockposition.getX() + 0.5D; - this.locY = (double) blockposition.getY(); - this.locZ = (double) blockposition.getZ() + 0.5D; -+ if (valid) world.entityJoinedWorld(this, false); // Paper - ensure Entity is moved to its proper chunk - this.lastX = this.locX; - this.lastY = this.locY; - this.lastZ = this.locZ; --- -2.18.0 - diff --git a/Spigot-Server-Patches/0344-MC-111480-Start-Entity-ID-s-at-1.patch b/Spigot-Server-Patches/0344-MC-111480-Start-Entity-ID-s-at-1.patch new file mode 100644 index 0000000000..0704357df5 --- /dev/null +++ b/Spigot-Server-Patches/0344-MC-111480-Start-Entity-ID-s-at-1.patch @@ -0,0 +1,24 @@ +From 996d5012be524c6833e6834a0fe7e530993ef648 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sun, 29 Jul 2018 22:58:47 -0400 +Subject: [PATCH] MC-111480: Start Entity ID's at 1 + +DataWatchers that store Entity ID's treat 0 as special, +and can break things such as Elytra Fireworks. + +diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +index d2dbaaf2..3a2ff25e 100644 +--- a/src/main/java/net/minecraft/server/Entity.java ++++ b/src/main/java/net/minecraft/server/Entity.java +@@ -81,7 +81,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper + private static final List b = Collections.emptyList(); + private static final AxisAlignedBB c = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); + private static double f = 1.0D; +- private static int entityCount; ++ private static int entityCount = 1; // Paper - MC-111480 - ID 0 is treated as special for DataWatchers, start 1 + private int id; + public boolean i; public boolean blocksEntitySpawning() { return i; } // Paper - OBFHELPER + public final List passengers; +-- +2.19.1 + diff --git a/Spigot-Server-Patches/0345-Break-up-and-make-tab-spam-limits-configurable.patch b/Spigot-Server-Patches/0345-Break-up-and-make-tab-spam-limits-configurable.patch new file mode 100644 index 0000000000..33634db40a --- /dev/null +++ b/Spigot-Server-Patches/0345-Break-up-and-make-tab-spam-limits-configurable.patch @@ -0,0 +1,71 @@ +From 536a1753d23653447298f60a4dfd3c8467b2cfd2 Mon Sep 17 00:00:00 2001 +From: Shane Freeder +Date: Sun, 29 Jul 2018 05:02:15 +0100 +Subject: [PATCH] Break up and make tab spam limits configurable + +Due to the changes in 1.13, clients will send a tab completion request +for all bukkit commands in order to factor in the lack of support for +brigadier and provide backwards support in the API. + +Craftbukkit, however; has moved the chat spam limiter to also interact +with the tab completion request, which while good for avoiding abuse, +causes 1.13 clients to easilly be kicked from a server in bukkit due +to this. Removing the spam limit could cause issues for servers, however, +there is no way for servers to manipulate this without blindly cancelling +kick events, which only causes additional complications. This also causes +issues in that the tab spam limit and chat share the same field but different +limits, meaning that a player having typed a long command may be kicked from +the server. + +Splitting the field up and making it configurable allows for server owners +to take the burden of this into their own hand without having to rely on +plugins doing unsafe things. + +diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java +index 5a17ce3d..a5ff014e 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java +@@ -303,4 +303,11 @@ public class PaperConfig { + Bukkit.getLogger().log(Level.INFO, "Using Aikar's Alternative Luck Formula to apply Luck attribute to all loot pool calculations. See https://luckformula.emc.gs"); + } + } ++ ++ public static int tabSpamIncrement = 10; ++ public static int tabSpamLimit = 500; ++ private static void tabSpamLimiters() { ++ tabSpamIncrement = getInt("settings.spam-limiter.tab-spam-increment", tabSpamIncrement); ++ tabSpamLimit = getInt("settings.spam-limiter.tab-spam-limit", tabSpamLimit); ++ } + } +diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +index 0ba182b1..398f2fdf 100644 +--- a/src/main/java/net/minecraft/server/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/PlayerConnection.java +@@ -75,6 +75,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { + // CraftBukkit start - multithreaded fields + private volatile int chatThrottle; + private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(PlayerConnection.class, "chatThrottle"); ++ private final java.util.concurrent.atomic.AtomicInteger tabSpamLimiter = new java.util.concurrent.atomic.AtomicInteger(); // Paper - configurable tab spam limits + // CraftBukkit end + private int j; + private final IntHashMap k = new IntHashMap(); +@@ -204,6 +205,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { + this.minecraftServer.methodProfiler.b(); + // CraftBukkit start + for (int spam; (spam = this.chatThrottle) > 0 && !chatSpamField.compareAndSet(this, spam, spam - 1); ) ; ++ if (tabSpamLimiter.get() > 0) tabSpamLimiter.getAndDecrement(); // Paper - split to seperate variable + /* Use thread-safe field access instead + if (this.chatThrottle > 0) { + --this.chatThrottle; +@@ -2284,7 +2286,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { + // Paper start - async tab completion + public void a(PacketPlayInTabComplete packet) { + // CraftBukkit start +- if (chatSpamField.addAndGet(this, 10) > 500 && !this.minecraftServer.getPlayerList().isOp(this.player.getProfile())) { ++ if (tabSpamLimiter.addAndGet(com.destroystokyo.paper.PaperConfig.tabSpamIncrement) > com.destroystokyo.paper.PaperConfig.tabSpamLimit && !this.minecraftServer.getPlayerList().isOp(this.player.getProfile())) { // Paper start - split and make configurable + minecraftServer.postToMainThread(() -> this.disconnect(new ChatMessage("disconnect.spam", new Object[0]))); + return; + } +-- +2.19.1 + diff --git a/Spigot-Server-Patches/0345-MC-111480-Start-Entity-ID-s-at-1.patch b/Spigot-Server-Patches/0345-MC-111480-Start-Entity-ID-s-at-1.patch deleted file mode 100644 index 7bba1729db..0000000000 --- a/Spigot-Server-Patches/0345-MC-111480-Start-Entity-ID-s-at-1.patch +++ /dev/null @@ -1,24 +0,0 @@ -From b65086b45edfb15a357b918552a2d8284cce6c88 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 29 Jul 2018 22:58:47 -0400 -Subject: [PATCH] MC-111480: Start Entity ID's at 1 - -DataWatchers that store Entity ID's treat 0 as special, -and can break things such as Elytra Fireworks. - -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index fce677f9f6..9b5f7fcf72 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -81,7 +81,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper - private static final List b = Collections.emptyList(); - private static final AxisAlignedBB c = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); - private static double f = 1.0D; -- private static int entityCount; -+ private static int entityCount = 1; // Paper - MC-111480 - ID 0 is treated as special for DataWatchers, start 1 - private int id; - public boolean i; public boolean blocksEntitySpawning() { return i; } // Paper - OBFHELPER - public final List passengers; --- -2.18.0 - diff --git a/Spigot-Server-Patches/0346-Break-up-and-make-tab-spam-limits-configurable.patch b/Spigot-Server-Patches/0346-Break-up-and-make-tab-spam-limits-configurable.patch deleted file mode 100644 index 8456dbc420..0000000000 --- a/Spigot-Server-Patches/0346-Break-up-and-make-tab-spam-limits-configurable.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 438859b071118528c6cc6c8f2411ef055ad58cf6 Mon Sep 17 00:00:00 2001 -From: Shane Freeder -Date: Sun, 29 Jul 2018 05:02:15 +0100 -Subject: [PATCH] Break up and make tab spam limits configurable - -Due to the changes in 1.13, clients will send a tab completion request -for all bukkit commands in order to factor in the lack of support for -brigadier and provide backwards support in the API. - -Craftbukkit, however; has moved the chat spam limiter to also interact -with the tab completion request, which while good for avoiding abuse, -causes 1.13 clients to easilly be kicked from a server in bukkit due -to this. Removing the spam limit could cause issues for servers, however, -there is no way for servers to manipulate this without blindly cancelling -kick events, which only causes additional complications. This also causes -issues in that the tab spam limit and chat share the same field but different -limits, meaning that a player having typed a long command may be kicked from -the server. - -Splitting the field up and making it configurable allows for server owners -to take the burden of this into their own hand without having to rely on -plugins doing unsafe things. - -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 5a17ce3d22..a5ff014e33 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -303,4 +303,11 @@ public class PaperConfig { - Bukkit.getLogger().log(Level.INFO, "Using Aikar's Alternative Luck Formula to apply Luck attribute to all loot pool calculations. See https://luckformula.emc.gs"); - } - } -+ -+ public static int tabSpamIncrement = 10; -+ public static int tabSpamLimit = 500; -+ private static void tabSpamLimiters() { -+ tabSpamIncrement = getInt("settings.spam-limiter.tab-spam-increment", tabSpamIncrement); -+ tabSpamLimit = getInt("settings.spam-limiter.tab-spam-limit", tabSpamLimit); -+ } - } -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 521c466093..7b12d17a4c 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -75,6 +75,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { - // CraftBukkit start - multithreaded fields - private volatile int chatThrottle; - private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(PlayerConnection.class, "chatThrottle"); -+ private final java.util.concurrent.atomic.AtomicInteger tabSpamLimiter = new java.util.concurrent.atomic.AtomicInteger(); // Paper - configurable tab spam limits - // CraftBukkit end - private int j; - private final IntHashMap k = new IntHashMap(); -@@ -204,6 +205,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { - this.minecraftServer.methodProfiler.b(); - // CraftBukkit start - for (int spam; (spam = this.chatThrottle) > 0 && !chatSpamField.compareAndSet(this, spam, spam - 1); ) ; -+ if (tabSpamLimiter.get() > 0) tabSpamLimiter.getAndDecrement(); // Paper - split to seperate variable - /* Use thread-safe field access instead - if (this.chatThrottle > 0) { - --this.chatThrottle; -@@ -2282,7 +2284,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { - // Paper start - async tab completion - public void a(PacketPlayInTabComplete packet) { - // CraftBukkit start -- if (chatSpamField.addAndGet(this, 10) > 500 && !this.minecraftServer.getPlayerList().isOp(this.player.getProfile())) { -+ if (tabSpamLimiter.addAndGet(com.destroystokyo.paper.PaperConfig.tabSpamIncrement) > com.destroystokyo.paper.PaperConfig.tabSpamLimit && !this.minecraftServer.getPlayerList().isOp(this.player.getProfile())) { // Paper start - split and make configurable - minecraftServer.postToMainThread(() -> this.disconnect(new ChatMessage("disconnect.spam", new Object[0]))); - return; - } --- -2.18.0 - diff --git a/Spigot-Server-Patches/0346-MC-135506-Experience-should-save-as-Integers.patch b/Spigot-Server-Patches/0346-MC-135506-Experience-should-save-as-Integers.patch new file mode 100644 index 0000000000..6fa6ef7d7a --- /dev/null +++ b/Spigot-Server-Patches/0346-MC-135506-Experience-should-save-as-Integers.patch @@ -0,0 +1,30 @@ +From a5c88cadb6c4db888c8ad46701adb5dc9b4a0ed6 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Fri, 3 Aug 2018 00:04:54 -0400 +Subject: [PATCH] MC-135506: Experience should save as Integers + + +diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java +index 1c59fd96..becb102c 100644 +--- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java ++++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java +@@ -193,14 +193,14 @@ public class EntityExperienceOrb extends Entity { + public void b(NBTTagCompound nbttagcompound) { + nbttagcompound.setShort("Health", (short) this.d); + nbttagcompound.setShort("Age", (short) this.b); +- nbttagcompound.setShort("Value", (short) this.value); ++ nbttagcompound.setInt("Value", this.value); // Paper - save as Integer + savePaperNBT(nbttagcompound); // Paper + } + + public void a(NBTTagCompound nbttagcompound) { + this.d = nbttagcompound.getShort("Health"); + this.b = nbttagcompound.getShort("Age"); +- this.value = nbttagcompound.getShort("Value"); ++ this.value = nbttagcompound.getInt("Value"); // Paper - load as Integer + loadPaperNBT(nbttagcompound); // Paper + } + +-- +2.19.1 + diff --git a/Spigot-Server-Patches/0347-Entity-add-to-world-fixes.patch b/Spigot-Server-Patches/0347-Entity-add-to-world-fixes.patch new file mode 100644 index 0000000000..506a7aae75 --- /dev/null +++ b/Spigot-Server-Patches/0347-Entity-add-to-world-fixes.patch @@ -0,0 +1,87 @@ +From 28915916c310632997ed1146e1f86bc7d89ac53e Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Fri, 3 Aug 2018 22:47:46 -0400 +Subject: [PATCH] Entity add to world fixes + +1) Chunk Registration might kill an entity, don't add it to the world if it did! + +2) By default, entities are added to the world per slice iteration. +This opens risk of the slices being manipulated during chunk add if an +EntityAddToWorldEvent spawns an entity into this chunk. +Fix this by differing entity add to world for all entities at the same time + +3) If a duplicate entity is attempted to add to the world of an entity, and +the original entity is dead, overwrite it as the logic does for unloaod queued entities. + +diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +index dfa4a4bf..523d10e8 100644 +--- a/src/main/java/net/minecraft/server/Chunk.java ++++ b/src/main/java/net/minecraft/server/Chunk.java +@@ -889,6 +889,7 @@ public class Chunk { + this.world.b(this.tileEntities.values()); + List[] aentityslice = this.entitySlices; // Spigot + int i = aentityslice.length; ++ List toAdd = new java.util.ArrayList<>(32); // Paper + + for (int j = 0; j < i; ++j) { + List entityslice = aentityslice[j]; // Spigot +@@ -936,10 +937,12 @@ public class Chunk { + thisChunk.put(entity.uniqueID, entity); + } + } +- // Paper end + +- this.world.a((Collection) entityslice); ++ //this.world.a((Collection) entityslice); // Move down, add all entities at same time ++ toAdd.addAll(entityslice); ++ // Paper end + } ++ this.world.addChunkEntities(toAdd); // Paper - add all at same time to avoid entities adding to world modifying slice state + + } + +diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +index 4a16f7ac..04d0fa1d 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -1204,6 +1204,7 @@ public abstract class World implements IBlockAccess { + } + + this.getChunkAt(i, j).a(entity); ++ if (entity.dead) return false; // Paper - don't add dead entities, chunk registration may of killed it + this.entityList.add(entity); + this.b(entity); + return true; +@@ -2743,6 +2744,7 @@ public abstract class World implements IBlockAccess { + return i; + } + ++ public void addChunkEntities(Collection collection) { a(collection); } // Paper - OBFHELPER + public void a(Collection collection) { + org.spigotmc.AsyncCatcher.catchOp( "entity world add"); // Spigot + // CraftBukkit start +@@ -2752,7 +2754,7 @@ public abstract class World implements IBlockAccess { + while (iterator.hasNext()) { + Entity entity = (Entity) iterator.next(); + +- if (entity == null) { ++ if (entity == null || entity.dead || entity.valid) { // Paper - prevent adding already added or dead entities + continue; + } + this.entityList.add(entity); +diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +index 1244baf4..a14b5e06 100644 +--- a/src/main/java/net/minecraft/server/WorldServer.java ++++ b/src/main/java/net/minecraft/server/WorldServer.java +@@ -1173,7 +1173,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { + if (this.entitiesByUUID.containsKey(uuid)) { + Entity entity1 = (Entity) this.entitiesByUUID.get(uuid); + +- if (this.f.contains(entity1)) { ++ if (this.f.contains(entity1) || entity1.dead) { // Paper - if dupe is dead, overwrite + this.f.remove(entity1); + } else { + if (!(entity instanceof EntityHuman)) { +-- +2.19.1 + diff --git a/Spigot-Server-Patches/0347-MC-135506-Experience-should-save-as-Integers.patch b/Spigot-Server-Patches/0347-MC-135506-Experience-should-save-as-Integers.patch deleted file mode 100644 index bfc0051bf2..0000000000 --- a/Spigot-Server-Patches/0347-MC-135506-Experience-should-save-as-Integers.patch +++ /dev/null @@ -1,30 +0,0 @@ -From ac00b144ea5c59904530bae2a8697b9f05892649 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Fri, 3 Aug 2018 00:04:54 -0400 -Subject: [PATCH] MC-135506: Experience should save as Integers - - -diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java -index 1c59fd96..becb102c 100644 ---- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java -+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java -@@ -193,14 +193,14 @@ public class EntityExperienceOrb extends Entity { - public void b(NBTTagCompound nbttagcompound) { - nbttagcompound.setShort("Health", (short) this.d); - nbttagcompound.setShort("Age", (short) this.b); -- nbttagcompound.setShort("Value", (short) this.value); -+ nbttagcompound.setInt("Value", this.value); // Paper - save as Integer - savePaperNBT(nbttagcompound); // Paper - } - - public void a(NBTTagCompound nbttagcompound) { - this.d = nbttagcompound.getShort("Health"); - this.b = nbttagcompound.getShort("Age"); -- this.value = nbttagcompound.getShort("Value"); -+ this.value = nbttagcompound.getInt("Value"); // Paper - load as Integer - loadPaperNBT(nbttagcompound); // Paper - } - --- -2.18.0 - diff --git a/Spigot-Server-Patches/0348-Add-Early-Warning-Feature-to-WatchDog.patch b/Spigot-Server-Patches/0348-Add-Early-Warning-Feature-to-WatchDog.patch new file mode 100644 index 0000000000..6acaa48350 --- /dev/null +++ b/Spigot-Server-Patches/0348-Add-Early-Warning-Feature-to-WatchDog.patch @@ -0,0 +1,167 @@ +From 2b8c504b605b5cad94dc78011c29becfeb6c62fa Mon Sep 17 00:00:00 2001 +From: miclebrick +Date: Wed, 8 Aug 2018 15:30:52 -0400 +Subject: [PATCH] Add Early Warning Feature to WatchDog + +Detect when the server has been hung for a long duration, and start printing +thread dumps at an interval until the point of crash. + +This will help diagnose what was going on in that time before the crash. + +diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java +index a5ff014e..332e90f8 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java +@@ -23,6 +23,8 @@ import org.bukkit.configuration.InvalidConfigurationException; + import org.bukkit.configuration.file.YamlConfiguration; + import co.aikar.timings.Timings; + import co.aikar.timings.TimingsManager; ++import org.spigotmc.SpigotConfig; ++import org.spigotmc.WatchdogThread; + + public class PaperConfig { + +@@ -304,6 +306,14 @@ public class PaperConfig { + } + } + ++ public static int watchdogPrintEarlyWarningEvery = 5000; ++ public static int watchdogPrintEarlyWarningDelay = 10000; ++ private static void watchdogEarlyWarning() { ++ watchdogPrintEarlyWarningEvery = getInt("settings.watchdog.early-warning-every", 5000); ++ watchdogPrintEarlyWarningDelay = getInt("settings.watchdog.early-warning-delay", 10000); ++ WatchdogThread.doStart(SpigotConfig.timeoutTime, SpigotConfig.restartOnCrash ); ++ } ++ + public static int tabSpamIncrement = 10; + public static int tabSpamLimit = 500; + private static void tabSpamLimiters() { +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 0399a48e..e0546e3d 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -622,6 +622,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs + this.a(this.q); + + // Spigot start ++ org.spigotmc.WatchdogThread.hasStarted = true; + Arrays.fill( recentTps, 20 ); + long start = System.nanoTime(), lastTick = start - TICK_TIME, catchupTime = 0, curTime, wait, tickSection = start; // Paper - Further improve server tick loop + while (this.isRunning) { +diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java +index 4f9fd4bc..2cdd9aaf 100644 +--- a/src/main/java/org/spigotmc/SpigotConfig.java ++++ b/src/main/java/org/spigotmc/SpigotConfig.java +@@ -223,7 +223,7 @@ public class SpigotConfig + restartScript = getString( "settings.restart-script", restartScript ); + restartMessage = transform( getString( "messages.restart", "Server is restarting" ) ); + commands.put( "restart", new RestartCommand( "restart" ) ); +- WatchdogThread.doStart( timeoutTime, restartOnCrash ); ++ //WatchdogThread.doStart( timeoutTime, restartOnCrash ); // Paper - moved to PaperConfig + } + + public static boolean bungee; +diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java +index 57a4748a..93dc6983 100644 +--- a/src/main/java/org/spigotmc/WatchdogThread.java ++++ b/src/main/java/org/spigotmc/WatchdogThread.java +@@ -5,6 +5,7 @@ import java.lang.management.MonitorInfo; + import java.lang.management.ThreadInfo; + import java.util.logging.Level; + import java.util.logging.Logger; ++import com.destroystokyo.paper.PaperConfig; + import net.minecraft.server.MinecraftServer; + import org.bukkit.Bukkit; + +@@ -13,6 +14,10 @@ public class WatchdogThread extends Thread + + private static WatchdogThread instance; + private final long timeoutTime; ++ private final long earlyWarningEvery; // Paper - Timeout time for just printing a dump but not restarting ++ private final long earlyWarningDelay; // Paper ++ public static volatile boolean hasStarted; // Paper ++ private long lastEarlyWarning; // Paper - Keep track of short dump times to avoid spamming console with short dumps + private final boolean restart; + private volatile long lastTick; + private volatile boolean stopping; +@@ -22,6 +27,8 @@ public class WatchdogThread extends Thread + super( "Paper Watchdog Thread" ); + this.timeoutTime = timeoutTime; + this.restart = restart; ++ earlyWarningEvery = Math.min(PaperConfig.watchdogPrintEarlyWarningEvery, timeoutTime); // Paper ++ earlyWarningDelay = Math.min(PaperConfig.watchdogPrintEarlyWarningDelay, timeoutTime); // Paper + } + + public static void doStart(int timeoutTime, boolean restart) +@@ -52,9 +59,19 @@ public class WatchdogThread extends Thread + while ( !stopping ) + { + // +- if ( lastTick != 0 && System.currentTimeMillis() > lastTick + timeoutTime && !Boolean.getBoolean("disable.watchdog")) // Paper - Add property to disable ++ long currentTime = System.currentTimeMillis(); // Paper - do we REALLY need to call this method multiple times? ++ if ( lastTick != 0 && currentTime > lastTick + earlyWarningEvery && !Boolean.getBoolean("disable.watchdog") ) // Paper - Add property to disable and short timeout + { ++ // Paper start ++ boolean isLongTimeout = currentTime > lastTick + timeoutTime; ++ // Don't spam early warning dumps ++ if ( !isLongTimeout && (earlyWarningEvery <= 0 || !hasStarted || currentTime < lastEarlyWarning + earlyWarningEvery || currentTime < lastTick + earlyWarningDelay)) continue; ++ lastEarlyWarning = currentTime; ++ // Paper end + Logger log = Bukkit.getServer().getLogger(); ++ // Paper start - Different message when it's a short timeout ++ if ( isLongTimeout ) ++ { + log.log( Level.SEVERE, "The server has stopped responding!" ); + log.log( Level.SEVERE, "Please report this to https://github.com/PaperMC/Paper/issues" ); + log.log( Level.SEVERE, "Be sure to include ALL relevant console errors and Minecraft crash reports" ); +@@ -79,29 +96,46 @@ public class WatchdogThread extends Thread + } + } + // Paper end ++ } else ++ { ++ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH ---"); ++ log.log(Level.SEVERE, "The server has not responded for " + (currentTime - lastTick) / 1000 + " seconds! Creating thread dump"); ++ } ++ // Paper end - Different message for short timeout + log.log( Level.SEVERE, "------------------------------" ); + log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Paper!):" ); + dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().primaryThread.getId(), Integer.MAX_VALUE ), log ); + log.log( Level.SEVERE, "------------------------------" ); + // ++ // Paper start - Only print full dump on long timeouts ++ if ( isLongTimeout ) ++ { + log.log( Level.SEVERE, "Entire Thread Dump:" ); + ThreadInfo[] threads = ManagementFactory.getThreadMXBean().dumpAllThreads( true, true ); + for ( ThreadInfo thread : threads ) + { + dumpThread( thread, log ); + } ++ } else { ++ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH ---"); ++ } ++ ++ + log.log( Level.SEVERE, "------------------------------" ); + ++ if ( isLongTimeout ) ++ { + if ( restart ) + { + RestartCommand.restart(); + } + break; ++ } // Paper end + } + + try + { +- sleep( 10000 ); ++ sleep( 1000 ); // Paper - Reduce check time to every second instead of every ten seconds, more consistent and allows for short timeout + } catch ( InterruptedException ex ) + { + interrupt(); +-- +2.19.1 + diff --git a/Spigot-Server-Patches/0348-Entity-add-to-world-fixes.patch b/Spigot-Server-Patches/0348-Entity-add-to-world-fixes.patch deleted file mode 100644 index 0557588e80..0000000000 --- a/Spigot-Server-Patches/0348-Entity-add-to-world-fixes.patch +++ /dev/null @@ -1,87 +0,0 @@ -From 7c862f1ffd126fdece882da529400f7b090dd19a Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Fri, 3 Aug 2018 22:47:46 -0400 -Subject: [PATCH] Entity add to world fixes - -1) Chunk Registration might kill an entity, don't add it to the world if it did! - -2) By default, entities are added to the world per slice iteration. -This opens risk of the slices being manipulated during chunk add if an -EntityAddToWorldEvent spawns an entity into this chunk. -Fix this by differing entity add to world for all entities at the same time - -3) If a duplicate entity is attempted to add to the world of an entity, and -the original entity is dead, overwrite it as the logic does for unloaod queued entities. - -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 2a5d1c90b4..1d2673a7b3 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -889,6 +889,7 @@ public class Chunk { - this.world.b(this.tileEntities.values()); - List[] aentityslice = this.entitySlices; // Spigot - int i = aentityslice.length; -+ List toAdd = new java.util.ArrayList<>(32); // Paper - - for (int j = 0; j < i; ++j) { - List entityslice = aentityslice[j]; // Spigot -@@ -936,10 +937,12 @@ public class Chunk { - thisChunk.put(entity.uniqueID, entity); - } - } -- // Paper end - -- this.world.a((Collection) entityslice); -+ //this.world.a((Collection) entityslice); // Move down, add all entities at same time -+ toAdd.addAll(entityslice); -+ // Paper end - } -+ this.world.addChunkEntities(toAdd); // Paper - add all at same time to avoid entities adding to world modifying slice state - - } - -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 4a16f7ac71..04d0fa1df9 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -1204,6 +1204,7 @@ public abstract class World implements IBlockAccess { - } - - this.getChunkAt(i, j).a(entity); -+ if (entity.dead) return false; // Paper - don't add dead entities, chunk registration may of killed it - this.entityList.add(entity); - this.b(entity); - return true; -@@ -2743,6 +2744,7 @@ public abstract class World implements IBlockAccess { - return i; - } - -+ public void addChunkEntities(Collection collection) { a(collection); } // Paper - OBFHELPER - public void a(Collection collection) { - org.spigotmc.AsyncCatcher.catchOp( "entity world add"); // Spigot - // CraftBukkit start -@@ -2752,7 +2754,7 @@ public abstract class World implements IBlockAccess { - while (iterator.hasNext()) { - Entity entity = (Entity) iterator.next(); - -- if (entity == null) { -+ if (entity == null || entity.dead || entity.valid) { // Paper - prevent adding already added or dead entities - continue; - } - this.entityList.add(entity); -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 1244baf45a..a14b5e0618 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1173,7 +1173,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { - if (this.entitiesByUUID.containsKey(uuid)) { - Entity entity1 = (Entity) this.entitiesByUUID.get(uuid); - -- if (this.f.contains(entity1)) { -+ if (this.f.contains(entity1) || entity1.dead) { // Paper - if dupe is dead, overwrite - this.f.remove(entity1); - } else { - if (!(entity instanceof EntityHuman)) { --- -2.18.0 - diff --git a/Spigot-Server-Patches/0349-Add-Early-Warning-Feature-to-WatchDog.patch b/Spigot-Server-Patches/0349-Add-Early-Warning-Feature-to-WatchDog.patch deleted file mode 100644 index a8c754ec65..0000000000 --- a/Spigot-Server-Patches/0349-Add-Early-Warning-Feature-to-WatchDog.patch +++ /dev/null @@ -1,167 +0,0 @@ -From 5ed114bb47c66db7798442d43bc8914ccea4cd5d Mon Sep 17 00:00:00 2001 -From: miclebrick -Date: Wed, 8 Aug 2018 15:30:52 -0400 -Subject: [PATCH] Add Early Warning Feature to WatchDog - -Detect when the server has been hung for a long duration, and start printing -thread dumps at an interval until the point of crash. - -This will help diagnose what was going on in that time before the crash. - -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index a5ff014e3..332e90f86 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -23,6 +23,8 @@ import org.bukkit.configuration.InvalidConfigurationException; - import org.bukkit.configuration.file.YamlConfiguration; - import co.aikar.timings.Timings; - import co.aikar.timings.TimingsManager; -+import org.spigotmc.SpigotConfig; -+import org.spigotmc.WatchdogThread; - - public class PaperConfig { - -@@ -304,6 +306,14 @@ public class PaperConfig { - } - } - -+ public static int watchdogPrintEarlyWarningEvery = 5000; -+ public static int watchdogPrintEarlyWarningDelay = 10000; -+ private static void watchdogEarlyWarning() { -+ watchdogPrintEarlyWarningEvery = getInt("settings.watchdog.early-warning-every", 5000); -+ watchdogPrintEarlyWarningDelay = getInt("settings.watchdog.early-warning-delay", 10000); -+ WatchdogThread.doStart(SpigotConfig.timeoutTime, SpigotConfig.restartOnCrash ); -+ } -+ - public static int tabSpamIncrement = 10; - public static int tabSpamLimit = 500; - private static void tabSpamLimiters() { -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 0399a48e1..e0546e3dd 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -622,6 +622,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs - this.a(this.q); - - // Spigot start -+ org.spigotmc.WatchdogThread.hasStarted = true; - Arrays.fill( recentTps, 20 ); - long start = System.nanoTime(), lastTick = start - TICK_TIME, catchupTime = 0, curTime, wait, tickSection = start; // Paper - Further improve server tick loop - while (this.isRunning) { -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 4f9fd4bc6..2cdd9aaf8 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -223,7 +223,7 @@ public class SpigotConfig - restartScript = getString( "settings.restart-script", restartScript ); - restartMessage = transform( getString( "messages.restart", "Server is restarting" ) ); - commands.put( "restart", new RestartCommand( "restart" ) ); -- WatchdogThread.doStart( timeoutTime, restartOnCrash ); -+ //WatchdogThread.doStart( timeoutTime, restartOnCrash ); // Paper - moved to PaperConfig - } - - public static boolean bungee; -diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java -index 57a4748a3..93dc69835 100644 ---- a/src/main/java/org/spigotmc/WatchdogThread.java -+++ b/src/main/java/org/spigotmc/WatchdogThread.java -@@ -5,6 +5,7 @@ import java.lang.management.MonitorInfo; - import java.lang.management.ThreadInfo; - import java.util.logging.Level; - import java.util.logging.Logger; -+import com.destroystokyo.paper.PaperConfig; - import net.minecraft.server.MinecraftServer; - import org.bukkit.Bukkit; - -@@ -13,6 +14,10 @@ public class WatchdogThread extends Thread - - private static WatchdogThread instance; - private final long timeoutTime; -+ private final long earlyWarningEvery; // Paper - Timeout time for just printing a dump but not restarting -+ private final long earlyWarningDelay; // Paper -+ public static volatile boolean hasStarted; // Paper -+ private long lastEarlyWarning; // Paper - Keep track of short dump times to avoid spamming console with short dumps - private final boolean restart; - private volatile long lastTick; - private volatile boolean stopping; -@@ -22,6 +27,8 @@ public class WatchdogThread extends Thread - super( "Paper Watchdog Thread" ); - this.timeoutTime = timeoutTime; - this.restart = restart; -+ earlyWarningEvery = Math.min(PaperConfig.watchdogPrintEarlyWarningEvery, timeoutTime); // Paper -+ earlyWarningDelay = Math.min(PaperConfig.watchdogPrintEarlyWarningDelay, timeoutTime); // Paper - } - - public static void doStart(int timeoutTime, boolean restart) -@@ -52,9 +59,19 @@ public class WatchdogThread extends Thread - while ( !stopping ) - { - // -- if ( lastTick != 0 && System.currentTimeMillis() > lastTick + timeoutTime && !Boolean.getBoolean("disable.watchdog")) // Paper - Add property to disable -+ long currentTime = System.currentTimeMillis(); // Paper - do we REALLY need to call this method multiple times? -+ if ( lastTick != 0 && currentTime > lastTick + earlyWarningEvery && !Boolean.getBoolean("disable.watchdog") ) // Paper - Add property to disable and short timeout - { -+ // Paper start -+ boolean isLongTimeout = currentTime > lastTick + timeoutTime; -+ // Don't spam early warning dumps -+ if ( !isLongTimeout && (earlyWarningEvery <= 0 || !hasStarted || currentTime < lastEarlyWarning + earlyWarningEvery || currentTime < lastTick + earlyWarningDelay)) continue; -+ lastEarlyWarning = currentTime; -+ // Paper end - Logger log = Bukkit.getServer().getLogger(); -+ // Paper start - Different message when it's a short timeout -+ if ( isLongTimeout ) -+ { - log.log( Level.SEVERE, "The server has stopped responding!" ); - log.log( Level.SEVERE, "Please report this to https://github.com/PaperMC/Paper/issues" ); - log.log( Level.SEVERE, "Be sure to include ALL relevant console errors and Minecraft crash reports" ); -@@ -79,29 +96,46 @@ public class WatchdogThread extends Thread - } - } - // Paper end -+ } else -+ { -+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH ---"); -+ log.log(Level.SEVERE, "The server has not responded for " + (currentTime - lastTick) / 1000 + " seconds! Creating thread dump"); -+ } -+ // Paper end - Different message for short timeout - log.log( Level.SEVERE, "------------------------------" ); - log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Paper!):" ); - dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().primaryThread.getId(), Integer.MAX_VALUE ), log ); - log.log( Level.SEVERE, "------------------------------" ); - // -+ // Paper start - Only print full dump on long timeouts -+ if ( isLongTimeout ) -+ { - log.log( Level.SEVERE, "Entire Thread Dump:" ); - ThreadInfo[] threads = ManagementFactory.getThreadMXBean().dumpAllThreads( true, true ); - for ( ThreadInfo thread : threads ) - { - dumpThread( thread, log ); - } -+ } else { -+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH ---"); -+ } -+ -+ - log.log( Level.SEVERE, "------------------------------" ); - -+ if ( isLongTimeout ) -+ { - if ( restart ) - { - RestartCommand.restart(); - } - break; -+ } // Paper end - } - - try - { -- sleep( 10000 ); -+ sleep( 1000 ); // Paper - Reduce check time to every second instead of every ten seconds, more consistent and allows for short timeout - } catch ( InterruptedException ex ) - { - interrupt(); --- -2.18.0 - diff --git a/Spigot-Server-Patches/0349-Use-ConcurrentHashMap-in-JsonList.patch b/Spigot-Server-Patches/0349-Use-ConcurrentHashMap-in-JsonList.patch new file mode 100644 index 0000000000..75b4d90035 --- /dev/null +++ b/Spigot-Server-Patches/0349-Use-ConcurrentHashMap-in-JsonList.patch @@ -0,0 +1,114 @@ +From 86e6c74f8d45803881b609b6b1451fe44ccf1ad0 Mon Sep 17 00:00:00 2001 +From: egg82 +Date: Tue, 7 Aug 2018 01:24:23 -0600 +Subject: [PATCH] Use ConcurrentHashMap in JsonList + +This is specifically aimed at fixing #471 + +Using a ConcurrentHashMap because thread safety +The performance benefit of Map over ConcurrentMap is negligabe at best in this scenaio, as most operations will be get and not add or remove +Even without considering the use-case the benefits are still negligable + +Original ideas for the system included an expiration policy and/or handler +The simpler solution was to use a computeIfPresent in the get method +This will simultaneously have an O(1) lookup time and automatically expire any values +Since the get method (nor other similar methods) don't seem to have a critical need to flush the map to disk at any of these points further processing is simply wasteful +Meaning the original function expired values unrelated to the current value without actually having any explicit need to + +The h method was heavily modified to be much more efficient in its processing +Also instead of being called on every get, it's now called just before a save +This will eliminate stale values being flushed to disk + +Modified isEmpty to use the isEmpty() method instead of the slightly confusing size() < 1 +The point of this is readability, but does have a side-benefit of a small microptimization + +Finally, added a couple obfhelpers for the modified code + +diff --git a/src/main/java/net/minecraft/server/JsonList.java b/src/main/java/net/minecraft/server/JsonList.java +index 0859c7eb..93111cc2 100644 +--- a/src/main/java/net/minecraft/server/JsonList.java ++++ b/src/main/java/net/minecraft/server/JsonList.java +@@ -26,6 +26,7 @@ import java.util.Collection; + import java.util.Iterator; + import java.util.List; + import java.util.Map; ++ + import org.apache.commons.io.IOUtils; + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; +@@ -35,7 +36,8 @@ public class JsonList> { + protected static final Logger a = LogManager.getLogger(); + protected final Gson b; + private final File c; +- private final Map d = Maps.newHashMap(); ++ // Paper - replace HashMap is ConcurrentHashMap ++ private final Map d = Maps.newConcurrentMap(); private final Map getBackingMap() { return this.d; } // Paper - OBFHELPER + private boolean e = true; + private static final ParameterizedType f = new ParameterizedType() { + public Type[] getActualTypeArguments() { +@@ -83,8 +85,13 @@ public class JsonList> { + } + + public V get(K k0) { +- this.h(); +- return (V) this.d.get(this.a(k0)); // CraftBukkit - fix decompile error ++ // Paper start ++ // this.h(); ++ // return (V) this.d.get(this.a(k0)); // CraftBukkit - fix decompile error ++ return (V) this.getBackingMap().computeIfPresent(this.getMappingKey(k0), (k, v) -> { ++ return v.hasExpired() ? null : v; ++ }); ++ // Paper end + } + + public void remove(K k0) { +@@ -109,9 +116,11 @@ public class JsonList> { + // CraftBukkit end + + public boolean isEmpty() { +- return this.d.size() < 1; ++ // return this.d.size() < 1; // Paper ++ return this.getBackingMap().isEmpty(); // Paper - readability is the goal. As an aside, isEmpty() uses only sumCount() and a comparison. size() uses sumCount(), casts, and boolean logic + } + ++ protected final String getMappingKey(K k0) { return a(k0); } // Paper - OBFHELPER + protected String a(K k0) { + return k0.toString(); + } +@@ -120,8 +129,10 @@ public class JsonList> { + return this.d.containsKey(this.a(k0)); + } + ++ private void removeStaleEntries() { h(); } // Paper - OBFHELPER + private void h() { +- ArrayList arraylist = Lists.newArrayList(); ++ // Paper start ++ /*ArrayList arraylist = Lists.newArrayList(); + Iterator iterator = this.d.values().iterator(); + + while (iterator.hasNext()) { +@@ -138,8 +149,10 @@ public class JsonList> { + Object object = iterator.next(); + + this.d.remove(object); +- } +- ++ }*/ ++ ++ this.getBackingMap().values().removeIf((v) -> v.hasExpired()); ++ // Paper end + } + + protected JsonListEntry a(JsonObject jsonobject) { +@@ -151,6 +164,8 @@ public class JsonList> { + } + + public void save() throws IOException { ++ this.removeStaleEntries(); // Paper - remove expired values before saving ++ + Collection collection = this.d.values(); + String s = this.b.toJson(collection); + BufferedWriter bufferedwriter = null; +-- +2.19.1 + diff --git a/Spigot-Server-Patches/0350-Use-ConcurrentHashMap-in-JsonList.patch b/Spigot-Server-Patches/0350-Use-ConcurrentHashMap-in-JsonList.patch deleted file mode 100644 index cf53cbcca8..0000000000 --- a/Spigot-Server-Patches/0350-Use-ConcurrentHashMap-in-JsonList.patch +++ /dev/null @@ -1,114 +0,0 @@ -From 72e3adc2cacaffcbfc61561568f1ae6d0a02069d Mon Sep 17 00:00:00 2001 -From: egg82 -Date: Tue, 7 Aug 2018 01:24:23 -0600 -Subject: [PATCH] Use ConcurrentHashMap in JsonList - -This is specifically aimed at fixing #471 - -Using a ConcurrentHashMap because thread safety -The performance benefit of Map over ConcurrentMap is negligabe at best in this scenaio, as most operations will be get and not add or remove -Even without considering the use-case the benefits are still negligable - -Original ideas for the system included an expiration policy and/or handler -The simpler solution was to use a computeIfPresent in the get method -This will simultaneously have an O(1) lookup time and automatically expire any values -Since the get method (nor other similar methods) don't seem to have a critical need to flush the map to disk at any of these points further processing is simply wasteful -Meaning the original function expired values unrelated to the current value without actually having any explicit need to - -The h method was heavily modified to be much more efficient in its processing -Also instead of being called on every get, it's now called just before a save -This will eliminate stale values being flushed to disk - -Modified isEmpty to use the isEmpty() method instead of the slightly confusing size() < 1 -The point of this is readability, but does have a side-benefit of a small microptimization - -Finally, added a couple obfhelpers for the modified code - -diff --git a/src/main/java/net/minecraft/server/JsonList.java b/src/main/java/net/minecraft/server/JsonList.java -index 0859c7eb2b..93111cc240 100644 ---- a/src/main/java/net/minecraft/server/JsonList.java -+++ b/src/main/java/net/minecraft/server/JsonList.java -@@ -26,6 +26,7 @@ import java.util.Collection; - import java.util.Iterator; - import java.util.List; - import java.util.Map; -+ - import org.apache.commons.io.IOUtils; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -@@ -35,7 +36,8 @@ public class JsonList> { - protected static final Logger a = LogManager.getLogger(); - protected final Gson b; - private final File c; -- private final Map d = Maps.newHashMap(); -+ // Paper - replace HashMap is ConcurrentHashMap -+ private final Map d = Maps.newConcurrentMap(); private final Map getBackingMap() { return this.d; } // Paper - OBFHELPER - private boolean e = true; - private static final ParameterizedType f = new ParameterizedType() { - public Type[] getActualTypeArguments() { -@@ -83,8 +85,13 @@ public class JsonList> { - } - - public V get(K k0) { -- this.h(); -- return (V) this.d.get(this.a(k0)); // CraftBukkit - fix decompile error -+ // Paper start -+ // this.h(); -+ // return (V) this.d.get(this.a(k0)); // CraftBukkit - fix decompile error -+ return (V) this.getBackingMap().computeIfPresent(this.getMappingKey(k0), (k, v) -> { -+ return v.hasExpired() ? null : v; -+ }); -+ // Paper end - } - - public void remove(K k0) { -@@ -109,9 +116,11 @@ public class JsonList> { - // CraftBukkit end - - public boolean isEmpty() { -- return this.d.size() < 1; -+ // return this.d.size() < 1; // Paper -+ return this.getBackingMap().isEmpty(); // Paper - readability is the goal. As an aside, isEmpty() uses only sumCount() and a comparison. size() uses sumCount(), casts, and boolean logic - } - -+ protected final String getMappingKey(K k0) { return a(k0); } // Paper - OBFHELPER - protected String a(K k0) { - return k0.toString(); - } -@@ -120,8 +129,10 @@ public class JsonList> { - return this.d.containsKey(this.a(k0)); - } - -+ private void removeStaleEntries() { h(); } // Paper - OBFHELPER - private void h() { -- ArrayList arraylist = Lists.newArrayList(); -+ // Paper start -+ /*ArrayList arraylist = Lists.newArrayList(); - Iterator iterator = this.d.values().iterator(); - - while (iterator.hasNext()) { -@@ -138,8 +149,10 @@ public class JsonList> { - Object object = iterator.next(); - - this.d.remove(object); -- } -- -+ }*/ -+ -+ this.getBackingMap().values().removeIf((v) -> v.hasExpired()); -+ // Paper end - } - - protected JsonListEntry a(JsonObject jsonobject) { -@@ -151,6 +164,8 @@ public class JsonList> { - } - - public void save() throws IOException { -+ this.removeStaleEntries(); // Paper - remove expired values before saving -+ - Collection collection = this.d.values(); - String s = this.b.toJson(collection); - BufferedWriter bufferedwriter = null; --- -2.18.0 - diff --git a/Spigot-Server-Patches/0350-Use-a-Queue-for-Queueing-Commands.patch b/Spigot-Server-Patches/0350-Use-a-Queue-for-Queueing-Commands.patch new file mode 100644 index 0000000000..6a7b35d7d8 --- /dev/null +++ b/Spigot-Server-Patches/0350-Use-a-Queue-for-Queueing-Commands.patch @@ -0,0 +1,36 @@ +From d8ae95e1197458e374253152f54a1df259068bb2 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sun, 12 Aug 2018 02:33:39 -0400 +Subject: [PATCH] Use a Queue for Queueing Commands + +Lists are bad as Queues mmmkay. + +diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java +index 29229159..6a8292ce 100644 +--- a/src/main/java/net/minecraft/server/DedicatedServer.java ++++ b/src/main/java/net/minecraft/server/DedicatedServer.java +@@ -34,7 +34,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + + private static final Logger LOGGER = LogManager.getLogger(); + private static final Pattern l = Pattern.compile("^[a-fA-F0-9]{40}$"); +- private final List serverCommandQueue = Collections.synchronizedList(Lists.newArrayList()); // CraftBukkit - fix decompile error ++ private final java.util.Queue serverCommandQueue = new java.util.concurrent.ConcurrentLinkedQueue<>(); // Paper - use a proper queue + private RemoteStatusListener n; + public final RemoteControlCommandListener remoteControlCommandListener = new RemoteControlCommandListener(this); + private RemoteControlListener p; +@@ -448,8 +448,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + + public void aP() { + MinecraftTimings.serverCommandTimer.startTiming(); // Spigot +- while (!this.serverCommandQueue.isEmpty()) { +- ServerCommand servercommand = (ServerCommand) this.serverCommandQueue.remove(0); ++ // Paper start - use proper queue ++ ServerCommand servercommand; ++ while ((servercommand = this.serverCommandQueue.poll()) != null) { ++ // Paper end + + // CraftBukkit start - ServerCommand for preprocessing + ServerCommandEvent event = new ServerCommandEvent(console, servercommand.command); +-- +2.19.1 + diff --git a/Spigot-Server-Patches/0351-Allow-disabling-armour-stand-ticking.patch b/Spigot-Server-Patches/0351-Allow-disabling-armour-stand-ticking.patch new file mode 100644 index 0000000000..7dd70f9982 --- /dev/null +++ b/Spigot-Server-Patches/0351-Allow-disabling-armour-stand-ticking.patch @@ -0,0 +1,73 @@ +From 1ddf939a1e11ae48190c26bedd764bfa0c382fee Mon Sep 17 00:00:00 2001 +From: kashike +Date: Wed, 15 Aug 2018 01:26:09 -0700 +Subject: [PATCH] Allow disabling armour stand ticking + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index c3bd8269..ed147535 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -584,4 +584,10 @@ public class PaperWorldConfig { + break; + } + } ++ ++ public boolean armorStandTick = true; ++ private void armorStandTick() { ++ this.armorStandTick = this.getBoolean("armor-stands-tick", this.armorStandTick); ++ log("ArmorStand ticking is " + (this.armorStandTick ? "enabled" : "disabled") + " by default"); ++ } + } +diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java +index df0d66ad..dca49707 100644 +--- a/src/main/java/net/minecraft/server/EntityArmorStand.java ++++ b/src/main/java/net/minecraft/server/EntityArmorStand.java +@@ -51,6 +51,7 @@ public class EntityArmorStand extends EntityLiving { + public Vector3f leftLegPose; + public Vector3f rightLegPose; + public boolean canMove = true; // Paper ++ public boolean canTick = true; // Paper - armour stand ticking + + public EntityArmorStand(World world) { + super(world); +@@ -64,6 +65,7 @@ public class EntityArmorStand extends EntityLiving { + this.rightLegPose = EntityArmorStand.bw; + this.noclip = this.isNoGravity(); + this.setSize(0.5F, 1.975F); ++ if (world != null) this.canTick = world.paperConfig.armorStandTick; // Paper - armour stand ticking + } + + public EntityArmorStand(World world, double d0, double d1, double d2) { +@@ -568,6 +570,7 @@ public class EntityArmorStand extends EntityLiving { + } + + public void B_() { ++ if (!this.canTick) return;// Paper + super.B_(); + Vector3f vector3f = (Vector3f) this.datawatcher.get(EntityArmorStand.b); + +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java +index 8a06cb16..91b7bc2e 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java +@@ -221,4 +221,16 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand { + public void setCanMove(boolean move) { + getHandle().canMove = move; + } ++ ++ // Paper start ++ @Override ++ public boolean canTick() { ++ return this.getHandle().canTick; ++ } ++ ++ @Override ++ public void setCanTick(final boolean tick) { ++ this.getHandle().canTick = tick; ++ } ++ // Paper end + } +-- +2.19.1 + diff --git a/Spigot-Server-Patches/0351-Use-a-Queue-for-Queueing-Commands.patch b/Spigot-Server-Patches/0351-Use-a-Queue-for-Queueing-Commands.patch deleted file mode 100644 index 50f0c67253..0000000000 --- a/Spigot-Server-Patches/0351-Use-a-Queue-for-Queueing-Commands.patch +++ /dev/null @@ -1,36 +0,0 @@ -From a606668643e32d55ab47567a218b7c522526db84 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 12 Aug 2018 02:33:39 -0400 -Subject: [PATCH] Use a Queue for Queueing Commands - -Lists are bad as Queues mmmkay. - -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 2922915927..6a8292ce45 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -34,7 +34,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - - private static final Logger LOGGER = LogManager.getLogger(); - private static final Pattern l = Pattern.compile("^[a-fA-F0-9]{40}$"); -- private final List serverCommandQueue = Collections.synchronizedList(Lists.newArrayList()); // CraftBukkit - fix decompile error -+ private final java.util.Queue serverCommandQueue = new java.util.concurrent.ConcurrentLinkedQueue<>(); // Paper - use a proper queue - private RemoteStatusListener n; - public final RemoteControlCommandListener remoteControlCommandListener = new RemoteControlCommandListener(this); - private RemoteControlListener p; -@@ -448,8 +448,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - - public void aP() { - MinecraftTimings.serverCommandTimer.startTiming(); // Spigot -- while (!this.serverCommandQueue.isEmpty()) { -- ServerCommand servercommand = (ServerCommand) this.serverCommandQueue.remove(0); -+ // Paper start - use proper queue -+ ServerCommand servercommand; -+ while ((servercommand = this.serverCommandQueue.poll()) != null) { -+ // Paper end - - // CraftBukkit start - ServerCommand for preprocessing - ServerCommandEvent event = new ServerCommandEvent(console, servercommand.command); --- -2.18.0 - diff --git a/Spigot-Server-Patches/0352-Allow-disabling-armour-stand-ticking.patch b/Spigot-Server-Patches/0352-Allow-disabling-armour-stand-ticking.patch deleted file mode 100644 index 8a03395655..0000000000 --- a/Spigot-Server-Patches/0352-Allow-disabling-armour-stand-ticking.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 8e587147671ae4291c03ddbec1a4687639db87e9 Mon Sep 17 00:00:00 2001 -From: kashike -Date: Wed, 15 Aug 2018 01:26:09 -0700 -Subject: [PATCH] Allow disabling armour stand ticking - - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index c3bd82692..ed1475351 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -584,4 +584,10 @@ public class PaperWorldConfig { - break; - } - } -+ -+ public boolean armorStandTick = true; -+ private void armorStandTick() { -+ this.armorStandTick = this.getBoolean("armor-stands-tick", this.armorStandTick); -+ log("ArmorStand ticking is " + (this.armorStandTick ? "enabled" : "disabled") + " by default"); -+ } - } -diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java -index df0d66ad0..dca497072 100644 ---- a/src/main/java/net/minecraft/server/EntityArmorStand.java -+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java -@@ -51,6 +51,7 @@ public class EntityArmorStand extends EntityLiving { - public Vector3f leftLegPose; - public Vector3f rightLegPose; - public boolean canMove = true; // Paper -+ public boolean canTick = true; // Paper - armour stand ticking - - public EntityArmorStand(World world) { - super(world); -@@ -64,6 +65,7 @@ public class EntityArmorStand extends EntityLiving { - this.rightLegPose = EntityArmorStand.bw; - this.noclip = this.isNoGravity(); - this.setSize(0.5F, 1.975F); -+ if (world != null) this.canTick = world.paperConfig.armorStandTick; // Paper - armour stand ticking - } - - public EntityArmorStand(World world, double d0, double d1, double d2) { -@@ -568,6 +570,7 @@ public class EntityArmorStand extends EntityLiving { - } - - public void B_() { -+ if (!this.canTick) return;// Paper - super.B_(); - Vector3f vector3f = (Vector3f) this.datawatcher.get(EntityArmorStand.b); - -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java -index 8a06cb165..91b7bc2ed 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java -@@ -221,4 +221,16 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand { - public void setCanMove(boolean move) { - getHandle().canMove = move; - } -+ -+ // Paper start -+ @Override -+ public boolean canTick() { -+ return this.getHandle().canTick; -+ } -+ -+ @Override -+ public void setCanTick(final boolean tick) { -+ this.getHandle().canTick = tick; -+ } -+ // Paper end - } --- -2.18.0 - diff --git a/Spigot-Server-Patches/0352-Optimize-BlockPosition-helper-methods.patch b/Spigot-Server-Patches/0352-Optimize-BlockPosition-helper-methods.patch new file mode 100644 index 0000000000..e60bba3398 --- /dev/null +++ b/Spigot-Server-Patches/0352-Optimize-BlockPosition-helper-methods.patch @@ -0,0 +1,125 @@ +From 50c8dbe5270b79e57877effa262eb430d0e00fad Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Wed, 15 Aug 2018 12:05:12 -0700 +Subject: [PATCH] Optimize BlockPosition helper methods + +Resolves #1338 + +diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java +index 38a7af58..4849fcbc 100644 +--- a/src/main/java/net/minecraft/server/BlockPosition.java ++++ b/src/main/java/net/minecraft/server/BlockPosition.java +@@ -60,59 +60,96 @@ public class BlockPosition extends BaseBlockPosition { + } + + public BlockPosition up() { +- return this.up(1); ++ return new BlockPosition(this.getX(), this.getY() + 1, this.getZ()); // Paper - Optimize BlockPosition + } + + public BlockPosition up(int i) { +- return this.shift(EnumDirection.UP, i); ++ return i == 0 ? this : new BlockPosition(this.getX(), this.getY() + i, this.getZ()); // Paper - Optimize BlockPosition + } + + public BlockPosition down() { +- return this.down(1); ++ return new BlockPosition(this.getX(), this.getY() - 1, this.getZ()); // Paper - Optimize BlockPosition + } + + public BlockPosition down(int i) { +- return this.shift(EnumDirection.DOWN, i); ++ return i == 0 ? this : new BlockPosition(this.getX(), this.getY() - i, this.getZ()); // Paper - Optimize BlockPosition + } + + public BlockPosition north() { +- return this.north(1); ++ return new BlockPosition(this.getX(), this.getY(), this.getZ() - 1); // Paper - Optimize BlockPosition + } + + public BlockPosition north(int i) { +- return this.shift(EnumDirection.NORTH, i); ++ return i == 0 ? this : new BlockPosition(this.getX(), this.getY(), this.getZ() - i); // Paper - Optimize BlockPosition + } + + public BlockPosition south() { +- return this.south(1); ++ return new BlockPosition(this.getX(), this.getY(), this.getZ() + 1); // Paper - Optimize BlockPosition + } + + public BlockPosition south(int i) { +- return this.shift(EnumDirection.SOUTH, i); ++ return i == 0 ? this : new BlockPosition(this.getX(), this.getY(), this.getZ() + i); // Paper - Optimize BlockPosition + } + + public BlockPosition west() { +- return this.west(1); ++ return new BlockPosition(this.getX() - 1, this.getY(), this.getZ()); // Paper - Optimize BlockPosition + } + + public BlockPosition west(int i) { +- return this.shift(EnumDirection.WEST, i); ++ return i == 0 ? this : new BlockPosition(this.getX() - i, this.getY(), this.getZ()); // Paper - Optimize BlockPosition + } + + public BlockPosition east() { +- return this.east(1); ++ return new BlockPosition(this.getX() + 1, this.getY(), this.getZ()); // Paper - Optimize BlockPosition + } + + public BlockPosition east(int i) { +- return this.shift(EnumDirection.EAST, i); ++ return i == 0 ? this : new BlockPosition(this.getX() + i, this.getY(), this.getZ()); // Paper - Optimize BlockPosition + } + + public BlockPosition shift(EnumDirection enumdirection) { +- return this.shift(enumdirection, 1); ++ // Paper Start - Optimize BlockPosition ++ switch(enumdirection) { ++ case UP: ++ return new BlockPosition(this.getX(), this.getY() + 1, this.getZ()); ++ case DOWN: ++ return new BlockPosition(this.getX(), this.getY() - 1, this.getZ()); ++ case NORTH: ++ return new BlockPosition(this.getX(), this.getY(), this.getZ() - 1); ++ case SOUTH: ++ return new BlockPosition(this.getX(), this.getY(), this.getZ() + 1); ++ case WEST: ++ return new BlockPosition(this.getX() - 1, this.getY(), this.getZ()); ++ case EAST: ++ return new BlockPosition(this.getX() + 1, this.getY(), this.getZ()); ++ default: ++ return new BlockPosition(this.getX() + enumdirection.getAdjacentX(), this.getY() + enumdirection.getAdjacentY(), this.getZ() + enumdirection.getAdjacentZ()); ++ } ++ // Paper End + } + + public BlockPosition shift(EnumDirection enumdirection, int i) { +- return i == 0 ? this : new BlockPosition(this.getX() + enumdirection.getAdjacentX() * i, this.getY() + enumdirection.getAdjacentY() * i, this.getZ() + enumdirection.getAdjacentZ() * i); ++ // Paper Start - Optimize BlockPosition ++ if (i == 0) { ++ return this; ++ } ++ switch(enumdirection) { ++ case UP: ++ return new BlockPosition(this.getX(), this.getY() + i, this.getZ()); ++ case DOWN: ++ return new BlockPosition(this.getX(), this.getY() - i, this.getZ()); ++ case NORTH: ++ return new BlockPosition(this.getX(), this.getY(), this.getZ() - i); ++ case SOUTH: ++ return new BlockPosition(this.getX(), this.getY(), this.getZ() + i); ++ case WEST: ++ return new BlockPosition(this.getX() - i, this.getY(), this.getZ()); ++ case EAST: ++ return new BlockPosition(this.getX() + i, this.getY(), this.getZ()); ++ default: ++ return new BlockPosition(this.getX() + enumdirection.getAdjacentX() * i, this.getY() + enumdirection.getAdjacentY() * i, this.getZ() + enumdirection.getAdjacentZ() * i); ++ } ++ // Paper End + } + + public BlockPosition a(EnumBlockRotation enumblockrotation) { +-- +2.19.1 + diff --git a/Spigot-Server-Patches/0353-Ensure-chunks-are-always-loaded-on-hard-position-set.patch b/Spigot-Server-Patches/0353-Ensure-chunks-are-always-loaded-on-hard-position-set.patch deleted file mode 100644 index dd505a9539..0000000000 --- a/Spigot-Server-Patches/0353-Ensure-chunks-are-always-loaded-on-hard-position-set.patch +++ /dev/null @@ -1,33 +0,0 @@ -From ee5f7b1451005f94292b283fa1bc9e21cacb05c2 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Thu, 16 Aug 2018 17:36:41 -0400 -Subject: [PATCH] Ensure chunks are always loaded on hard position sets - -Player Movement, Entity Creation and Teleportation move -entities with a very "You are here, no debate" change, making -the server register them as there, regardless if that chunk was -loaded or not. - -It appears possible that with hack clients and lag, a player -may be able to move fast enough to move into an unloaded -chunk and get into a buggy state. - -To prevent this, we will ensure a chunk is always loaded, -guaranteeing that the entity will be properly registered -into its new home comfortably. - -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 9b5f7fcf72..48c9fbd9b3 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1309,6 +1309,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper - this.lastYaw -= 360.0F; - } - -+ world.getChunkAt((int) Math.floor(this.locX) >> 4, (int) Math.floor(this.locZ) >> 4); // Paper - ensure chunk is always loaded - this.setPosition(this.locX, this.locY, this.locZ); - this.setYawPitch(f, f1); - } --- -2.18.0 - diff --git a/Spigot-Server-Patches/0353-Send-nearby-packets-from-world-player-list-not-serve.patch b/Spigot-Server-Patches/0353-Send-nearby-packets-from-world-player-list-not-serve.patch new file mode 100644 index 0000000000..d2279da801 --- /dev/null +++ b/Spigot-Server-Patches/0353-Send-nearby-packets-from-world-player-list-not-serve.patch @@ -0,0 +1,136 @@ +From 15f184e4c071455a3b3576910f4763c29dac126c Mon Sep 17 00:00:00 2001 +From: Mystiflow +Date: Fri, 6 Jul 2018 13:21:30 +0100 +Subject: [PATCH] Send nearby packets from world player list not server list + + +diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +index eaaa54ac..44ced604 100644 +--- a/src/main/java/net/minecraft/server/PlayerList.java ++++ b/src/main/java/net/minecraft/server/PlayerList.java +@@ -1239,8 +1239,25 @@ public abstract class PlayerList { + } + + public void sendPacketNearby(@Nullable EntityHuman entityhuman, double d0, double d1, double d2, double d3, int i, Packet packet) { +- for (int j = 0; j < this.players.size(); ++j) { +- EntityPlayer entityplayer = (EntityPlayer) this.players.get(j); ++ // Paper start - Use world list instead of server list where preferable ++ sendPacketNearby(entityhuman, d0, d1, d2, d3, i, null, packet); // Retained for compatibility ++ } ++ ++ public void sendPacketNearby(@Nullable EntityHuman entityhuman, double d0, double d1, double d2, double d3, WorldServer world, Packet packet) { ++ sendPacketNearby(entityhuman, d0, d1, d2, d3, world.dimension, world, packet); ++ } ++ ++ public void sendPacketNearby(@Nullable EntityHuman entityhuman, double d0, double d1, double d2, double d3, int i, @Nullable WorldServer world, Packet packet) { ++ if (world == null && entityhuman != null && entityhuman.world instanceof WorldServer) { ++ world = (WorldServer) entityhuman.world; ++ } ++ ++ List players1 = world == null ? players : world.players; ++ for (int j = 0; j < players1.size(); ++j) { ++ EntityHuman entity = players1.get(j); ++ if (!(entity instanceof EntityPlayer)) continue; ++ EntityPlayer entityplayer = (EntityPlayer) players1.get(j); ++ // Paper end + + // CraftBukkit start - Test if player receiving packet can see the source of the packet + if (entityhuman != null && entityhuman instanceof EntityPlayer && !entityplayer.getBukkitEntity().canSee(((EntityPlayer) entityhuman).getBukkitEntity())) { +@@ -1248,7 +1265,7 @@ public abstract class PlayerList { + } + // CraftBukkit end + +- if (entityplayer != entityhuman && entityplayer.dimension == i) { ++ if (entityplayer != entityhuman && (world != null || entityplayer.dimension == i)) { // Paper + double d4 = d0 - entityplayer.locX; + double d5 = d1 - entityplayer.locY; + double d6 = d2 - entityplayer.locZ; +diff --git a/src/main/java/net/minecraft/server/WorldManager.java b/src/main/java/net/minecraft/server/WorldManager.java +index 2c8fb705..bfe003f6 100644 +--- a/src/main/java/net/minecraft/server/WorldManager.java ++++ b/src/main/java/net/minecraft/server/WorldManager.java +@@ -35,8 +35,8 @@ public class WorldManager implements IWorldAccess { + } + + public void a(@Nullable EntityHuman entityhuman, SoundEffect soundeffect, SoundCategory soundcategory, double d0, double d1, double d2, float f, float f1) { +- // CraftBukkit - this.world.dimension +- this.a.getPlayerList().sendPacketNearby(entityhuman, d0, d1, d2, f > 1.0F ? (double) (16.0F * f) : 16.0D, this.world.dimension, new PacketPlayOutNamedSoundEffect(soundeffect, soundcategory, d0, d1, d2, f, f1)); ++ // CraftBukkit - this.world.dimension, // Paper - this.world.dimension -> this.world ++ this.a.getPlayerList().sendPacketNearby(entityhuman, d0, d1, d2, f > 1.0F ? (double) (16.0F * f) : 16.0D, this.world, new PacketPlayOutNamedSoundEffect(soundeffect, soundcategory, d0, d1, d2, f, f1)); + } + + public void a(int i, int j, int k, int l, int i1, int j1) {} +@@ -51,7 +51,7 @@ public class WorldManager implements IWorldAccess { + + public void a(EntityHuman entityhuman, int i, BlockPosition blockposition, int j) { + // CraftBukkit - this.world.dimension +- this.a.getPlayerList().sendPacketNearby(entityhuman, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), 64.0D, this.world.dimension, new PacketPlayOutWorldEvent(i, blockposition, j, false)); ++ this.a.getPlayerList().sendPacketNearby(entityhuman, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), 64.0D, this.world, new PacketPlayOutWorldEvent(i, blockposition, j, false)); + } + + public void a(int i, BlockPosition blockposition, int j) { +@@ -59,7 +59,7 @@ public class WorldManager implements IWorldAccess { + } + + public void b(int i, BlockPosition blockposition, int j) { +- Iterator iterator = this.a.getPlayerList().v().iterator(); ++ // Iterator iterator = this.a.getPlayerList().v().iterator(); // Paper + + // CraftBukkit start + EntityHuman entityhuman = null; +@@ -67,8 +67,14 @@ public class WorldManager implements IWorldAccess { + if (entity instanceof EntityHuman) entityhuman = (EntityHuman) entity; + // CraftBukkit end + ++ // Paper start ++ java.util.List list = entity != null ? entity.world.players : this.a.getPlayerList().v(); ++ Iterator iterator = list.iterator(); + while (iterator.hasNext()) { +- EntityPlayer entityplayer = (EntityPlayer) iterator.next(); ++ EntityHuman human = iterator.next(); ++ if (!(human instanceof EntityPlayer)) continue; ++ EntityPlayer entityplayer = (EntityPlayer) human; ++ // Paper end + + if (entityplayer != null && entityplayer.world == this.world && entityplayer.getId() != i) { + double d0 = (double) blockposition.getX() - entityplayer.locX; +diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +index a14b5e06..b19942e0 100644 +--- a/src/main/java/net/minecraft/server/WorldServer.java ++++ b/src/main/java/net/minecraft/server/WorldServer.java +@@ -1267,7 +1267,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { + } + // CraftBukkit end + if (super.strikeLightning(entity)) { +- this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entity.locX, entity.locY, entity.locZ, 512.0D, dimension, new PacketPlayOutSpawnEntityWeather(entity)); // CraftBukkit - Use dimension ++ this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entity.locX, entity.locY, entity.locZ, 512.0D, this, new PacketPlayOutSpawnEntityWeather(entity)); // CraftBukkit - Use dimension, // Paper - use world instead of dimension + return true; + } else { + return false; +@@ -1342,8 +1342,8 @@ public class WorldServer extends World implements IAsyncTaskHandler { + BlockActionData blockactiondata = (BlockActionData) iterator.next(); + + if (this.a(blockactiondata)) { +- // CraftBukkit - this.worldProvider.dimension -> this.dimension +- this.server.getPlayerList().sendPacketNearby((EntityHuman) null, (double) blockactiondata.a().getX(), (double) blockactiondata.a().getY(), (double) blockactiondata.a().getZ(), 64.0D, dimension, new PacketPlayOutBlockAction(blockactiondata.a(), blockactiondata.d(), blockactiondata.b(), blockactiondata.c())); ++ // CraftBukkit - this.worldProvider.dimension -> this.dimension, // Paper - dimension -> world ++ this.server.getPlayerList().sendPacketNearby((EntityHuman) null, (double) blockactiondata.a().getX(), (double) blockactiondata.a().getY(), (double) blockactiondata.a().getZ(), 64.0D, this, new PacketPlayOutBlockAction(blockactiondata.a(), blockactiondata.d(), blockactiondata.b(), blockactiondata.c())); + } + } + +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +index ccff6fd0..567e9acb 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +@@ -1500,7 +1500,7 @@ public class CraftWorld implements World { + double z = loc.getZ(); + + PacketPlayOutCustomSoundEffect packet = new PacketPlayOutCustomSoundEffect(sound, SoundCategory.valueOf(category.name()), x, y, z, volume, pitch); +- world.getMinecraftServer().getPlayerList().sendPacketNearby(null, x, y, z, volume > 1.0F ? 16.0F * volume : 16.0D, this.world.dimension, packet); ++ world.getMinecraftServer().getPlayerList().sendPacketNearby(null, x, y, z, volume > 1.0F ? 16.0F * volume : 16.0D, this.world, packet); // Paper - this.world.dimension -> this.world + } + + public String getGameRuleValue(String rule) { +-- +2.19.1 + diff --git a/Spigot-Server-Patches/0354-Improve-death-events.patch b/Spigot-Server-Patches/0354-Improve-death-events.patch new file mode 100644 index 0000000000..26c42ec6b7 --- /dev/null +++ b/Spigot-Server-Patches/0354-Improve-death-events.patch @@ -0,0 +1,417 @@ +From 059e0ddf477c3fcf06ac7be0d347fb082c730573 Mon Sep 17 00:00:00 2001 +From: Phoenix616 +Date: Tue, 21 Aug 2018 01:39:35 +0100 +Subject: [PATCH] Improve death events + +This adds the ability to cancel the death events and to modify the sound +an entity makes when dying. (In cases were no sound should it will be +called with shouldPlaySound set to false allowing unsilencing of silent +entities) + +It makes handling of entity deaths a lot nicer as you no longer need +to listen on the damage event and calculate if the entity dies yourself +to cancel the death which has the benefit of also receiving the dropped +items and experience which is otherwise only properly possible by using +internal code. + +diff --git a/src/main/java/net/minecraft/server/CombatTracker.java b/src/main/java/net/minecraft/server/CombatTracker.java +index 7a076f3e..bddd66e7 100644 +--- a/src/main/java/net/minecraft/server/CombatTracker.java ++++ b/src/main/java/net/minecraft/server/CombatTracker.java +@@ -175,6 +175,7 @@ public class CombatTracker { + this.h = null; + } + ++ public void reset() { this.g(); } // Paper - OBFHELPER + public void g() { + int i = this.f ? 300 : 100; + +diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +index 3a2ff25e..d44c55d8 100644 +--- a/src/main/java/net/minecraft/server/Entity.java ++++ b/src/main/java/net/minecraft/server/Entity.java +@@ -1471,6 +1471,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper + return false; + } + ++ public void runKillTrigger(Entity entity, int kills, DamageSource damageSource) { this.a(entity, kills, damageSource); } // Paper - OBFHELPER + public void a(Entity entity, int i, DamageSource damagesource) { + if (entity instanceof EntityPlayer) { + CriterionTriggers.c.a((EntityPlayer) entity, this, damagesource); +@@ -2267,6 +2268,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper + + } + ++ public void onKill(EntityLiving entityLiving) { this.b(entityLiving); } // Paper - OBFHELPER + public void b(EntityLiving entityliving) {} + + protected boolean i(double d0, double d1, double d2) { +@@ -2965,6 +2967,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper + return EnumPistonReaction.NORMAL; + } + ++ public SoundCategory getDeathSoundCategory() { return bK();} // Paper - OBFHELPER + public SoundCategory bK() { + return SoundCategory.NEUTRAL; + } +diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java +index dca49707..454c1e7d 100644 +--- a/src/main/java/net/minecraft/server/EntityArmorStand.java ++++ b/src/main/java/net/minecraft/server/EntityArmorStand.java +@@ -641,7 +641,8 @@ public class EntityArmorStand extends EntityLiving { + } + + public void killEntity() { +- org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, drops); // CraftBukkit - call event ++ org.bukkit.event.entity.EntityDeathEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, drops); // CraftBukkit - call event // Paper - make cancellable ++ if (event.isCancelled()) return; // Paper - make cancellable + this.die(); + } + +diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +index 14637be4..ed5bb2d3 100644 +--- a/src/main/java/net/minecraft/server/EntityLiving.java ++++ b/src/main/java/net/minecraft/server/EntityLiving.java +@@ -75,14 +75,14 @@ public abstract class EntityLiving extends Entity { + public float aR; + public EntityHuman killer; + public int lastDamageByPlayerTime; // Paper - public +- protected boolean aU; ++ protected boolean aU; protected void setDying(boolean dying) { this.aU = dying; } protected boolean isDying() { return this.aU; } // Paper - OBFHELPER + protected int ticksFarFromPlayer; + protected float aW; + protected float aX; + protected float aY; + protected float aZ; + protected float ba; +- protected int bb; ++ protected int bb; protected int getKillCount() { return this.bb; } // Paper - OBFHELPER + public float lastDamage; + protected boolean bd; + public float be; +@@ -117,6 +117,7 @@ public abstract class EntityLiving extends Entity { + public org.bukkit.craftbukkit.attribute.CraftAttributeMap craftAttributes; + public boolean collides = true; + public boolean canPickUpLoot; ++ public boolean silentDeath = false; // Paper - mark entity as dying silently for cancellable death event + + @Override + public float getBukkitYaw() { +@@ -970,13 +971,17 @@ public abstract class EntityLiving extends Entity { + + if (this.getHealth() <= 0.0F) { + if (!this.e(damagesource)) { +- SoundEffect soundeffect = this.cf(); ++ // Paper start - moved into CraftEventFactory event caller for cancellable death event ++ //SoundEffect soundeffect = this.cf(); + +- if (flag1 && soundeffect != null) { +- this.a(soundeffect, this.cq(), this.cr()); +- } ++ //if (flag1 && soundeffect != null) { ++ // this.a(soundeffect, this.cq(), this.cr()); ++ //} ++ this.silentDeath = !flag1; // mark entity as dying silently ++ // Paper end + + this.die(damagesource); ++ this.silentDeath = false; // Paper - cancellable death event - reset to default + } + } else if (flag1) { + this.c(damagesource); +@@ -1114,16 +1119,20 @@ public abstract class EntityLiving extends Entity { + Entity entity = damagesource.getEntity(); + EntityLiving entityliving = this.ci(); + +- if (this.bb >= 0 && entityliving != null) { +- entityliving.a(this, this.bb, damagesource); +- } ++ // Paper start - move down to make death event cancellable ++ //if (this.bb >= 0 && entityliving != null) { ++ // entityliving.a(this, this.bb, damagesource); ++ //} + +- if (entity != null) { +- entity.b(this); +- } ++ //if (entity != null) { ++ // entity.b(this); ++ //} + +- this.aU = true; +- this.getCombatTracker().g(); ++ this.aU = true; // Paper - Always set at start, unset later if cancelled - GH-1432 ++ //this.getCombatTracker().g(); ++ ++ org.bukkit.event.entity.EntityDeathEvent deathEvent = null; ++ //Paper end + if (!this.world.isClientSide) { + int i = 0; + +@@ -1136,15 +1145,33 @@ public abstract class EntityLiving extends Entity { + + this.a(flag, i, damagesource); + // CraftBukkit start - Call death event +- CraftEventFactory.callEntityDeathEvent(this, this.drops); ++ deathEvent = CraftEventFactory.callEntityDeathEvent(this, this.drops); // Paper - cancellable death event + this.drops = new ArrayList(); + } else { +- CraftEventFactory.callEntityDeathEvent(this); ++ deathEvent = CraftEventFactory.callEntityDeathEvent(this); // Paper - cancellable death event + // CraftBukkit end + } + } + +- this.world.broadcastEntityEffect(this, (byte) 3); ++ // Paper start - cancellable death event ++ if (deathEvent == null || !deathEvent.isCancelled()) { ++ // triggers and stats got moved down ++ if (this.getKillCount() >= 0 && entityliving != null) { ++ entityliving.runKillTrigger(this, this.getKillCount(), damagesource); ++ } ++ ++ if (entity != null) { ++ entity.onKill(this); ++ } ++ ++ this.getCombatTracker().reset(); ++ this.setDying(true); ++ this.world.broadcastEntityEffect(this, (byte) 3); ++ } else { ++ this.setDying(false); // Paper - reset if cancelled ++ this.setHealth((float) deathEvent.getReviveHealth()); ++ } ++ // Paper end + } + } + +@@ -1198,6 +1225,7 @@ public abstract class EntityLiving extends Entity { + return SoundEffects.bX; + } + ++ @Nullable public SoundEffect getDeathSoundEffect() { return cf();} // Paper - OBFHELPER + @Nullable + protected SoundEffect cf() { + return SoundEffects.bS; +@@ -1583,10 +1611,12 @@ public abstract class EntityLiving extends Entity { + + } + ++ public float getDeathSoundVolume() { return cq();} // Paper - OBFHELPER + protected float cq() { + return 1.0F; + } + ++ public float getDeathSoundPitch() { return cr();} // Paper - OBFHELPER + protected float cr() { + return this.isBaby() ? (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.5F : (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F; + } +diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +index 4ff505cf..6afb6cf7 100644 +--- a/src/main/java/net/minecraft/server/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/EntityPlayer.java +@@ -79,6 +79,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + } + // Paper end + private int containerUpdateDelay; // Paper ++ // Paper start - cancellable death event ++ public boolean queueHealthUpdatePacket = false; ++ public net.minecraft.server.PacketPlayOutUpdateHealth queuedHealthUpdatePacket; ++ // Paper end + + // CraftBukkit start + public String displayName; +@@ -436,9 +440,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + public void die(DamageSource damagesource) { + boolean flag = this.world.getGameRules().getBoolean("showDeathMessages"); + +- this.playerConnection.sendPacket(new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, flag)); ++ //this.playerConnection.sendPacket(new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, flag)); // Paper - moved down for cancellable death event + // CraftBukkit start - fire PlayerDeathEvent + if (this.dead) { ++ this.playerConnection.sendPacket(new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, flag)); // Paper - moved down for cancellable death event + return; + } + java.util.List loot = new java.util.ArrayList(this.inventory.getSize()); +@@ -456,6 +461,16 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + + String deathmessage = chatmessage.toPlainText(); + org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, deathmessage, keepInventory); ++ // Paper start - cancellable death event ++ if (event.isCancelled()) { ++ // make compatible with plugins that might have already set the health in an event listener ++ if (this.getHealth() <= 0) { ++ this.setHealth((float) event.getReviveHealth()); ++ } ++ return; ++ } ++ this.playerConnection.sendPacket(new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, flag)); ++ // Paper end + + String deathMessage = event.getDeathMessage(); + +@@ -608,8 +623,17 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + } + } + } +- +- return super.damageEntity(damagesource, f); ++ // Paper start - cancellable death events ++ //return super.damageEntity(damagesource, f); ++ this.queueHealthUpdatePacket = true; ++ boolean damaged = super.damageEntity(damagesource, f); ++ this.queueHealthUpdatePacket = false; ++ if (this.queuedHealthUpdatePacket != null) { ++ this.playerConnection.sendPacket(this.queuedHealthUpdatePacket); ++ this.queuedHealthUpdatePacket = null; ++ } ++ return damaged; ++ // Paper end + } + } + } +diff --git a/src/main/java/net/minecraft/server/RegistryMaterials.java b/src/main/java/net/minecraft/server/RegistryMaterials.java +index d26abb41..aaedbc3b 100644 +--- a/src/main/java/net/minecraft/server/RegistryMaterials.java ++++ b/src/main/java/net/minecraft/server/RegistryMaterials.java +@@ -29,6 +29,7 @@ public class RegistryMaterials extends RegistrySimple implements Reg + return super.get(k0); + } + ++ @Nullable public K getByValue(V value) { return this.b(value); } // Paper - OBFHELPER + @Nullable + public K b(V v0) { + return this.b.get(v0); +diff --git a/src/main/java/net/minecraft/server/SoundEffect.java b/src/main/java/net/minecraft/server/SoundEffect.java +index ec37e237..8e0da7bd 100644 +--- a/src/main/java/net/minecraft/server/SoundEffect.java ++++ b/src/main/java/net/minecraft/server/SoundEffect.java +@@ -2,7 +2,7 @@ package net.minecraft.server; + + public class SoundEffect { + +- public static final RegistryMaterials a = new RegistryMaterials(); ++ public static final RegistryMaterials a = new RegistryMaterials(); public static RegistryMaterials getRegistry() { return a; }// Paper - OBFHELPER + private final MinecraftKey b; + private static int c; + +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftSound.java b/src/main/java/org/bukkit/craftbukkit/CraftSound.java +index 8871c6f3..84f4cb91 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftSound.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftSound.java +@@ -560,6 +560,22 @@ public enum CraftSound { + WEATHER_RAIN_ABOVE("weather.rain.above"); + private final String minecraftKey; + ++ // Paper start - cancellable death event ++ public static CraftSound getBySoundEffect(final SoundEffect effect) { ++ MinecraftKey key = SoundEffect.getRegistry().getByValue(effect); ++ Preconditions.checkArgument(key != null, "Key for sound effect %s not found?", effect.toString()); ++ ++ return valueOf(key.getKey().replace('.', '_').toUpperCase(java.util.Locale.ENGLISH)); ++ } ++ ++ public static Sound getSoundByEffect(final SoundEffect effect) { ++ return Sound.valueOf(getBySoundEffect(effect).name()); ++ } ++ ++ public static SoundEffect getSoundEffect(final Sound sound) { ++ return getSoundEffect(getSound(sound)); ++ } ++ // Paper end + CraftSound(String minecraftKey) { + this.minecraftKey = minecraftKey; + } +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +index 5f480ac0..d59d86ef 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +@@ -1612,7 +1612,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + } + + public void sendHealthUpdate() { +- getHandle().playerConnection.sendPacket(new PacketPlayOutUpdateHealth(getScaledHealth(), getHandle().getFoodData().getFoodLevel(), getHandle().getFoodData().getSaturationLevel())); ++ // Paper start - cancellable death event ++ //getHandle().playerConnection.sendPacket(new PacketPlayOutUpdateHealth(getScaledHealth(), getHandle().getFoodData().getFoodLevel(), getHandle().getFoodData().getSaturationLevel())); ++ PacketPlayOutUpdateHealth packet = new PacketPlayOutUpdateHealth(getScaledHealth(), getHandle().getFoodData().getFoodLevel(), getHandle().getFoodData().getSaturationLevel()); ++ if (this.getHandle().queueHealthUpdatePacket) { ++ this.getHandle().queuedHealthUpdatePacket = packet; ++ } else { ++ this.getHandle().playerConnection.sendPacket(packet); ++ } ++ // Paper end + } + + public void injectScaledMaxHealth(Collection collection, boolean force) { +diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +index cce4acc0..f1a3ca95 100644 +--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java ++++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +@@ -392,9 +392,16 @@ public class CraftEventFactory { + public static EntityDeathEvent callEntityDeathEvent(EntityLiving victim, List drops) { + CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity(); + EntityDeathEvent event = new EntityDeathEvent(entity, drops, victim.getExpReward()); ++ populateFields(victim, event); // Paper - make cancellable + CraftWorld world = (CraftWorld) entity.getWorld(); + Bukkit.getServer().getPluginManager().callEvent(event); + ++ // Paper start - make cancellable ++ if (event.isCancelled()) { ++ return event; ++ } ++ playDeathSound(victim, event); ++ // Paper end + victim.expToDrop = event.getDroppedExp(); + + for (org.bukkit.inventory.ItemStack stack : event.getDrops()) { +@@ -410,8 +417,15 @@ public class CraftEventFactory { + CraftPlayer entity = victim.getBukkitEntity(); + PlayerDeathEvent event = new PlayerDeathEvent(entity, drops, victim.getExpReward(), 0, deathMessage); + event.setKeepInventory(keepInventory); ++ populateFields(victim, event); // Paper - make cancellable + org.bukkit.World world = entity.getWorld(); + Bukkit.getServer().getPluginManager().callEvent(event); ++ // Paper start - make cancellable ++ if (event.isCancelled()) { ++ return event; ++ } ++ playDeathSound(victim, event); ++ // Paper end + + victim.keepLevel = event.getKeepLevel(); + victim.newLevel = event.getNewLevel(); +@@ -432,6 +446,31 @@ public class CraftEventFactory { + return event; + } + ++ // Paper start - helper methods for making death event cancellable ++ // Add information to death event ++ private static void populateFields(EntityLiving victim, EntityDeathEvent event) { ++ event.setReviveHealth(event.getEntity().getAttribute(org.bukkit.attribute.Attribute.GENERIC_MAX_HEALTH).getValue()); ++ event.setShouldPlayDeathSound(!victim.silentDeath && !victim.isSilent()); ++ SoundEffect soundEffect = victim.getDeathSoundEffect(); ++ event.setDeathSound(soundEffect != null ? org.bukkit.craftbukkit.CraftSound.getSoundByEffect(soundEffect) : null); ++ event.setDeathSoundCategory(org.bukkit.SoundCategory.valueOf(victim.getDeathSoundCategory().name())); ++ event.setDeathSoundVolume(victim.getDeathSoundVolume()); ++ event.setDeathSoundPitch(victim.getDeathSoundPitch()); ++ } ++ ++ // Play death sound manually ++ private static void playDeathSound(EntityLiving victim, EntityDeathEvent event) { ++ if (event.shouldPlayDeathSound() && event.getDeathSound() != null && event.getDeathSoundCategory() != null) { ++ EntityHuman source = victim instanceof EntityHuman ? (EntityHuman) victim : null; ++ double x = event.getEntity().getLocation().getX(); ++ double y = event.getEntity().getLocation().getY(); ++ double z = event.getEntity().getLocation().getZ(); ++ SoundEffect soundEffect = org.bukkit.craftbukkit.CraftSound.getSoundEffect(event.getDeathSound()); ++ SoundCategory soundCategory = SoundCategory.valueOf(event.getDeathSoundCategory().name()); ++ victim.world.sendSoundEffect(source, x, y, z, soundEffect, soundCategory, event.getDeathSoundVolume(), event.getDeathSoundPitch()); ++ } ++ } ++ // Paper end + /** + * Server methods + */ +-- +2.19.1 + diff --git a/Spigot-Server-Patches/0354-Optimize-BlockPosition-helper-methods.patch b/Spigot-Server-Patches/0354-Optimize-BlockPosition-helper-methods.patch deleted file mode 100644 index a2689f92e2..0000000000 --- a/Spigot-Server-Patches/0354-Optimize-BlockPosition-helper-methods.patch +++ /dev/null @@ -1,125 +0,0 @@ -From a304de0b4dc2adb5aac09bec3c5211da2ce8e469 Mon Sep 17 00:00:00 2001 -From: Spottedleaf -Date: Wed, 15 Aug 2018 12:05:12 -0700 -Subject: [PATCH] Optimize BlockPosition helper methods - -Resolves #1338 - -diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index 38a7af58c..4849fcbc8 100644 ---- a/src/main/java/net/minecraft/server/BlockPosition.java -+++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -60,59 +60,96 @@ public class BlockPosition extends BaseBlockPosition { - } - - public BlockPosition up() { -- return this.up(1); -+ return new BlockPosition(this.getX(), this.getY() + 1, this.getZ()); // Paper - Optimize BlockPosition - } - - public BlockPosition up(int i) { -- return this.shift(EnumDirection.UP, i); -+ return i == 0 ? this : new BlockPosition(this.getX(), this.getY() + i, this.getZ()); // Paper - Optimize BlockPosition - } - - public BlockPosition down() { -- return this.down(1); -+ return new BlockPosition(this.getX(), this.getY() - 1, this.getZ()); // Paper - Optimize BlockPosition - } - - public BlockPosition down(int i) { -- return this.shift(EnumDirection.DOWN, i); -+ return i == 0 ? this : new BlockPosition(this.getX(), this.getY() - i, this.getZ()); // Paper - Optimize BlockPosition - } - - public BlockPosition north() { -- return this.north(1); -+ return new BlockPosition(this.getX(), this.getY(), this.getZ() - 1); // Paper - Optimize BlockPosition - } - - public BlockPosition north(int i) { -- return this.shift(EnumDirection.NORTH, i); -+ return i == 0 ? this : new BlockPosition(this.getX(), this.getY(), this.getZ() - i); // Paper - Optimize BlockPosition - } - - public BlockPosition south() { -- return this.south(1); -+ return new BlockPosition(this.getX(), this.getY(), this.getZ() + 1); // Paper - Optimize BlockPosition - } - - public BlockPosition south(int i) { -- return this.shift(EnumDirection.SOUTH, i); -+ return i == 0 ? this : new BlockPosition(this.getX(), this.getY(), this.getZ() + i); // Paper - Optimize BlockPosition - } - - public BlockPosition west() { -- return this.west(1); -+ return new BlockPosition(this.getX() - 1, this.getY(), this.getZ()); // Paper - Optimize BlockPosition - } - - public BlockPosition west(int i) { -- return this.shift(EnumDirection.WEST, i); -+ return i == 0 ? this : new BlockPosition(this.getX() - i, this.getY(), this.getZ()); // Paper - Optimize BlockPosition - } - - public BlockPosition east() { -- return this.east(1); -+ return new BlockPosition(this.getX() + 1, this.getY(), this.getZ()); // Paper - Optimize BlockPosition - } - - public BlockPosition east(int i) { -- return this.shift(EnumDirection.EAST, i); -+ return i == 0 ? this : new BlockPosition(this.getX() + i, this.getY(), this.getZ()); // Paper - Optimize BlockPosition - } - - public BlockPosition shift(EnumDirection enumdirection) { -- return this.shift(enumdirection, 1); -+ // Paper Start - Optimize BlockPosition -+ switch(enumdirection) { -+ case UP: -+ return new BlockPosition(this.getX(), this.getY() + 1, this.getZ()); -+ case DOWN: -+ return new BlockPosition(this.getX(), this.getY() - 1, this.getZ()); -+ case NORTH: -+ return new BlockPosition(this.getX(), this.getY(), this.getZ() - 1); -+ case SOUTH: -+ return new BlockPosition(this.getX(), this.getY(), this.getZ() + 1); -+ case WEST: -+ return new BlockPosition(this.getX() - 1, this.getY(), this.getZ()); -+ case EAST: -+ return new BlockPosition(this.getX() + 1, this.getY(), this.getZ()); -+ default: -+ return new BlockPosition(this.getX() + enumdirection.getAdjacentX(), this.getY() + enumdirection.getAdjacentY(), this.getZ() + enumdirection.getAdjacentZ()); -+ } -+ // Paper End - } - - public BlockPosition shift(EnumDirection enumdirection, int i) { -- return i == 0 ? this : new BlockPosition(this.getX() + enumdirection.getAdjacentX() * i, this.getY() + enumdirection.getAdjacentY() * i, this.getZ() + enumdirection.getAdjacentZ() * i); -+ // Paper Start - Optimize BlockPosition -+ if (i == 0) { -+ return this; -+ } -+ switch(enumdirection) { -+ case UP: -+ return new BlockPosition(this.getX(), this.getY() + i, this.getZ()); -+ case DOWN: -+ return new BlockPosition(this.getX(), this.getY() - i, this.getZ()); -+ case NORTH: -+ return new BlockPosition(this.getX(), this.getY(), this.getZ() - i); -+ case SOUTH: -+ return new BlockPosition(this.getX(), this.getY(), this.getZ() + i); -+ case WEST: -+ return new BlockPosition(this.getX() - i, this.getY(), this.getZ()); -+ case EAST: -+ return new BlockPosition(this.getX() + i, this.getY(), this.getZ()); -+ default: -+ return new BlockPosition(this.getX() + enumdirection.getAdjacentX() * i, this.getY() + enumdirection.getAdjacentY() * i, this.getZ() + enumdirection.getAdjacentZ() * i); -+ } -+ // Paper End - } - - public BlockPosition a(EnumBlockRotation enumblockrotation) { --- -2.18.0 - diff --git a/Spigot-Server-Patches/0355-Send-nearby-packets-from-world-player-list-not-serve.patch b/Spigot-Server-Patches/0355-Send-nearby-packets-from-world-player-list-not-serve.patch deleted file mode 100644 index 40f054423f..0000000000 --- a/Spigot-Server-Patches/0355-Send-nearby-packets-from-world-player-list-not-serve.patch +++ /dev/null @@ -1,136 +0,0 @@ -From f1a4565a54f292f668f94ac2ff6f3f56937209c0 Mon Sep 17 00:00:00 2001 -From: Mystiflow -Date: Fri, 6 Jul 2018 13:21:30 +0100 -Subject: [PATCH] Send nearby packets from world player list not server list - - -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index eaaa54acd..44ced604a 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -1239,8 +1239,25 @@ public abstract class PlayerList { - } - - public void sendPacketNearby(@Nullable EntityHuman entityhuman, double d0, double d1, double d2, double d3, int i, Packet packet) { -- for (int j = 0; j < this.players.size(); ++j) { -- EntityPlayer entityplayer = (EntityPlayer) this.players.get(j); -+ // Paper start - Use world list instead of server list where preferable -+ sendPacketNearby(entityhuman, d0, d1, d2, d3, i, null, packet); // Retained for compatibility -+ } -+ -+ public void sendPacketNearby(@Nullable EntityHuman entityhuman, double d0, double d1, double d2, double d3, WorldServer world, Packet packet) { -+ sendPacketNearby(entityhuman, d0, d1, d2, d3, world.dimension, world, packet); -+ } -+ -+ public void sendPacketNearby(@Nullable EntityHuman entityhuman, double d0, double d1, double d2, double d3, int i, @Nullable WorldServer world, Packet packet) { -+ if (world == null && entityhuman != null && entityhuman.world instanceof WorldServer) { -+ world = (WorldServer) entityhuman.world; -+ } -+ -+ List players1 = world == null ? players : world.players; -+ for (int j = 0; j < players1.size(); ++j) { -+ EntityHuman entity = players1.get(j); -+ if (!(entity instanceof EntityPlayer)) continue; -+ EntityPlayer entityplayer = (EntityPlayer) players1.get(j); -+ // Paper end - - // CraftBukkit start - Test if player receiving packet can see the source of the packet - if (entityhuman != null && entityhuman instanceof EntityPlayer && !entityplayer.getBukkitEntity().canSee(((EntityPlayer) entityhuman).getBukkitEntity())) { -@@ -1248,7 +1265,7 @@ public abstract class PlayerList { - } - // CraftBukkit end - -- if (entityplayer != entityhuman && entityplayer.dimension == i) { -+ if (entityplayer != entityhuman && (world != null || entityplayer.dimension == i)) { // Paper - double d4 = d0 - entityplayer.locX; - double d5 = d1 - entityplayer.locY; - double d6 = d2 - entityplayer.locZ; -diff --git a/src/main/java/net/minecraft/server/WorldManager.java b/src/main/java/net/minecraft/server/WorldManager.java -index 2c8fb705d..bfe003f60 100644 ---- a/src/main/java/net/minecraft/server/WorldManager.java -+++ b/src/main/java/net/minecraft/server/WorldManager.java -@@ -35,8 +35,8 @@ public class WorldManager implements IWorldAccess { - } - - public void a(@Nullable EntityHuman entityhuman, SoundEffect soundeffect, SoundCategory soundcategory, double d0, double d1, double d2, float f, float f1) { -- // CraftBukkit - this.world.dimension -- this.a.getPlayerList().sendPacketNearby(entityhuman, d0, d1, d2, f > 1.0F ? (double) (16.0F * f) : 16.0D, this.world.dimension, new PacketPlayOutNamedSoundEffect(soundeffect, soundcategory, d0, d1, d2, f, f1)); -+ // CraftBukkit - this.world.dimension, // Paper - this.world.dimension -> this.world -+ this.a.getPlayerList().sendPacketNearby(entityhuman, d0, d1, d2, f > 1.0F ? (double) (16.0F * f) : 16.0D, this.world, new PacketPlayOutNamedSoundEffect(soundeffect, soundcategory, d0, d1, d2, f, f1)); - } - - public void a(int i, int j, int k, int l, int i1, int j1) {} -@@ -51,7 +51,7 @@ public class WorldManager implements IWorldAccess { - - public void a(EntityHuman entityhuman, int i, BlockPosition blockposition, int j) { - // CraftBukkit - this.world.dimension -- this.a.getPlayerList().sendPacketNearby(entityhuman, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), 64.0D, this.world.dimension, new PacketPlayOutWorldEvent(i, blockposition, j, false)); -+ this.a.getPlayerList().sendPacketNearby(entityhuman, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), 64.0D, this.world, new PacketPlayOutWorldEvent(i, blockposition, j, false)); - } - - public void a(int i, BlockPosition blockposition, int j) { -@@ -59,7 +59,7 @@ public class WorldManager implements IWorldAccess { - } - - public void b(int i, BlockPosition blockposition, int j) { -- Iterator iterator = this.a.getPlayerList().v().iterator(); -+ // Iterator iterator = this.a.getPlayerList().v().iterator(); // Paper - - // CraftBukkit start - EntityHuman entityhuman = null; -@@ -67,8 +67,14 @@ public class WorldManager implements IWorldAccess { - if (entity instanceof EntityHuman) entityhuman = (EntityHuman) entity; - // CraftBukkit end - -+ // Paper start -+ java.util.List list = entity != null ? entity.world.players : this.a.getPlayerList().v(); -+ Iterator iterator = list.iterator(); - while (iterator.hasNext()) { -- EntityPlayer entityplayer = (EntityPlayer) iterator.next(); -+ EntityHuman human = iterator.next(); -+ if (!(human instanceof EntityPlayer)) continue; -+ EntityPlayer entityplayer = (EntityPlayer) human; -+ // Paper end - - if (entityplayer != null && entityplayer.world == this.world && entityplayer.getId() != i) { - double d0 = (double) blockposition.getX() - entityplayer.locX; -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index a14b5e061..b19942e0f 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1267,7 +1267,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { - } - // CraftBukkit end - if (super.strikeLightning(entity)) { -- this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entity.locX, entity.locY, entity.locZ, 512.0D, dimension, new PacketPlayOutSpawnEntityWeather(entity)); // CraftBukkit - Use dimension -+ this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entity.locX, entity.locY, entity.locZ, 512.0D, this, new PacketPlayOutSpawnEntityWeather(entity)); // CraftBukkit - Use dimension, // Paper - use world instead of dimension - return true; - } else { - return false; -@@ -1342,8 +1342,8 @@ public class WorldServer extends World implements IAsyncTaskHandler { - BlockActionData blockactiondata = (BlockActionData) iterator.next(); - - if (this.a(blockactiondata)) { -- // CraftBukkit - this.worldProvider.dimension -> this.dimension -- this.server.getPlayerList().sendPacketNearby((EntityHuman) null, (double) blockactiondata.a().getX(), (double) blockactiondata.a().getY(), (double) blockactiondata.a().getZ(), 64.0D, dimension, new PacketPlayOutBlockAction(blockactiondata.a(), blockactiondata.d(), blockactiondata.b(), blockactiondata.c())); -+ // CraftBukkit - this.worldProvider.dimension -> this.dimension, // Paper - dimension -> world -+ this.server.getPlayerList().sendPacketNearby((EntityHuman) null, (double) blockactiondata.a().getX(), (double) blockactiondata.a().getY(), (double) blockactiondata.a().getZ(), 64.0D, this, new PacketPlayOutBlockAction(blockactiondata.a(), blockactiondata.d(), blockactiondata.b(), blockactiondata.c())); - } - } - -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index ccff6fd05..567e9acb1 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1500,7 +1500,7 @@ public class CraftWorld implements World { - double z = loc.getZ(); - - PacketPlayOutCustomSoundEffect packet = new PacketPlayOutCustomSoundEffect(sound, SoundCategory.valueOf(category.name()), x, y, z, volume, pitch); -- world.getMinecraftServer().getPlayerList().sendPacketNearby(null, x, y, z, volume > 1.0F ? 16.0F * volume : 16.0D, this.world.dimension, packet); -+ world.getMinecraftServer().getPlayerList().sendPacketNearby(null, x, y, z, volume > 1.0F ? 16.0F * volume : 16.0D, this.world, packet); // Paper - this.world.dimension -> this.world - } - - public String getGameRuleValue(String rule) { --- -2.18.0 - diff --git a/Spigot-Server-Patches/0355-isChunkGenerated-API.patch b/Spigot-Server-Patches/0355-isChunkGenerated-API.patch new file mode 100644 index 0000000000..10b0ae93d4 --- /dev/null +++ b/Spigot-Server-Patches/0355-isChunkGenerated-API.patch @@ -0,0 +1,44 @@ +From 7746107816c3e6e29f7c5175591ce4642c35949f Mon Sep 17 00:00:00 2001 +From: cswhite2000 <18whitechristop@gmail.com> +Date: Tue, 21 Aug 2018 19:44:10 -0700 +Subject: [PATCH] isChunkGenerated API + +Resolves #1329 + +diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java +index 0eba3df5..ad548590 100644 +--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +@@ -85,6 +85,12 @@ public class ChunkProviderServer implements IChunkProvider { + + } + ++ // Paper start ++ public boolean isChunkGenerated(int x, int z) { ++ return this.chunks.containsKey(ChunkCoordIntPair.asLong(x, z)) || this.chunkLoader.chunkExists(x, z); ++ } ++ // Paper end ++ + @Nullable + public Chunk getLoadedChunkAt(int i, int j) { + long k = ChunkCoordIntPair.a(i, j); +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +index 567e9acb..afb141c6 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +@@ -630,6 +630,12 @@ public class CraftWorld implements World { + return getChunkAt(location.getBlockX() >> 4, location.getBlockZ() >> 4); + } + ++ // Paper start ++ public boolean isChunkGenerated(int x, int z) { ++ return this.getHandle().getChunkProviderServer().isChunkGenerated(x, z); ++ } ++ // Paper end ++ + public ChunkGenerator getGenerator() { + return generator; + } +-- +2.19.1 + diff --git a/Spigot-Server-Patches/0356-Add-source-block-to-BlockPhysicsEvent.patch b/Spigot-Server-Patches/0356-Add-source-block-to-BlockPhysicsEvent.patch new file mode 100644 index 0000000000..8190c88c82 --- /dev/null +++ b/Spigot-Server-Patches/0356-Add-source-block-to-BlockPhysicsEvent.patch @@ -0,0 +1,22 @@ +From efd444d51f821d324f1aaf4c0e5f19ce17067a8b Mon Sep 17 00:00:00 2001 +From: Sotr +Date: Thu, 23 Aug 2018 16:14:12 +0800 +Subject: [PATCH] Add source block to BlockPhysicsEvent + + +diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +index 04d0fa1d..64d75934 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -590,7 +590,7 @@ public abstract class World implements IBlockAccess { + // CraftBukkit start + CraftWorld world = ((WorldServer) this).getWorld(); + if (world != null && !((WorldServer)this).stopPhysicsEvent) { // Paper +- BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftMagicNumbers.getId(block)); ++ BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftMagicNumbers.getId(block), blockposition1.getX(), blockposition1.getY(), blockposition1.getZ()); // Paper - add source block + this.getServer().getPluginManager().callEvent(event); + + if (event.isCancelled()) { +-- +2.19.1 + diff --git a/Spigot-Server-Patches/0356-Improve-death-events.patch b/Spigot-Server-Patches/0356-Improve-death-events.patch deleted file mode 100644 index 47ab426e8b..0000000000 --- a/Spigot-Server-Patches/0356-Improve-death-events.patch +++ /dev/null @@ -1,417 +0,0 @@ -From 61dddacb42c358d24f53ae3a28e5a49eca53d271 Mon Sep 17 00:00:00 2001 -From: Phoenix616 -Date: Tue, 21 Aug 2018 01:39:35 +0100 -Subject: [PATCH] Improve death events - -This adds the ability to cancel the death events and to modify the sound -an entity makes when dying. (In cases were no sound should it will be -called with shouldPlaySound set to false allowing unsilencing of silent -entities) - -It makes handling of entity deaths a lot nicer as you no longer need -to listen on the damage event and calculate if the entity dies yourself -to cancel the death which has the benefit of also receiving the dropped -items and experience which is otherwise only properly possible by using -internal code. - -diff --git a/src/main/java/net/minecraft/server/CombatTracker.java b/src/main/java/net/minecraft/server/CombatTracker.java -index 7a076f3e4..bddd66e79 100644 ---- a/src/main/java/net/minecraft/server/CombatTracker.java -+++ b/src/main/java/net/minecraft/server/CombatTracker.java -@@ -175,6 +175,7 @@ public class CombatTracker { - this.h = null; - } - -+ public void reset() { this.g(); } // Paper - OBFHELPER - public void g() { - int i = this.f ? 300 : 100; - -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index b0b49f4ff..d0dcce945 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1471,6 +1471,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper - return false; - } - -+ public void runKillTrigger(Entity entity, int kills, DamageSource damageSource) { this.a(entity, kills, damageSource); } // Paper - OBFHELPER - public void a(Entity entity, int i, DamageSource damagesource) { - if (entity instanceof EntityPlayer) { - CriterionTriggers.c.a((EntityPlayer) entity, this, damagesource); -@@ -2267,6 +2268,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper - - } - -+ public void onKill(EntityLiving entityLiving) { this.b(entityLiving); } // Paper - OBFHELPER - public void b(EntityLiving entityliving) {} - - protected boolean i(double d0, double d1, double d2) { -@@ -2965,6 +2967,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper - return EnumPistonReaction.NORMAL; - } - -+ public SoundCategory getDeathSoundCategory() { return bK();} // Paper - OBFHELPER - public SoundCategory bK() { - return SoundCategory.NEUTRAL; - } -diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java -index dca497072..454c1e7d0 100644 ---- a/src/main/java/net/minecraft/server/EntityArmorStand.java -+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java -@@ -641,7 +641,8 @@ public class EntityArmorStand extends EntityLiving { - } - - public void killEntity() { -- org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, drops); // CraftBukkit - call event -+ org.bukkit.event.entity.EntityDeathEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, drops); // CraftBukkit - call event // Paper - make cancellable -+ if (event.isCancelled()) return; // Paper - make cancellable - this.die(); - } - -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 14637be49..5ccd3ea6f 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -75,14 +75,14 @@ public abstract class EntityLiving extends Entity { - public float aR; - public EntityHuman killer; - public int lastDamageByPlayerTime; // Paper - public -- protected boolean aU; -+ protected boolean aU; protected void setDying(boolean dying) { this.aU = dying; } protected boolean isDying() { return this.aU; } // Paper - OBFHELPER - protected int ticksFarFromPlayer; - protected float aW; - protected float aX; - protected float aY; - protected float aZ; - protected float ba; -- protected int bb; -+ protected int bb; protected int getKillCount() { return this.bb; } // Paper - OBFHELPER - public float lastDamage; - protected boolean bd; - public float be; -@@ -117,6 +117,7 @@ public abstract class EntityLiving extends Entity { - public org.bukkit.craftbukkit.attribute.CraftAttributeMap craftAttributes; - public boolean collides = true; - public boolean canPickUpLoot; -+ public boolean silentDeath = false; // Paper - mark entity as dying silently for cancellable death event - - @Override - public float getBukkitYaw() { -@@ -970,13 +971,17 @@ public abstract class EntityLiving extends Entity { - - if (this.getHealth() <= 0.0F) { - if (!this.e(damagesource)) { -- SoundEffect soundeffect = this.cf(); -+ // Paper start - moved into CraftEventFactory event caller for cancellable death event -+ //SoundEffect soundeffect = this.cf(); - -- if (flag1 && soundeffect != null) { -- this.a(soundeffect, this.cq(), this.cr()); -- } -+ //if (flag1 && soundeffect != null) { -+ // this.a(soundeffect, this.cq(), this.cr()); -+ //} -+ this.silentDeath = !flag1; // mark entity as dying silently -+ // Paper end - - this.die(damagesource); -+ this.silentDeath = false; // Paper - cancellable death event - reset to default - } - } else if (flag1) { - this.c(damagesource); -@@ -1114,16 +1119,20 @@ public abstract class EntityLiving extends Entity { - Entity entity = damagesource.getEntity(); - EntityLiving entityliving = this.ci(); - -- if (this.bb >= 0 && entityliving != null) { -- entityliving.a(this, this.bb, damagesource); -- } -+ // Paper start - move down to make death event cancellable -+ //if (this.bb >= 0 && entityliving != null) { -+ // entityliving.a(this, this.bb, damagesource); -+ //} - -- if (entity != null) { -- entity.b(this); -- } -+ //if (entity != null) { -+ // entity.b(this); -+ //} - -- this.aU = true; -- this.getCombatTracker().g(); -+ this.aU = true; // Paper - Always set at start, unset later if cancelled - GH-1432 -+ //this.getCombatTracker().g(); -+ -+ org.bukkit.event.entity.EntityDeathEvent deathEvent = null; -+ //Paper end - if (!this.world.isClientSide) { - int i = 0; - -@@ -1136,15 +1145,33 @@ public abstract class EntityLiving extends Entity { - - this.a(flag, i, damagesource); - // CraftBukkit start - Call death event -- CraftEventFactory.callEntityDeathEvent(this, this.drops); -+ deathEvent = CraftEventFactory.callEntityDeathEvent(this, this.drops); // Paper - cancellable death event - this.drops = new ArrayList(); - } else { -- CraftEventFactory.callEntityDeathEvent(this); -+ deathEvent = CraftEventFactory.callEntityDeathEvent(this); // Paper - cancellable death event - // CraftBukkit end - } - } - -- this.world.broadcastEntityEffect(this, (byte) 3); -+ // Paper start - cancellable death event -+ if (deathEvent == null || !deathEvent.isCancelled()) { -+ // triggers and stats got moved down -+ if (this.getKillCount() >= 0 && entityliving != null) { -+ entityliving.runKillTrigger(this, this.getKillCount(), damagesource); -+ } -+ -+ if (entity != null) { -+ entity.onKill(this); -+ } -+ -+ this.getCombatTracker().reset(); -+ this.setDying(true); -+ this.world.broadcastEntityEffect(this, (byte) 3); -+ } else { -+ this.setDying(false); // Paper - reset if cancelled -+ this.setHealth((float) deathEvent.getReviveHealth()); -+ } -+ // Paper end - } - } - -@@ -1198,6 +1225,7 @@ public abstract class EntityLiving extends Entity { - return SoundEffects.bX; - } - -+ @Nullable public SoundEffect getDeathSoundEffect() { return cf();} // Paper - OBFHELPER - @Nullable - protected SoundEffect cf() { - return SoundEffects.bS; -@@ -1583,10 +1611,12 @@ public abstract class EntityLiving extends Entity { - - } - -+ public float getDeathSoundVolume() { return cq();} // Paper - OBFHELPER - protected float cq() { - return 1.0F; - } - -+ public float getDeathSoundPitch() { return cr();} // Paper - OBFHELPER - protected float cr() { - return this.isBaby() ? (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.5F : (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F; - } -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 4ff505cfa..6afb6cf7b 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -79,6 +79,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - } - // Paper end - private int containerUpdateDelay; // Paper -+ // Paper start - cancellable death event -+ public boolean queueHealthUpdatePacket = false; -+ public net.minecraft.server.PacketPlayOutUpdateHealth queuedHealthUpdatePacket; -+ // Paper end - - // CraftBukkit start - public String displayName; -@@ -436,9 +440,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - public void die(DamageSource damagesource) { - boolean flag = this.world.getGameRules().getBoolean("showDeathMessages"); - -- this.playerConnection.sendPacket(new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, flag)); -+ //this.playerConnection.sendPacket(new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, flag)); // Paper - moved down for cancellable death event - // CraftBukkit start - fire PlayerDeathEvent - if (this.dead) { -+ this.playerConnection.sendPacket(new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, flag)); // Paper - moved down for cancellable death event - return; - } - java.util.List loot = new java.util.ArrayList(this.inventory.getSize()); -@@ -456,6 +461,16 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - - String deathmessage = chatmessage.toPlainText(); - org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, deathmessage, keepInventory); -+ // Paper start - cancellable death event -+ if (event.isCancelled()) { -+ // make compatible with plugins that might have already set the health in an event listener -+ if (this.getHealth() <= 0) { -+ this.setHealth((float) event.getReviveHealth()); -+ } -+ return; -+ } -+ this.playerConnection.sendPacket(new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, flag)); -+ // Paper end - - String deathMessage = event.getDeathMessage(); - -@@ -608,8 +623,17 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - } - } - } -- -- return super.damageEntity(damagesource, f); -+ // Paper start - cancellable death events -+ //return super.damageEntity(damagesource, f); -+ this.queueHealthUpdatePacket = true; -+ boolean damaged = super.damageEntity(damagesource, f); -+ this.queueHealthUpdatePacket = false; -+ if (this.queuedHealthUpdatePacket != null) { -+ this.playerConnection.sendPacket(this.queuedHealthUpdatePacket); -+ this.queuedHealthUpdatePacket = null; -+ } -+ return damaged; -+ // Paper end - } - } - } -diff --git a/src/main/java/net/minecraft/server/RegistryMaterials.java b/src/main/java/net/minecraft/server/RegistryMaterials.java -index d26abb419..aaedbc3b7 100644 ---- a/src/main/java/net/minecraft/server/RegistryMaterials.java -+++ b/src/main/java/net/minecraft/server/RegistryMaterials.java -@@ -29,6 +29,7 @@ public class RegistryMaterials extends RegistrySimple implements Reg - return super.get(k0); - } - -+ @Nullable public K getByValue(V value) { return this.b(value); } // Paper - OBFHELPER - @Nullable - public K b(V v0) { - return this.b.get(v0); -diff --git a/src/main/java/net/minecraft/server/SoundEffect.java b/src/main/java/net/minecraft/server/SoundEffect.java -index ec37e237f..8e0da7bd7 100644 ---- a/src/main/java/net/minecraft/server/SoundEffect.java -+++ b/src/main/java/net/minecraft/server/SoundEffect.java -@@ -2,7 +2,7 @@ package net.minecraft.server; - - public class SoundEffect { - -- public static final RegistryMaterials a = new RegistryMaterials(); -+ public static final RegistryMaterials a = new RegistryMaterials(); public static RegistryMaterials getRegistry() { return a; }// Paper - OBFHELPER - private final MinecraftKey b; - private static int c; - -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftSound.java b/src/main/java/org/bukkit/craftbukkit/CraftSound.java -index 8871c6f3a..84f4cb91e 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftSound.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftSound.java -@@ -560,6 +560,22 @@ public enum CraftSound { - WEATHER_RAIN_ABOVE("weather.rain.above"); - private final String minecraftKey; - -+ // Paper start - cancellable death event -+ public static CraftSound getBySoundEffect(final SoundEffect effect) { -+ MinecraftKey key = SoundEffect.getRegistry().getByValue(effect); -+ Preconditions.checkArgument(key != null, "Key for sound effect %s not found?", effect.toString()); -+ -+ return valueOf(key.getKey().replace('.', '_').toUpperCase(java.util.Locale.ENGLISH)); -+ } -+ -+ public static Sound getSoundByEffect(final SoundEffect effect) { -+ return Sound.valueOf(getBySoundEffect(effect).name()); -+ } -+ -+ public static SoundEffect getSoundEffect(final Sound sound) { -+ return getSoundEffect(getSound(sound)); -+ } -+ // Paper end - CraftSound(String minecraftKey) { - this.minecraftKey = minecraftKey; - } -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 5f480ac06..d59d86efc 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1612,7 +1612,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - } - - public void sendHealthUpdate() { -- getHandle().playerConnection.sendPacket(new PacketPlayOutUpdateHealth(getScaledHealth(), getHandle().getFoodData().getFoodLevel(), getHandle().getFoodData().getSaturationLevel())); -+ // Paper start - cancellable death event -+ //getHandle().playerConnection.sendPacket(new PacketPlayOutUpdateHealth(getScaledHealth(), getHandle().getFoodData().getFoodLevel(), getHandle().getFoodData().getSaturationLevel())); -+ PacketPlayOutUpdateHealth packet = new PacketPlayOutUpdateHealth(getScaledHealth(), getHandle().getFoodData().getFoodLevel(), getHandle().getFoodData().getSaturationLevel()); -+ if (this.getHandle().queueHealthUpdatePacket) { -+ this.getHandle().queuedHealthUpdatePacket = packet; -+ } else { -+ this.getHandle().playerConnection.sendPacket(packet); -+ } -+ // Paper end - } - - public void injectScaledMaxHealth(Collection collection, boolean force) { -diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index cce4acc0b..f1a3ca950 100644 ---- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -392,9 +392,16 @@ public class CraftEventFactory { - public static EntityDeathEvent callEntityDeathEvent(EntityLiving victim, List drops) { - CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity(); - EntityDeathEvent event = new EntityDeathEvent(entity, drops, victim.getExpReward()); -+ populateFields(victim, event); // Paper - make cancellable - CraftWorld world = (CraftWorld) entity.getWorld(); - Bukkit.getServer().getPluginManager().callEvent(event); - -+ // Paper start - make cancellable -+ if (event.isCancelled()) { -+ return event; -+ } -+ playDeathSound(victim, event); -+ // Paper end - victim.expToDrop = event.getDroppedExp(); - - for (org.bukkit.inventory.ItemStack stack : event.getDrops()) { -@@ -410,8 +417,15 @@ public class CraftEventFactory { - CraftPlayer entity = victim.getBukkitEntity(); - PlayerDeathEvent event = new PlayerDeathEvent(entity, drops, victim.getExpReward(), 0, deathMessage); - event.setKeepInventory(keepInventory); -+ populateFields(victim, event); // Paper - make cancellable - org.bukkit.World world = entity.getWorld(); - Bukkit.getServer().getPluginManager().callEvent(event); -+ // Paper start - make cancellable -+ if (event.isCancelled()) { -+ return event; -+ } -+ playDeathSound(victim, event); -+ // Paper end - - victim.keepLevel = event.getKeepLevel(); - victim.newLevel = event.getNewLevel(); -@@ -432,6 +446,31 @@ public class CraftEventFactory { - return event; - } - -+ // Paper start - helper methods for making death event cancellable -+ // Add information to death event -+ private static void populateFields(EntityLiving victim, EntityDeathEvent event) { -+ event.setReviveHealth(event.getEntity().getAttribute(org.bukkit.attribute.Attribute.GENERIC_MAX_HEALTH).getValue()); -+ event.setShouldPlayDeathSound(!victim.silentDeath && !victim.isSilent()); -+ SoundEffect soundEffect = victim.getDeathSoundEffect(); -+ event.setDeathSound(soundEffect != null ? org.bukkit.craftbukkit.CraftSound.getSoundByEffect(soundEffect) : null); -+ event.setDeathSoundCategory(org.bukkit.SoundCategory.valueOf(victim.getDeathSoundCategory().name())); -+ event.setDeathSoundVolume(victim.getDeathSoundVolume()); -+ event.setDeathSoundPitch(victim.getDeathSoundPitch()); -+ } -+ -+ // Play death sound manually -+ private static void playDeathSound(EntityLiving victim, EntityDeathEvent event) { -+ if (event.shouldPlayDeathSound() && event.getDeathSound() != null && event.getDeathSoundCategory() != null) { -+ EntityHuman source = victim instanceof EntityHuman ? (EntityHuman) victim : null; -+ double x = event.getEntity().getLocation().getX(); -+ double y = event.getEntity().getLocation().getY(); -+ double z = event.getEntity().getLocation().getZ(); -+ SoundEffect soundEffect = org.bukkit.craftbukkit.CraftSound.getSoundEffect(event.getDeathSound()); -+ SoundCategory soundCategory = SoundCategory.valueOf(event.getDeathSoundCategory().name()); -+ victim.world.sendSoundEffect(source, x, y, z, soundEffect, soundCategory, event.getDeathSoundVolume(), event.getDeathSoundPitch()); -+ } -+ } -+ // Paper end - /** - * Server methods - */ --- -2.19.0 - diff --git a/Spigot-Server-Patches/0357-Optimize-Region-File-Cache.patch b/Spigot-Server-Patches/0357-Optimize-Region-File-Cache.patch new file mode 100644 index 0000000000..9ba5b81e53 --- /dev/null +++ b/Spigot-Server-Patches/0357-Optimize-Region-File-Cache.patch @@ -0,0 +1,67 @@ +From 7ee8a85aea5d25dfa91eaf98b66a3243e414c250 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Mon, 23 Jul 2018 23:40:04 -0400 +Subject: [PATCH] Optimize Region File Cache + +CraftBukkit added synchronization to read and write methods. This adds +much more contention on this object for accessing region files, as +the entire read and write of NBT data is now a blocking operation. + +This causes issues when something then simply needs to check if a chunk exists +on the main thread, causing a block... + +However, this synchronization was unnecessary, because there is already +enough synchronization done to keep things safe + +1) Obtaining a Region File: Those methods are still static synchronized. + Meaning we can safely obtain a Region File concurrently. + +2) RegionFile data access: Methods reading and manipulating data from + a region file are also marked synchronized, ensuring that no 2 processes + are reading or writing data at the same time. + +3) Checking a region file for chunkExists: getOffset is also synchronized + ensuring that even if a chunk is currently being written, it will be safe. + +By removing these synchronizations, we reduce the locking to only +when data is being write or read. + +GZIP compression and NBT Buffer creation will no longer be part of the +synchronized context, reducing lock times. + +Ultimately: This brings us back to Vanilla, which has had no indication of region file loss. + +diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java +index 7e756580..15a09ab3 100644 +--- a/src/main/java/net/minecraft/server/RegionFileCache.java ++++ b/src/main/java/net/minecraft/server/RegionFileCache.java +@@ -95,7 +95,7 @@ public class RegionFileCache { + } + + // CraftBukkit start - call sites hoisted for synchronization +- public static synchronized NBTTagCompound d(File file, int i, int j) throws IOException { ++ public static NBTTagCompound d(File file, int i, int j) throws IOException { // Paper - remove synchronization + RegionFile regionfile = a(file, i, j); + + DataInputStream datainputstream = regionfile.a(i & 31, j & 31); +@@ -107,7 +107,7 @@ public class RegionFileCache { + return NBTCompressedStreamTools.a(datainputstream); + } + +- public static synchronized void e(File file, int i, int j, NBTTagCompound nbttagcompound) throws IOException { ++ public static void e(File file, int i, int j, NBTTagCompound nbttagcompound) throws IOException { // Paper - remove synchronization + RegionFile regionfile = a(file, i, j); + + DataOutputStream dataoutputstream = regionfile.b(i & 31, j & 31); +@@ -116,7 +116,7 @@ public class RegionFileCache { + } + // CraftBukkit end + +- public static synchronized boolean chunkExists(File file, int i, int j) { ++ public static boolean chunkExists(File file, int i, int j) { // Paper - remove synchronization + RegionFile regionfile = b(file, i, j); + + return regionfile != null ? regionfile.c(i & 31, j & 31) : false; +-- +2.19.1 + diff --git a/Spigot-Server-Patches/0357-isChunkGenerated-API.patch b/Spigot-Server-Patches/0357-isChunkGenerated-API.patch deleted file mode 100644 index 777c6e4b9c..0000000000 --- a/Spigot-Server-Patches/0357-isChunkGenerated-API.patch +++ /dev/null @@ -1,44 +0,0 @@ -From a1591adb339b39f104073b0e8c1294671a2ebf25 Mon Sep 17 00:00:00 2001 -From: cswhite2000 <18whitechristop@gmail.com> -Date: Tue, 21 Aug 2018 19:44:10 -0700 -Subject: [PATCH] isChunkGenerated API - -Resolves #1329 - -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 0eba3df571..ad5485908d 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -85,6 +85,12 @@ public class ChunkProviderServer implements IChunkProvider { - - } - -+ // Paper start -+ public boolean isChunkGenerated(int x, int z) { -+ return this.chunks.containsKey(ChunkCoordIntPair.asLong(x, z)) || this.chunkLoader.chunkExists(x, z); -+ } -+ // Paper end -+ - @Nullable - public Chunk getLoadedChunkAt(int i, int j) { - long k = ChunkCoordIntPair.a(i, j); -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 567e9acb13..afb141c629 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -630,6 +630,12 @@ public class CraftWorld implements World { - return getChunkAt(location.getBlockX() >> 4, location.getBlockZ() >> 4); - } - -+ // Paper start -+ public boolean isChunkGenerated(int x, int z) { -+ return this.getHandle().getChunkProviderServer().isChunkGenerated(x, z); -+ } -+ // Paper end -+ - public ChunkGenerator getGenerator() { - return generator; - } --- -2.18.0 - diff --git a/Spigot-Server-Patches/0358-Add-source-block-to-BlockPhysicsEvent.patch b/Spigot-Server-Patches/0358-Add-source-block-to-BlockPhysicsEvent.patch deleted file mode 100644 index 8ba29fedcc..0000000000 --- a/Spigot-Server-Patches/0358-Add-source-block-to-BlockPhysicsEvent.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 1f57f866821be74be996417e22f59eb70b77df8a Mon Sep 17 00:00:00 2001 -From: Sotr -Date: Thu, 23 Aug 2018 16:14:12 +0800 -Subject: [PATCH] Add source block to BlockPhysicsEvent - - -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 04d0fa1df9..64d75934bc 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -590,7 +590,7 @@ public abstract class World implements IBlockAccess { - // CraftBukkit start - CraftWorld world = ((WorldServer) this).getWorld(); - if (world != null && !((WorldServer)this).stopPhysicsEvent) { // Paper -- BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftMagicNumbers.getId(block)); -+ BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftMagicNumbers.getId(block), blockposition1.getX(), blockposition1.getY(), blockposition1.getZ()); // Paper - add source block - this.getServer().getPluginManager().callEvent(event); - - if (event.isCancelled()) { --- -2.18.0 - diff --git a/Spigot-Server-Patches/0358-Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch b/Spigot-Server-Patches/0358-Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch new file mode 100644 index 0000000000..32c0b2599f --- /dev/null +++ b/Spigot-Server-Patches/0358-Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch @@ -0,0 +1,44 @@ +From c7d283d94f373fb0890e9cef9185cd0b79a95cc0 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Thu, 27 Sep 2018 23:46:03 -0400 +Subject: [PATCH] Fix issues with entity loss due to unloaded chunks + +Vanilla has risk of losing entities by causing them to be +removed from all chunks if they try to move into an unloaded chunk. + +This pretty much means high chance this entity will be lost in this scenario. + +There is another case that adding an enttiy to the world can fail if +the chunk isn't loaded. + +Lots of the server is designed around addEntity never expecting to fail for these reasons, +nor is it really logical. + +This change ensures the chunks are always loaded when entities are +added to the world, or a valid entity moves between chunks. + +diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +index 64d75934..bcbdadbd 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -1181,7 +1181,7 @@ public abstract class World implements IBlockAccess { + + int i = MathHelper.floor(entity.locX / 16.0D); + int j = MathHelper.floor(entity.locZ / 16.0D); +- boolean flag = entity.attachedToPlayer; ++ boolean flag = true; // Paper - always load chunks + + // Paper start - Set origin location when the entity is being added to the world + if (entity.origin == null) { +@@ -1826,7 +1826,7 @@ public abstract class World implements IBlockAccess { + this.getChunkAt(entity.ab, entity.ad).a(entity, entity.ac); + } + +- if (!entity.bD() && !this.isChunkLoaded(i, k, true)) { ++ if (!entity.valid && !entity.bD() && !this.isChunkLoaded(i, k, true)) { // Paper - always load to new chunk if valid + entity.aa = false; + } else { + this.getChunkAt(i, k).a(entity); +-- +2.19.1 + diff --git a/Spigot-Server-Patches/0359-Backport-Village-Door-fix-from-1.13.patch b/Spigot-Server-Patches/0359-Backport-Village-Door-fix-from-1.13.patch new file mode 100644 index 0000000000..7a0414a8a2 --- /dev/null +++ b/Spigot-Server-Patches/0359-Backport-Village-Door-fix-from-1.13.patch @@ -0,0 +1,48 @@ +From b9d9bdcfe732d18f11e991dbe6cd98b901fa2889 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sat, 29 Sep 2018 12:13:23 -0400 +Subject: [PATCH] Backport Village Door fix from 1.13 + + +diff --git a/src/main/java/net/minecraft/server/Village.java b/src/main/java/net/minecraft/server/Village.java +index 9f1867dd..6536e5fb 100644 +--- a/src/main/java/net/minecraft/server/Village.java ++++ b/src/main/java/net/minecraft/server/Village.java +@@ -14,7 +14,7 @@ public class Village { + private World a; + private final List b = Lists.newArrayList(); + private BlockPosition c; +- private BlockPosition d; ++ private BlockPosition d; private BlockPosition getCenter() { return d; } // Paper - OBFHELPER + private int e; + private int f; + private int g; +@@ -44,6 +44,12 @@ public class Village { + } + + public void a(int i) { ++ // Paper - don't tick village if chunk isn't loaded ++ Chunk chunk = this.a.getChunkIfLoaded(getCenter()); ++ if (chunk == null || !chunk.areNeighborsLoaded(1)) { ++ return; ++ } ++ // Paper end + this.g = i; + this.m(); + this.l(); +@@ -307,6 +313,12 @@ public class Village { + + while (iterator.hasNext()) { + VillageDoor villagedoor = (VillageDoor) iterator.next(); ++ // Paper start- don't remove doors from unloaded chunks ++ if (!this.a.isLoaded(villagedoor.d())) { ++ villagedoor.a(villagedoor.h() + 1); ++ continue; ++ } ++ // Paper end + + if (flag1) { + villagedoor.a(); +-- +2.19.1 + diff --git a/Spigot-Server-Patches/0359-Optimize-Region-File-Cache.patch b/Spigot-Server-Patches/0359-Optimize-Region-File-Cache.patch deleted file mode 100644 index 435e9f87ab..0000000000 --- a/Spigot-Server-Patches/0359-Optimize-Region-File-Cache.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 0ac08bd946937912a9903ff03232a5a26518e58a Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Mon, 23 Jul 2018 23:40:04 -0400 -Subject: [PATCH] Optimize Region File Cache - -CraftBukkit added synchronization to read and write methods. This adds -much more contention on this object for accessing region files, as -the entire read and write of NBT data is now a blocking operation. - -This causes issues when something then simply needs to check if a chunk exists -on the main thread, causing a block... - -However, this synchronization was unnecessary, because there is already -enough synchronization done to keep things safe - -1) Obtaining a Region File: Those methods are still static synchronized. - Meaning we can safely obtain a Region File concurrently. - -2) RegionFile data access: Methods reading and manipulating data from - a region file are also marked synchronized, ensuring that no 2 processes - are reading or writing data at the same time. - -3) Checking a region file for chunkExists: getOffset is also synchronized - ensuring that even if a chunk is currently being written, it will be safe. - -By removing these synchronizations, we reduce the locking to only -when data is being write or read. - -GZIP compression and NBT Buffer creation will no longer be part of the -synchronized context, reducing lock times. - -Ultimately: This brings us back to Vanilla, which has had no indication of region file loss. - -diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java -index 7e75658076..15a09ab360 100644 ---- a/src/main/java/net/minecraft/server/RegionFileCache.java -+++ b/src/main/java/net/minecraft/server/RegionFileCache.java -@@ -95,7 +95,7 @@ public class RegionFileCache { - } - - // CraftBukkit start - call sites hoisted for synchronization -- public static synchronized NBTTagCompound d(File file, int i, int j) throws IOException { -+ public static NBTTagCompound d(File file, int i, int j) throws IOException { // Paper - remove synchronization - RegionFile regionfile = a(file, i, j); - - DataInputStream datainputstream = regionfile.a(i & 31, j & 31); -@@ -107,7 +107,7 @@ public class RegionFileCache { - return NBTCompressedStreamTools.a(datainputstream); - } - -- public static synchronized void e(File file, int i, int j, NBTTagCompound nbttagcompound) throws IOException { -+ public static void e(File file, int i, int j, NBTTagCompound nbttagcompound) throws IOException { // Paper - remove synchronization - RegionFile regionfile = a(file, i, j); - - DataOutputStream dataoutputstream = regionfile.b(i & 31, j & 31); -@@ -116,7 +116,7 @@ public class RegionFileCache { - } - // CraftBukkit end - -- public static synchronized boolean chunkExists(File file, int i, int j) { -+ public static boolean chunkExists(File file, int i, int j) { // Paper - remove synchronization - RegionFile regionfile = b(file, i, j); - - return regionfile != null ? regionfile.c(i & 31, j & 31) : false; --- -2.19.0 - diff --git a/Spigot-Server-Patches/0360-Backport-light-queue-changes-from-1.13.patch b/Spigot-Server-Patches/0360-Backport-light-queue-changes-from-1.13.patch new file mode 100644 index 0000000000..6c00014bce --- /dev/null +++ b/Spigot-Server-Patches/0360-Backport-light-queue-changes-from-1.13.patch @@ -0,0 +1,111 @@ +From bb903acf7693529a64663a38dbf589ca324f0677 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sun, 23 Sep 2018 20:44:52 -0400 +Subject: [PATCH] Backport light queue changes from 1.13 + + +diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +index 523d10e8..6541f5af 100644 +--- a/src/main/java/net/minecraft/server/Chunk.java ++++ b/src/main/java/net/minecraft/server/Chunk.java +@@ -274,14 +274,7 @@ public class Chunk { + + private void h(boolean flag) { + this.world.methodProfiler.a("recheckGaps"); +- if (this.world.areChunksLoaded(new BlockPosition(this.locX * 16 + 8, 0, this.locZ * 16 + 8), 16)) { +- this.runOrQueueLightUpdate(() -> recheckGaps(flag)); // Paper - Queue light update +- } +- } +- +- private void recheckGaps(boolean flag) { +- if (true) { +- // Paper end ++ if (this.areNeighborsLoaded(1)) { // Paper + for (int i = 0; i < 16; ++i) { + for (int j = 0; j < 16; ++j) { + if (this.i[i + j * 16]) { +@@ -332,7 +325,7 @@ public class Chunk { + } + + private void a(int i, int j, int k, int l) { +- if (l > k && this.world.areChunksLoaded(new BlockPosition(i, 0, j), 16)) { ++ if (l > k && this.areNeighborsLoaded(1)) { // Paper + for (int i1 = k; i1 < l; ++i1) { + this.world.c(EnumSkyBlock.SKY, new BlockPosition(i, i1, j)); + } +diff --git a/src/main/java/net/minecraft/server/PaperLightingQueue.java b/src/main/java/net/minecraft/server/PaperLightingQueue.java +index 345cd582..f1c01311 100644 +--- a/src/main/java/net/minecraft/server/PaperLightingQueue.java ++++ b/src/main/java/net/minecraft/server/PaperLightingQueue.java +@@ -6,16 +6,16 @@ import it.unimi.dsi.fastutil.objects.ObjectCollection; + import java.util.ArrayDeque; + + class PaperLightingQueue { +- private static final long MAX_TIME = (long) (1000000000 / 20 * .95); +- private static int updatesThisTick; +- ++ private static final long MAX_TIME = (long) (1000000000 / 20 * 1.15); + + static void processQueue(long curTime) { +- updatesThisTick = 0; +- + final long startTime = System.nanoTime(); + final long maxTickTime = MAX_TIME - (startTime - curTime); + ++ if (maxTickTime <= 0) { ++ return; ++ } ++ + START: + for (World world : MinecraftServer.getServer().worlds) { + if (!world.paperConfig.queueLightUpdates) { +@@ -23,7 +23,7 @@ class PaperLightingQueue { + } + + ObjectCollection loadedChunks = ((WorldServer) world).getChunkProviderServer().chunks.values(); +- for (Chunk chunk : loadedChunks.toArray(new Chunk[loadedChunks.size()])) { ++ for (Chunk chunk : loadedChunks.toArray(new Chunk[0])) { + if (chunk.lightingQueue.processQueue(startTime, maxTickTime)) { + break START; + } +@@ -50,14 +50,15 @@ class PaperLightingQueue { + if (this.isEmpty()) { + return false; + } ++ if (isOutOfTime(maxTickTime, startTime)) { ++ return true; ++ } + try (Timing ignored = chunk.world.timings.lightingQueueTimer.startTiming()) { + Runnable lightUpdate; + while ((lightUpdate = this.poll()) != null) { + lightUpdate.run(); +- if (startTime > 0 && ++PaperLightingQueue.updatesThisTick % 10 == 0 && PaperLightingQueue.updatesThisTick > 10) { +- if (System.nanoTime() - startTime > maxTickTime) { +- return true; +- } ++ if (isOutOfTime(maxTickTime, startTime)) { ++ return true; + } + } + } +@@ -74,7 +75,7 @@ class PaperLightingQueue { + } + processQueue(0, 0); // No timeout + +- final int radius = 1; // TODO: bitflip, why should this ever be 2? ++ final int radius = 1; + for (int x = chunk.locX - radius; x <= chunk.locX + radius; ++x) { + for (int z = chunk.locZ - radius; z <= chunk.locZ + radius; ++z) { + if (x == chunk.locX && z == chunk.locZ) { +@@ -89,4 +90,8 @@ class PaperLightingQueue { + } + } + } ++ ++ private static boolean isOutOfTime(long maxTickTime, long startTime) { ++ return startTime > 0 && System.nanoTime() - startTime > maxTickTime; ++ } + } +-- +2.19.1 + diff --git a/Spigot-Server-Patches/0360-Sync-Player-Position-to-Vehicles.patch b/Spigot-Server-Patches/0360-Sync-Player-Position-to-Vehicles.patch deleted file mode 100644 index 4fe554e2da..0000000000 --- a/Spigot-Server-Patches/0360-Sync-Player-Position-to-Vehicles.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 74bfd7a72f4d6b73add1f237f013a9ef70a19e3c Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Fri, 21 Sep 2018 11:34:00 -0400 -Subject: [PATCH] Sync Player Position to Vehicles - -Player Positions could become desynced with their vehicle resulting -in chunk conflicts about which chunk the entity should really be in. - -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 7b12d17a4c..1ad6b45196 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -374,10 +374,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { - } - - entity.setLocation(d3, d4, d5, f, f1); -+ Location curPos = getPlayer().getLocation(); // Paper -+ player.setLocation(d3, d4, d5, f, f1); // Paper - boolean flag2 = worldserver.getCubes(entity, entity.getBoundingBox().shrink(0.0625D)).isEmpty(); - - if (flag && (flag1 || !flag2)) { - entity.setLocation(d0, d1, d2, f, f1); -+ player.setLocation(d0, d1, d2, f, f1); // Paper - this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity)); - return; - } -@@ -387,7 +390,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { - // Spigot Start - if ( !hasMoved ) - { -- Location curPos = player.getLocation(); -+ //Location curPos = player.getLocation(); // Paper - move up - lastPosX = curPos.getX(); - lastPosY = curPos.getY(); - lastPosZ = curPos.getZ(); --- -2.19.0 - diff --git a/Spigot-Server-Patches/0361-Backport-Water-Activation-Range.patch b/Spigot-Server-Patches/0361-Backport-Water-Activation-Range.patch new file mode 100644 index 0000000000..0a7fd8e990 --- /dev/null +++ b/Spigot-Server-Patches/0361-Backport-Water-Activation-Range.patch @@ -0,0 +1,130 @@ +From f3a8522fa637866a209e3af4b2c47412008c4b94 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sat, 6 Oct 2018 01:10:21 -0400 +Subject: [PATCH] Backport Water Activation Range + +Adds Entity Activation Range for water mobs +and no longer gives immunity to mobs (squid) that know how to +pathfind in water. + +diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java +index 33ae7389..4c8d94c8 100644 +--- a/src/main/java/org/spigotmc/ActivationRange.java ++++ b/src/main/java/org/spigotmc/ActivationRange.java +@@ -19,6 +19,7 @@ import net.minecraft.server.EntityFallingBlock; + import net.minecraft.server.EntityFireball; + import net.minecraft.server.EntityFireworks; + import net.minecraft.server.EntityHuman; ++import net.minecraft.server.EntityInsentient; + import net.minecraft.server.EntityLiving; + import net.minecraft.server.EntityLlama; + import net.minecraft.server.EntityMonster; +@@ -27,11 +28,13 @@ import net.minecraft.server.EntitySheep; + import net.minecraft.server.EntitySlime; + import net.minecraft.server.EntityTNTPrimed; + import net.minecraft.server.EntityVillager; ++import net.minecraft.server.EntityWaterAnimal; + import net.minecraft.server.EntityWeather; + import net.minecraft.server.EntityWither; + import net.minecraft.server.MCUtil; + import net.minecraft.server.MathHelper; + import net.minecraft.server.MinecraftServer; ++import net.minecraft.server.NavigationGuardian; + import net.minecraft.server.World; + + public class ActivationRange +@@ -40,6 +43,7 @@ public class ActivationRange + static AxisAlignedBB maxBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 ); + static AxisAlignedBB miscBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 ); + static AxisAlignedBB animalBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 ); ++ static AxisAlignedBB waterBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 ); // Paper + static AxisAlignedBB monsterBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 ); + + /** +@@ -51,6 +55,7 @@ public class ActivationRange + */ + public static byte initializeEntityActivationType(Entity entity) + { ++ if (entity instanceof EntityWaterAnimal) { return 4; } // Paper + if ( entity instanceof EntityMonster || entity instanceof EntitySlime ) + { + return 1; // Monster +@@ -75,6 +80,7 @@ public class ActivationRange + if ( ( entity.activationType == 3 && config.miscActivationRange == 0 ) + || ( entity.activationType == 2 && config.animalActivationRange == 0 ) + || ( entity.activationType == 1 && config.monsterActivationRange == 0 ) ++ || ( entity.activationType == 4 && config.waterActivationRange == 0 ) // Paper + || entity instanceof EntityHuman + || entity instanceof EntityProjectile + || entity instanceof EntityEnderDragon +@@ -105,6 +111,7 @@ public class ActivationRange + final int miscActivationRange = world.spigotConfig.miscActivationRange; + final int animalActivationRange = world.spigotConfig.animalActivationRange; + final int monsterActivationRange = world.spigotConfig.monsterActivationRange; ++ final int waterActivationRange = world.spigotConfig.waterActivationRange; // Paper + + int maxRange = Math.max( monsterActivationRange, animalActivationRange ); + maxRange = Math.max( maxRange, miscActivationRange ); +@@ -118,6 +125,7 @@ public class ActivationRange + maxBB = player.getBoundingBox().grow( maxRange, 256, maxRange ); + miscBB = player.getBoundingBox().grow( miscActivationRange, 256, miscActivationRange ); + animalBB = player.getBoundingBox().grow( animalActivationRange, 256, animalActivationRange ); ++ waterBB = player.getBoundingBox().grow( waterActivationRange, 256, waterActivationRange ); // Paper + monsterBB = player.getBoundingBox().grow( monsterActivationRange, 256, monsterActivationRange ); + + int i = MathHelper.floor( maxBB.a / 16.0D ); +@@ -171,6 +179,14 @@ public class ActivationRange + entity.activatedTick = MinecraftServer.currentTick; + } + break; ++ // Paper start ++ case 4: ++ if ( waterBB.c( entity.getBoundingBox() ) ) ++ { ++ entity.activatedTick = MinecraftServer.currentTick; ++ } ++ break; ++ // Paper end + case 3: + default: + if ( miscBB.c( entity.getBoundingBox() ) ) +@@ -192,11 +208,14 @@ public class ActivationRange + */ + public static boolean checkEntityImmunities(Entity entity) + { +- // quick checks. +- if ( entity.inWater || entity.fireTicks > 0 ) +- { ++ // Paper start - optimize Water cases ++ if ((entity.inWater && (!(entity instanceof EntityInsentient) || !(((EntityInsentient) entity).getNavigation() instanceof NavigationGuardian)))) { ++ return true; ++ } ++ if (entity.fireTicks > 0) { + return true; + } ++ // Paper end + if ( !( entity instanceof EntityArrow ) ) + { + if ( !entity.onGround || !entity.passengers.isEmpty() || entity.isPassenger() ) +diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java +index 66c399a2..f872c155 100644 +--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java ++++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java +@@ -144,12 +144,14 @@ public class SpigotWorldConfig + public int animalActivationRange = 32; + public int monsterActivationRange = 32; + public int miscActivationRange = 16; ++ public int waterActivationRange = 16; // Paper + public boolean tickInactiveVillagers = true; + private void activationRange() + { + animalActivationRange = getInt( "entity-activation-range.animals", animalActivationRange ); + monsterActivationRange = getInt( "entity-activation-range.monsters", monsterActivationRange ); + miscActivationRange = getInt( "entity-activation-range.misc", miscActivationRange ); ++ waterActivationRange = getInt( "entity-activation-range.water", waterActivationRange ); // Paper + tickInactiveVillagers = getBoolean( "entity-activation-range.tick-inactive-villagers", tickInactiveVillagers ); + log( "Entity Activation Range: An " + animalActivationRange + " / Mo " + monsterActivationRange + " / Mi " + miscActivationRange + " / Tiv " + tickInactiveVillagers ); + } +-- +2.19.1 + diff --git a/Spigot-Server-Patches/0361-Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch b/Spigot-Server-Patches/0361-Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch deleted file mode 100644 index 9c1e8b502d..0000000000 --- a/Spigot-Server-Patches/0361-Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch +++ /dev/null @@ -1,44 +0,0 @@ -From b322bbfe37599b5e635f2338d81be6e20854ea12 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Thu, 27 Sep 2018 23:46:03 -0400 -Subject: [PATCH] Fix issues with entity loss due to unloaded chunks - -Vanilla has risk of losing entities by causing them to be -removed from all chunks if they try to move into an unloaded chunk. - -This pretty much means high chance this entity will be lost in this scenario. - -There is another case that adding an enttiy to the world can fail if -the chunk isn't loaded. - -Lots of the server is designed around addEntity never expecting to fail for these reasons, -nor is it really logical. - -This change ensures the chunks are always loaded when entities are -added to the world, or a valid entity moves between chunks. - -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 64d75934bc..bcbdadbd3a 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -1181,7 +1181,7 @@ public abstract class World implements IBlockAccess { - - int i = MathHelper.floor(entity.locX / 16.0D); - int j = MathHelper.floor(entity.locZ / 16.0D); -- boolean flag = entity.attachedToPlayer; -+ boolean flag = true; // Paper - always load chunks - - // Paper start - Set origin location when the entity is being added to the world - if (entity.origin == null) { -@@ -1826,7 +1826,7 @@ public abstract class World implements IBlockAccess { - this.getChunkAt(entity.ab, entity.ad).a(entity, entity.ac); - } - -- if (!entity.bD() && !this.isChunkLoaded(i, k, true)) { -+ if (!entity.valid && !entity.bD() && !this.isChunkLoaded(i, k, true)) { // Paper - always load to new chunk if valid - entity.aa = false; - } else { - this.getChunkAt(i, k).a(entity); --- -2.19.0 - diff --git a/Spigot-Server-Patches/0362-Backport-Prevent-mob-spawning-from-loading-generatin.patch b/Spigot-Server-Patches/0362-Backport-Prevent-mob-spawning-from-loading-generatin.patch new file mode 100644 index 0000000000..f63578bb0d --- /dev/null +++ b/Spigot-Server-Patches/0362-Backport-Prevent-mob-spawning-from-loading-generatin.patch @@ -0,0 +1,34 @@ +From 1a9b0d21e27dd93bd48f483b2336201f6ba110c1 Mon Sep 17 00:00:00 2001 +From: Shane Freeder +Date: Mon, 8 Oct 2018 17:51:52 +0100 +Subject: [PATCH] Backport: Prevent mob spawning from loading/generating chunks + + +diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java +index 11e69a05..5c5bed03 100644 +--- a/src/main/java/net/minecraft/server/SpawnerCreature.java ++++ b/src/main/java/net/minecraft/server/SpawnerCreature.java +@@ -158,9 +158,9 @@ public final class SpawnerCreature { + int i2 = blockposition1.getX(); + int j2 = blockposition1.getY(); + int k2 = blockposition1.getZ(); +- IBlockData iblockdata = worldserver.getType(blockposition1); ++ IBlockData iblockdata = worldserver.getWorldBorder().isInBounds(blockposition1) ? worldserver.getTypeIfLoaded(blockposition1) : null; // Paper + +- if (!iblockdata.l()) { ++ if (iblockdata != null && !iblockdata.l()) { // Paper + int l2 = 0; + int i3 = 0; + +@@ -184,7 +184,7 @@ public final class SpawnerCreature { + float f = (float) j3 + 0.5F; + float f1 = (float) l3 + 0.5F; + +- if (!worldserver.isPlayerNearby((double) f, (double) k3, (double) f1, 24.0D) && blockposition.distanceSquared((double) f, (double) k3, (double) f1) >= 576.0D) { ++ if (worldserver.getWorldBorder().isInBounds(blockposition_mutableblockposition) && worldserver.getChunkIfLoaded(blockposition_mutableblockposition) != null && !worldserver.isPlayerNearby((double) f, (double) k3, (double) f1, 24.0D) && blockposition.distanceSquared((double) f, (double) k3, (double) f1) >= 576.0D) { // Paper - Prevent mob spawning from loading/generating chunks + if (biomebase_biomemeta == null) { + biomebase_biomemeta = worldserver.a(enumcreaturetype, (BlockPosition) blockposition_mutableblockposition); + if (biomebase_biomemeta == null) { +-- +2.19.1 + diff --git a/Spigot-Server-Patches/0362-Backport-Village-Door-fix-from-1.13.patch b/Spigot-Server-Patches/0362-Backport-Village-Door-fix-from-1.13.patch deleted file mode 100644 index d549ea8eeb..0000000000 --- a/Spigot-Server-Patches/0362-Backport-Village-Door-fix-from-1.13.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 4b72bfde9db5ffb7b5ab8f252588c22e6a4b41d3 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sat, 29 Sep 2018 12:13:23 -0400 -Subject: [PATCH] Backport Village Door fix from 1.13 - - -diff --git a/src/main/java/net/minecraft/server/Village.java b/src/main/java/net/minecraft/server/Village.java -index 9f1867ddd3..6536e5fb84 100644 ---- a/src/main/java/net/minecraft/server/Village.java -+++ b/src/main/java/net/minecraft/server/Village.java -@@ -14,7 +14,7 @@ public class Village { - private World a; - private final List b = Lists.newArrayList(); - private BlockPosition c; -- private BlockPosition d; -+ private BlockPosition d; private BlockPosition getCenter() { return d; } // Paper - OBFHELPER - private int e; - private int f; - private int g; -@@ -44,6 +44,12 @@ public class Village { - } - - public void a(int i) { -+ // Paper - don't tick village if chunk isn't loaded -+ Chunk chunk = this.a.getChunkIfLoaded(getCenter()); -+ if (chunk == null || !chunk.areNeighborsLoaded(1)) { -+ return; -+ } -+ // Paper end - this.g = i; - this.m(); - this.l(); -@@ -307,6 +313,12 @@ public class Village { - - while (iterator.hasNext()) { - VillageDoor villagedoor = (VillageDoor) iterator.next(); -+ // Paper start- don't remove doors from unloaded chunks -+ if (!this.a.isLoaded(villagedoor.d())) { -+ villagedoor.a(villagedoor.h() + 1); -+ continue; -+ } -+ // Paper end - - if (flag1) { - villagedoor.a(); --- -2.19.1 - diff --git a/Spigot-Server-Patches/0363-Backport-light-queue-changes-from-1.13.patch b/Spigot-Server-Patches/0363-Backport-light-queue-changes-from-1.13.patch deleted file mode 100644 index 1295ac3bcd..0000000000 --- a/Spigot-Server-Patches/0363-Backport-light-queue-changes-from-1.13.patch +++ /dev/null @@ -1,111 +0,0 @@ -From 659e74a4f51ee97e903472c73e725d728a87dc7d Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 23 Sep 2018 20:44:52 -0400 -Subject: [PATCH] Backport light queue changes from 1.13 - - -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 523d10e8bc..6541f5af47 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -274,14 +274,7 @@ public class Chunk { - - private void h(boolean flag) { - this.world.methodProfiler.a("recheckGaps"); -- if (this.world.areChunksLoaded(new BlockPosition(this.locX * 16 + 8, 0, this.locZ * 16 + 8), 16)) { -- this.runOrQueueLightUpdate(() -> recheckGaps(flag)); // Paper - Queue light update -- } -- } -- -- private void recheckGaps(boolean flag) { -- if (true) { -- // Paper end -+ if (this.areNeighborsLoaded(1)) { // Paper - for (int i = 0; i < 16; ++i) { - for (int j = 0; j < 16; ++j) { - if (this.i[i + j * 16]) { -@@ -332,7 +325,7 @@ public class Chunk { - } - - private void a(int i, int j, int k, int l) { -- if (l > k && this.world.areChunksLoaded(new BlockPosition(i, 0, j), 16)) { -+ if (l > k && this.areNeighborsLoaded(1)) { // Paper - for (int i1 = k; i1 < l; ++i1) { - this.world.c(EnumSkyBlock.SKY, new BlockPosition(i, i1, j)); - } -diff --git a/src/main/java/net/minecraft/server/PaperLightingQueue.java b/src/main/java/net/minecraft/server/PaperLightingQueue.java -index 345cd58240..f1c013116f 100644 ---- a/src/main/java/net/minecraft/server/PaperLightingQueue.java -+++ b/src/main/java/net/minecraft/server/PaperLightingQueue.java -@@ -6,16 +6,16 @@ import it.unimi.dsi.fastutil.objects.ObjectCollection; - import java.util.ArrayDeque; - - class PaperLightingQueue { -- private static final long MAX_TIME = (long) (1000000000 / 20 * .95); -- private static int updatesThisTick; -- -+ private static final long MAX_TIME = (long) (1000000000 / 20 * 1.15); - - static void processQueue(long curTime) { -- updatesThisTick = 0; -- - final long startTime = System.nanoTime(); - final long maxTickTime = MAX_TIME - (startTime - curTime); - -+ if (maxTickTime <= 0) { -+ return; -+ } -+ - START: - for (World world : MinecraftServer.getServer().worlds) { - if (!world.paperConfig.queueLightUpdates) { -@@ -23,7 +23,7 @@ class PaperLightingQueue { - } - - ObjectCollection loadedChunks = ((WorldServer) world).getChunkProviderServer().chunks.values(); -- for (Chunk chunk : loadedChunks.toArray(new Chunk[loadedChunks.size()])) { -+ for (Chunk chunk : loadedChunks.toArray(new Chunk[0])) { - if (chunk.lightingQueue.processQueue(startTime, maxTickTime)) { - break START; - } -@@ -50,14 +50,15 @@ class PaperLightingQueue { - if (this.isEmpty()) { - return false; - } -+ if (isOutOfTime(maxTickTime, startTime)) { -+ return true; -+ } - try (Timing ignored = chunk.world.timings.lightingQueueTimer.startTiming()) { - Runnable lightUpdate; - while ((lightUpdate = this.poll()) != null) { - lightUpdate.run(); -- if (startTime > 0 && ++PaperLightingQueue.updatesThisTick % 10 == 0 && PaperLightingQueue.updatesThisTick > 10) { -- if (System.nanoTime() - startTime > maxTickTime) { -- return true; -- } -+ if (isOutOfTime(maxTickTime, startTime)) { -+ return true; - } - } - } -@@ -74,7 +75,7 @@ class PaperLightingQueue { - } - processQueue(0, 0); // No timeout - -- final int radius = 1; // TODO: bitflip, why should this ever be 2? -+ final int radius = 1; - for (int x = chunk.locX - radius; x <= chunk.locX + radius; ++x) { - for (int z = chunk.locZ - radius; z <= chunk.locZ + radius; ++z) { - if (x == chunk.locX && z == chunk.locZ) { -@@ -89,4 +90,8 @@ class PaperLightingQueue { - } - } - } -+ -+ private static boolean isOutOfTime(long maxTickTime, long startTime) { -+ return startTime > 0 && System.nanoTime() - startTime > maxTickTime; -+ } - } --- -2.19.0 - diff --git a/Spigot-Server-Patches/0363-Detect-and-repair-corrupt-Region-Files.patch b/Spigot-Server-Patches/0363-Detect-and-repair-corrupt-Region-Files.patch new file mode 100644 index 0000000000..3be82ad0db --- /dev/null +++ b/Spigot-Server-Patches/0363-Detect-and-repair-corrupt-Region-Files.patch @@ -0,0 +1,125 @@ +From ec510b0b41b7924da4737613c9c10441498eb46f Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sat, 11 Aug 2018 00:49:20 -0400 +Subject: [PATCH] Detect and repair corrupt Region Files + +If the file has partial data written but not the full 8192 bytes, +then the server will be unable to load that region file... + +I don't know why mojang only checks for 4096, when anything less than 8192 is a crash. + +But to be safe, it will attempt to back up the file. + +diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java +index 2bd85e2d..d334d634 100644 +--- a/src/main/java/net/minecraft/server/RegionFile.java ++++ b/src/main/java/net/minecraft/server/RegionFile.java +@@ -23,10 +23,10 @@ import javax.annotation.Nullable; + public class RegionFile { + + private static final byte[] a = new byte[4096]; +- private final File b; +- private RandomAccessFile c; +- private final int[] d = new int[1024]; +- private final int[] e = new int[1024]; ++ private final File b;private File getFile() { return b; } // Paper - OBFHELPER ++ private RandomAccessFile c;private RandomAccessFile getDataFile() { return c; } // Paper - OBFHELPER ++ private final int[] d = new int[1024];private int[] offsets = d; // Paper - OBFHELPER ++ private final int[] e = new int[1024];private int[] timestamps = e; // Paper - OBFHELPER + private List f; + private int g; + private long h; +@@ -40,10 +40,11 @@ public class RegionFile { + this.h = file.lastModified(); + } + ++ + this.c = new RandomAccessFile(file, "rw"); +- if (this.c.length() < 4096L) { +- this.c.write(RegionFile.a); +- this.c.write(RegionFile.a); ++ if (this.c.length() < 8192L) { // Paper - headers should be 8192 ++ this.c.write(a); ++ this.c.write(a); + this.g += 8192; + } + +@@ -81,16 +82,16 @@ public class RegionFile { + for (j = 0; j < 1024; ++j) { + k = headerAsInts.get(); // Paper + this.d[j] = k; +- if (k != 0 && (k >> 8) + (k & 255) <= this.f.size()) { ++ if (k > 0 && (k >> 8) > 1 && (k >> 8) + (k & 255) <= this.f.size()) { // Paper >= 1 as 0/1 are the headers, and negative isnt valid + for (int l = 0; l < (k & 255); ++l) { + this.f.set((k >> 8) + l, Boolean.valueOf(false)); + } +- } ++ } else if (k != 0) deleteChunk(j); // Paper + } + + for (j = 0; j < 1024; ++j) { + k = headerAsInts.get(); // Paper +- this.e[j] = k; ++ if (offsets[j] != 0) this.timestamps[j] = k; // Paper - don't set timestamp if it got 0'd above due to corruption + } + } catch (IOException ioexception) { + ioexception.printStackTrace(); +@@ -264,6 +265,55 @@ public class RegionFile { + + } + ++ // Paper start ++ public synchronized void deleteChunk(int j1) { ++ backup(); ++ int k = offsets[j1]; ++ int x = j1 & 1024; ++ int z = j1 >> 2; ++ int offset = (k >> 8); ++ int len = (k & 255); ++ org.apache.logging.log4j.Logger logger = org.apache.logging.log4j.LogManager.getLogger(); ++ String debug = "idx:" + + j1 + " - " + x + "," + z + " - offset: " + offset + " - len: " + len; ++ try { ++ RandomAccessFile file = getDataFile(); ++ file.seek(j1 * 4); ++ file.writeInt(0); ++ // clear the timestamp ++ file.seek(4096 + j1 * 4); ++ file.writeInt(0); ++ timestamps[j1] = 0; ++ offsets[j1] = 0; ++ logger.error("Deleted corrupt chunk (" + debug + ") " + getFile().getAbsolutePath(), e); ++ } catch (IOException e) { ++ ++ logger.error("Error deleting corrupt chunk (" + debug + ") " + getFile().getAbsolutePath(), e); ++ } ++ } ++ private boolean backedUp = false; ++ private synchronized void backup() { ++ if (backedUp) { ++ return; ++ } ++ backedUp = true; ++ File file = this.getFile(); ++ java.text.DateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd"); ++ java.util.Date today = new java.util.Date(); ++ File corrupt = new File(file.getParentFile(), file.getName() + "." + formatter.format(today) + ".corrupt"); ++ if (corrupt.exists()) { ++ return; ++ } ++ org.apache.logging.log4j.Logger logger = org.apache.logging.log4j.LogManager.getLogger(); ++ logger.error("Region file " + file.getAbsolutePath() + " was corrupt. Backing up to " + corrupt.getAbsolutePath() + " and repairing"); ++ try { ++ java.nio.file.Files.copy(file.toPath(), corrupt.toPath()); ++ ++ } catch (IOException e) { ++ logger.error("Error backing up corrupt file" + file.getAbsolutePath(), e); ++ } ++ } ++ // Paper end ++ + class ChunkBuffer extends ByteArrayOutputStream { + + private final int b; +-- +2.19.1 + diff --git a/Spigot-Server-Patches/0364-Backport-Water-Activation-Range.patch b/Spigot-Server-Patches/0364-Backport-Water-Activation-Range.patch deleted file mode 100644 index 5fb09a840c..0000000000 --- a/Spigot-Server-Patches/0364-Backport-Water-Activation-Range.patch +++ /dev/null @@ -1,130 +0,0 @@ -From dc1b736e06fa15ed7a6f3501f306da089bd1c4f7 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sat, 6 Oct 2018 01:10:21 -0400 -Subject: [PATCH] Backport Water Activation Range - -Adds Entity Activation Range for water mobs -and no longer gives immunity to mobs (squid) that know how to -pathfind in water. - -diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index 33ae738908..4c8d94c877 100644 ---- a/src/main/java/org/spigotmc/ActivationRange.java -+++ b/src/main/java/org/spigotmc/ActivationRange.java -@@ -19,6 +19,7 @@ import net.minecraft.server.EntityFallingBlock; - import net.minecraft.server.EntityFireball; - import net.minecraft.server.EntityFireworks; - import net.minecraft.server.EntityHuman; -+import net.minecraft.server.EntityInsentient; - import net.minecraft.server.EntityLiving; - import net.minecraft.server.EntityLlama; - import net.minecraft.server.EntityMonster; -@@ -27,11 +28,13 @@ import net.minecraft.server.EntitySheep; - import net.minecraft.server.EntitySlime; - import net.minecraft.server.EntityTNTPrimed; - import net.minecraft.server.EntityVillager; -+import net.minecraft.server.EntityWaterAnimal; - import net.minecraft.server.EntityWeather; - import net.minecraft.server.EntityWither; - import net.minecraft.server.MCUtil; - import net.minecraft.server.MathHelper; - import net.minecraft.server.MinecraftServer; -+import net.minecraft.server.NavigationGuardian; - import net.minecraft.server.World; - - public class ActivationRange -@@ -40,6 +43,7 @@ public class ActivationRange - static AxisAlignedBB maxBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 ); - static AxisAlignedBB miscBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 ); - static AxisAlignedBB animalBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 ); -+ static AxisAlignedBB waterBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 ); // Paper - static AxisAlignedBB monsterBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 ); - - /** -@@ -51,6 +55,7 @@ public class ActivationRange - */ - public static byte initializeEntityActivationType(Entity entity) - { -+ if (entity instanceof EntityWaterAnimal) { return 4; } // Paper - if ( entity instanceof EntityMonster || entity instanceof EntitySlime ) - { - return 1; // Monster -@@ -75,6 +80,7 @@ public class ActivationRange - if ( ( entity.activationType == 3 && config.miscActivationRange == 0 ) - || ( entity.activationType == 2 && config.animalActivationRange == 0 ) - || ( entity.activationType == 1 && config.monsterActivationRange == 0 ) -+ || ( entity.activationType == 4 && config.waterActivationRange == 0 ) // Paper - || entity instanceof EntityHuman - || entity instanceof EntityProjectile - || entity instanceof EntityEnderDragon -@@ -105,6 +111,7 @@ public class ActivationRange - final int miscActivationRange = world.spigotConfig.miscActivationRange; - final int animalActivationRange = world.spigotConfig.animalActivationRange; - final int monsterActivationRange = world.spigotConfig.monsterActivationRange; -+ final int waterActivationRange = world.spigotConfig.waterActivationRange; // Paper - - int maxRange = Math.max( monsterActivationRange, animalActivationRange ); - maxRange = Math.max( maxRange, miscActivationRange ); -@@ -118,6 +125,7 @@ public class ActivationRange - maxBB = player.getBoundingBox().grow( maxRange, 256, maxRange ); - miscBB = player.getBoundingBox().grow( miscActivationRange, 256, miscActivationRange ); - animalBB = player.getBoundingBox().grow( animalActivationRange, 256, animalActivationRange ); -+ waterBB = player.getBoundingBox().grow( waterActivationRange, 256, waterActivationRange ); // Paper - monsterBB = player.getBoundingBox().grow( monsterActivationRange, 256, monsterActivationRange ); - - int i = MathHelper.floor( maxBB.a / 16.0D ); -@@ -171,6 +179,14 @@ public class ActivationRange - entity.activatedTick = MinecraftServer.currentTick; - } - break; -+ // Paper start -+ case 4: -+ if ( waterBB.c( entity.getBoundingBox() ) ) -+ { -+ entity.activatedTick = MinecraftServer.currentTick; -+ } -+ break; -+ // Paper end - case 3: - default: - if ( miscBB.c( entity.getBoundingBox() ) ) -@@ -192,11 +208,14 @@ public class ActivationRange - */ - public static boolean checkEntityImmunities(Entity entity) - { -- // quick checks. -- if ( entity.inWater || entity.fireTicks > 0 ) -- { -+ // Paper start - optimize Water cases -+ if ((entity.inWater && (!(entity instanceof EntityInsentient) || !(((EntityInsentient) entity).getNavigation() instanceof NavigationGuardian)))) { -+ return true; -+ } -+ if (entity.fireTicks > 0) { - return true; - } -+ // Paper end - if ( !( entity instanceof EntityArrow ) ) - { - if ( !entity.onGround || !entity.passengers.isEmpty() || entity.isPassenger() ) -diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 66c399a260..f872c1554d 100644 ---- a/src/main/java/org/spigotmc/SpigotWorldConfig.java -+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java -@@ -144,12 +144,14 @@ public class SpigotWorldConfig - public int animalActivationRange = 32; - public int monsterActivationRange = 32; - public int miscActivationRange = 16; -+ public int waterActivationRange = 16; // Paper - public boolean tickInactiveVillagers = true; - private void activationRange() - { - animalActivationRange = getInt( "entity-activation-range.animals", animalActivationRange ); - monsterActivationRange = getInt( "entity-activation-range.monsters", monsterActivationRange ); - miscActivationRange = getInt( "entity-activation-range.misc", miscActivationRange ); -+ waterActivationRange = getInt( "entity-activation-range.water", waterActivationRange ); // Paper - tickInactiveVillagers = getBoolean( "entity-activation-range.tick-inactive-villagers", tickInactiveVillagers ); - log( "Entity Activation Range: An " + animalActivationRange + " / Mo " + monsterActivationRange + " / Mi " + miscActivationRange + " / Tiv " + tickInactiveVillagers ); - } --- -2.19.0 - diff --git a/Spigot-Server-Patches/0364-Backport-the-dupe-uuid-and-entity-log-changes.patch b/Spigot-Server-Patches/0364-Backport-the-dupe-uuid-and-entity-log-changes.patch new file mode 100644 index 0000000000..25e983ade1 --- /dev/null +++ b/Spigot-Server-Patches/0364-Backport-the-dupe-uuid-and-entity-log-changes.patch @@ -0,0 +1,144 @@ +From 82ae87163d6936053ea6476cf58a3115948a1892 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Fri, 12 Oct 2018 01:37:54 -0400 +Subject: [PATCH] Backport the dupe uuid and entity log changes + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index ed147535..ba299afc 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -543,7 +543,7 @@ public class PaperWorldConfig { + } + + public enum DuplicateUUIDMode { +- SAFE_REGEN, REGEN, DELETE, NOTHING, WARN ++ SAFE_REGEN, DELETE, NOTHING, WARN + } + public DuplicateUUIDMode duplicateUUIDMode = DuplicateUUIDMode.SAFE_REGEN; + public int duplicateUUIDDeleteRange = 32; +@@ -553,13 +553,10 @@ public class PaperWorldConfig { + switch (desiredMode.toLowerCase()) { + case "saferegen": + case "saferegenerate": +- duplicateUUIDMode = DuplicateUUIDMode.SAFE_REGEN; +- log("Duplicate UUID Resolve: Safer Regenerate New UUID (Delete likely duplicates within " + duplicateUUIDDeleteRange + " blocks)"); +- break; + case "regen": + case "regenerate": +- duplicateUUIDMode = DuplicateUUIDMode.REGEN; +- log("Duplicate UUID Resolve: Regenerate New UUID"); ++ duplicateUUIDMode = DuplicateUUIDMode.SAFE_REGEN; ++ log("Duplicate UUID Resolve: Safer Regenerate New UUID (Delete likely duplicates within " + duplicateUUIDDeleteRange + " blocks)"); + break; + case "remove": + case "delete": +diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +index 6541f5af..00c46fe5 100644 +--- a/src/main/java/net/minecraft/server/Chunk.java ++++ b/src/main/java/net/minecraft/server/Chunk.java +@@ -888,7 +888,7 @@ public class Chunk { + List entityslice = aentityslice[j]; // Spigot + // Paper start + DuplicateUUIDMode mode = world.paperConfig.duplicateUUIDMode; +- if (mode == DuplicateUUIDMode.WARN || mode == DuplicateUUIDMode.DELETE || mode == DuplicateUUIDMode.REGEN || mode == DuplicateUUIDMode.SAFE_REGEN) { ++ if (mode == DuplicateUUIDMode.WARN || mode == DuplicateUUIDMode.DELETE || mode == DuplicateUUIDMode.SAFE_REGEN) { + Map thisChunk = new HashMap<>(); + for (Iterator iterator = ((List) entityslice).iterator(); iterator.hasNext(); ) { + Entity entity = iterator.next(); +@@ -903,27 +903,26 @@ public class Chunk { + && java.util.Objects.equals(other.getSaveID(), entity.getSaveID()) + && entity.getBukkitEntity().getLocation().distance(other.getBukkitEntity().getLocation()) < world.paperConfig.duplicateUUIDDeleteRange + ) { +- logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + " because it was near the duplicate and likely an actual duplicate. See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); ++ if (World.DEBUG_ENTITIES) logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + " because it was near the duplicate and likely an actual duplicate. See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); + entity.die(); + iterator.remove(); + continue; + } + if (other != null && !other.dead) { + switch (mode) { +- case SAFE_REGEN: +- case REGEN: { ++ case SAFE_REGEN: { + entity.setUUID(UUID.randomUUID()); +- logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", regenerated UUID for " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); ++ if (World.DEBUG_ENTITIES) logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", regenerated UUID for " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); + break; + } + case DELETE: { +- logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); ++ if (World.DEBUG_ENTITIES) logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); + entity.die(); + iterator.remove(); + break; + } + default: +- logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", doing nothing to " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); ++ if (World.DEBUG_ENTITIES) logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", doing nothing to " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); + break; + } + } +diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +index bcbdadbd..7633a613 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -45,6 +45,7 @@ public abstract class World implements IBlockAccess { + private int a = 63; + protected boolean d; + // Spigot start - guard entity list from removals ++ public static final boolean DEBUG_ENTITIES = Boolean.getBoolean("debug.entities"); // Paper + public final List entityList = new java.util.ArrayList() + { + @Override +diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +index b19942e0..d29420dd 100644 +--- a/src/main/java/net/minecraft/server/WorldServer.java ++++ b/src/main/java/net/minecraft/server/WorldServer.java +@@ -54,7 +54,6 @@ public class WorldServer extends World implements IAsyncTaskHandler { + private final List W = Lists.newArrayList(); + + // CraftBukkit start +- private static final boolean DEBUG_ENTITIES = Boolean.getBoolean("debug.entities"); // Paper + private static Throwable getAddToWorldStackTrace(Entity entity) { + return new Throwable(entity + " Added to world at " + new Date()); + } +@@ -1164,8 +1163,10 @@ public class WorldServer extends World implements IAsyncTaskHandler { + + private boolean j(Entity entity) { + if (entity.dead) { +- WorldServer.a.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.a(entity)); // CraftBukkit // Paper +- if (DEBUG_ENTITIES) getAddToWorldStackTrace(entity).printStackTrace(); ++ if (DEBUG_ENTITIES) { ++ WorldServer.a.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.a(entity)); // CraftBukkit // Paper ++ getAddToWorldStackTrace(entity).printStackTrace(); ++ } + return false; + } else { + UUID uuid = entity.getUniqueID(); +@@ -1178,9 +1179,10 @@ public class WorldServer extends World implements IAsyncTaskHandler { + } else { + if (!(entity instanceof EntityHuman)) { + if (entity.world.paperConfig.duplicateUUIDMode != com.destroystokyo.paper.PaperWorldConfig.DuplicateUUIDMode.NOTHING) { +- WorldServer.a.error("Keeping entity {} that already exists with UUID {}", entity1, uuid.toString()); // CraftBukkit // Paper +- WorldServer.a.error("Duplicate entity {} will not be added to the world. See paper.yml duplicate-uuid-resolver and set this to either regen, delete or nothing to get rid of this message", entity); // Paper + if (DEBUG_ENTITIES) { ++ WorldServer.a.error("Keeping entity {} that already exists with UUID {}", entity1, uuid.toString()); // CraftBukkit // Paper ++ WorldServer.a.error("Duplicate entity {} will not be added to the world. See paper.yml duplicate-uuid-resolver and set this to either regen, delete or nothing to get rid of this message", entity); // Paper ++ + if (entity1.addedToWorldStack != null) { + entity1.addedToWorldStack.printStackTrace(); + } +@@ -1211,8 +1213,8 @@ public class WorldServer extends World implements IAsyncTaskHandler { + Entity old = this.entitiesByUUID.put(entity.getUniqueID(), entity); + if (old != null && old.getId() != entity.getId() && old.valid && entity.world.paperConfig.duplicateUUIDMode != com.destroystokyo.paper.PaperWorldConfig.DuplicateUUIDMode.NOTHING) { + Logger logger = LogManager.getLogger(); +- logger.error("Overwrote an existing entity " + old + " with " + entity); + if (DEBUG_ENTITIES) { ++ logger.error("Overwrote an existing entity " + old + " with " + entity); + if (old.addedToWorldStack != null) { + old.addedToWorldStack.printStackTrace(); + } else { +-- +2.19.1 + diff --git a/Spigot-Server-Patches/0365-Backport-Prevent-mob-spawning-from-loading-generatin.patch b/Spigot-Server-Patches/0365-Backport-Prevent-mob-spawning-from-loading-generatin.patch deleted file mode 100644 index 8ab32a6de5..0000000000 --- a/Spigot-Server-Patches/0365-Backport-Prevent-mob-spawning-from-loading-generatin.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 96a29101e4eedaca172aec3ab96c880b9b3e5371 Mon Sep 17 00:00:00 2001 -From: Shane Freeder -Date: Mon, 8 Oct 2018 17:51:52 +0100 -Subject: [PATCH] Backport: Prevent mob spawning from loading/generating chunks - - -diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index 11e69a0547..5c5bed0344 100644 ---- a/src/main/java/net/minecraft/server/SpawnerCreature.java -+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java -@@ -158,9 +158,9 @@ public final class SpawnerCreature { - int i2 = blockposition1.getX(); - int j2 = blockposition1.getY(); - int k2 = blockposition1.getZ(); -- IBlockData iblockdata = worldserver.getType(blockposition1); -+ IBlockData iblockdata = worldserver.getWorldBorder().isInBounds(blockposition1) ? worldserver.getTypeIfLoaded(blockposition1) : null; // Paper - -- if (!iblockdata.l()) { -+ if (iblockdata != null && !iblockdata.l()) { // Paper - int l2 = 0; - int i3 = 0; - -@@ -184,7 +184,7 @@ public final class SpawnerCreature { - float f = (float) j3 + 0.5F; - float f1 = (float) l3 + 0.5F; - -- if (!worldserver.isPlayerNearby((double) f, (double) k3, (double) f1, 24.0D) && blockposition.distanceSquared((double) f, (double) k3, (double) f1) >= 576.0D) { -+ if (worldserver.getWorldBorder().isInBounds(blockposition_mutableblockposition) && worldserver.getChunkIfLoaded(blockposition_mutableblockposition) != null && !worldserver.isPlayerNearby((double) f, (double) k3, (double) f1, 24.0D) && blockposition.distanceSquared((double) f, (double) k3, (double) f1) >= 576.0D) { // Paper - Prevent mob spawning from loading/generating chunks - if (biomebase_biomemeta == null) { - biomebase_biomemeta = worldserver.a(enumcreaturetype, (BlockPosition) blockposition_mutableblockposition); - if (biomebase_biomemeta == null) { --- -2.19.1 - diff --git a/Spigot-Server-Patches/0365-MC-54026-Backport-1.13-client-desync-fix-on-fast-too.patch b/Spigot-Server-Patches/0365-MC-54026-Backport-1.13-client-desync-fix-on-fast-too.patch new file mode 100644 index 0000000000..0a7fb019bc --- /dev/null +++ b/Spigot-Server-Patches/0365-MC-54026-Backport-1.13-client-desync-fix-on-fast-too.patch @@ -0,0 +1,21 @@ +From 120ded7b1d9144d338d1aa4b3d769dbe498f5f5e Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Fri, 12 Oct 2018 22:41:29 -0400 +Subject: [PATCH] MC-54026: Backport 1.13 client desync fix on fast tools + + +diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java +index fcb64666..3d867982 100644 +--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java ++++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java +@@ -197,6 +197,7 @@ public class PlayerInteractManager { + int i = (int) (f * 10.0F); + + this.world.c(this.player.getId(), blockposition, i); ++ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition)); // Paper - MC-54026 - backport from 1.13 + this.k = i; + } + +-- +2.19.1 + diff --git a/Spigot-Server-Patches/0366-Detect-and-repair-corrupt-Region-Files.patch b/Spigot-Server-Patches/0366-Detect-and-repair-corrupt-Region-Files.patch deleted file mode 100644 index ce99ef9fbc..0000000000 --- a/Spigot-Server-Patches/0366-Detect-and-repair-corrupt-Region-Files.patch +++ /dev/null @@ -1,125 +0,0 @@ -From 69ff7bf015b80568bfbf721f70e20aaeda805c3b Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sat, 11 Aug 2018 00:49:20 -0400 -Subject: [PATCH] Detect and repair corrupt Region Files - -If the file has partial data written but not the full 8192 bytes, -then the server will be unable to load that region file... - -I don't know why mojang only checks for 4096, when anything less than 8192 is a crash. - -But to be safe, it will attempt to back up the file. - -diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index 2bd85e2d16..d334d63429 100644 ---- a/src/main/java/net/minecraft/server/RegionFile.java -+++ b/src/main/java/net/minecraft/server/RegionFile.java -@@ -23,10 +23,10 @@ import javax.annotation.Nullable; - public class RegionFile { - - private static final byte[] a = new byte[4096]; -- private final File b; -- private RandomAccessFile c; -- private final int[] d = new int[1024]; -- private final int[] e = new int[1024]; -+ private final File b;private File getFile() { return b; } // Paper - OBFHELPER -+ private RandomAccessFile c;private RandomAccessFile getDataFile() { return c; } // Paper - OBFHELPER -+ private final int[] d = new int[1024];private int[] offsets = d; // Paper - OBFHELPER -+ private final int[] e = new int[1024];private int[] timestamps = e; // Paper - OBFHELPER - private List f; - private int g; - private long h; -@@ -40,10 +40,11 @@ public class RegionFile { - this.h = file.lastModified(); - } - -+ - this.c = new RandomAccessFile(file, "rw"); -- if (this.c.length() < 4096L) { -- this.c.write(RegionFile.a); -- this.c.write(RegionFile.a); -+ if (this.c.length() < 8192L) { // Paper - headers should be 8192 -+ this.c.write(a); -+ this.c.write(a); - this.g += 8192; - } - -@@ -81,16 +82,16 @@ public class RegionFile { - for (j = 0; j < 1024; ++j) { - k = headerAsInts.get(); // Paper - this.d[j] = k; -- if (k != 0 && (k >> 8) + (k & 255) <= this.f.size()) { -+ if (k > 0 && (k >> 8) > 1 && (k >> 8) + (k & 255) <= this.f.size()) { // Paper >= 1 as 0/1 are the headers, and negative isnt valid - for (int l = 0; l < (k & 255); ++l) { - this.f.set((k >> 8) + l, Boolean.valueOf(false)); - } -- } -+ } else if (k != 0) deleteChunk(j); // Paper - } - - for (j = 0; j < 1024; ++j) { - k = headerAsInts.get(); // Paper -- this.e[j] = k; -+ if (offsets[j] != 0) this.timestamps[j] = k; // Paper - don't set timestamp if it got 0'd above due to corruption - } - } catch (IOException ioexception) { - ioexception.printStackTrace(); -@@ -264,6 +265,55 @@ public class RegionFile { - - } - -+ // Paper start -+ public synchronized void deleteChunk(int j1) { -+ backup(); -+ int k = offsets[j1]; -+ int x = j1 & 1024; -+ int z = j1 >> 2; -+ int offset = (k >> 8); -+ int len = (k & 255); -+ org.apache.logging.log4j.Logger logger = org.apache.logging.log4j.LogManager.getLogger(); -+ String debug = "idx:" + + j1 + " - " + x + "," + z + " - offset: " + offset + " - len: " + len; -+ try { -+ RandomAccessFile file = getDataFile(); -+ file.seek(j1 * 4); -+ file.writeInt(0); -+ // clear the timestamp -+ file.seek(4096 + j1 * 4); -+ file.writeInt(0); -+ timestamps[j1] = 0; -+ offsets[j1] = 0; -+ logger.error("Deleted corrupt chunk (" + debug + ") " + getFile().getAbsolutePath(), e); -+ } catch (IOException e) { -+ -+ logger.error("Error deleting corrupt chunk (" + debug + ") " + getFile().getAbsolutePath(), e); -+ } -+ } -+ private boolean backedUp = false; -+ private synchronized void backup() { -+ if (backedUp) { -+ return; -+ } -+ backedUp = true; -+ File file = this.getFile(); -+ java.text.DateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd"); -+ java.util.Date today = new java.util.Date(); -+ File corrupt = new File(file.getParentFile(), file.getName() + "." + formatter.format(today) + ".corrupt"); -+ if (corrupt.exists()) { -+ return; -+ } -+ org.apache.logging.log4j.Logger logger = org.apache.logging.log4j.LogManager.getLogger(); -+ logger.error("Region file " + file.getAbsolutePath() + " was corrupt. Backing up to " + corrupt.getAbsolutePath() + " and repairing"); -+ try { -+ java.nio.file.Files.copy(file.toPath(), corrupt.toPath()); -+ -+ } catch (IOException e) { -+ logger.error("Error backing up corrupt file" + file.getAbsolutePath(), e); -+ } -+ } -+ // Paper end -+ - class ChunkBuffer extends ByteArrayOutputStream { - - private final int b; --- -2.19.1 - diff --git a/Spigot-Server-Patches/0367-Backport-the-dupe-uuid-and-entity-log-changes.patch b/Spigot-Server-Patches/0367-Backport-the-dupe-uuid-and-entity-log-changes.patch deleted file mode 100644 index ded65a7d54..0000000000 --- a/Spigot-Server-Patches/0367-Backport-the-dupe-uuid-and-entity-log-changes.patch +++ /dev/null @@ -1,144 +0,0 @@ -From 11cf0fdfd5befaac8c2e5fbdb29a834a1dc69d1f Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Fri, 12 Oct 2018 01:37:54 -0400 -Subject: [PATCH] Backport the dupe uuid and entity log changes - - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index ed14753512..ba299afc40 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -543,7 +543,7 @@ public class PaperWorldConfig { - } - - public enum DuplicateUUIDMode { -- SAFE_REGEN, REGEN, DELETE, NOTHING, WARN -+ SAFE_REGEN, DELETE, NOTHING, WARN - } - public DuplicateUUIDMode duplicateUUIDMode = DuplicateUUIDMode.SAFE_REGEN; - public int duplicateUUIDDeleteRange = 32; -@@ -553,13 +553,10 @@ public class PaperWorldConfig { - switch (desiredMode.toLowerCase()) { - case "saferegen": - case "saferegenerate": -- duplicateUUIDMode = DuplicateUUIDMode.SAFE_REGEN; -- log("Duplicate UUID Resolve: Safer Regenerate New UUID (Delete likely duplicates within " + duplicateUUIDDeleteRange + " blocks)"); -- break; - case "regen": - case "regenerate": -- duplicateUUIDMode = DuplicateUUIDMode.REGEN; -- log("Duplicate UUID Resolve: Regenerate New UUID"); -+ duplicateUUIDMode = DuplicateUUIDMode.SAFE_REGEN; -+ log("Duplicate UUID Resolve: Safer Regenerate New UUID (Delete likely duplicates within " + duplicateUUIDDeleteRange + " blocks)"); - break; - case "remove": - case "delete": -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 6541f5af47..00c46fe50f 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -888,7 +888,7 @@ public class Chunk { - List entityslice = aentityslice[j]; // Spigot - // Paper start - DuplicateUUIDMode mode = world.paperConfig.duplicateUUIDMode; -- if (mode == DuplicateUUIDMode.WARN || mode == DuplicateUUIDMode.DELETE || mode == DuplicateUUIDMode.REGEN || mode == DuplicateUUIDMode.SAFE_REGEN) { -+ if (mode == DuplicateUUIDMode.WARN || mode == DuplicateUUIDMode.DELETE || mode == DuplicateUUIDMode.SAFE_REGEN) { - Map thisChunk = new HashMap<>(); - for (Iterator iterator = ((List) entityslice).iterator(); iterator.hasNext(); ) { - Entity entity = iterator.next(); -@@ -903,27 +903,26 @@ public class Chunk { - && java.util.Objects.equals(other.getSaveID(), entity.getSaveID()) - && entity.getBukkitEntity().getLocation().distance(other.getBukkitEntity().getLocation()) < world.paperConfig.duplicateUUIDDeleteRange - ) { -- logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + " because it was near the duplicate and likely an actual duplicate. See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); -+ if (World.DEBUG_ENTITIES) logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + " because it was near the duplicate and likely an actual duplicate. See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); - entity.die(); - iterator.remove(); - continue; - } - if (other != null && !other.dead) { - switch (mode) { -- case SAFE_REGEN: -- case REGEN: { -+ case SAFE_REGEN: { - entity.setUUID(UUID.randomUUID()); -- logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", regenerated UUID for " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); -+ if (World.DEBUG_ENTITIES) logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", regenerated UUID for " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); - break; - } - case DELETE: { -- logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); -+ if (World.DEBUG_ENTITIES) logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); - entity.die(); - iterator.remove(); - break; - } - default: -- logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", doing nothing to " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); -+ if (World.DEBUG_ENTITIES) logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", doing nothing to " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); - break; - } - } -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index bcbdadbd3a..7633a61342 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -45,6 +45,7 @@ public abstract class World implements IBlockAccess { - private int a = 63; - protected boolean d; - // Spigot start - guard entity list from removals -+ public static final boolean DEBUG_ENTITIES = Boolean.getBoolean("debug.entities"); // Paper - public final List entityList = new java.util.ArrayList() - { - @Override -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index b19942e0f1..d29420dd49 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -54,7 +54,6 @@ public class WorldServer extends World implements IAsyncTaskHandler { - private final List W = Lists.newArrayList(); - - // CraftBukkit start -- private static final boolean DEBUG_ENTITIES = Boolean.getBoolean("debug.entities"); // Paper - private static Throwable getAddToWorldStackTrace(Entity entity) { - return new Throwable(entity + " Added to world at " + new Date()); - } -@@ -1164,8 +1163,10 @@ public class WorldServer extends World implements IAsyncTaskHandler { - - private boolean j(Entity entity) { - if (entity.dead) { -- WorldServer.a.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.a(entity)); // CraftBukkit // Paper -- if (DEBUG_ENTITIES) getAddToWorldStackTrace(entity).printStackTrace(); -+ if (DEBUG_ENTITIES) { -+ WorldServer.a.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.a(entity)); // CraftBukkit // Paper -+ getAddToWorldStackTrace(entity).printStackTrace(); -+ } - return false; - } else { - UUID uuid = entity.getUniqueID(); -@@ -1178,9 +1179,10 @@ public class WorldServer extends World implements IAsyncTaskHandler { - } else { - if (!(entity instanceof EntityHuman)) { - if (entity.world.paperConfig.duplicateUUIDMode != com.destroystokyo.paper.PaperWorldConfig.DuplicateUUIDMode.NOTHING) { -- WorldServer.a.error("Keeping entity {} that already exists with UUID {}", entity1, uuid.toString()); // CraftBukkit // Paper -- WorldServer.a.error("Duplicate entity {} will not be added to the world. See paper.yml duplicate-uuid-resolver and set this to either regen, delete or nothing to get rid of this message", entity); // Paper - if (DEBUG_ENTITIES) { -+ WorldServer.a.error("Keeping entity {} that already exists with UUID {}", entity1, uuid.toString()); // CraftBukkit // Paper -+ WorldServer.a.error("Duplicate entity {} will not be added to the world. See paper.yml duplicate-uuid-resolver and set this to either regen, delete or nothing to get rid of this message", entity); // Paper -+ - if (entity1.addedToWorldStack != null) { - entity1.addedToWorldStack.printStackTrace(); - } -@@ -1211,8 +1213,8 @@ public class WorldServer extends World implements IAsyncTaskHandler { - Entity old = this.entitiesByUUID.put(entity.getUniqueID(), entity); - if (old != null && old.getId() != entity.getId() && old.valid && entity.world.paperConfig.duplicateUUIDMode != com.destroystokyo.paper.PaperWorldConfig.DuplicateUUIDMode.NOTHING) { - Logger logger = LogManager.getLogger(); -- logger.error("Overwrote an existing entity " + old + " with " + entity); - if (DEBUG_ENTITIES) { -+ logger.error("Overwrote an existing entity " + old + " with " + entity); - if (old.addedToWorldStack != null) { - old.addedToWorldStack.printStackTrace(); - } else { --- -2.19.1 - diff --git a/Spigot-Server-Patches/0368-MC-54026-Backport-1.13-client-desync-fix-on-fast-too.patch b/Spigot-Server-Patches/0368-MC-54026-Backport-1.13-client-desync-fix-on-fast-too.patch deleted file mode 100644 index b1e81289e8..0000000000 --- a/Spigot-Server-Patches/0368-MC-54026-Backport-1.13-client-desync-fix-on-fast-too.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 4b22585d7ede957b7b5cb95fe4c708fd49c61453 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Fri, 12 Oct 2018 22:41:29 -0400 -Subject: [PATCH] MC-54026: Backport 1.13 client desync fix on fast tools - - -diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java -index fcb64666e3..3d86798248 100644 ---- a/src/main/java/net/minecraft/server/PlayerInteractManager.java -+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java -@@ -197,6 +197,7 @@ public class PlayerInteractManager { - int i = (int) (f * 10.0F); - - this.world.c(this.player.getId(), blockposition, i); -+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition)); // Paper - MC-54026 - backport from 1.13 - this.k = i; - } - --- -2.19.1 - diff --git a/scripts/upstreamMerge.sh b/scripts/upstreamMerge.sh index 6d9541970d..25ca49c449 100755 --- a/scripts/upstreamMerge.sh +++ b/scripts/upstreamMerge.sh @@ -9,7 +9,8 @@ gitcmd="git -c commit.gpgsign=false" function update { cd "$workdir/$1" - $gitcmd fetch && $gitcmd reset --hard origin/master + echo "$1" + $gitcmd fetch && $gitcmd reset --hard origin/version/1.12.2 cd ../ $gitcmd add $1 } @@ -19,7 +20,8 @@ update CraftBukkit update Spigot if [[ "$2" = "all" || "$2" = "a" ]] ; then - update BuildData - update Paperclip + #update BuildData + #update Paperclip + echo "Cannot update BuildData or Paperclip any further!" fi ) diff --git a/work/Bukkit b/work/Bukkit index bdd0eda71f..558fdf5f54 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit bdd0eda71f87cb8ca3b1842bd9bbd43bba5a08bd +Subproject commit 558fdf5f54b0f527cd48903daf9368ac4b862876 diff --git a/work/CraftBukkit b/work/CraftBukkit index 2b93d839dd..d7bebeff02 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit 2b93d839ddb1541cad937e3dd7a4da5d1525af3d +Subproject commit d7bebeff028af7baf52105394529598f1c4093c4 diff --git a/work/Spigot b/work/Spigot index 2cf50f0552..dcd16439b5 160000 --- a/work/Spigot +++ b/work/Spigot @@ -1 +1 @@ -Subproject commit 2cf50f055260acaa2344390334bbca546d46726d +Subproject commit dcd16439b51429c18f1028bbe36ff805547050de -- cgit v1.2.3