From cce3635569b8d55405b991ced473098ba2fe9a22 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Thu, 13 Sep 2018 12:06:16 -0400 Subject: [PATCH 01/90] Update branch for github version checking --- Spigot-API-Patches/0008-Check-Paper-versions.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Spigot-API-Patches/0008-Check-Paper-versions.patch b/Spigot-API-Patches/0008-Check-Paper-versions.patch index 0460ad07255a..18acf62395f9 100644 --- a/Spigot-API-Patches/0008-Check-Paper-versions.patch +++ b/Spigot-API-Patches/0008-Check-Paper-versions.patch @@ -117,7 +117,7 @@ index 760d58eb..044361af 100644 + } + + // Contributed by Techcable in GH PR #65 -+ private static final String BRANCH = "master"; ++ private static final String BRANCH = "ver/1.12.2"; + private static int getFromRepo(String repo, String hash) { + try { + HttpURLConnection connection = (HttpURLConnection) new URL("https://api.github.com/repos/" + repo + "/compare/" + BRANCH + "..." + hash).openConnection(); From ec58c208b39d7f9490de8f1b696a7135ec66fae2 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 13 Sep 2018 20:55:31 -0400 Subject: [PATCH 02/90] Performance & Concurrency Improvements to Permissions Modifying of permissions was only half protected, enabling concurrency issues to occur if permissions were modified async. While no plugin really should be doing that, modifying operations are not heavily called, so they are safe to add synchronization to. Now, all modification API's will be synchronized ensuring safety. Additionally, hasPermission was victim to a common java newbie mistake of calling if (containsKey(k)) return get(k), resulting in 2 map lookups. Optimized it to simply be a single get call cutting permission map lookups in half. --- ...currency-Improvements-to-Permissions.patch | 114 ++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 Spigot-API-Patches/0134-Performance-Concurrency-Improvements-to-Permissions.patch diff --git a/Spigot-API-Patches/0134-Performance-Concurrency-Improvements-to-Permissions.patch b/Spigot-API-Patches/0134-Performance-Concurrency-Improvements-to-Permissions.patch new file mode 100644 index 000000000000..92152a8efbb7 --- /dev/null +++ b/Spigot-API-Patches/0134-Performance-Concurrency-Improvements-to-Permissions.patch @@ -0,0 +1,114 @@ +From c4ffbeb0571e0c4f9a4b116127a362511d21908f Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Thu, 13 Sep 2018 20:51:50 -0400 +Subject: [PATCH] Performance & Concurrency Improvements to Permissions + +Modifying of permissions was only half protected, enabling concurrency +issues to occur if permissions were modified async. + +While no plugin really should be doing that, modifying operations +are not heavily called, so they are safe to add synchronization to. + +Now, all modification API's will be synchronized ensuring safety. + +Additionally, hasPermission was victim to a common java newbie mistake +of calling if (containsKey(k)) return get(k), resulting in 2 map lookups. + +Optimized it to simply be a single get call cutting permission map +lookups in half. + +diff --git a/src/main/java/org/bukkit/permissions/PermissibleBase.java b/src/main/java/org/bukkit/permissions/PermissibleBase.java +index d4cb00a82..486f69f86 100644 +--- a/src/main/java/org/bukkit/permissions/PermissibleBase.java ++++ b/src/main/java/org/bukkit/permissions/PermissibleBase.java +@@ -68,8 +68,11 @@ public class PermissibleBase implements Permissible { + + String name = inName.toLowerCase(java.util.Locale.ENGLISH); + +- if (isPermissionSet(name)) { +- return permissions.get(name).getValue(); ++ // Paper start ++ PermissionAttachmentInfo info = permissions.get(name); ++ if (info != null) { ++ return info.getValue(); ++ // Paper end + } else { + Permission perm = Bukkit.getServer().getPluginManager().getPermission(name); + +@@ -88,13 +91,16 @@ public class PermissibleBase implements Permissible { + + String name = perm.getName().toLowerCase(java.util.Locale.ENGLISH); + +- if (isPermissionSet(name)) { +- return permissions.get(name).getValue(); ++ // Paper start ++ PermissionAttachmentInfo info = permissions.get(name); ++ if (info != null) { ++ return info.getValue(); + } ++ // Paper end + return perm.getDefault().getValue(isOp()); + } + +- public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value) { ++ public synchronized PermissionAttachment addAttachment(Plugin plugin, String name, boolean value) { // Paper - synchronized + if (name == null) { + throw new IllegalArgumentException("Permission name cannot be null"); + } else if (plugin == null) { +@@ -111,7 +117,7 @@ public class PermissibleBase implements Permissible { + return result; + } + +- public PermissionAttachment addAttachment(Plugin plugin) { ++ public synchronized PermissionAttachment addAttachment(Plugin plugin) { // Paper - synchronized + if (plugin == null) { + throw new IllegalArgumentException("Plugin cannot be null"); + } else if (!plugin.isEnabled()) { +@@ -126,7 +132,7 @@ public class PermissibleBase implements Permissible { + return result; + } + +- public void removeAttachment(PermissionAttachment attachment) { ++ public synchronized void removeAttachment(PermissionAttachment attachment) { // Paper - synchronized + if (attachment == null) { + throw new IllegalArgumentException("Attachment cannot be null"); + } +@@ -145,7 +151,7 @@ public class PermissibleBase implements Permissible { + } + } + +- public void recalculatePermissions() { ++ public synchronized void recalculatePermissions() { // Paper - synchronized + clearPermissions(); + Set defaults = Bukkit.getServer().getPluginManager().getDefaultPermissions(isOp()); + Bukkit.getServer().getPluginManager().subscribeToDefaultPerms(isOp(), parent); +@@ -192,7 +198,7 @@ public class PermissibleBase implements Permissible { + } + } + +- public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value, int ticks) { ++ public synchronized PermissionAttachment addAttachment(Plugin plugin, String name, boolean value, int ticks) { // Paper - synchronized + if (name == null) { + throw new IllegalArgumentException("Permission name cannot be null"); + } else if (plugin == null) { +@@ -210,7 +216,7 @@ public class PermissibleBase implements Permissible { + return result; + } + +- public PermissionAttachment addAttachment(Plugin plugin, int ticks) { ++ public synchronized PermissionAttachment addAttachment(Plugin plugin, int ticks) { // Paper - synchronized + if (plugin == null) { + throw new IllegalArgumentException("Plugin cannot be null"); + } else if (!plugin.isEnabled()) { +@@ -228,7 +234,7 @@ public class PermissibleBase implements Permissible { + } + } + +- public Set getEffectivePermissions() { ++ public synchronized Set getEffectivePermissions() { // Paper - synchronized + return new HashSet(permissions.values()); + } + +-- +2.18.0 + From 15712119ad2f47608105e9f13b669393b4f45972 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 16 Sep 2018 14:26:30 -0400 Subject: [PATCH 03/90] 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. --- .../0359-Optimize-Region-File-Cache.patch | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 Spigot-Server-Patches/0359-Optimize-Region-File-Cache.patch diff --git a/Spigot-Server-Patches/0359-Optimize-Region-File-Cache.patch b/Spigot-Server-Patches/0359-Optimize-Region-File-Cache.patch new file mode 100644 index 000000000000..435e9f87ab9b --- /dev/null +++ b/Spigot-Server-Patches/0359-Optimize-Region-File-Cache.patch @@ -0,0 +1,67 @@ +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 + From 4909d1366c5a0d4a11a069462a9fcff232559eb2 Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 21 Sep 2018 11:40:46 -0400 Subject: [PATCH 04/90] 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. --- ...360-Sync-Player-Position-to-Vehicles.patch | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Spigot-Server-Patches/0360-Sync-Player-Position-to-Vehicles.patch diff --git a/Spigot-Server-Patches/0360-Sync-Player-Position-to-Vehicles.patch b/Spigot-Server-Patches/0360-Sync-Player-Position-to-Vehicles.patch new file mode 100644 index 000000000000..4fe554e2daa8 --- /dev/null +++ b/Spigot-Server-Patches/0360-Sync-Player-Position-to-Vehicles.patch @@ -0,0 +1,38 @@ +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 + From e0a25a9b9921b52cb6061c5a8f249a35821a9955 Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Sun, 23 Sep 2018 00:05:54 -0400 Subject: [PATCH 05/90] Fix NPE race condition in ServerListPingEvent Fixes GH-1473 If a ping is responded to prior to the server sample being populated (pre-tick as an example) it can result in an NPE. --- .../0275-Implement-extended-PaperServerListPingEvent.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Spigot-Server-Patches/0275-Implement-extended-PaperServerListPingEvent.patch b/Spigot-Server-Patches/0275-Implement-extended-PaperServerListPingEvent.patch index 376716356415..d30b180f4941 100644 --- a/Spigot-Server-Patches/0275-Implement-extended-PaperServerListPingEvent.patch +++ b/Spigot-Server-Patches/0275-Implement-extended-PaperServerListPingEvent.patch @@ -91,7 +91,7 @@ index 000000000..350410527 + + private StandardPaperServerListPingEventImpl(MinecraftServer server, NetworkManager networkManager, ServerPing ping) { + super(server, new PaperStatusClient(networkManager), ping.getServerData().getProtocolVersion(), server.server.getServerIcon()); -+ this.originalSample = ping.getPlayers().getSample(); ++ this.originalSample = ping.getPlayers() == null ? null : ping.getPlayers().getSample(); // GH-1473 - pre-tick race condition NPE + } + + @Nonnull From 9759652bfb82b88be6c7a872d13c4b95f1fee072 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 23 Sep 2018 20:45:32 -0400 Subject: [PATCH 06/90] Backport light queue changes from 1.13 --- ...ckport-light-queue-changes-from-1.13.patch | 145 ++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 Spigot-Server-Patches/0361-Backport-light-queue-changes-from-1.13.patch diff --git a/Spigot-Server-Patches/0361-Backport-light-queue-changes-from-1.13.patch b/Spigot-Server-Patches/0361-Backport-light-queue-changes-from-1.13.patch new file mode 100644 index 000000000000..153579a75c4e --- /dev/null +++ b/Spigot-Server-Patches/0361-Backport-light-queue-changes-from-1.13.patch @@ -0,0 +1,145 @@ +From d34f861c60d8b6a41b6091118cfffe747420d72b 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/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index ed14753512..10262b29fa 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -141,10 +141,10 @@ public class PaperWorldConfig { + log("Top of the nether void damage: " + netherVoidTopDamage); + } + +- public boolean queueLightUpdates; ++ public boolean queueLightUpdates = true; + private void queueLightUpdates() { +- queueLightUpdates = getBoolean("queue-light-updates", false); +- log("Lighting Queue enabled: " + queueLightUpdates); ++ //queueLightUpdates = getBoolean("queue-light-updates", false); ++ //log("Lighting Queue enabled: " + queueLightUpdates); + } + + public boolean disableEndCredits; +diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +index 523d10e8bc..b6acf7c13f 100644 +--- a/src/main/java/net/minecraft/server/Chunk.java ++++ b/src/main/java/net/minecraft/server/Chunk.java +@@ -272,16 +272,10 @@ public class Chunk { + this.m = true; + } + ++ private void recheckGaps(boolean flag) { h(flag); } // Paper + 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 + for (int i = 0; i < 16; ++i) { + for (int j = 0; j < 16; ++j) { + if (this.i[i + j * 16]) { +@@ -1231,9 +1225,19 @@ public class Chunk { + return new BlockPosition(blockposition.getX(), this.h[k], blockposition.getZ()); + } + ++ // Paper start ++ private boolean shouldRecheckGaps = false; ++ public void doGapCheck() { ++ if (shouldRecheckGaps) { ++ this.recheckGaps(false); ++ shouldRecheckGaps = false; ++ } ++ } ++ // Paper end ++ + public void b(boolean flag) { + if (this.m && this.world.worldProvider.m() && !flag) { +- this.h(this.world.isClientSide); ++ shouldRecheckGaps = true; // Paper + } + + this.r = true; +diff --git a/src/main/java/net/minecraft/server/PaperLightingQueue.java b/src/main/java/net/minecraft/server/PaperLightingQueue.java +index 345cd58240..325255e9d4 100644 +--- a/src/main/java/net/minecraft/server/PaperLightingQueue.java ++++ b/src/main/java/net/minecraft/server/PaperLightingQueue.java +@@ -7,15 +7,15 @@ import java.util.ArrayDeque; + + class PaperLightingQueue { + private static final long MAX_TIME = (long) (1000000000 / 20 * .95); +- private static int updatesThisTick; +- + + 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,10 +23,11 @@ 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; + } ++ chunk.doGapCheck(); + } + } + } +@@ -50,14 +51,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 +76,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 +91,8 @@ class PaperLightingQueue { + } + } + } ++ ++ private static boolean isOutOfTime(long maxTickTime, long startTime) { ++ return startTime > 0 && System.nanoTime() - startTime > maxTickTime; ++ } + } +-- +2.19.0 + From 69c8e71723291f4693bd5c7aacb0b9ebec502355 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Mon, 24 Sep 2018 20:54:43 -0400 Subject: [PATCH 07/90] Allow zero revive health when it matches maxHealth Apparently a zero max health attribute is perfectly fine in vanilla and our own revive handling code appears to handle the case fine, even when EntityDeathEvent is cancelled. So we should allow it to avoid issues when these mobs are killed. --- Spigot-API-Patches/0130-Improve-death-events.patch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Spigot-API-Patches/0130-Improve-death-events.patch b/Spigot-API-Patches/0130-Improve-death-events.patch index 13994b151dea..c2b4519a0496 100644 --- a/Spigot-API-Patches/0130-Improve-death-events.patch +++ b/Spigot-API-Patches/0130-Improve-death-events.patch @@ -1,4 +1,4 @@ -From b86fe574c68b575d7b24b8f893b3b472d6369fd0 Mon Sep 17 00:00:00 2001 +From 66e1c37f5010478c239e08b053a179592ca28145 Mon Sep 17 00:00:00 2001 From: Phoenix616 Date: Tue, 21 Aug 2018 01:32:28 +0100 Subject: [PATCH] Improve death events @@ -15,7 +15,7 @@ items and experience which is otherwise only properly possible by using internal code. diff --git a/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java b/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java -index ab9e81fd..a7b8f869 100644 +index ab9e81fd..fef134c6 100644 --- a/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java +++ b/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java @@ -8,10 +8,19 @@ import org.bukkit.inventory.ItemStack; @@ -74,7 +74,7 @@ index ab9e81fd..a7b8f869 100644 + */ + public void setReviveHealth(double reviveHealth) throws IllegalArgumentException { + double maxHealth = ((LivingEntity) entity).getAttribute(org.bukkit.attribute.Attribute.GENERIC_MAX_HEALTH).getValue(); -+ if ((reviveHealth <= 0) || (reviveHealth > maxHealth)) { ++ if ((maxHealth != 0 && reviveHealth <= 0) || (reviveHealth > maxHealth)) { + throw new IllegalArgumentException("Health must be between 0 (exclusive) and " + maxHealth + " (inclusive), but was " + reviveHealth); + } + this.reviveHealth = reviveHealth; @@ -173,5 +173,5 @@ index ab9e81fd..a7b8f869 100644 + // Paper end } -- -2.18.0.windows.1 +2.19.0 From c1cd6183f5e58ecb0cb79f659c2f7479ee9a2c52 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Mon, 24 Sep 2018 21:03:09 -0400 Subject: [PATCH 08/90] Update 1.12.2 distribution info just in case --- Spigot-API-Patches/0001-POM-changes.patch | 71 +++++++++---------- ...002-add-Trove-and-FastUtil-to-Bukkit.patch | 8 +-- .../0023-Use-ASM-for-event-executors.patch | 8 +-- .../0059-Profile-Lookup-Events.patch | 8 +-- ...low-plugins-to-use-SLF4J-for-logging.patch | 10 +-- pom.xml | 8 +-- 6 files changed, 54 insertions(+), 59 deletions(-) diff --git a/Spigot-API-Patches/0001-POM-changes.patch b/Spigot-API-Patches/0001-POM-changes.patch index 0ce6f0e91fa6..d34dab8cb7ee 100644 --- a/Spigot-API-Patches/0001-POM-changes.patch +++ b/Spigot-API-Patches/0001-POM-changes.patch @@ -1,14 +1,14 @@ -From 7836876ec5222a072d9d65d965f4edcc0ea8bbe4 Mon Sep 17 00:00:00 2001 +From f689646087896900f4b4a46521b3a5d5487184b3 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 1 Mar 2016 00:16:08 +0100 Subject: [PATCH] POM changes diff --git a/pom.xml b/pom.xml -index 7c81917d..4c5bda27 100644 +index 7c81917d..3889d668 100644 --- a/pom.xml +++ b/pom.xml -@@ -3,39 +3,39 @@ +@@ -3,46 +3,46 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 @@ -40,50 +40,45 @@ index 7c81917d..4c5bda27 100644 UTF-8 - - +- +- - spigotmc-releases - https://hub.spigotmc.org/nexus/content/repositories/releases/ -+ destroystokyo-releases -+ https://destroystokyo.com/repo/repository/maven-releases/ - - +- +- - spigotmc-snapshots - https://hub.spigotmc.org/nexus/content/repositories/snapshots/ -+ destroystokyo-snapshots -+ https://destroystokyo.com/repo/repository/maven-snapshots/ - - - -- -- -- spigotmc-public -- https://hub.spigotmc.org/nexus/content/groups/public/ -- -- -- - - - spigotmc-public -@@ -43,6 +43,17 @@ - - - -+ -+ +- +- ++ ++ + spigotmc-public + https://hub.spigotmc.org/nexus/content/groups/public/ -+ ++ ++ + + + + spigotmc-public + https://hub.spigotmc.org/nexus/content/groups/public/ + + + sonatype + https://oss.sonatype.org/content/groups/public/ + -+ -+ + + +- +- +- spigotmc-public +- https://hub.spigotmc.org/nexus/content/groups/public/ +- +- +- commons-lang -@@ -56,6 +67,13 @@ +@@ -56,6 +56,13 @@ 1.1.1 compile @@ -97,7 +92,7 @@ index 7c81917d..4c5bda27 100644 com.google.guava -@@ -100,15 +118,12 @@ +@@ -100,15 +107,12 @@ @@ -114,7 +109,7 @@ index 7c81917d..4c5bda27 100644 -@@ -131,6 +146,7 @@ +@@ -131,6 +135,7 @@ @@ -122,7 +117,7 @@ index 7c81917d..4c5bda27 100644 true -@@ -138,33 +154,4 @@ +@@ -138,33 +143,4 @@ @@ -157,5 +152,5 @@ index 7c81917d..4c5bda27 100644 - -- -2.18.0 +2.19.0 diff --git a/Spigot-API-Patches/0002-add-Trove-and-FastUtil-to-Bukkit.patch b/Spigot-API-Patches/0002-add-Trove-and-FastUtil-to-Bukkit.patch index db536d295d23..dc6051cddd5c 100644 --- a/Spigot-API-Patches/0002-add-Trove-and-FastUtil-to-Bukkit.patch +++ b/Spigot-API-Patches/0002-add-Trove-and-FastUtil-to-Bukkit.patch @@ -1,14 +1,14 @@ -From f428f0343bf4b0aa2c42fa1755d9523eaec91d3b Mon Sep 17 00:00:00 2001 +From bf38aff997d53e25de73849488a72a7422f36b97 Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 1 Apr 2016 00:02:47 -0400 Subject: [PATCH] add Trove and FastUtil to Bukkit diff --git a/pom.xml b/pom.xml -index 4220760f..623d9eae 100644 +index 3889d668..c5b3f430 100644 --- a/pom.xml +++ b/pom.xml -@@ -55,6 +55,19 @@ +@@ -44,6 +44,19 @@ @@ -29,5 +29,5 @@ index 4220760f..623d9eae 100644 commons-lang commons-lang -- -2.16.2 +2.19.0 diff --git a/Spigot-API-Patches/0023-Use-ASM-for-event-executors.patch b/Spigot-API-Patches/0023-Use-ASM-for-event-executors.patch index b21251cca5be..d056bb6ac88e 100644 --- a/Spigot-API-Patches/0023-Use-ASM-for-event-executors.patch +++ b/Spigot-API-Patches/0023-Use-ASM-for-event-executors.patch @@ -1,4 +1,4 @@ -From 15b5224e92a45ca15a6e5d34f97734922e539b92 Mon Sep 17 00:00:00 2001 +From d70c376fbf3dfc694895e80aba6a00df4b88c775 Mon Sep 17 00:00:00 2001 From: Techcable Date: Thu, 3 Mar 2016 13:20:33 -0700 Subject: [PATCH] Use ASM for event executors. @@ -6,10 +6,10 @@ Subject: [PATCH] Use ASM for event executors. Uses method handles for private or static methods. diff --git a/pom.xml b/pom.xml -index 8d4032e2..21a4a8be 100644 +index c5b3f430..09c42fe2 100644 --- a/pom.xml +++ b/pom.xml -@@ -128,6 +128,17 @@ +@@ -117,6 +117,17 @@ 1.3 test @@ -427,5 +427,5 @@ index d8b9c244..40fd71dc 100644 eventSet.add(new TimedRegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled())); } else { -- -2.17.0 +2.19.0 diff --git a/Spigot-API-Patches/0059-Profile-Lookup-Events.patch b/Spigot-API-Patches/0059-Profile-Lookup-Events.patch index adaec2f85fd4..df2e4769a603 100644 --- a/Spigot-API-Patches/0059-Profile-Lookup-Events.patch +++ b/Spigot-API-Patches/0059-Profile-Lookup-Events.patch @@ -1,4 +1,4 @@ -From b1eb117fbca758844625ae8de33b71f3d526ea0a Mon Sep 17 00:00:00 2001 +From 4c9bcc7cd688a1c959ea8335a93b16c888d36f83 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 17 Jun 2017 16:30:44 -0400 Subject: [PATCH] Profile Lookup Events @@ -7,10 +7,10 @@ Adds a Pre Lookup Event and a Post Lookup Event so that plugins may prefill in p profiles that had to be looked up. diff --git a/pom.xml b/pom.xml -index c8b37997..13994dc2 100644 +index 09c42fe2..d75bf7da 100644 --- a/pom.xml +++ b/pom.xml -@@ -62,6 +62,13 @@ +@@ -51,6 +51,13 @@ provided @@ -241,5 +241,5 @@ index 00000000..aa0666d5 + +} -- -2.15.1 +2.19.0 diff --git a/Spigot-API-Patches/0069-Allow-plugins-to-use-SLF4J-for-logging.patch b/Spigot-API-Patches/0069-Allow-plugins-to-use-SLF4J-for-logging.patch index 7e9cb03ad4a8..c79b75b7ca34 100644 --- a/Spigot-API-Patches/0069-Allow-plugins-to-use-SLF4J-for-logging.patch +++ b/Spigot-API-Patches/0069-Allow-plugins-to-use-SLF4J-for-logging.patch @@ -1,4 +1,4 @@ -From 21357c1c249a2ebea454a1bb6b7b435c3fecdbfa Mon Sep 17 00:00:00 2001 +From fe849acd162816d608ef8b797037f95cfbb95dc3 Mon Sep 17 00:00:00 2001 From: Minecrell Date: Thu, 21 Sep 2017 16:33:12 +0200 Subject: [PATCH] Allow plugins to use SLF4J for logging @@ -14,10 +14,10 @@ it without having to shade it in the plugin and going through several layers of logging abstraction. diff --git a/pom.xml b/pom.xml -index 13994dc2..45145c5f 100644 +index d75bf7da..2fa2dd7c 100644 --- a/pom.xml +++ b/pom.xml -@@ -122,6 +122,14 @@ +@@ -111,6 +111,14 @@ compile @@ -33,7 +33,7 @@ index 13994dc2..45145c5f 100644 junit diff --git a/src/main/java/org/bukkit/plugin/Plugin.java b/src/main/java/org/bukkit/plugin/Plugin.java -index c4e22c62..02670254 100644 +index 55debf5d..8d2999ac 100644 --- a/src/main/java/org/bukkit/plugin/Plugin.java +++ b/src/main/java/org/bukkit/plugin/Plugin.java @@ -157,6 +157,12 @@ public interface Plugin extends TabExecutor { @@ -50,5 +50,5 @@ index c4e22c62..02670254 100644 * Returns the name of the plugin. *

-- -2.15.1 +2.19.0 diff --git a/pom.xml b/pom.xml index 6522a82da39b..d7afcb29ab1a 100644 --- a/pom.xml +++ b/pom.xml @@ -43,12 +43,12 @@ - destroystokyo-releases - https://destroystokyo.com/repo/repository/maven-releases/ + papermc-releases + https://papermc.io/repo/repository/maven-releases/ - destroystokyo-snapshots - https://destroystokyo.com/repo/repository/maven-snapshots/ + papermc-snapshots + https://papermc.io/repo/repository/maven-snapshots/ From de977253d91f4ca300ae0bd793977813afed5125 Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 25 Sep 2018 23:37:01 -0400 Subject: [PATCH 09/90] Re-add toggle for light queue, bump queue time there is apparently bugs with relighting, so turning toggle back on also bumped the max time threshold to reduce risk of starving the queue allows it to violate TPS some, but at cost of better light data also fixed some chunk neighbor checks --- ...ckport-light-queue-changes-from-1.13.patch | 42 ++++++++----------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/Spigot-Server-Patches/0361-Backport-light-queue-changes-from-1.13.patch b/Spigot-Server-Patches/0361-Backport-light-queue-changes-from-1.13.patch index 153579a75c4e..c609c163db09 100644 --- a/Spigot-Server-Patches/0361-Backport-light-queue-changes-from-1.13.patch +++ b/Spigot-Server-Patches/0361-Backport-light-queue-changes-from-1.13.patch @@ -1,29 +1,11 @@ -From d34f861c60d8b6a41b6091118cfffe747420d72b Mon Sep 17 00:00:00 2001 +From 7ddde7192795ce5518a53680ad998839aab39eba 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/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index ed14753512..10262b29fa 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -141,10 +141,10 @@ public class PaperWorldConfig { - log("Top of the nether void damage: " + netherVoidTopDamage); - } - -- public boolean queueLightUpdates; -+ public boolean queueLightUpdates = true; - private void queueLightUpdates() { -- queueLightUpdates = getBoolean("queue-light-updates", false); -- log("Lighting Queue enabled: " + queueLightUpdates); -+ //queueLightUpdates = getBoolean("queue-light-updates", false); -+ //log("Lighting Queue enabled: " + queueLightUpdates); - } - - public boolean disableEndCredits; diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 523d10e8bc..b6acf7c13f 100644 +index 523d10e8bc..0f3ef1ba18 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -272,16 +272,10 @@ public class Chunk { @@ -33,7 +15,7 @@ index 523d10e8bc..b6acf7c13f 100644 + private void recheckGaps(boolean flag) { h(flag); } // Paper 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)) { +- if (this.world.areChunksLoaded(new BlockPosition(this.locX * 16 + 8, 0, this.locZ * 16 + 8), 16)) { - this.runOrQueueLightUpdate(() -> recheckGaps(flag)); // Paper - Queue light update - } - } @@ -41,9 +23,19 @@ index 523d10e8bc..b6acf7c13f 100644 - 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 +326,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)); + } @@ -1231,9 +1225,19 @@ public class Chunk { return new BlockPosition(blockposition.getX(), this.h[k], blockposition.getZ()); } @@ -66,15 +58,17 @@ index 523d10e8bc..b6acf7c13f 100644 this.r = true; diff --git a/src/main/java/net/minecraft/server/PaperLightingQueue.java b/src/main/java/net/minecraft/server/PaperLightingQueue.java -index 345cd58240..325255e9d4 100644 +index 345cd58240..9ef414da09 100644 --- a/src/main/java/net/minecraft/server/PaperLightingQueue.java +++ b/src/main/java/net/minecraft/server/PaperLightingQueue.java -@@ -7,15 +7,15 @@ import java.util.ArrayDeque; +@@ -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 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; From 22fd6384829be11a3ef24637b7f9d54cb6e36c64 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 27 Sep 2018 23:52:46 -0400 Subject: [PATCH 10/90] 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. Hopefully will fix issues #1496 and #1434 --- ...h-entity-loss-due-to-unloaded-chunks.patch | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Spigot-Server-Patches/0362-Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch diff --git a/Spigot-Server-Patches/0362-Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch b/Spigot-Server-Patches/0362-Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch new file mode 100644 index 000000000000..fad5adbdf5ac --- /dev/null +++ b/Spigot-Server-Patches/0362-Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch @@ -0,0 +1,44 @@ +From 2583b7ee5959cd427bf88fdc24c10cbcfa774691 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 + From a690c979f14f9abdd17068feb0bdb5ab7047652b Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 29 Sep 2018 12:14:40 -0400 Subject: [PATCH 11/90] Backport Village Door fix from 1.13 --- ...-Backport-Village-Door-fix-from-1.13.patch | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Spigot-Server-Patches/0363-Backport-Village-Door-fix-from-1.13.patch diff --git a/Spigot-Server-Patches/0363-Backport-Village-Door-fix-from-1.13.patch b/Spigot-Server-Patches/0363-Backport-Village-Door-fix-from-1.13.patch new file mode 100644 index 000000000000..926993ed1c31 --- /dev/null +++ b/Spigot-Server-Patches/0363-Backport-Village-Door-fix-from-1.13.patch @@ -0,0 +1,22 @@ +From 3a22b07de7c465b2db5d456dbf516c8a443f57d6 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..af09551f4e 100644 +--- a/src/main/java/net/minecraft/server/Village.java ++++ b/src/main/java/net/minecraft/server/Village.java +@@ -312,7 +312,7 @@ public class Village { + villagedoor.a(); + } + +- if (!this.f(villagedoor.d()) || Math.abs(this.g - villagedoor.h()) > 1200) { ++ if ((!this.f(villagedoor.d()) || Math.abs(this.g - villagedoor.h()) > 1200) && this.a.isLoaded(villagedoor.d())) { // Paper - don't remove doors from unloaded chunks + this.c = this.c.b(villagedoor.d()); + flag = true; + villagedoor.a(true); +-- +2.19.0 + From 7ec576d1fcf603b6647576b8ae7bc35646316f50 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Sat, 29 Sep 2018 22:42:20 -0400 Subject: [PATCH 12/90] Fix cancelled lootables --- ...-API-Replenishable-Lootables-Feature.patch | 24 +++++++++++++++++-- ...7-Ability-to-apply-mending-to-XP-API.patch | 8 +++---- ...0304-ItemStack-getMaxItemUseDuration.patch | 10 ++++---- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/Spigot-Server-Patches/0126-LootTable-API-Replenishable-Lootables-Feature.patch b/Spigot-Server-Patches/0126-LootTable-API-Replenishable-Lootables-Feature.patch index 5f4ce5977252..e6abd886d2b9 100644 --- a/Spigot-Server-Patches/0126-LootTable-API-Replenishable-Lootables-Feature.patch +++ b/Spigot-Server-Patches/0126-LootTable-API-Replenishable-Lootables-Feature.patch @@ -1,4 +1,4 @@ -From e390dbccabd0c678c953bc4769e771a54e4c38bb Mon Sep 17 00:00:00 2001 +From a92ddb31414c1c1149f93ebdffca0b8d08f31e85 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 1 May 2016 21:19:14 -0400 Subject: [PATCH] LootTable API & Replenishable Lootables Feature @@ -540,6 +540,26 @@ index d6afa4aa6..50d7d34b8 100644 + } + // Paper end } +diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java +index 5047a57e9..b25dfaa16 100644 +--- a/src/main/java/net/minecraft/server/ItemStack.java ++++ b/src/main/java/net/minecraft/server/ItemStack.java +@@ -229,6 +229,15 @@ public final class ItemStack { + enuminteractionresult = EnumInteractionResult.FAIL; // cancel placement + // PAIL: Remove this when MC-99075 fixed + placeEvent.getPlayer().updateInventory(); ++ ++ // Paper start ++ for (Map.Entry e : world.capturedTileEntities.entrySet()) { ++ if (e.getValue() instanceof TileEntityLootable) { ++ ((TileEntityLootable) e.getValue()).setLootTable(null); ++ } ++ } ++ // Paper end ++ + // revert back all captured blocks + for (BlockState blockstate : blocks) { + blockstate.update(true, false); diff --git a/src/main/java/net/minecraft/server/TileEntityLootable.java b/src/main/java/net/minecraft/server/TileEntityLootable.java index a97ad2037..618521304 100644 --- a/src/main/java/net/minecraft/server/TileEntityLootable.java @@ -791,5 +811,5 @@ index e9963e21c..acb4dee04 100644 CraftMinecartHopper(CraftServer server, EntityMinecartHopper entity) { -- -2.18.0 +2.19.0 diff --git a/Spigot-Server-Patches/0257-Ability-to-apply-mending-to-XP-API.patch b/Spigot-Server-Patches/0257-Ability-to-apply-mending-to-XP-API.patch index 06c5c96faff5..720ed04df144 100644 --- a/Spigot-Server-Patches/0257-Ability-to-apply-mending-to-XP-API.patch +++ b/Spigot-Server-Patches/0257-Ability-to-apply-mending-to-XP-API.patch @@ -1,4 +1,4 @@ -From 5a07c0ee8d6b1ae0143448473c2e081ec6517412 Mon Sep 17 00:00:00 2001 +From 0b0b6356ab5bbf4da29e883baa4181223fae8584 Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 20 Dec 2017 17:36:49 -0500 Subject: [PATCH] Ability to apply mending to XP API @@ -52,7 +52,7 @@ index ff5cc74ba..1c59fd966 100644 return i * 2; } diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index d666088f2..f6b802dc8 100644 +index 2dc428552..7be588176 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java @@ -29,7 +29,7 @@ public final class ItemStack { @@ -64,7 +64,7 @@ index d666088f2..f6b802dc8 100644 private EntityItemFrame i; private Block j; private boolean k; -@@ -350,10 +350,12 @@ public final class ItemStack { +@@ -359,10 +359,12 @@ public final class ItemStack { return this.getItem().k(); } @@ -123,5 +123,5 @@ index d69784386..77c50ba14 100644 } -- -2.18.0 +2.19.0 diff --git a/Spigot-Server-Patches/0304-ItemStack-getMaxItemUseDuration.patch b/Spigot-Server-Patches/0304-ItemStack-getMaxItemUseDuration.patch index 9a070ba57e4f..6f3865a9d55f 100644 --- a/Spigot-Server-Patches/0304-ItemStack-getMaxItemUseDuration.patch +++ b/Spigot-Server-Patches/0304-ItemStack-getMaxItemUseDuration.patch @@ -1,4 +1,4 @@ -From addea0ca53003e381887f658b0a8bbd823c8c921 Mon Sep 17 00:00:00 2001 +From 753ba2d406cf3ebeae11485b9c77c24d47835397 Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 5 Jun 2018 23:00:29 -0400 Subject: [PATCH] ItemStack#getMaxItemUseDuration @@ -6,10 +6,10 @@ Subject: [PATCH] ItemStack#getMaxItemUseDuration Allows you to determine how long it takes to use a usable/consumable item diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index f6b802dc8..6521bb508 100644 +index 7be588176..99f4b6aac 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java -@@ -561,6 +561,7 @@ public final class ItemStack { +@@ -570,6 +570,7 @@ public final class ItemStack { this.getItem().b(this, world, entityhuman); } @@ -18,7 +18,7 @@ index f6b802dc8..6521bb508 100644 return this.getItem().e(this); } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -index aa99254ff..be6589dbf 100644 +index 49576e665..decdccdc7 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java @@ -180,6 +180,13 @@ public final class CraftItemStack extends ItemStack { @@ -36,5 +36,5 @@ index aa99254ff..be6589dbf 100644 public void addUnsafeEnchantment(Enchantment ench, int level) { Validate.notNull(ench, "Cannot add null enchantment"); -- -2.18.0 +2.19.0 From 3ac4505b1e059b38dcc97558352b10af899a8cd7 Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 1 Oct 2018 20:28:06 -0400 Subject: [PATCH 13/90] Fix bug in the last commit for loot table fix --- ...-API-Replenishable-Lootables-Feature.patch | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Spigot-Server-Patches/0126-LootTable-API-Replenishable-Lootables-Feature.patch b/Spigot-Server-Patches/0126-LootTable-API-Replenishable-Lootables-Feature.patch index e6abd886d2b9..a4991d92cdd8 100644 --- a/Spigot-Server-Patches/0126-LootTable-API-Replenishable-Lootables-Feature.patch +++ b/Spigot-Server-Patches/0126-LootTable-API-Replenishable-Lootables-Feature.patch @@ -1,4 +1,4 @@ -From a92ddb31414c1c1149f93ebdffca0b8d08f31e85 Mon Sep 17 00:00:00 2001 +From 242c1065f2370a39bf4b79f1da420b000c55d96c Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 1 May 2016 21:19:14 -0400 Subject: [PATCH] LootTable API & Replenishable Lootables Feature @@ -11,7 +11,7 @@ This feature is good for long term worlds so that newer players do not suffer with "Every chest has been looted" diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index d96311f6b..067cb233e 100644 +index d96311f6bc..067cb233e4 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -303,4 +303,26 @@ public class PaperWorldConfig { @@ -43,7 +43,7 @@ index d96311f6b..067cb233e 100644 } diff --git a/src/main/java/com/destroystokyo/paper/loottable/CraftLootable.java b/src/main/java/com/destroystokyo/paper/loottable/CraftLootable.java new file mode 100644 -index 000000000..36c36d158 +index 0000000000..36c36d158f --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/loottable/CraftLootable.java @@ -0,0 +1,12 @@ @@ -61,7 +61,7 @@ index 000000000..36c36d158 +} diff --git a/src/main/java/com/destroystokyo/paper/loottable/CraftLootableBlockInventory.java b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableBlockInventory.java new file mode 100644 -index 000000000..20d236c45 +index 0000000000..20d236c451 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableBlockInventory.java @@ -0,0 +1,33 @@ @@ -100,7 +100,7 @@ index 000000000..20d236c45 +} diff --git a/src/main/java/com/destroystokyo/paper/loottable/CraftLootableEntityInventory.java b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableEntityInventory.java new file mode 100644 -index 000000000..1150dee01 +index 0000000000..1150dee01e --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableEntityInventory.java @@ -0,0 +1,31 @@ @@ -137,7 +137,7 @@ index 000000000..1150dee01 +} diff --git a/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventory.java new file mode 100644 -index 000000000..668097620 +index 0000000000..668097620f --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventory.java @@ -0,0 +1,88 @@ @@ -231,7 +231,7 @@ index 000000000..668097620 +} diff --git a/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventoryData.java b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventoryData.java new file mode 100644 -index 000000000..de2eff17e +index 0000000000..de2eff17e7 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventoryData.java @@ -0,0 +1,182 @@ @@ -418,7 +418,7 @@ index 000000000..de2eff17e + } +} diff --git a/src/main/java/net/minecraft/server/EntityMinecartContainer.java b/src/main/java/net/minecraft/server/EntityMinecartContainer.java -index d6afa4aa6..50d7d34b8 100644 +index d6afa4aa61..50d7d34b80 100644 --- a/src/main/java/net/minecraft/server/EntityMinecartContainer.java +++ b/src/main/java/net/minecraft/server/EntityMinecartContainer.java @@ -6,17 +6,21 @@ import javax.annotation.Nullable; @@ -541,7 +541,7 @@ index d6afa4aa6..50d7d34b8 100644 + // Paper end } diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index 5047a57e9..b25dfaa16 100644 +index 5047a57e9b..eae31653de 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java @@ -229,6 +229,15 @@ public final class ItemStack { @@ -552,7 +552,7 @@ index 5047a57e9..b25dfaa16 100644 + // Paper start + for (Map.Entry e : world.capturedTileEntities.entrySet()) { + if (e.getValue() instanceof TileEntityLootable) { -+ ((TileEntityLootable) e.getValue()).setLootTable(null); ++ ((TileEntityLootable) e.getValue()).clearLootTable(); + } + } + // Paper end @@ -561,7 +561,7 @@ index 5047a57e9..b25dfaa16 100644 for (BlockState blockstate : blocks) { blockstate.update(true, false); diff --git a/src/main/java/net/minecraft/server/TileEntityLootable.java b/src/main/java/net/minecraft/server/TileEntityLootable.java -index a97ad2037..618521304 100644 +index a97ad2037b..6185213046 100644 --- a/src/main/java/net/minecraft/server/TileEntityLootable.java +++ b/src/main/java/net/minecraft/server/TileEntityLootable.java @@ -1,44 +1,50 @@ @@ -678,7 +678,7 @@ index a97ad2037..618521304 100644 + } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java -index 8328ed005..266f87d7f 100644 +index 8328ed0052..266f87d7f1 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java @@ -60,7 +60,7 @@ public class CraftBlockEntityState extends CraftBlockState @@ -691,7 +691,7 @@ index 8328ed005..266f87d7f 100644 } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java -index 85f3bb272..733c04ef7 100644 +index 85f3bb2720..733c04ef75 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java @@ -1,5 +1,6 @@ @@ -711,7 +711,7 @@ index 85f3bb272..733c04ef7 100644 public CraftChest(final Block block) { super(block, TileEntityChest.class); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java b/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java -index 1dc8bfecd..bfcf9b6c4 100644 +index 1dc8bfecd2..bfcf9b6c4d 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java @@ -1,5 +1,6 @@ @@ -731,7 +731,7 @@ index 1dc8bfecd..bfcf9b6c4 100644 public CraftDispenser(final Block block) { super(block, TileEntityDispenser.class); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftHopper.java b/src/main/java/org/bukkit/craftbukkit/block/CraftHopper.java -index 6566554ab..df156d0d9 100644 +index 6566554ab6..df156d0d92 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftHopper.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftHopper.java @@ -1,5 +1,6 @@ @@ -751,7 +751,7 @@ index 6566554ab..df156d0d9 100644 public CraftHopper(final Block block) { super(block, TileEntityHopper.class); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java b/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java -index c029a1244..c26f0b5af 100644 +index c029a12441..c26f0b5afc 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java @@ -1,5 +1,6 @@ @@ -771,7 +771,7 @@ index c029a1244..c26f0b5af 100644 public CraftShulkerBox(final Block block) { super(block, TileEntityShulkerBox.class); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java -index 69435c457..4291edf25 100644 +index 69435c4576..4291edf252 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java @@ -1,5 +1,6 @@ @@ -791,7 +791,7 @@ index 69435c457..4291edf25 100644 public CraftMinecartChest(CraftServer server, EntityMinecartChest entity) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java -index e9963e21c..acb4dee04 100644 +index e9963e21cd..acb4dee04f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java @@ -1,5 +1,6 @@ From 67370956a0e2a516b7238d60988239e7925256ee Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 6 Oct 2018 01:03:51 -0400 Subject: [PATCH 14/90] Backport light fix for recheck gaps --- ...-entity-loss-due-to-unloaded-chunks.patch} | 2 +- ...Backport-Village-Door-fix-from-1.13.patch} | 2 +- ...kport-light-queue-changes-from-1.13.patch} | 46 ++++--------------- 3 files changed, 11 insertions(+), 39 deletions(-) rename Spigot-Server-Patches/{0362-Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch => 0361-Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch} (96%) rename Spigot-Server-Patches/{0363-Backport-Village-Door-fix-from-1.13.patch => 0362-Backport-Village-Door-fix-from-1.13.patch} (93%) rename Spigot-Server-Patches/{0361-Backport-light-queue-changes-from-1.13.patch => 0363-Backport-light-queue-changes-from-1.13.patch} (77%) diff --git a/Spigot-Server-Patches/0362-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 similarity index 96% rename from Spigot-Server-Patches/0362-Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch rename to Spigot-Server-Patches/0361-Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch index fad5adbdf5ac..9c1e8b502da4 100644 --- a/Spigot-Server-Patches/0362-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 @@ -1,4 +1,4 @@ -From 2583b7ee5959cd427bf88fdc24c10cbcfa774691 Mon Sep 17 00:00:00 2001 +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 diff --git a/Spigot-Server-Patches/0363-Backport-Village-Door-fix-from-1.13.patch b/Spigot-Server-Patches/0362-Backport-Village-Door-fix-from-1.13.patch similarity index 93% rename from Spigot-Server-Patches/0363-Backport-Village-Door-fix-from-1.13.patch rename to Spigot-Server-Patches/0362-Backport-Village-Door-fix-from-1.13.patch index 926993ed1c31..464eb8c6821a 100644 --- a/Spigot-Server-Patches/0363-Backport-Village-Door-fix-from-1.13.patch +++ b/Spigot-Server-Patches/0362-Backport-Village-Door-fix-from-1.13.patch @@ -1,4 +1,4 @@ -From 3a22b07de7c465b2db5d456dbf516c8a443f57d6 Mon Sep 17 00:00:00 2001 +From 9542aadf8d5db8a0f3937f5a311338fca70fc581 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/Spigot-Server-Patches/0361-Backport-light-queue-changes-from-1.13.patch b/Spigot-Server-Patches/0363-Backport-light-queue-changes-from-1.13.patch similarity index 77% rename from Spigot-Server-Patches/0361-Backport-light-queue-changes-from-1.13.patch rename to Spigot-Server-Patches/0363-Backport-light-queue-changes-from-1.13.patch index c609c163db09..1295ac3bcdd5 100644 --- a/Spigot-Server-Patches/0361-Backport-light-queue-changes-from-1.13.patch +++ b/Spigot-Server-Patches/0363-Backport-light-queue-changes-from-1.13.patch @@ -1,18 +1,15 @@ -From 7ddde7192795ce5518a53680ad998839aab39eba Mon Sep 17 00:00:00 2001 +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..0f3ef1ba18 100644 +index 523d10e8bc..6541f5af47 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -272,16 +272,10 @@ public class Chunk { - this.m = true; - } +@@ -274,14 +274,7 @@ public class Chunk { -+ private void recheckGaps(boolean flag) { h(flag); } // Paper 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)) { @@ -27,7 +24,7 @@ index 523d10e8bc..0f3ef1ba18 100644 for (int i = 0; i < 16; ++i) { for (int j = 0; j < 16; ++j) { if (this.i[i + j * 16]) { -@@ -332,7 +326,7 @@ public class Chunk { +@@ -332,7 +325,7 @@ public class Chunk { } private void a(int i, int j, int k, int l) { @@ -36,29 +33,8 @@ index 523d10e8bc..0f3ef1ba18 100644 for (int i1 = k; i1 < l; ++i1) { this.world.c(EnumSkyBlock.SKY, new BlockPosition(i, i1, j)); } -@@ -1231,9 +1225,19 @@ public class Chunk { - return new BlockPosition(blockposition.getX(), this.h[k], blockposition.getZ()); - } - -+ // Paper start -+ private boolean shouldRecheckGaps = false; -+ public void doGapCheck() { -+ if (shouldRecheckGaps) { -+ this.recheckGaps(false); -+ shouldRecheckGaps = false; -+ } -+ } -+ // Paper end -+ - public void b(boolean flag) { - if (this.m && this.world.worldProvider.m() && !flag) { -- this.h(this.world.isClientSide); -+ shouldRecheckGaps = true; // Paper - } - - this.r = true; diff --git a/src/main/java/net/minecraft/server/PaperLightingQueue.java b/src/main/java/net/minecraft/server/PaperLightingQueue.java -index 345cd58240..9ef414da09 100644 +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; @@ -83,7 +59,7 @@ index 345cd58240..9ef414da09 100644 START: for (World world : MinecraftServer.getServer().worlds) { if (!world.paperConfig.queueLightUpdates) { -@@ -23,10 +23,11 @@ class PaperLightingQueue { +@@ -23,7 +23,7 @@ class PaperLightingQueue { } ObjectCollection loadedChunks = ((WorldServer) world).getChunkProviderServer().chunks.values(); @@ -92,11 +68,7 @@ index 345cd58240..9ef414da09 100644 if (chunk.lightingQueue.processQueue(startTime, maxTickTime)) { break START; } -+ chunk.doGapCheck(); - } - } - } -@@ -50,14 +51,15 @@ class PaperLightingQueue { +@@ -50,14 +50,15 @@ class PaperLightingQueue { if (this.isEmpty()) { return false; } @@ -116,7 +88,7 @@ index 345cd58240..9ef414da09 100644 } } } -@@ -74,7 +76,7 @@ class PaperLightingQueue { +@@ -74,7 +75,7 @@ class PaperLightingQueue { } processQueue(0, 0); // No timeout @@ -125,7 +97,7 @@ index 345cd58240..9ef414da09 100644 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 +91,8 @@ class PaperLightingQueue { +@@ -89,4 +90,8 @@ class PaperLightingQueue { } } } From f9494493380622dc227b3991802793fcc184dca1 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 6 Oct 2018 01:13:48 -0400 Subject: [PATCH 15/90] 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. --- ...0364-Backport-Water-Activation-Range.patch | 130 ++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 Spigot-Server-Patches/0364-Backport-Water-Activation-Range.patch diff --git a/Spigot-Server-Patches/0364-Backport-Water-Activation-Range.patch b/Spigot-Server-Patches/0364-Backport-Water-Activation-Range.patch new file mode 100644 index 000000000000..5fb09a840c88 --- /dev/null +++ b/Spigot-Server-Patches/0364-Backport-Water-Activation-Range.patch @@ -0,0 +1,130 @@ +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 + From c3538607484b430bb948fcc54b422ca6c6d6d72d Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Mon, 8 Oct 2018 18:18:00 +0100 Subject: [PATCH 16/90] Backport: Prevent mob spawning from loading/generating chunks --- ...-mob-spawning-from-loading-generatin.patch | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Spigot-Server-Patches/0365-Backport-Prevent-mob-spawning-from-loading-generatin.patch 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 new file mode 100644 index 000000000000..5fc06436925c --- /dev/null +++ b/Spigot-Server-Patches/0365-Backport-Prevent-mob-spawning-from-loading-generatin.patch @@ -0,0 +1,33 @@ +From 58a667675d7fc52cb8a5502f3c75ec519df7b950 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..c1d0ff1376 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.getType(blockposition1) : null; // Paper + +- if (!iblockdata.l()) { ++ if (iblockdata != null && !iblockdata.l()) { // Paper + int l2 = 0; + int i3 = 0; + +@@ -184,6 +184,7 @@ public final class SpawnerCreature { + float f = (float) j3 + 0.5F; + float f1 = (float) l3 + 0.5F; + ++ if (!worldserver.isChunkLoaded(j3, l3, true) || !worldserver.getWorldBorder().isInBounds(blockposition_mutableblockposition)) continue; // paper - Prevent mob spawning from loading/generating chunks + if (!worldserver.isPlayerNearby((double) f, (double) k3, (double) f1, 24.0D) && blockposition.distanceSquared((double) f, (double) k3, (double) f1) >= 576.0D) { + if (biomebase_biomemeta == null) { + biomebase_biomemeta = worldserver.a(enumcreaturetype, (BlockPosition) blockposition_mutableblockposition); +-- +2.19.1 + From 87d2e7686034fc96e2b0cc3b39a7f3add6083d79 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Mon, 8 Oct 2018 20:29:37 +0100 Subject: [PATCH 17/90] Fix oversight in behavior of last patch --- ...ckport-Prevent-mob-spawning-from-loading-generatin.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 index 5fc06436925c..3e89af780381 100644 --- 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 @@ -1,11 +1,11 @@ -From 58a667675d7fc52cb8a5502f3c75ec519df7b950 Mon Sep 17 00:00:00 2001 +From 88153d3b72c888683b63d4d5aa8bcc94cbe5f07a 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..c1d0ff1376 100644 +index 11e69a0547..93ae14e4a5 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 { @@ -24,7 +24,7 @@ index 11e69a0547..c1d0ff1376 100644 float f = (float) j3 + 0.5F; float f1 = (float) l3 + 0.5F; -+ if (!worldserver.isChunkLoaded(j3, l3, true) || !worldserver.getWorldBorder().isInBounds(blockposition_mutableblockposition)) continue; // paper - Prevent mob spawning from loading/generating chunks ++ if (worldserver.isChunkLoaded(j3, l3, true) && !worldserver.getWorldBorder().isInBounds(blockposition_mutableblockposition)) // paper - Prevent mob spawning from loading/generating chunks if (!worldserver.isPlayerNearby((double) f, (double) k3, (double) f1, 24.0D) && blockposition.distanceSquared((double) f, (double) k3, (double) f1) >= 576.0D) { if (biomebase_biomemeta == null) { biomebase_biomemeta = worldserver.a(enumcreaturetype, (BlockPosition) blockposition_mutableblockposition); From 583be93c81596a92e6c82ba90ad7c08b3ad2feb2 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Thu, 11 Oct 2018 20:03:52 +0100 Subject: [PATCH 18/90] Fix inversion issue in last patch --- ...5-Backport-Prevent-mob-spawning-from-loading-generatin.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index 3e89af780381..b14186c90efd 100644 --- 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 @@ -24,7 +24,7 @@ index 11e69a0547..93ae14e4a5 100644 float f = (float) j3 + 0.5F; float f1 = (float) l3 + 0.5F; -+ if (worldserver.isChunkLoaded(j3, l3, true) && !worldserver.getWorldBorder().isInBounds(blockposition_mutableblockposition)) // paper - Prevent mob spawning from loading/generating chunks ++ if (worldserver.isChunkLoaded(j3, l3, true) && worldserver.getWorldBorder().isInBounds(blockposition_mutableblockposition)) // paper - Prevent mob spawning from loading/generating chunks if (!worldserver.isPlayerNearby((double) f, (double) k3, (double) f1, 24.0D) && blockposition.distanceSquared((double) f, (double) k3, (double) f1) >= 576.0D) { if (biomebase_biomemeta == null) { biomebase_biomemeta = worldserver.a(enumcreaturetype, (BlockPosition) blockposition_mutableblockposition); From 33d2de5f725353cd3ba2dda6739774bf326f8efc Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 11 Oct 2018 21:16:08 -0400 Subject: [PATCH 19/90] Improve Village Door fix to not merge villages (Iron Titan) Improves doors to better handle unloaded state so they need 1200 LOADED ticks in order to not be dismissed. Also improves the villages to not even tick when the center of the village + 1 is not loaded, improving server performance (and helping door issue) This should keep Iron Titans back working --- ...-Backport-Village-Door-fix-from-1.13.patch | 54 ++++++++++++++++--- scripts/importmcdev.sh | 1 + 2 files changed, 48 insertions(+), 7 deletions(-) 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 index 464eb8c6821a..e41bb006c02e 100644 --- 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 @@ -1,22 +1,62 @@ -From 9542aadf8d5db8a0f3937f5a311338fca70fc581 Mon Sep 17 00:00:00 2001 +From d4d9b90ec44df0777e139ace23b70438a000c800 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..af09551f4e 100644 +index 9f1867ddd3..d48487cc15 100644 --- a/src/main/java/net/minecraft/server/Village.java +++ b/src/main/java/net/minecraft/server/Village.java -@@ -312,7 +312,7 @@ public class Village { - villagedoor.a(); +@@ -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(); +@@ -313,6 +319,14 @@ public class Village { } -- if (!this.f(villagedoor.d()) || Math.abs(this.g - villagedoor.h()) > 1200) { -+ if ((!this.f(villagedoor.d()) || Math.abs(this.g - villagedoor.h()) > 1200) && this.a.isLoaded(villagedoor.d())) { // Paper - don't remove doors from unloaded chunks + if (!this.f(villagedoor.d()) || Math.abs(this.g - villagedoor.h()) > 1200) { ++ // Paper start- don't remove doors from unloaded chunks ++ if (!this.a.isLoaded(villagedoor.d())) { ++ villagedoor.inactiveDoorTicks = 0; ++ continue; ++ } else if (++villagedoor.inactiveDoorTicks < 1200) { ++ continue; ++ } ++ // Paper end this.c = this.c.b(villagedoor.d()); flag = true; villagedoor.a(true); +diff --git a/src/main/java/net/minecraft/server/VillageDoor.java b/src/main/java/net/minecraft/server/VillageDoor.java +index 43de227738..1a7e3e8745 100644 +--- a/src/main/java/net/minecraft/server/VillageDoor.java ++++ b/src/main/java/net/minecraft/server/VillageDoor.java +@@ -2,6 +2,7 @@ package net.minecraft.server; + + public class VillageDoor { + ++ public int inactiveDoorTicks = 0; // Paper + private final BlockPosition a; + private final BlockPosition b; + private final EnumDirection c; -- -2.19.0 +2.19.1 diff --git a/scripts/importmcdev.sh b/scripts/importmcdev.sh index bc3b21f90e67..46be2434a294 100755 --- a/scripts/importmcdev.sh +++ b/scripts/importmcdev.sh @@ -116,6 +116,7 @@ import StructurePiece import StructureStart import TileEntityEnderChest import TileEntityLootable +import VillageDoor import WorldGenStronghold import WorldProvider From b91846a31bbbe6b37c5625b59906b5192525a78a Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 11 Oct 2018 21:16:12 -0400 Subject: [PATCH 20/90] Backport Detect and recover from corrupt region files see https://github.com/PaperMC/Paper/commit/069371698489fdc3122b2e14852cbb0488989ddf --- ...tect-and-repair-corrupt-Region-Files.patch | 125 ++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 Spigot-Server-Patches/0366-Detect-and-repair-corrupt-Region-Files.patch 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 new file mode 100644 index 000000000000..ce99ef9fbc71 --- /dev/null +++ b/Spigot-Server-Patches/0366-Detect-and-repair-corrupt-Region-Files.patch @@ -0,0 +1,125 @@ +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 + From 8601385dd760152f79a037d73f6fa44a0d407ae1 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 11 Oct 2018 21:45:28 -0400 Subject: [PATCH 21/90] Further improve village door code for 1.12 --- ...-Backport-Village-Door-fix-from-1.13.patch | 40 ++++++------------- scripts/importmcdev.sh | 1 - 2 files changed, 13 insertions(+), 28 deletions(-) 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 index e41bb006c02e..d549ea8eebf0 100644 --- 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 @@ -1,11 +1,11 @@ -From d4d9b90ec44df0777e139ace23b70438a000c800 Mon Sep 17 00:00:00 2001 +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..d48487cc15 100644 +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 { @@ -30,33 +30,19 @@ index 9f1867ddd3..d48487cc15 100644 this.g = i; this.m(); this.l(); -@@ -313,6 +319,14 @@ public class Village { - } +@@ -307,6 +313,12 @@ public class Village { - if (!this.f(villagedoor.d()) || Math.abs(this.g - villagedoor.h()) > 1200) { -+ // Paper start- don't remove doors from unloaded chunks -+ if (!this.a.isLoaded(villagedoor.d())) { -+ villagedoor.inactiveDoorTicks = 0; -+ continue; -+ } else if (++villagedoor.inactiveDoorTicks < 1200) { -+ continue; -+ } -+ // Paper end - this.c = this.c.b(villagedoor.d()); - flag = true; - villagedoor.a(true); -diff --git a/src/main/java/net/minecraft/server/VillageDoor.java b/src/main/java/net/minecraft/server/VillageDoor.java -index 43de227738..1a7e3e8745 100644 ---- a/src/main/java/net/minecraft/server/VillageDoor.java -+++ b/src/main/java/net/minecraft/server/VillageDoor.java -@@ -2,6 +2,7 @@ package net.minecraft.server; + 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 - public class VillageDoor { - -+ public int inactiveDoorTicks = 0; // Paper - private final BlockPosition a; - private final BlockPosition b; - private final EnumDirection c; + if (flag1) { + villagedoor.a(); -- 2.19.1 diff --git a/scripts/importmcdev.sh b/scripts/importmcdev.sh index 46be2434a294..bc3b21f90e67 100755 --- a/scripts/importmcdev.sh +++ b/scripts/importmcdev.sh @@ -116,7 +116,6 @@ import StructurePiece import StructureStart import TileEntityEnderChest import TileEntityLootable -import VillageDoor import WorldGenStronghold import WorldProvider From be4fc8c7af2ea2d586feed78dac022853cf0cf16 Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 12 Oct 2018 01:38:32 -0400 Subject: [PATCH 22/90] Backport the dupe uuid and entity log changes --- ...the-dupe-uuid-and-entity-log-changes.patch | 144 ++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 Spigot-Server-Patches/0367-Backport-the-dupe-uuid-and-entity-log-changes.patch 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 new file mode 100644 index 000000000000..ded65a7d5417 --- /dev/null +++ b/Spigot-Server-Patches/0367-Backport-the-dupe-uuid-and-entity-log-changes.patch @@ -0,0 +1,144 @@ +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 + From ca8dc1b847136110048d89acad42ebbc2f56c4d2 Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 12 Oct 2018 16:54:46 -0400 Subject: [PATCH 23/90] Actually fix mob spawning for real Fixes #1567 --- ...revent-mob-spawning-from-loading-generatin.patch | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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 index b14186c90efd..8ab32a6de5a5 100644 --- 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 @@ -1,11 +1,11 @@ -From 88153d3b72c888683b63d4d5aa8bcc94cbe5f07a Mon Sep 17 00:00:00 2001 +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..93ae14e4a5 100644 +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 { @@ -13,21 +13,22 @@ index 11e69a0547..93ae14e4a5 100644 int j2 = blockposition1.getY(); int k2 = blockposition1.getZ(); - IBlockData iblockdata = worldserver.getType(blockposition1); -+ IBlockData iblockdata = worldserver.getWorldBorder().isInBounds(blockposition1) ? worldserver.getType(blockposition1) : null; // Paper ++ 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,6 +184,7 @@ public final class SpawnerCreature { +@@ -184,7 +184,7 @@ public final class SpawnerCreature { float f = (float) j3 + 0.5F; float f1 = (float) l3 + 0.5F; -+ if (worldserver.isChunkLoaded(j3, l3, true) && worldserver.getWorldBorder().isInBounds(blockposition_mutableblockposition)) // paper - Prevent mob spawning from loading/generating chunks - if (!worldserver.isPlayerNearby((double) f, (double) k3, (double) f1, 24.0D) && blockposition.distanceSquared((double) f, (double) k3, (double) f1) >= 576.0D) { +- 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 From fce9e20719c53eaae1e974ab51bdf55ef650b455 Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 17 Oct 2018 22:53:08 -0400 Subject: [PATCH 24/90] MC-54026: Backport 1.13 client desync fix on fast tools --- ...t-1.13-client-desync-fix-on-fast-too.patch | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Spigot-Server-Patches/0368-MC-54026-Backport-1.13-client-desync-fix-on-fast-too.patch 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 new file mode 100644 index 000000000000..b1e81289e874 --- /dev/null +++ b/Spigot-Server-Patches/0368-MC-54026-Backport-1.13-client-desync-fix-on-fast-too.patch @@ -0,0 +1,21 @@ +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 + From e7245e68bd9289007c26e08809da599907f91f33 Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 17 Oct 2018 23:11:04 -0400 Subject: [PATCH 25/90] Backport Timings improvements from 1.13 --- ...kport-Timings-improvements-from-1.13.patch | 359 ++++++++++++++++++ 1 file changed, 359 insertions(+) create mode 100644 Spigot-API-Patches/0135-Backport-Timings-improvements-from-1.13.patch diff --git a/Spigot-API-Patches/0135-Backport-Timings-improvements-from-1.13.patch b/Spigot-API-Patches/0135-Backport-Timings-improvements-from-1.13.patch new file mode 100644 index 000000000000..574d3fe12e46 --- /dev/null +++ b/Spigot-API-Patches/0135-Backport-Timings-improvements-from-1.13.patch @@ -0,0 +1,359 @@ +From 89d13915b1039ffd557247d45a056339d20d149b Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Wed, 17 Oct 2018 21:58:27 -0400 +Subject: [PATCH] Backport Timings improvements from 1.13 + + +diff --git a/src/main/java/co/aikar/timings/TimingHistory.java b/src/main/java/co/aikar/timings/TimingHistory.java +index c2c2fb838..28d0954a3 100644 +--- a/src/main/java/co/aikar/timings/TimingHistory.java ++++ b/src/main/java/co/aikar/timings/TimingHistory.java +@@ -201,11 +201,11 @@ public class TimingHistory { + + @SuppressWarnings("unchecked") + final Map entityCounts = MRUMapCache.of(LoadingMap.of( +- new EnumMap(EntityType.class), Counter.LOADER ++ new EnumMap(EntityType.class), k -> new Counter() + )); + @SuppressWarnings("unchecked") + final Map tileEntityCounts = MRUMapCache.of(LoadingMap.of( +- new EnumMap(Material.class), Counter.LOADER ++ new EnumMap(Material.class), k -> new Counter() + )); + + static class RegionId { +@@ -335,13 +335,6 @@ public class TimingHistory { + + private static class Counter { + private int count = 0; +- @SuppressWarnings({"rawtypes", "SuppressionAnnotation", "Guava"}) +- static Function LOADER = new LoadingMap.Feeder() { +- @Override +- public Counter apply() { +- return new Counter(); +- } +- }; + public int increment() { + return ++count; + } +diff --git a/src/main/java/co/aikar/timings/TimingIdentifier.java b/src/main/java/co/aikar/timings/TimingIdentifier.java +index 623dda49c..636c7119a 100644 +--- a/src/main/java/co/aikar/timings/TimingIdentifier.java ++++ b/src/main/java/co/aikar/timings/TimingIdentifier.java +@@ -23,12 +23,13 @@ + */ + package co.aikar.timings; + +-import com.google.common.base.Function; + import co.aikar.util.LoadingMap; +-import co.aikar.util.MRUMapCache; + + import java.util.ArrayDeque; + import java.util.Map; ++import java.util.Objects; ++import java.util.concurrent.ConcurrentHashMap; ++import java.util.concurrent.atomic.AtomicInteger; + + /** + *

Used as a basis for fast HashMap key comparisons for the Timing Map.

+@@ -39,15 +40,8 @@ final class TimingIdentifier { + /** + * Holds all groups. Autoloads on request for a group by name. + */ +- static final Map GROUP_MAP = MRUMapCache.of( +- LoadingMap.newIdentityHashMap(new Function() { +- @Override +- public TimingGroup apply(String group) { +- return new TimingGroup(group); +- } +- }, 64) +- ); +- static final TimingGroup DEFAULT_GROUP = getGroup("Minecraft"); ++ static final Map GROUP_MAP = LoadingMap.of(new ConcurrentHashMap<>(64, .5F), TimingGroup::new); ++ private static final TimingGroup DEFAULT_GROUP = getGroup("Minecraft"); + final String group; + final String name; + final TimingHandler groupHandler; +@@ -55,8 +49,8 @@ final class TimingIdentifier { + private final int hashCode; + + TimingIdentifier(String group, String name, Timing groupHandler, boolean protect) { +- this.group = group != null ? group.intern() : DEFAULT_GROUP.name; +- this.name = name.intern(); ++ this.group = group != null ? group: DEFAULT_GROUP.name; ++ this.name = name; + this.groupHandler = groupHandler != null ? groupHandler.getTimingHandler() : null; + this.protect = protect; + this.hashCode = (31 * this.group.hashCode()) + this.name.hashCode(); +@@ -67,11 +61,9 @@ final class TimingIdentifier { + return DEFAULT_GROUP; + } + +- return GROUP_MAP.get(groupName.intern()); ++ return GROUP_MAP.get(groupName); + } + +- // We are using .intern() on the strings so it is guaranteed to be an identity comparison. +- @SuppressWarnings("StringEquality") + @Override + public boolean equals(Object o) { + if (o == null) { +@@ -79,7 +71,7 @@ final class TimingIdentifier { + } + + TimingIdentifier that = (TimingIdentifier) o; +- return group == that.group && name == that.name; ++ return Objects.equals(group, that.group) && Objects.equals(name, that.name); + } + + @Override +@@ -89,8 +81,8 @@ final class TimingIdentifier { + + static class TimingGroup { + +- private static int idPool = 1; +- final int id = idPool++; ++ private static AtomicInteger idPool = new AtomicInteger(1); ++ final int id = idPool.getAndIncrement(); + + final String name; + ArrayDeque handlers = new ArrayDeque(64); +@@ -98,5 +90,18 @@ final class TimingIdentifier { + private TimingGroup(String name) { + this.name = name; + } ++ ++ @Override ++ public boolean equals(Object o) { ++ if (this == o) return true; ++ if (o == null || getClass() != o.getClass()) return false; ++ TimingGroup that = (TimingGroup) o; ++ return id == that.id; ++ } ++ ++ @Override ++ public int hashCode() { ++ return id; ++ } + } + } +diff --git a/src/main/java/co/aikar/timings/TimingsManager.java b/src/main/java/co/aikar/timings/TimingsManager.java +index 58ed35e00..3b4401900 100644 +--- a/src/main/java/co/aikar/timings/TimingsManager.java ++++ b/src/main/java/co/aikar/timings/TimingsManager.java +@@ -23,45 +23,35 @@ + */ + package co.aikar.timings; + +-import com.google.common.base.Function; ++import co.aikar.util.LoadingMap; + import com.google.common.collect.EvictingQueue; + import org.bukkit.Bukkit; + import org.bukkit.Server; + import org.bukkit.command.Command; + import org.bukkit.plugin.Plugin; + import org.bukkit.plugin.java.PluginClassLoader; +-import co.aikar.util.LoadingMap; + +-import java.util.ArrayDeque; + import java.util.ArrayList; +-import java.util.Collection; +-import java.util.Collections; + import java.util.List; + import java.util.Map; ++import java.util.concurrent.ConcurrentHashMap; + import java.util.logging.Level; + + public final class TimingsManager { +- static final Map TIMING_MAP = +- Collections.synchronizedMap(LoadingMap.newHashMap( +- new Function() { +- @Override +- public TimingHandler apply(TimingIdentifier id) { +- return (id.protect ? +- new UnsafeTimingHandler(id) : +- new TimingHandler(id) +- ); +- } +- }, +- 256, .5F +- )); ++ static final Map TIMING_MAP = LoadingMap.of( ++ new ConcurrentHashMap<>(4096, .5F), id -> (id.protect ? ++ new UnsafeTimingHandler(id) : ++ new TimingHandler(id) ++ ) ++ ); + public static final FullServerTickHandler FULL_SERVER_TICK = new FullServerTickHandler(); + public static final TimingHandler TIMINGS_TICK = Timings.ofSafe("Timings Tick", FULL_SERVER_TICK); + public static final Timing PLUGIN_GROUP_HANDLER = Timings.ofSafe("Plugins"); + public static List hiddenConfigs = new ArrayList(); + public static boolean privacy = false; + +- static final Collection HANDLERS = new ArrayDeque(); +- static final ArrayDeque MINUTE_REPORTS = new ArrayDeque(); ++ static final List HANDLERS = new ArrayList<>(1024); ++ static final List MINUTE_REPORTS = new ArrayList<>(64); + + static EvictingQueue HISTORY = EvictingQueue.create(12); + static TimingHandler CURRENT; +diff --git a/src/main/java/co/aikar/util/LoadingMap.java b/src/main/java/co/aikar/util/LoadingMap.java +index 1474384e8..9a4f9dca8 100644 +--- a/src/main/java/co/aikar/util/LoadingMap.java ++++ b/src/main/java/co/aikar/util/LoadingMap.java +@@ -23,20 +23,14 @@ + */ + package co.aikar.util; + +- +-import com.google.common.base.Function; +-import org.bukkit.Material; +-import co.aikar.timings.TimingHistory; +-import org.w3c.dom.css.Counter; +- + import java.lang.reflect.Constructor; + import java.util.AbstractMap; + import java.util.Collection; +-import java.util.EnumMap; + import java.util.HashMap; + import java.util.IdentityHashMap; + import java.util.Map; + import java.util.Set; ++import java.util.function.Function; + + /** + * Allows you to pass a Loader function that when a key is accessed that doesn't exists, +@@ -53,16 +47,16 @@ import java.util.Set; + * @param Key + * @param Value + */ +-public class LoadingMap extends AbstractMap { ++public class LoadingMap extends AbstractMap { + private final Map backingMap; +- private final Function loader; ++ private final java.util.function.Function loader; + + /** + * Initializes an auto loading map using specified loader and backing map + * @param backingMap Map to wrap + * @param loader Loader + */ +- public LoadingMap(Map backingMap, Function loader) { ++ public LoadingMap(Map backingMap, java.util.function.Function loader) { + this.backingMap = backingMap; + this.loader = loader; + } +@@ -77,7 +71,7 @@ public class LoadingMap extends AbstractMap { + * @return Map + */ + public static Map of(Map backingMap, Function loader) { +- return new LoadingMap(backingMap, loader); ++ return new LoadingMap<>(backingMap, loader); + } + + /** +@@ -97,7 +91,7 @@ public class LoadingMap extends AbstractMap { + */ + public static Map newAutoMap(Map backingMap, final Class keyClass, + final Class valueClass) { +- return new LoadingMap(backingMap, new AutoInstantiatingLoader(keyClass, valueClass)); ++ return new LoadingMap<>(backingMap, new AutoInstantiatingLoader<>(keyClass, valueClass)); + } + /** + * Creates a LoadingMap with an auto instantiating loader. +@@ -130,7 +124,7 @@ public class LoadingMap extends AbstractMap { + * @return Map that auto instantiates on .get() + */ + public static Map newHashAutoMap(final Class keyClass, final Class valueClass) { +- return newAutoMap(new HashMap(), keyClass, valueClass); ++ return newAutoMap(new HashMap<>(), keyClass, valueClass); + } + + /** +@@ -161,7 +155,7 @@ public class LoadingMap extends AbstractMap { + * @return Map that auto instantiates on .get() + */ + public static Map newHashAutoMap(final Class keyClass, final Class valueClass, int initialCapacity, float loadFactor) { +- return newAutoMap(new HashMap(initialCapacity, loadFactor), keyClass, valueClass); ++ return newAutoMap(new HashMap<>(initialCapacity, loadFactor), keyClass, valueClass); + } + + /** +@@ -189,9 +183,21 @@ public class LoadingMap extends AbstractMap { + * @return Map + */ + public static Map newHashMap(Function loader) { +- return new LoadingMap(new HashMap(), loader); ++ return new LoadingMap<>(new HashMap<>(), loader); + } + ++ /** ++ * Initializes an auto loading map using a HashMap ++ * ++ * @param loader Loader to use ++ * @param initialCapacity Initial capacity to use ++ * @param Key Type of the Map ++ * @param Value Type of the Map ++ * @return Map ++ */ ++ public static Map newHashMap(Function loader, int initialCapacity) { ++ return new LoadingMap<>(new HashMap<>(initialCapacity), loader); ++ } + /** + * Initializes an auto loading map using a HashMap + * +@@ -203,7 +209,7 @@ public class LoadingMap extends AbstractMap { + * @return Map + */ + public static Map newHashMap(Function loader, int initialCapacity, float loadFactor) { +- return new LoadingMap(new HashMap(initialCapacity, loadFactor), loader); ++ return new LoadingMap<>(new HashMap<>(initialCapacity, loadFactor), loader); + } + + /** +@@ -215,7 +221,7 @@ public class LoadingMap extends AbstractMap { + * @return Map + */ + public static Map newIdentityHashMap(Function loader) { +- return new LoadingMap(new IdentityHashMap(), loader); ++ return new LoadingMap<>(new IdentityHashMap<>(), loader); + } + + /** +@@ -228,7 +234,7 @@ public class LoadingMap extends AbstractMap { + * @return Map + */ + public static Map newIdentityHashMap(Function loader, int initialCapacity) { +- return new LoadingMap(new IdentityHashMap(initialCapacity), loader); ++ return new LoadingMap<>(new IdentityHashMap<>(initialCapacity), loader); + } + + @Override +@@ -245,14 +251,7 @@ public class LoadingMap extends AbstractMap { + + @Override + public V get(Object key) { +- V res = backingMap.get(key); +- if (res == null && key != null) { +- res = loader.apply((K) key); +- if (res != null) { +- backingMap.put((K) key, res); +- } +- } +- return res; ++ return backingMap.computeIfAbsent((K) key, loader); + } + + public V put(K key, V value) {return backingMap.put(key, value);} +@@ -283,7 +282,7 @@ public class LoadingMap extends AbstractMap { + } + + public LoadingMap clone() { +- return new LoadingMap(backingMap, loader); ++ return new LoadingMap<>(backingMap, loader); + } + + private static class AutoInstantiatingLoader implements Function { +-- +2.19.1 + From b15c43a38971a92fff66282e937923cfad488a71 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 23 Oct 2018 19:03:32 -0400 Subject: [PATCH 26/90] Update upstream for minecart spawner improvement --- .../0008-Check-Paper-versions.patch | 14 ++-- ...d-version-history-to-version-command.patch | 15 +++-- ...-MinecraftKey-Information-to-Objects.patch | 12 ++-- ...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 ++--- ...ck-and-tnt-entities-at-the-specified.patch | 14 ++-- .../0025-Entity-Origin-API.patch | 22 +++--- ...nfigurable-top-of-nether-void-damage.patch | 16 ++--- ...51-Ensure-commands-are-not-ran-async.patch | 16 ++--- ...oreboards-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 +-- ...nilla-per-world-scoreboard-coloring-.patch | 14 ++-- ...2-Vehicle-Event-Cancellation-Changes.patch | 10 +-- ...6-Optional-TNT-doesn-t-move-in-water.patch | 14 ++-- ...mative-vehicle-moved-wrongly-message.patch | 8 +-- ...153-Fix-AIOOBE-in-inventory-handling.patch | 8 +-- ...onfigurable-packet-in-spam-threshold.patch | 10 +-- .../0185-IllegalPacketEvent.patch | 16 ++--- ...86-Properly-fix-item-duplication-bug.patch | 10 +-- ...llow-entities-to-ride-themselves-572.patch | 8 +-- .../0196-Fix-block-break-desync.patch | 8 +-- ...ke-parrots-stay-on-shoulders-despite.patch | 12 ++-- .../0220-Entity-fromMobSpawner.patch | 14 ++-- .../0240-Add-PlayerJumpEvent.patch | 10 +-- ...1-handle-PacketPlayInKeepAlive-async.patch | 8 +-- .../0252-AsyncTabCompleteEvent.patch | 12 ++-- ...-allowed-colored-signs-to-be-created.patch | 8 +-- ...emove-entities-on-dimension-teleport.patch | 10 +-- .../0325-InventoryCloseEvent-Reason-API.patch | 22 +++--- ...nventory-when-cancelling-PlayerInter.patch | 8 +-- ...-more-information-to-Entity.toString.patch | 8 +-- .../0338-Duplicate-UUID-Resolve-Option.patch | 16 ++--- ...cess-chunk-registration-after-moving.patch | 67 ------------------- ...44-MC-111480-Start-Entity-ID-s-at-1.patch} | 6 +- ...d-make-tab-spam-limits-configurable.patch} | 10 +-- ...-Experience-should-save-as-Integers.patch} | 4 +- ...h => 0347-Entity-add-to-world-fixes.patch} | 10 +-- ...d-Early-Warning-Feature-to-WatchDog.patch} | 12 ++-- ...9-Use-ConcurrentHashMap-in-JsonList.patch} | 6 +- ...0-Use-a-Queue-for-Queueing-Commands.patch} | 6 +- ...llow-disabling-armour-stand-ticking.patch} | 10 +-- ...timize-BlockPosition-helper-methods.patch} | 6 +- ...e-always-loaded-on-hard-position-set.patch | 33 --------- ...ts-from-world-player-list-not-serve.patch} | 12 ++-- ....patch => 0354-Improve-death-events.patch} | 24 +++---- ....patch => 0355-isChunkGenerated-API.patch} | 8 +-- ...d-source-block-to-BlockPhysicsEvent.patch} | 6 +- ... => 0357-Optimize-Region-File-Cache.patch} | 6 +- ...-entity-loss-due-to-unloaded-chunks.patch} | 6 +- ...Backport-Village-Door-fix-from-1.13.patch} | 4 +- ...kport-light-queue-changes-from-1.13.patch} | 8 +-- ...360-Sync-Player-Position-to-Vehicles.patch | 38 ----------- ...361-Backport-Water-Activation-Range.patch} | 8 +-- ...mob-spawning-from-loading-generatin.patch} | 4 +- ...ect-and-repair-corrupt-Region-Files.patch} | 4 +- ...he-dupe-uuid-and-entity-log-changes.patch} | 10 +-- ...-1.13-client-desync-fix-on-fast-too.patch} | 4 +- scripts/upstreamMerge.sh | 8 ++- work/Bukkit | 2 +- work/CraftBukkit | 2 +- work/Spigot | 2 +- 64 files changed, 315 insertions(+), 448 deletions(-) delete mode 100644 Spigot-Server-Patches/0344-Always-process-chunk-registration-after-moving.patch rename Spigot-Server-Patches/{0345-MC-111480-Start-Entity-ID-s-at-1.patch => 0344-MC-111480-Start-Entity-ID-s-at-1.patch} (90%) rename Spigot-Server-Patches/{0346-Break-up-and-make-tab-spam-limits-configurable.patch => 0345-Break-up-and-make-tab-spam-limits-configurable.patch} (95%) rename Spigot-Server-Patches/{0347-MC-135506-Experience-should-save-as-Integers.patch => 0346-MC-135506-Experience-should-save-as-Integers.patch} (94%) rename Spigot-Server-Patches/{0348-Entity-add-to-world-fixes.patch => 0347-Entity-add-to-world-fixes.patch} (95%) rename Spigot-Server-Patches/{0349-Add-Early-Warning-Feature-to-WatchDog.patch => 0348-Add-Early-Warning-Feature-to-WatchDog.patch} (97%) rename Spigot-Server-Patches/{0350-Use-ConcurrentHashMap-in-JsonList.patch => 0349-Use-ConcurrentHashMap-in-JsonList.patch} (97%) rename Spigot-Server-Patches/{0351-Use-a-Queue-for-Queueing-Commands.patch => 0350-Use-a-Queue-for-Queueing-Commands.patch} (94%) rename Spigot-Server-Patches/{0352-Allow-disabling-armour-stand-ticking.patch => 0351-Allow-disabling-armour-stand-ticking.patch} (94%) rename Spigot-Server-Patches/{0354-Optimize-BlockPosition-helper-methods.patch => 0352-Optimize-BlockPosition-helper-methods.patch} (98%) delete mode 100644 Spigot-Server-Patches/0353-Ensure-chunks-are-always-loaded-on-hard-position-set.patch rename Spigot-Server-Patches/{0355-Send-nearby-packets-from-world-player-list-not-serve.patch => 0353-Send-nearby-packets-from-world-player-list-not-serve.patch} (97%) rename Spigot-Server-Patches/{0356-Improve-death-events.patch => 0354-Improve-death-events.patch} (98%) rename Spigot-Server-Patches/{0357-isChunkGenerated-API.patch => 0355-isChunkGenerated-API.patch} (91%) rename Spigot-Server-Patches/{0358-Add-source-block-to-BlockPhysicsEvent.patch => 0356-Add-source-block-to-BlockPhysicsEvent.patch} (91%) rename Spigot-Server-Patches/{0359-Optimize-Region-File-Cache.patch => 0357-Optimize-Region-File-Cache.patch} (96%) rename Spigot-Server-Patches/{0361-Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch => 0358-Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch} (94%) rename Spigot-Server-Patches/{0362-Backport-Village-Door-fix-from-1.13.patch => 0359-Backport-Village-Door-fix-from-1.13.patch} (93%) rename Spigot-Server-Patches/{0363-Backport-light-queue-changes-from-1.13.patch => 0360-Backport-light-queue-changes-from-1.13.patch} (96%) delete mode 100644 Spigot-Server-Patches/0360-Sync-Player-Position-to-Vehicles.patch rename Spigot-Server-Patches/{0364-Backport-Water-Activation-Range.patch => 0361-Backport-Water-Activation-Range.patch} (97%) rename Spigot-Server-Patches/{0365-Backport-Prevent-mob-spawning-from-loading-generatin.patch => 0362-Backport-Prevent-mob-spawning-from-loading-generatin.patch} (95%) rename Spigot-Server-Patches/{0366-Detect-and-repair-corrupt-Region-Files.patch => 0363-Detect-and-repair-corrupt-Region-Files.patch} (98%) rename Spigot-Server-Patches/{0367-Backport-the-dupe-uuid-and-entity-log-changes.patch => 0364-Backport-the-dupe-uuid-and-entity-log-changes.patch} (97%) rename Spigot-Server-Patches/{0368-MC-54026-Backport-1.13-client-desync-fix-on-fast-too.patch => 0365-MC-54026-Backport-1.13-client-desync-fix-on-fast-too.patch} (88%) diff --git a/Spigot-API-Patches/0008-Check-Paper-versions.patch b/Spigot-API-Patches/0008-Check-Paper-versions.patch index 18acf62395f9..2168ec42646b 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 8423eafcc10f..3f0e7e804ffe 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 f327c45af266..0951a3bfd3e2 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 6166befb9c69..fdd16a62d1b4 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 c7fd99a99301..354aee9dc40c 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 81ac89d4857c..44048cbeddc7 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 d38c1117f979..3f7de9eba228 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 2e434629422f..9682774229ac 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 84c5c75ce79b..15b509140c9a 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 5fcda5b7a7b6..7517147dd595 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 c1b5b26b688c..5ad3950fcc77 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 18f34858e036..448b2983791c 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 86f493e50081..71812dc943c4 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 b6fa875d7982..ca088cd915e9 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 92a61c0641ef..dde00cf0da47 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 89abe915c8e8..1c2c6354af8d 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 f48cacde8421..11e4e59426cf 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 3b393c987fdd..15c56631258b 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 24f979e481da..acbf7115ac76 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 cc040a5c85ef..7e338bb7a3b7 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 26fdf47c5af7..75ee18426718 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 6ae70642d2ca..62f0eb514657 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 3ca32d8f94fd..25b7e02ef893 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 fa15a2055ba6..889258d1ad76 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 373736e54adb..4b2302d05721 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 55e5e37873ec..3879e2eb83c7 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 e5570e949719..8c9a1ce07ad2 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 3f12db1cd2b5..45ab38bacbda 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 f836cbe4c25a..80afeeb25172 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 9a26faad726d..a5771ed2fb53 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 997c42c76673..6cca27f17c9e 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 6824311a9601..a140950b1dcc 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 881cdbcf8701..9e66375801f9 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 bd8bf558503e..eb399be892f4 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 ea5d9a5efadb..62bb5d1eb836 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 a50d65770641..000000000000 --- 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/0345-MC-111480-Start-Entity-ID-s-at-1.patch b/Spigot-Server-Patches/0344-MC-111480-Start-Entity-ID-s-at-1.patch similarity index 90% rename from Spigot-Server-Patches/0345-MC-111480-Start-Entity-ID-s-at-1.patch rename to Spigot-Server-Patches/0344-MC-111480-Start-Entity-ID-s-at-1.patch index 7bba1729dbee..0704357df5e0 100644 --- a/Spigot-Server-Patches/0345-MC-111480-Start-Entity-ID-s-at-1.patch +++ b/Spigot-Server-Patches/0344-MC-111480-Start-Entity-ID-s-at-1.patch @@ -1,4 +1,4 @@ -From b65086b45edfb15a357b918552a2d8284cce6c88 Mon Sep 17 00:00:00 2001 +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 @@ -7,7 +7,7 @@ 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 +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 @@ -20,5 +20,5 @@ index fce677f9f6..9b5f7fcf72 100644 public boolean i; public boolean blocksEntitySpawning() { return i; } // Paper - OBFHELPER public final List passengers; -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0346-Break-up-and-make-tab-spam-limits-configurable.patch b/Spigot-Server-Patches/0345-Break-up-and-make-tab-spam-limits-configurable.patch similarity index 95% rename from Spigot-Server-Patches/0346-Break-up-and-make-tab-spam-limits-configurable.patch rename to Spigot-Server-Patches/0345-Break-up-and-make-tab-spam-limits-configurable.patch index 8456dbc420b7..33634db40a27 100644 --- a/Spigot-Server-Patches/0346-Break-up-and-make-tab-spam-limits-configurable.patch +++ b/Spigot-Server-Patches/0345-Break-up-and-make-tab-spam-limits-configurable.patch @@ -1,4 +1,4 @@ -From 438859b071118528c6cc6c8f2411ef055ad58cf6 Mon Sep 17 00:00:00 2001 +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 @@ -22,7 +22,7 @@ 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 +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 { @@ -38,7 +38,7 @@ index 5a17ce3d22..a5ff014e33 100644 + } } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 521c466093..7b12d17a4c 100644 +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 { @@ -57,7 +57,7 @@ index 521c466093..7b12d17a4c 100644 /* Use thread-safe field access instead if (this.chatThrottle > 0) { --this.chatThrottle; -@@ -2282,7 +2284,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -2284,7 +2286,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { // Paper start - async tab completion public void a(PacketPlayInTabComplete packet) { // CraftBukkit start @@ -67,5 +67,5 @@ index 521c466093..7b12d17a4c 100644 return; } -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0347-MC-135506-Experience-should-save-as-Integers.patch b/Spigot-Server-Patches/0346-MC-135506-Experience-should-save-as-Integers.patch similarity index 94% rename from Spigot-Server-Patches/0347-MC-135506-Experience-should-save-as-Integers.patch rename to Spigot-Server-Patches/0346-MC-135506-Experience-should-save-as-Integers.patch index bfc0051bf287..6fa6ef7d7a7d 100644 --- a/Spigot-Server-Patches/0347-MC-135506-Experience-should-save-as-Integers.patch +++ b/Spigot-Server-Patches/0346-MC-135506-Experience-should-save-as-Integers.patch @@ -1,4 +1,4 @@ -From ac00b144ea5c59904530bae2a8697b9f05892649 Mon Sep 17 00:00:00 2001 +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 @@ -26,5 +26,5 @@ index 1c59fd96..becb102c 100644 } -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0348-Entity-add-to-world-fixes.patch b/Spigot-Server-Patches/0347-Entity-add-to-world-fixes.patch similarity index 95% rename from Spigot-Server-Patches/0348-Entity-add-to-world-fixes.patch rename to Spigot-Server-Patches/0347-Entity-add-to-world-fixes.patch index 0557588e8034..506a7aae7534 100644 --- a/Spigot-Server-Patches/0348-Entity-add-to-world-fixes.patch +++ b/Spigot-Server-Patches/0347-Entity-add-to-world-fixes.patch @@ -1,4 +1,4 @@ -From 7c862f1ffd126fdece882da529400f7b090dd19a Mon Sep 17 00:00:00 2001 +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 @@ -14,7 +14,7 @@ Fix this by differing entity add to world for all entities at the same time 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 +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 { @@ -41,7 +41,7 @@ index 2a5d1c90b4..1d2673a7b3 100644 } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 4a16f7ac71..04d0fa1df9 100644 +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 { @@ -70,7 +70,7 @@ index 4a16f7ac71..04d0fa1df9 100644 } 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 +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 { @@ -83,5 +83,5 @@ index 1244baf45a..a14b5e0618 100644 } else { if (!(entity instanceof EntityHuman)) { -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0349-Add-Early-Warning-Feature-to-WatchDog.patch b/Spigot-Server-Patches/0348-Add-Early-Warning-Feature-to-WatchDog.patch similarity index 97% rename from Spigot-Server-Patches/0349-Add-Early-Warning-Feature-to-WatchDog.patch rename to Spigot-Server-Patches/0348-Add-Early-Warning-Feature-to-WatchDog.patch index a8c754ec655d..6acaa4835039 100644 --- a/Spigot-Server-Patches/0349-Add-Early-Warning-Feature-to-WatchDog.patch +++ b/Spigot-Server-Patches/0348-Add-Early-Warning-Feature-to-WatchDog.patch @@ -1,4 +1,4 @@ -From 5ed114bb47c66db7798442d43bc8914ccea4cd5d Mon Sep 17 00:00:00 2001 +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 @@ -9,7 +9,7 @@ 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 +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; @@ -37,7 +37,7 @@ index a5ff014e3..332e90f86 100644 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 +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 @@ -49,7 +49,7 @@ index 0399a48e1..e0546e3dd 100644 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 +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 @@ -62,7 +62,7 @@ index 4f9fd4bc6..2cdd9aaf8 100644 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 +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; @@ -163,5 +163,5 @@ index 57a4748a3..93dc69835 100644 { interrupt(); -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0350-Use-ConcurrentHashMap-in-JsonList.patch b/Spigot-Server-Patches/0349-Use-ConcurrentHashMap-in-JsonList.patch similarity index 97% rename from Spigot-Server-Patches/0350-Use-ConcurrentHashMap-in-JsonList.patch rename to Spigot-Server-Patches/0349-Use-ConcurrentHashMap-in-JsonList.patch index cf53cbcca859..75b4d9003530 100644 --- a/Spigot-Server-Patches/0350-Use-ConcurrentHashMap-in-JsonList.patch +++ b/Spigot-Server-Patches/0349-Use-ConcurrentHashMap-in-JsonList.patch @@ -1,4 +1,4 @@ -From 72e3adc2cacaffcbfc61561568f1ae6d0a02069d Mon Sep 17 00:00:00 2001 +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 @@ -25,7 +25,7 @@ The point of this is readability, but does have a side-benefit of a small microp 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 +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; @@ -110,5 +110,5 @@ index 0859c7eb2b..93111cc240 100644 String s = this.b.toJson(collection); BufferedWriter bufferedwriter = null; -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0351-Use-a-Queue-for-Queueing-Commands.patch b/Spigot-Server-Patches/0350-Use-a-Queue-for-Queueing-Commands.patch similarity index 94% rename from Spigot-Server-Patches/0351-Use-a-Queue-for-Queueing-Commands.patch rename to Spigot-Server-Patches/0350-Use-a-Queue-for-Queueing-Commands.patch index 50f0c6725321..6a7b35d7d83a 100644 --- a/Spigot-Server-Patches/0351-Use-a-Queue-for-Queueing-Commands.patch +++ b/Spigot-Server-Patches/0350-Use-a-Queue-for-Queueing-Commands.patch @@ -1,4 +1,4 @@ -From a606668643e32d55ab47567a218b7c522526db84 Mon Sep 17 00:00:00 2001 +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 @@ -6,7 +6,7 @@ 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 +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 @@ -32,5 +32,5 @@ index 2922915927..6a8292ce45 100644 // CraftBukkit start - ServerCommand for preprocessing ServerCommandEvent event = new ServerCommandEvent(console, servercommand.command); -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0352-Allow-disabling-armour-stand-ticking.patch b/Spigot-Server-Patches/0351-Allow-disabling-armour-stand-ticking.patch similarity index 94% rename from Spigot-Server-Patches/0352-Allow-disabling-armour-stand-ticking.patch rename to Spigot-Server-Patches/0351-Allow-disabling-armour-stand-ticking.patch index 8a033956558c..7dd70f99824d 100644 --- a/Spigot-Server-Patches/0352-Allow-disabling-armour-stand-ticking.patch +++ b/Spigot-Server-Patches/0351-Allow-disabling-armour-stand-ticking.patch @@ -1,11 +1,11 @@ -From 8e587147671ae4291c03ddbec1a4687639db87e9 Mon Sep 17 00:00:00 2001 +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 c3bd82692..ed1475351 100644 +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 { @@ -20,7 +20,7 @@ index c3bd82692..ed1475351 100644 + } } diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java -index df0d66ad0..dca497072 100644 +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 { @@ -48,7 +48,7 @@ index df0d66ad0..dca497072 100644 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 +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 { @@ -69,5 +69,5 @@ index 8a06cb165..91b7bc2ed 100644 + // Paper end } -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0354-Optimize-BlockPosition-helper-methods.patch b/Spigot-Server-Patches/0352-Optimize-BlockPosition-helper-methods.patch similarity index 98% rename from Spigot-Server-Patches/0354-Optimize-BlockPosition-helper-methods.patch rename to Spigot-Server-Patches/0352-Optimize-BlockPosition-helper-methods.patch index a2689f92e206..e60bba33989f 100644 --- a/Spigot-Server-Patches/0354-Optimize-BlockPosition-helper-methods.patch +++ b/Spigot-Server-Patches/0352-Optimize-BlockPosition-helper-methods.patch @@ -1,4 +1,4 @@ -From a304de0b4dc2adb5aac09bec3c5211da2ce8e469 Mon Sep 17 00:00:00 2001 +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 @@ -6,7 +6,7 @@ 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 +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 { @@ -121,5 +121,5 @@ index 38a7af58c..4849fcbc8 100644 public BlockPosition a(EnumBlockRotation enumblockrotation) { -- -2.18.0 +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 dd505a95395d..000000000000 --- 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/0355-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 similarity index 97% rename from Spigot-Server-Patches/0355-Send-nearby-packets-from-world-player-list-not-serve.patch rename to Spigot-Server-Patches/0353-Send-nearby-packets-from-world-player-list-not-serve.patch index 40f054423ffa..d2279da8014d 100644 --- a/Spigot-Server-Patches/0355-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 @@ -1,11 +1,11 @@ -From f1a4565a54f292f668f94ac2ff6f3f56937209c0 Mon Sep 17 00:00:00 2001 +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 eaaa54acd..44ced604a 100644 +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 { @@ -46,7 +46,7 @@ index eaaa54acd..44ced604a 100644 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 +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 { @@ -95,7 +95,7 @@ index 2c8fb705d..bfe003f60 100644 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 +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 { @@ -119,7 +119,7 @@ index a14b5e061..b19942e0f 100644 } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index ccff6fd05..567e9acb1 100644 +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 { @@ -132,5 +132,5 @@ index ccff6fd05..567e9acb1 100644 public String getGameRuleValue(String rule) { -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0356-Improve-death-events.patch b/Spigot-Server-Patches/0354-Improve-death-events.patch similarity index 98% rename from Spigot-Server-Patches/0356-Improve-death-events.patch rename to Spigot-Server-Patches/0354-Improve-death-events.patch index 47ab426e8b37..26c42ec6b703 100644 --- a/Spigot-Server-Patches/0356-Improve-death-events.patch +++ b/Spigot-Server-Patches/0354-Improve-death-events.patch @@ -1,4 +1,4 @@ -From 61dddacb42c358d24f53ae3a28e5a49eca53d271 Mon Sep 17 00:00:00 2001 +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 @@ -15,7 +15,7 @@ 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 +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 { @@ -27,7 +27,7 @@ index 7a076f3e4..bddd66e79 100644 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 +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 @@ -55,7 +55,7 @@ index b0b49f4ff..d0dcce945 100644 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 +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 { @@ -69,7 +69,7 @@ index dca497072..454c1e7d0 100644 } diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 14637be49..5ccd3ea6f 100644 +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 { @@ -207,7 +207,7 @@ index 14637be49..5ccd3ea6f 100644 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 +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 { @@ -271,7 +271,7 @@ index 4ff505cfa..6afb6cf7b 100644 } } diff --git a/src/main/java/net/minecraft/server/RegistryMaterials.java b/src/main/java/net/minecraft/server/RegistryMaterials.java -index d26abb419..aaedbc3b7 100644 +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 @@ -283,7 +283,7 @@ index d26abb419..aaedbc3b7 100644 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 +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; @@ -296,7 +296,7 @@ index ec37e237f..8e0da7bd7 100644 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 +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 { @@ -323,7 +323,7 @@ index 8871c6f3a..84f4cb91e 100644 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 +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 { @@ -344,7 +344,7 @@ index 5f480ac06..d59d86efc 100644 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 +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 { @@ -413,5 +413,5 @@ index cce4acc0b..f1a3ca950 100644 * Server methods */ -- -2.19.0 +2.19.1 diff --git a/Spigot-Server-Patches/0357-isChunkGenerated-API.patch b/Spigot-Server-Patches/0355-isChunkGenerated-API.patch similarity index 91% rename from Spigot-Server-Patches/0357-isChunkGenerated-API.patch rename to Spigot-Server-Patches/0355-isChunkGenerated-API.patch index 777c6e4b9c09..10b0ae93d4f7 100644 --- a/Spigot-Server-Patches/0357-isChunkGenerated-API.patch +++ b/Spigot-Server-Patches/0355-isChunkGenerated-API.patch @@ -1,4 +1,4 @@ -From a1591adb339b39f104073b0e8c1294671a2ebf25 Mon Sep 17 00:00:00 2001 +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 @@ -6,7 +6,7 @@ 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 +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 { @@ -23,7 +23,7 @@ index 0eba3df571..ad5485908d 100644 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 +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 { @@ -40,5 +40,5 @@ index 567e9acb13..afb141c629 100644 return generator; } -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0358-Add-source-block-to-BlockPhysicsEvent.patch b/Spigot-Server-Patches/0356-Add-source-block-to-BlockPhysicsEvent.patch similarity index 91% rename from Spigot-Server-Patches/0358-Add-source-block-to-BlockPhysicsEvent.patch rename to Spigot-Server-Patches/0356-Add-source-block-to-BlockPhysicsEvent.patch index 8ba29fedcc09..8190c88c8281 100644 --- a/Spigot-Server-Patches/0358-Add-source-block-to-BlockPhysicsEvent.patch +++ b/Spigot-Server-Patches/0356-Add-source-block-to-BlockPhysicsEvent.patch @@ -1,11 +1,11 @@ -From 1f57f866821be74be996417e22f59eb70b77df8a Mon Sep 17 00:00:00 2001 +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 04d0fa1df9..64d75934bc 100644 +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 { @@ -18,5 +18,5 @@ index 04d0fa1df9..64d75934bc 100644 if (event.isCancelled()) { -- -2.18.0 +2.19.1 diff --git a/Spigot-Server-Patches/0359-Optimize-Region-File-Cache.patch b/Spigot-Server-Patches/0357-Optimize-Region-File-Cache.patch similarity index 96% rename from Spigot-Server-Patches/0359-Optimize-Region-File-Cache.patch rename to Spigot-Server-Patches/0357-Optimize-Region-File-Cache.patch index 435e9f87ab9b..9ba5b81e5359 100644 --- a/Spigot-Server-Patches/0359-Optimize-Region-File-Cache.patch +++ b/Spigot-Server-Patches/0357-Optimize-Region-File-Cache.patch @@ -1,4 +1,4 @@ -From 0ac08bd946937912a9903ff03232a5a26518e58a Mon Sep 17 00:00:00 2001 +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 @@ -32,7 +32,7 @@ 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 +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 { @@ -63,5 +63,5 @@ index 7e75658076..15a09ab360 100644 return regionfile != null ? regionfile.c(i & 31, j & 31) : false; -- -2.19.0 +2.19.1 diff --git a/Spigot-Server-Patches/0361-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 similarity index 94% rename from Spigot-Server-Patches/0361-Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch rename to Spigot-Server-Patches/0358-Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch index 9c1e8b502da4..32c0b2599fc0 100644 --- a/Spigot-Server-Patches/0361-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 @@ -1,4 +1,4 @@ -From b322bbfe37599b5e635f2338d81be6e20854ea12 Mon Sep 17 00:00:00 2001 +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 @@ -18,7 +18,7 @@ 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 +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 { @@ -40,5 +40,5 @@ index 64d75934bc..bcbdadbd3a 100644 } else { this.getChunkAt(i, k).a(entity); -- -2.19.0 +2.19.1 diff --git a/Spigot-Server-Patches/0362-Backport-Village-Door-fix-from-1.13.patch b/Spigot-Server-Patches/0359-Backport-Village-Door-fix-from-1.13.patch similarity index 93% rename from Spigot-Server-Patches/0362-Backport-Village-Door-fix-from-1.13.patch rename to Spigot-Server-Patches/0359-Backport-Village-Door-fix-from-1.13.patch index d549ea8eebf0..7a0414a8a247 100644 --- a/Spigot-Server-Patches/0362-Backport-Village-Door-fix-from-1.13.patch +++ b/Spigot-Server-Patches/0359-Backport-Village-Door-fix-from-1.13.patch @@ -1,11 +1,11 @@ -From 4b72bfde9db5ffb7b5ab8f252588c22e6a4b41d3 Mon Sep 17 00:00:00 2001 +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 9f1867ddd3..6536e5fb84 100644 +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 { diff --git a/Spigot-Server-Patches/0363-Backport-light-queue-changes-from-1.13.patch b/Spigot-Server-Patches/0360-Backport-light-queue-changes-from-1.13.patch similarity index 96% rename from Spigot-Server-Patches/0363-Backport-light-queue-changes-from-1.13.patch rename to Spigot-Server-Patches/0360-Backport-light-queue-changes-from-1.13.patch index 1295ac3bcdd5..6c00014bceae 100644 --- a/Spigot-Server-Patches/0363-Backport-light-queue-changes-from-1.13.patch +++ b/Spigot-Server-Patches/0360-Backport-light-queue-changes-from-1.13.patch @@ -1,11 +1,11 @@ -From 659e74a4f51ee97e903472c73e725d728a87dc7d Mon Sep 17 00:00:00 2001 +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 523d10e8bc..6541f5af47 100644 +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 { @@ -34,7 +34,7 @@ index 523d10e8bc..6541f5af47 100644 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 +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; @@ -107,5 +107,5 @@ index 345cd58240..f1c013116f 100644 + } } -- -2.19.0 +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 4fe554e2daa8..000000000000 --- 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/0364-Backport-Water-Activation-Range.patch b/Spigot-Server-Patches/0361-Backport-Water-Activation-Range.patch similarity index 97% rename from Spigot-Server-Patches/0364-Backport-Water-Activation-Range.patch rename to Spigot-Server-Patches/0361-Backport-Water-Activation-Range.patch index 5fb09a840c88..0a7fd8e990ea 100644 --- a/Spigot-Server-Patches/0364-Backport-Water-Activation-Range.patch +++ b/Spigot-Server-Patches/0361-Backport-Water-Activation-Range.patch @@ -1,4 +1,4 @@ -From dc1b736e06fa15ed7a6f3501f306da089bd1c4f7 Mon Sep 17 00:00:00 2001 +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 @@ -8,7 +8,7 @@ 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 +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; @@ -107,7 +107,7 @@ index 33ae738908..4c8d94c877 100644 { 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 +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 @@ -126,5 +126,5 @@ index 66c399a260..f872c1554d 100644 log( "Entity Activation Range: An " + animalActivationRange + " / Mo " + monsterActivationRange + " / Mi " + miscActivationRange + " / Tiv " + tickInactiveVillagers ); } -- -2.19.0 +2.19.1 diff --git a/Spigot-Server-Patches/0365-Backport-Prevent-mob-spawning-from-loading-generatin.patch b/Spigot-Server-Patches/0362-Backport-Prevent-mob-spawning-from-loading-generatin.patch similarity index 95% rename from Spigot-Server-Patches/0365-Backport-Prevent-mob-spawning-from-loading-generatin.patch rename to Spigot-Server-Patches/0362-Backport-Prevent-mob-spawning-from-loading-generatin.patch index 8ab32a6de5a5..f63578bb0d08 100644 --- a/Spigot-Server-Patches/0365-Backport-Prevent-mob-spawning-from-loading-generatin.patch +++ b/Spigot-Server-Patches/0362-Backport-Prevent-mob-spawning-from-loading-generatin.patch @@ -1,11 +1,11 @@ -From 96a29101e4eedaca172aec3ab96c880b9b3e5371 Mon Sep 17 00:00:00 2001 +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 11e69a0547..5c5bed0344 100644 +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 { diff --git a/Spigot-Server-Patches/0366-Detect-and-repair-corrupt-Region-Files.patch b/Spigot-Server-Patches/0363-Detect-and-repair-corrupt-Region-Files.patch similarity index 98% rename from Spigot-Server-Patches/0366-Detect-and-repair-corrupt-Region-Files.patch rename to Spigot-Server-Patches/0363-Detect-and-repair-corrupt-Region-Files.patch index ce99ef9fbc71..3be82ad0dbf4 100644 --- a/Spigot-Server-Patches/0366-Detect-and-repair-corrupt-Region-Files.patch +++ b/Spigot-Server-Patches/0363-Detect-and-repair-corrupt-Region-Files.patch @@ -1,4 +1,4 @@ -From 69ff7bf015b80568bfbf721f70e20aaeda805c3b Mon Sep 17 00:00:00 2001 +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 @@ -11,7 +11,7 @@ I don't know why mojang only checks for 4096, when anything less than 8192 is a 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 +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; diff --git a/Spigot-Server-Patches/0367-Backport-the-dupe-uuid-and-entity-log-changes.patch b/Spigot-Server-Patches/0364-Backport-the-dupe-uuid-and-entity-log-changes.patch similarity index 97% rename from Spigot-Server-Patches/0367-Backport-the-dupe-uuid-and-entity-log-changes.patch rename to Spigot-Server-Patches/0364-Backport-the-dupe-uuid-and-entity-log-changes.patch index ded65a7d5417..25e983ade1d8 100644 --- a/Spigot-Server-Patches/0367-Backport-the-dupe-uuid-and-entity-log-changes.patch +++ b/Spigot-Server-Patches/0364-Backport-the-dupe-uuid-and-entity-log-changes.patch @@ -1,11 +1,11 @@ -From 11cf0fdfd5befaac8c2e5fbdb29a834a1dc69d1f Mon Sep 17 00:00:00 2001 +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 ed14753512..ba299afc40 100644 +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 { @@ -34,7 +34,7 @@ index ed14753512..ba299afc40 100644 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 +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 { @@ -80,7 +80,7 @@ index 6541f5af47..00c46fe50f 100644 } } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index bcbdadbd3a..7633a61342 100644 +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 { @@ -92,7 +92,7 @@ index bcbdadbd3a..7633a61342 100644 { @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 +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 { diff --git a/Spigot-Server-Patches/0368-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 similarity index 88% rename from Spigot-Server-Patches/0368-MC-54026-Backport-1.13-client-desync-fix-on-fast-too.patch rename to Spigot-Server-Patches/0365-MC-54026-Backport-1.13-client-desync-fix-on-fast-too.patch index b1e81289e874..0a7fb019bc57 100644 --- a/Spigot-Server-Patches/0368-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 @@ -1,11 +1,11 @@ -From 4b22585d7ede957b7b5cb95fe4c708fd49c61453 Mon Sep 17 00:00:00 2001 +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 fcb64666e3..3d86798248 100644 +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 { diff --git a/scripts/upstreamMerge.sh b/scripts/upstreamMerge.sh index 6d9541970dfb..25ca49c4497d 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 bdd0eda71f87..558fdf5f54b0 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit bdd0eda71f87cb8ca3b1842bd9bbd43bba5a08bd +Subproject commit 558fdf5f54b0f527cd48903daf9368ac4b862876 diff --git a/work/CraftBukkit b/work/CraftBukkit index 2b93d839ddb1..d7bebeff028a 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit 2b93d839ddb1541cad937e3dd7a4da5d1525af3d +Subproject commit d7bebeff028af7baf52105394529598f1c4093c4 diff --git a/work/Spigot b/work/Spigot index 2cf50f055260..dcd16439b514 160000 --- a/work/Spigot +++ b/work/Spigot @@ -1 +1 @@ -Subproject commit 2cf50f055260acaa2344390334bbca546d46726d +Subproject commit dcd16439b51429c18f1028bbe36ff805547050de From 4297106c093cd24459ecc67675a47192d67ed2fe Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 23 Oct 2018 22:06:33 -0400 Subject: [PATCH 27/90] Do not let the server load chunks from newer versions If the server attempts to load a chunk generated by a newer version of the game, immediately stop the server to prevent data corruption. You can override this functionality at your own peril. --- ...erver-load-chunks-from-newer-version.patch | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Spigot-Server-Patches/0366-Do-not-let-the-server-load-chunks-from-newer-version.patch diff --git a/Spigot-Server-Patches/0366-Do-not-let-the-server-load-chunks-from-newer-version.patch b/Spigot-Server-Patches/0366-Do-not-let-the-server-load-chunks-from-newer-version.patch new file mode 100644 index 000000000000..c11afbeaff8c --- /dev/null +++ b/Spigot-Server-Patches/0366-Do-not-let-the-server-load-chunks-from-newer-version.patch @@ -0,0 +1,40 @@ +From 652ddff89bc697d79803e1fc33b767bc5af0c1a8 Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Tue, 23 Oct 2018 22:03:37 -0400 +Subject: [PATCH] Do not let the server load chunks from newer versions + +If the server attempts to load a chunk generated by a newer version of +the game, immediately stop the server to prevent data corruption. + +You can override this functionality at your own peril. + +diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java +index bad287fca..e6906effb 100644 +--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java ++++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java +@@ -90,8 +90,22 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { + return nbttagcompound != null ? true : RegionFileCache.chunkExists(this.d, i, j); + } + ++ // Paper start ++ private static final int CURRENT_DATA_VERSION = 1343; // Paper ++ private static final boolean JUST_CORRUPT_IT = Boolean.valueOf("Paper.ignoreWorldDataVersion"); ++ // Paper end ++ + @Nullable + protected Object[] a(World world, int i, int j, NBTTagCompound nbttagcompound) { // CraftBukkit - return Chunk -> Object[] ++ // Paper start - Do NOT attempt to load chunks saved with newer versions ++ if (nbttagcompound.hasKeyOfType("DataVersion", 3)) { ++ int dataVersion = nbttagcompound.getInt("DataVersion"); ++ if (!JUST_CORRUPT_IT && dataVersion > CURRENT_DATA_VERSION) { ++ new RuntimeException("Server attempted to load chunk saved with newer version of minecraft! " + dataVersion + " > " + CURRENT_DATA_VERSION).printStackTrace(); ++ System.exit(1); ++ } ++ } ++ // Paper end + if (!nbttagcompound.hasKeyOfType("Level", 10)) { + ChunkRegionLoader.a.error("Chunk file at {},{} is missing level data, skipping", Integer.valueOf(i), Integer.valueOf(j)); + return null; +-- +2.19.1 + From 857123a6538237efff9a7dc6a3cbd7588d2ede02 Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 2 Nov 2018 23:24:35 -0400 Subject: [PATCH 28/90] Keep players yaw/pitch on vehicle updates --- ...players-yaw-pitch-on-vehicle-updates.patch | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Spigot-Server-Patches/0367-Keep-players-yaw-pitch-on-vehicle-updates.patch diff --git a/Spigot-Server-Patches/0367-Keep-players-yaw-pitch-on-vehicle-updates.patch b/Spigot-Server-Patches/0367-Keep-players-yaw-pitch-on-vehicle-updates.patch new file mode 100644 index 000000000000..fc6a018bfbe7 --- /dev/null +++ b/Spigot-Server-Patches/0367-Keep-players-yaw-pitch-on-vehicle-updates.patch @@ -0,0 +1,28 @@ +From 182ee0d285eaeedc1c500912fc51359878544406 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Fri, 2 Nov 2018 23:22:34 -0400 +Subject: [PATCH] Keep players yaw/pitch on vehicle updates + + +diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +index 398f2fdf83..edd7ba353d 100644 +--- a/src/main/java/net/minecraft/server/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/PlayerConnection.java +@@ -375,12 +375,12 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { + Location curPos = this.getPlayer().getLocation(); // Spigot + + entity.setLocation(d3, d4, d5, f, f1); +- player.setLocation(d3, d4, d5, f, f1); // CraftBukkit ++ player.setLocation(d3, d4, d5, player.yaw, player.pitch); // CraftBukkit // 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); // CraftBukkit ++ player.setLocation(d3, d4, d5, player.yaw, player.pitch); // CraftBukkit // Paper + this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity)); + return; + } +-- +2.19.1 + From 67787d388c887020c8053e6626138ad7e984cc8f Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Mon, 5 Nov 2018 21:51:04 -0500 Subject: [PATCH 29/90] Fix server icon encoding to show on newer clients The base64 encoding method for server favicons in 1.12 puts newlines in the encoded string. The 1.13 client and server pair fixed this issue and no longer consider it valid. Luckily the 1.12.2 client will parse the correct encoding just fine as well. This fixes the encoding so that the server icon will display properly on both 1.12.2 clients as well as newer clients. Shout out to ViaVersion whose contributors noticed this some time ago. --- ...encoding-to-show-properly-on-1.13-cl.patch | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Spigot-Server-Patches/0368-Fix-server-icon-encoding-to-show-properly-on-1.13-cl.patch diff --git a/Spigot-Server-Patches/0368-Fix-server-icon-encoding-to-show-properly-on-1.13-cl.patch b/Spigot-Server-Patches/0368-Fix-server-icon-encoding-to-show-properly-on-1.13-cl.patch new file mode 100644 index 000000000000..2752544c7716 --- /dev/null +++ b/Spigot-Server-Patches/0368-Fix-server-icon-encoding-to-show-properly-on-1.13-cl.patch @@ -0,0 +1,36 @@ +From 4bca90c7e6140df3eedf5527f28d9081ea048508 Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Mon, 5 Nov 2018 21:50:13 -0500 +Subject: [PATCH] Fix server icon encoding to show properly on 1.13 clients as + well + + +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index e0546e3dd..3b982f990 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -735,7 +735,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs + ImageIO.write(bufferedimage, "PNG", new ByteBufOutputStream(bytebuf)); + /*ByteBuf */ bytebuf1 = Base64.encode(bytebuf); // Paper - cleanup favicon bytebuf + +- serverping.setFavicon("data:image/png;base64," + bytebuf1.toString(StandardCharsets.UTF_8)); ++ serverping.setFavicon("data:image/png;base64," + bytebuf1.toString(StandardCharsets.UTF_8).replace("\n", "")); // Paper - Fix encoding for 1.13+ clients, still compat w/ 1.12 clients + } catch (Exception exception) { + MinecraftServer.LOGGER.error("Couldn\'t load server icon", exception); + } finally { +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index 9fe555986..7c82e18b9 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -1778,7 +1778,7 @@ public final class CraftServer implements Server { + ImageIO.write(image, "PNG", new ByteBufOutputStream(bytebuf)); + ByteBuf bytebuf1 = Base64.encode(bytebuf); + +- return new CraftIconCache("data:image/png;base64," + bytebuf1.toString(Charsets.UTF_8)); ++ return new CraftIconCache("data:image/png;base64," + bytebuf1.toString(Charsets.UTF_8).replace("\n", "")); // Paper - Fix encoding for 1.13+ clients, still compat w/ 1.12 clients + } + + @Override +-- +2.19.1 + From 531dfad2d23a238531caf29afa738cd3986b7e75 Mon Sep 17 00:00:00 2001 From: BlackHole Date: Thu, 8 Nov 2018 19:00:27 -0500 Subject: [PATCH 30/90] Fix PreFillProfileEvent --- .../0264-Fill-Profile-Property-Events.patch | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Spigot-Server-Patches/0264-Fill-Profile-Property-Events.patch b/Spigot-Server-Patches/0264-Fill-Profile-Property-Events.patch index e668ddc081d7..427b0554ff4c 100644 --- a/Spigot-Server-Patches/0264-Fill-Profile-Property-Events.patch +++ b/Spigot-Server-Patches/0264-Fill-Profile-Property-Events.patch @@ -1,4 +1,4 @@ -From 7de0f8add5f32e662c9354154f52a63942cb1274 Mon Sep 17 00:00:00 2001 +From bb3e56dcc9c689402ea30a5cdd9e009a84022109 Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 2 Jan 2018 00:31:26 -0500 Subject: [PATCH] Fill Profile Property Events @@ -11,7 +11,7 @@ If Mojang API does need to be hit, event fire so you can get the results. This is useful for implementing a ProfileCache for Player Skulls diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java -index 4b2a67423..f83aa5ef0 100644 +index 4b2a67423f..61cfdf73c8 100644 --- a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java +++ b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java @@ -1,5 +1,7 @@ @@ -22,12 +22,14 @@ index 4b2a67423..f83aa5ef0 100644 import com.mojang.authlib.GameProfile; import com.mojang.authlib.minecraft.MinecraftProfileTexture; import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; -@@ -19,7 +21,13 @@ public class PaperMinecraftSessionService extends YggdrasilMinecraftSessionServi +@@ -19,7 +21,15 @@ public class PaperMinecraftSessionService extends YggdrasilMinecraftSessionServi @Override public GameProfile fillProfileProperties(GameProfile profile, boolean requireSecure) { - return super.fillProfileProperties(profile, requireSecure); -+ new PreFillProfileEvent(CraftPlayerProfile.asBukkitMirror(profile)).callEvent(); ++ CraftPlayerProfile playerProfile = (CraftPlayerProfile) CraftPlayerProfile.asBukkitMirror(profile); ++ new PreFillProfileEvent(playerProfile).callEvent(); ++ profile = playerProfile.getGameProfile(); + if (profile.isComplete() && profile.getProperties().containsKey("textures")) { + return profile; + } @@ -38,5 +40,5 @@ index 4b2a67423..f83aa5ef0 100644 @Override -- -2.18.0 +2.19.1 From 07c797387b4f78d7d82b1a709e503db835c95f6b Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 17 Nov 2018 00:09:25 -0500 Subject: [PATCH 31/90] Limit Book Sizes --- .../0369-Limit-Book-Sizes.patch | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 Spigot-Server-Patches/0369-Limit-Book-Sizes.patch diff --git a/Spigot-Server-Patches/0369-Limit-Book-Sizes.patch b/Spigot-Server-Patches/0369-Limit-Book-Sizes.patch new file mode 100644 index 000000000000..147d39fdfb6b --- /dev/null +++ b/Spigot-Server-Patches/0369-Limit-Book-Sizes.patch @@ -0,0 +1,86 @@ +From b037f9c518d26ee6c566647b9df1d2ceed356fda Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sat, 17 Nov 2018 00:08:54 -0500 +Subject: [PATCH] Limit Book Sizes + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java +index 332e90f86b..0ac61f4de0 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java +@@ -320,4 +320,12 @@ public class PaperConfig { + tabSpamIncrement = getInt("settings.spam-limiter.tab-spam-increment", tabSpamIncrement); + tabSpamLimit = getInt("settings.spam-limiter.tab-spam-limit", tabSpamLimit); + } ++ ++ ++ public static int maxBookPageSize = 1024; ++ public static double maxBookTotalSizeMultiplier = 0.90D; ++ private static void maxBookSize() { ++ maxBookPageSize = getInt("settings.book-size.page-max", maxBookPageSize); ++ maxBookTotalSizeMultiplier = getDouble("settings.book-size.total-multiplier", maxBookTotalSizeMultiplier); ++ } + } +diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +index edd7ba353d..4c35132892 100644 +--- a/src/main/java/net/minecraft/server/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/PlayerConnection.java +@@ -2329,6 +2329,39 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { + this.player.a(packetplayinsettings); + } + ++ // Paper start ++ private boolean validateBook(ItemStack testStack) { ++ NBTTagList pageList = testStack.getTag().getList("pages", 8); ++ long byteTotal = 0; ++ int maxBookPageSize = com.destroystokyo.paper.PaperConfig.maxBookPageSize; ++ double multiplier = Math.max(0.3D, Math.min(1D, com.destroystokyo.paper.PaperConfig.maxBookTotalSizeMultiplier)); ++ long byteAllowed = maxBookPageSize; ++ for (int i = 0; i < pageList.size(); ++i) { ++ String testString = pageList.getString(i); ++ int byteLength = testString.getBytes().length; ++ byteTotal += byteLength; ++ if (byteTotal > byteAllowed) { ++ PlayerConnection.LOGGER.warn(this.player.getName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size()); ++ minecraftServer.postToMainThread(() -> this.disconnect("Book too large!")); ++ return false; ++ } ++ int length = testString.length(); ++ int multibytes = byteLength == length ? byteLength : (int) Math.round((double) byteLength / (double) length); ++ for (int x = 1; x < multibytes; x++) { ++ multiplier *= multiplier; ++ } ++ byteAllowed += (maxBookPageSize * Math.min(1, Math.max(0.1D, (double) length / 255D))) * multiplier; ++ multiplier *= multiplier; ++ ++ if (multibytes > 1) { ++ // penalize MB some more ++ byteAllowed -= length; ++ } ++ } ++ return true; ++ } ++ // Paper end ++ + public void a(PacketPlayInCustomPayload packetplayincustompayload) { + PlayerConnectionUtils.ensureMainThread(packetplayincustompayload, this, this.player.x()); + String s = packetplayincustompayload.a(); +@@ -2362,6 +2395,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { + } + + if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack.getItem() == itemstack1.getItem()) { ++ if (!validateBook(itemstack)) return; // Paper + itemstack1.a("pages", (NBTBase) itemstack.getTag().getList("pages", 8)); + CraftEventFactory.handleEditBookEvent(player, itemstack1); // CraftBukkit + } +@@ -2397,6 +2431,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { + } + + if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack1.getItem() == Items.WRITABLE_BOOK) { ++ if (!validateBook(itemstack)) return; // Paper + ItemStack itemstack2 = new ItemStack(Items.WRITTEN_BOOK); + + itemstack2.a("author", (NBTBase) (new NBTTagString(this.player.getName()))); +-- +2.19.1 + From a62a77885daf150a68dca949561eb83b88a302f4 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 17 Nov 2018 00:39:22 -0500 Subject: [PATCH 32/90] Specify charset explicitly on getBytes --- Spigot-Server-Patches/0369-Limit-Book-Sizes.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Spigot-Server-Patches/0369-Limit-Book-Sizes.patch b/Spigot-Server-Patches/0369-Limit-Book-Sizes.patch index 147d39fdfb6b..8ec90276696c 100644 --- a/Spigot-Server-Patches/0369-Limit-Book-Sizes.patch +++ b/Spigot-Server-Patches/0369-Limit-Book-Sizes.patch @@ -38,7 +38,7 @@ index edd7ba353d..4c35132892 100644 + long byteAllowed = maxBookPageSize; + for (int i = 0; i < pageList.size(); ++i) { + String testString = pageList.getString(i); -+ int byteLength = testString.getBytes().length; ++ int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length; + byteTotal += byteLength; + if (byteTotal > byteAllowed) { + PlayerConnection.LOGGER.warn(this.player.getName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size()); From cfe5920cab817fbf4de49f3e0b08d02808384bb0 Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 26 Nov 2018 19:44:34 -0500 Subject: [PATCH 33/90] Prevent rayTrace from loading chunks ray tracing into an unloaded chunk should be treated as a miss this saves a ton of lag for when AI tries to raytrace near unloaded chunks. --- ...Prevent-rayTrace-from-loading-chunks.patch | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Spigot-Server-Patches/0370-Prevent-rayTrace-from-loading-chunks.patch diff --git a/Spigot-Server-Patches/0370-Prevent-rayTrace-from-loading-chunks.patch b/Spigot-Server-Patches/0370-Prevent-rayTrace-from-loading-chunks.patch new file mode 100644 index 000000000000..74fbc08b900a --- /dev/null +++ b/Spigot-Server-Patches/0370-Prevent-rayTrace-from-loading-chunks.patch @@ -0,0 +1,35 @@ +From b0f9bb4104252c176abf468b9563a0008409e688 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Mon, 26 Nov 2018 19:44:01 -0500 +Subject: [PATCH] Prevent rayTrace from loading chunks + +ray tracing into an unloaded chunk should be treated as a miss +this saves a ton of lag for when AI tries to raytrace near unloaded chunks. + +diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +index 7633a61342..bc231c7f29 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -932,7 +932,8 @@ public abstract class World implements IBlockAccess { + int i1 = MathHelper.floor(vec3d.y); + int j1 = MathHelper.floor(vec3d.z); + BlockPosition blockposition = new BlockPosition(l, i1, j1); +- IBlockData iblockdata = this.getType(blockposition); ++ IBlockData iblockdata = this.getTypeIfLoaded(blockposition); // Paper ++ if (iblockdata == null) return null; // Paper + Block block = iblockdata.getBlock(); + + if ((!flag1 || iblockdata.d(this, blockposition) != Block.k) && block.a(iblockdata, flag)) { +@@ -1034,7 +1035,8 @@ public abstract class World implements IBlockAccess { + i1 = MathHelper.floor(vec3d.y) - (enumdirection == EnumDirection.UP ? 1 : 0); + j1 = MathHelper.floor(vec3d.z) - (enumdirection == EnumDirection.SOUTH ? 1 : 0); + blockposition = new BlockPosition(l, i1, j1); +- IBlockData iblockdata1 = this.getType(blockposition); ++ IBlockData iblockdata1 = this.getTypeIfLoaded(blockposition); // Paper ++ if (iblockdata1 == null) return null; // Paper + Block block1 = iblockdata1.getBlock(); + + if (!flag1 || iblockdata1.getMaterial() == Material.PORTAL || iblockdata1.d(this, blockposition) != Block.k) { +-- +2.19.1 + From b82359ef5ae2ac4a3d0387ac1e7eb4d8910ec642 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 27 Nov 2018 18:40:56 -0500 Subject: [PATCH 34/90] Persist ArmorStand canTick API value across restarts --- ...Allow-disabling-armour-stand-ticking.patch | 25 ++++++++++++++++--- .../0354-Improve-death-events.patch | 6 ++--- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/Spigot-Server-Patches/0351-Allow-disabling-armour-stand-ticking.patch b/Spigot-Server-Patches/0351-Allow-disabling-armour-stand-ticking.patch index 7dd70f99824d..a5dfb35bc485 100644 --- a/Spigot-Server-Patches/0351-Allow-disabling-armour-stand-ticking.patch +++ b/Spigot-Server-Patches/0351-Allow-disabling-armour-stand-ticking.patch @@ -1,4 +1,4 @@ -From 1ddf939a1e11ae48190c26bedd764bfa0c382fee Mon Sep 17 00:00:00 2001 +From 6b1beefbc59949532cb4e66f634583d3fadc42a7 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 @@ -20,7 +20,7 @@ index c3bd8269..ed147535 100644 + } } diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java -index df0d66ad..dca49707 100644 +index df0d66ad..c7215888 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 { @@ -39,7 +39,26 @@ index df0d66ad..dca49707 100644 } public EntityArmorStand(World world, double d0, double d1, double d2) { -@@ -568,6 +570,7 @@ public class EntityArmorStand extends EntityLiving { +@@ -211,6 +213,7 @@ public class EntityArmorStand extends EntityLiving { + } + + nbttagcompound.set("Pose", this.C()); ++ nbttagcompound.setBoolean("Paper.CanTick", this.canTick); // Paper - persist no tick setting + } + + public void a(NBTTagCompound nbttagcompound) { +@@ -242,6 +245,10 @@ public class EntityArmorStand extends EntityLiving { + this.setMarker(nbttagcompound.getBoolean("Marker")); + this.bC = !this.isMarker(); + this.noclip = this.isNoGravity(); ++ // Paper - persist no tick ++ if (nbttagcompound.hasKey("Paper.CanTick")) { ++ this.canTick = nbttagcompound.getBoolean("Paper.CanTick"); ++ } + NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Pose"); + + this.g(nbttagcompound1); +@@ -568,6 +575,7 @@ public class EntityArmorStand extends EntityLiving { } public void B_() { diff --git a/Spigot-Server-Patches/0354-Improve-death-events.patch b/Spigot-Server-Patches/0354-Improve-death-events.patch index 26c42ec6b703..e5ee2ddc46a3 100644 --- a/Spigot-Server-Patches/0354-Improve-death-events.patch +++ b/Spigot-Server-Patches/0354-Improve-death-events.patch @@ -1,4 +1,4 @@ -From 059e0ddf477c3fcf06ac7be0d347fb082c730573 Mon Sep 17 00:00:00 2001 +From 2e5245ebec442569e203bd86dcc65a67539ad223 Mon Sep 17 00:00:00 2001 From: Phoenix616 Date: Tue, 21 Aug 2018 01:39:35 +0100 Subject: [PATCH] Improve death events @@ -55,10 +55,10 @@ index 3a2ff25e..d44c55d8 100644 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 +index c7215888..90749924 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 { +@@ -646,7 +646,8 @@ public class EntityArmorStand extends EntityLiving { } public void killEntity() { From cedf38aac061173a5f055f7c2acf089627c440c1 Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 27 Nov 2018 21:55:37 -0500 Subject: [PATCH 35/90] Handle Large Packets disconnecting client If a players inventory is too big to send in a single packet, split the inventory set into multiple packets instead. --- ...e-Large-Packets-disconnecting-client.patch | 104 ++++++++++++++++++ scripts/importmcdev.sh | 3 + 2 files changed, 107 insertions(+) create mode 100644 Spigot-Server-Patches/0371-Handle-Large-Packets-disconnecting-client.patch diff --git a/Spigot-Server-Patches/0371-Handle-Large-Packets-disconnecting-client.patch b/Spigot-Server-Patches/0371-Handle-Large-Packets-disconnecting-client.patch new file mode 100644 index 000000000000..4fe46ff061e4 --- /dev/null +++ b/Spigot-Server-Patches/0371-Handle-Large-Packets-disconnecting-client.patch @@ -0,0 +1,104 @@ +From 158c65a57917f6a0b3c27f5b67f834306e229194 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Tue, 27 Nov 2018 21:18:06 -0500 +Subject: [PATCH] Handle Large Packets disconnecting client + +If a players inventory is too big to send in a single packet, +split the inventory set into multiple packets instead. + +diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java +index 3d32e0056..a7fcc14f2 100644 +--- a/src/main/java/net/minecraft/server/NetworkManager.java ++++ b/src/main/java/net/minecraft/server/NetworkManager.java +@@ -112,6 +112,15 @@ public class NetworkManager extends SimpleChannelInboundHandler> { + } + + public void exceptionCaught(ChannelHandlerContext channelhandlercontext, Throwable throwable) throws Exception { ++ // Paper start ++ if (throwable instanceof io.netty.handler.codec.EncoderException && throwable.getCause() instanceof PacketEncoder.PacketTooLargeException) { ++ if (((PacketEncoder.PacketTooLargeException) throwable.getCause()).getPacket().packetTooLarge(this)) { ++ return; ++ } else { ++ throwable = throwable.getCause(); ++ } ++ } ++ // Paper end + ChatMessage chatmessage; + + if (throwable instanceof TimeoutException) { +diff --git a/src/main/java/net/minecraft/server/Packet.java b/src/main/java/net/minecraft/server/Packet.java +index fdc142b75..b283e1557 100644 +--- a/src/main/java/net/minecraft/server/Packet.java ++++ b/src/main/java/net/minecraft/server/Packet.java +@@ -8,5 +8,10 @@ public interface Packet { + + void b(PacketDataSerializer packetdataserializer) throws IOException; + ++ // Paper start ++ default boolean packetTooLarge(NetworkManager manager) { ++ return false; ++ } ++ // Paper end + void a(T t0); + } +diff --git a/src/main/java/net/minecraft/server/PacketEncoder.java b/src/main/java/net/minecraft/server/PacketEncoder.java +index a6da6f5cc..4e263aa8d 100644 +--- a/src/main/java/net/minecraft/server/PacketEncoder.java ++++ b/src/main/java/net/minecraft/server/PacketEncoder.java +@@ -44,11 +44,32 @@ public class PacketEncoder extends MessageToByteEncoder> { + PacketEncoder.a.error(throwable); + } + ++ // Paper start ++ int packetLength = bytebuf.readableBytes(); ++ if (packetLength > MAX_PACKET_SIZE) { ++ throw new PacketTooLargeException(packet, packetLength); ++ } ++ // Paper end + } + } + } + +- protected void encode(ChannelHandlerContext channelhandlercontext, Object object, ByteBuf bytebuf) throws Exception { ++ // Paper start ++ private static int MAX_PACKET_SIZE = 2097152; ++ public static class PacketTooLargeException extends RuntimeException { ++ private final Packet packet; ++ PacketTooLargeException(Packet packet, int packetLength) { ++ super("PacketTooLarge - " + packet.getClass().getSimpleName() + " is " + packetLength +". Max is " + MAX_PACKET_SIZE); ++ this.packet = packet; ++ } ++ ++ public Packet getPacket() { ++ return packet; ++ } ++ } ++ // Paper end ++ ++ protected void encode(ChannelHandlerContext channelhandlercontext, Packet object, ByteBuf bytebuf) throws Exception { // Paper - decompile fix + this.a(channelhandlercontext, (Packet) object, bytebuf); + } + } +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java b/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java +index bf47c8249..e054757d2 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java +@@ -9,6 +9,15 @@ public class PacketPlayOutWindowItems implements Packet { + private int a; + private List b; + ++ //Paper start ++ @Override ++ public boolean packetTooLarge(NetworkManager manager) { ++ for (int i = 0 ; i < this.b.size() ; i++) { ++ manager.sendPacket(new PacketPlayOutSetSlot(this.a, i, this.b.get(i))); ++ } ++ return true; ++ } ++ // Paper end + public PacketPlayOutWindowItems() {} + + public PacketPlayOutWindowItems(int i, NonNullList nonnulllist) { +-- +2.19.1 + diff --git a/scripts/importmcdev.sh b/scripts/importmcdev.sh index bc3b21f90e67..39d34bfdd320 100755 --- a/scripts/importmcdev.sh +++ b/scripts/importmcdev.sh @@ -89,12 +89,15 @@ import LotoSelectorEntry import NavigationAbstract import NBTTagCompound import NBTTagList +import Packet +import PacketEncoder import PacketPlayInUseEntity import PacketPlayOutMapChunk import PacketPlayOutPlayerListHeaderFooter import PacketPlayOutScoreboardTeam import PacketPlayOutTitle import PacketPlayOutUpdateTime +import PacketPlayOutWindowItems import PathfinderAbstract import PathfinderGoal import PathfinderGoalFloat From ea0646b6f6cb3c7d699470242387dab626c62c02 Mon Sep 17 00:00:00 2001 From: Amosar Date: Sat, 1 Dec 2018 20:04:38 +0000 Subject: [PATCH 36/90] backport: SPIGOT-2719: Comparator and Observer don't trigger BlockRedstoneEvent --- ...2719-Comparator-and-Observer-don-t-t.patch | 72 +++++++++++++++++++ scripts/importmcdev.sh | 2 + 2 files changed, 74 insertions(+) create mode 100644 Spigot-Server-Patches/0372-backport-SPIGOT-2719-Comparator-and-Observer-don-t-t.patch diff --git a/Spigot-Server-Patches/0372-backport-SPIGOT-2719-Comparator-and-Observer-don-t-t.patch b/Spigot-Server-Patches/0372-backport-SPIGOT-2719-Comparator-and-Observer-don-t-t.patch new file mode 100644 index 000000000000..e412e02214ab --- /dev/null +++ b/Spigot-Server-Patches/0372-backport-SPIGOT-2719-Comparator-and-Observer-don-t-t.patch @@ -0,0 +1,72 @@ +From 778d563e5b2d8141a1df1c4b3fc074928f6552c2 Mon Sep 17 00:00:00 2001 +From: Amosar +Date: Sat, 1 Dec 2018 20:00:22 +0000 +Subject: [PATCH] backport: SPIGOT-2719: Comparator and Observer don't trigger + BlockRedstoneEvent + + +diff --git a/src/main/java/net/minecraft/server/BlockObserver.java b/src/main/java/net/minecraft/server/BlockObserver.java +index 59e93e6f6..5836a7637 100644 +--- a/src/main/java/net/minecraft/server/BlockObserver.java ++++ b/src/main/java/net/minecraft/server/BlockObserver.java +@@ -1,6 +1,7 @@ + package net.minecraft.server; + + import java.util.Random; ++import org.bukkit.craftbukkit.event.CraftEventFactory; // Paper + + public class BlockObserver extends BlockDirectional { + +@@ -26,8 +27,18 @@ public class BlockObserver extends BlockDirectional { + + public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) { + if (((Boolean) iblockdata.get(BlockObserver.a)).booleanValue()) { ++ // Paper start ++ if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 15, 0).getNewCurrent() != 0) { ++ return; ++ } ++ // Paper end + world.setTypeAndData(blockposition, iblockdata.set(BlockObserver.a, Boolean.valueOf(false)), 2); + } else { ++ // Paper start ++ if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 0, 15).getNewCurrent() != 15) { ++ return; ++ } ++ // Paper end + world.setTypeAndData(blockposition, iblockdata.set(BlockObserver.a, Boolean.valueOf(true)), 2); + world.a(blockposition, (Block) this, 2); + } +diff --git a/src/main/java/net/minecraft/server/BlockRedstoneComparator.java b/src/main/java/net/minecraft/server/BlockRedstoneComparator.java +index 78ad3374d..04d973d9a 100644 +--- a/src/main/java/net/minecraft/server/BlockRedstoneComparator.java ++++ b/src/main/java/net/minecraft/server/BlockRedstoneComparator.java +@@ -4,6 +4,7 @@ import com.google.common.base.Predicate; + import java.util.List; + import java.util.Random; + import javax.annotation.Nullable; ++import org.bukkit.craftbukkit.event.CraftEventFactory; //Paper + + public class BlockRedstoneComparator extends BlockDiodeAbstract implements ITileEntity { + +@@ -164,8 +165,18 @@ public class BlockRedstoneComparator extends BlockDiodeAbstract implements ITile + boolean flag1 = this.A(iblockdata); + + if (flag1 && !flag) { ++ // Paper start ++ if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 15, 0).getNewCurrent() != 0) { ++ return; ++ } ++ // Paper end + world.setTypeAndData(blockposition, iblockdata.set(BlockRedstoneComparator.POWERED, Boolean.valueOf(false)), 2); + } else if (!flag1 && flag) { ++ // Paper start ++ if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 0, 15).getNewCurrent() != 15) { ++ return; ++ } ++ // Paper end + world.setTypeAndData(blockposition, iblockdata.set(BlockRedstoneComparator.POWERED, Boolean.valueOf(true)), 2); + } + +-- +2.19.2 + diff --git a/scripts/importmcdev.sh b/scripts/importmcdev.sh index 39d34bfdd320..16fdcab66f96 100755 --- a/scripts/importmcdev.sh +++ b/scripts/importmcdev.sh @@ -48,7 +48,9 @@ import BlockChest import BlockFalling import BlockFurnace import BlockIceFrost +import BlockObserver import BlockPosition +import BlockRedstoneComparator import BlockSnowBlock import BlockStateEnum import ChunkCache From cbd70031ec25041cdfd1e25dbc1eb7187263f1fa Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Thu, 6 Dec 2018 22:02:57 -0500 Subject: [PATCH 37/90] Update upstream CB/S --- work/CraftBukkit Submodule work/CraftBukkit d7bebeff0..acbc348e9: > SPIGOT-4477: Arrows only firing direction of boat > Improve zombie villagers --- work/Spigot Submodule work/Spigot dcd16439b..e8ded36bc: > Rebuild patches > Add PlayerConnection timings --- Spigot-Server-Patches/0008-MC-Utils.patch | 8 ++--- Spigot-Server-Patches/0009-Timings-v2.patch | 31 ++++++++++++++----- ...ncoding-to-show-properly-on-1.13-cl.patch} | 8 ++--- ...players-yaw-pitch-on-vehicle-updates.patch | 28 ----------------- ...izes.patch => 0368-Limit-Book-Sizes.patch} | 8 ++--- ...revent-rayTrace-from-loading-chunks.patch} | 6 ++-- ...-Large-Packets-disconnecting-client.patch} | 12 +++---- ...719-Comparator-and-Observer-don-t-t.patch} | 6 ++-- work/CraftBukkit | 2 +- work/Spigot | 2 +- 10 files changed, 50 insertions(+), 61 deletions(-) rename Spigot-Server-Patches/{0368-Fix-server-icon-encoding-to-show-properly-on-1.13-cl.patch => 0367-Fix-server-icon-encoding-to-show-properly-on-1.13-cl.patch} (93%) delete mode 100644 Spigot-Server-Patches/0367-Keep-players-yaw-pitch-on-vehicle-updates.patch rename Spigot-Server-Patches/{0369-Limit-Book-Sizes.patch => 0368-Limit-Book-Sizes.patch} (96%) rename Spigot-Server-Patches/{0370-Prevent-rayTrace-from-loading-chunks.patch => 0369-Prevent-rayTrace-from-loading-chunks.patch} (94%) rename Spigot-Server-Patches/{0371-Handle-Large-Packets-disconnecting-client.patch => 0370-Handle-Large-Packets-disconnecting-client.patch} (95%) rename Spigot-Server-Patches/{0372-backport-SPIGOT-2719-Comparator-and-Observer-don-t-t.patch => 0371-backport-SPIGOT-2719-Comparator-and-Observer-don-t-t.patch} (96%) diff --git a/Spigot-Server-Patches/0008-MC-Utils.patch b/Spigot-Server-Patches/0008-MC-Utils.patch index 354aee9dc40c..b34ec5852ea2 100644 --- a/Spigot-Server-Patches/0008-MC-Utils.patch +++ b/Spigot-Server-Patches/0008-MC-Utils.patch @@ -1,4 +1,4 @@ -From 314b0b3eeb050f45dc3e9ba4eb41acf52e24e80f Mon Sep 17 00:00:00 2001 +From 736cdf2368b8d0f95b7c643fa2766d9787378c10 Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 28 Mar 2016 20:55:47 -0400 Subject: [PATCH] MC Utils @@ -354,7 +354,7 @@ index e0cb6aa6..bc638366 100644 public NBTTagList() {} diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 25dedb9d..c98dfd26 100644 +index 8c604ef8..8efcb831 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 25dedb9d..c98dfd26 100644 // CraftBukkit start - multithreaded fields private volatile int chatThrottle; private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(PlayerConnection.class, "chatThrottle"); -@@ -2160,6 +2160,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -2162,6 +2162,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { } @@ -379,5 +379,5 @@ index 25dedb9d..c98dfd26 100644 return System.nanoTime() / 1000000L; } -- -2.19.1 +2.19.2 diff --git a/Spigot-Server-Patches/0009-Timings-v2.patch b/Spigot-Server-Patches/0009-Timings-v2.patch index 44048cbeddc7..81216043dbbb 100644 --- a/Spigot-Server-Patches/0009-Timings-v2.patch +++ b/Spigot-Server-Patches/0009-Timings-v2.patch @@ -1,4 +1,4 @@ -From 4434336cca0aea35c9261dd4abbc5679c8c6a7ca Mon Sep 17 00:00:00 2001 +From 5e253ec4989164677875afdb670324f72b6161bf Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 3 Mar 2016 04:00:11 -0600 Subject: [PATCH] Timings v2 @@ -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 c98dfd26..4174fbfd 100644 +index 8efcb831..27a6d1e2 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,23 @@ index c98dfd26..4174fbfd 100644 // CraftBukkit end public class PlayerConnection implements PacketListenerPlayIn, ITickable { -@@ -1380,7 +1381,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -135,7 +136,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { + // CraftBukkit end + + public void e() { +- org.bukkit.craftbukkit.SpigotTimings.playerConnectionTimer.startTiming(); // Spigot + this.syncPosition(); + this.player.playerTick(); + this.player.setLocation(this.l, this.m, this.n, this.player.yaw, this.player.pitch); +@@ -208,7 +208,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { + this.player.resetIdleTimer(); // CraftBukkit - SPIGOT-854 + this.disconnect(new ChatMessage("multiplayer.disconnect.idling", new Object[0])); + } +- org.bukkit.craftbukkit.SpigotTimings.playerConnectionTimer.stopTiming(); // Spigot + + } + +@@ -1382,7 +1381,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { // CraftBukkit end private void handleCommand(String s) { @@ -1007,7 +1023,7 @@ index c98dfd26..4174fbfd 100644 // CraftBukkit start - whole method if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot this.LOGGER.info(this.player.getName() + " issued server command: " + s); -@@ -1391,22 +1392,22 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -1393,22 +1392,22 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { this.server.getPluginManager().callEvent(event); if (event.isCancelled()) { @@ -1428,10 +1444,10 @@ index 14851a3a..9042deed 100644 org.spigotmc.RestartCommand.restart(); diff --git a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java deleted file mode 100644 -index 4c8ab2bc..00000000 +index 666d1eb9..00000000 --- a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java +++ /dev/null -@@ -1,174 +0,0 @@ +@@ -1,175 +0,0 @@ -package org.bukkit.craftbukkit; - -import com.google.common.collect.Maps; @@ -1451,6 +1467,7 @@ index 4c8ab2bc..00000000 - public static final CustomTimingsHandler playerListTimer = new CustomTimingsHandler("Player List"); - public static final CustomTimingsHandler commandFunctionsTimer = new CustomTimingsHandler("Command Functions"); - public static final CustomTimingsHandler connectionTimer = new CustomTimingsHandler("Connection Handler"); +- public static final CustomTimingsHandler playerConnectionTimer = new CustomTimingsHandler("** PlayerConnection"); - public static final CustomTimingsHandler tickablesTimer = new CustomTimingsHandler("Tickables"); - public static final CustomTimingsHandler schedulerTimer = new CustomTimingsHandler("Scheduler"); - public static final CustomTimingsHandler chunkIOTickTimer = new CustomTimingsHandler("ChunkIOTick"); @@ -1909,5 +1926,5 @@ index 2bd690fd..38be7ed7 100644 } } -- -2.19.1 +2.19.2 diff --git a/Spigot-Server-Patches/0368-Fix-server-icon-encoding-to-show-properly-on-1.13-cl.patch b/Spigot-Server-Patches/0367-Fix-server-icon-encoding-to-show-properly-on-1.13-cl.patch similarity index 93% rename from Spigot-Server-Patches/0368-Fix-server-icon-encoding-to-show-properly-on-1.13-cl.patch rename to Spigot-Server-Patches/0367-Fix-server-icon-encoding-to-show-properly-on-1.13-cl.patch index 2752544c7716..e0cd0bbe8be6 100644 --- a/Spigot-Server-Patches/0368-Fix-server-icon-encoding-to-show-properly-on-1.13-cl.patch +++ b/Spigot-Server-Patches/0367-Fix-server-icon-encoding-to-show-properly-on-1.13-cl.patch @@ -1,4 +1,4 @@ -From 4bca90c7e6140df3eedf5527f28d9081ea048508 Mon Sep 17 00:00:00 2001 +From 88f7737821901b4291d56f94b497b50068cda9d0 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Mon, 5 Nov 2018 21:50:13 -0500 Subject: [PATCH] Fix server icon encoding to show properly on 1.13 clients as @@ -6,7 +6,7 @@ Subject: [PATCH] Fix server icon encoding to show properly on 1.13 clients as diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index e0546e3dd..3b982f990 100644 +index e0546e3d..3b982f99 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -735,7 +735,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs @@ -19,7 +19,7 @@ index e0546e3dd..3b982f990 100644 MinecraftServer.LOGGER.error("Couldn\'t load server icon", exception); } finally { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 9fe555986..7c82e18b9 100644 +index 9fe55598..7c82e18b 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1778,7 +1778,7 @@ public final class CraftServer implements Server { @@ -32,5 +32,5 @@ index 9fe555986..7c82e18b9 100644 @Override -- -2.19.1 +2.19.2 diff --git a/Spigot-Server-Patches/0367-Keep-players-yaw-pitch-on-vehicle-updates.patch b/Spigot-Server-Patches/0367-Keep-players-yaw-pitch-on-vehicle-updates.patch deleted file mode 100644 index fc6a018bfbe7..000000000000 --- a/Spigot-Server-Patches/0367-Keep-players-yaw-pitch-on-vehicle-updates.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 182ee0d285eaeedc1c500912fc51359878544406 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Fri, 2 Nov 2018 23:22:34 -0400 -Subject: [PATCH] Keep players yaw/pitch on vehicle updates - - -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 398f2fdf83..edd7ba353d 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -375,12 +375,12 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { - Location curPos = this.getPlayer().getLocation(); // Spigot - - entity.setLocation(d3, d4, d5, f, f1); -- player.setLocation(d3, d4, d5, f, f1); // CraftBukkit -+ player.setLocation(d3, d4, d5, player.yaw, player.pitch); // CraftBukkit // 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); // CraftBukkit -+ player.setLocation(d3, d4, d5, player.yaw, player.pitch); // CraftBukkit // Paper - this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity)); - return; - } --- -2.19.1 - diff --git a/Spigot-Server-Patches/0369-Limit-Book-Sizes.patch b/Spigot-Server-Patches/0368-Limit-Book-Sizes.patch similarity index 96% rename from Spigot-Server-Patches/0369-Limit-Book-Sizes.patch rename to Spigot-Server-Patches/0368-Limit-Book-Sizes.patch index 8ec90276696c..aebda329b476 100644 --- a/Spigot-Server-Patches/0369-Limit-Book-Sizes.patch +++ b/Spigot-Server-Patches/0368-Limit-Book-Sizes.patch @@ -1,11 +1,11 @@ -From b037f9c518d26ee6c566647b9df1d2ceed356fda Mon Sep 17 00:00:00 2001 +From a9f81124c623c9d1003357bb6c4c89ca834f3c2f Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 17 Nov 2018 00:08:54 -0500 Subject: [PATCH] Limit Book Sizes diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 332e90f86b..0ac61f4de0 100644 +index 332e90f8..0ac61f4d 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -320,4 +320,12 @@ public class PaperConfig { @@ -22,7 +22,7 @@ index 332e90f86b..0ac61f4de0 100644 + } } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index edd7ba353d..4c35132892 100644 +index d6d2010d..ea999b70 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -2329,6 +2329,39 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { @@ -82,5 +82,5 @@ index edd7ba353d..4c35132892 100644 itemstack2.a("author", (NBTBase) (new NBTTagString(this.player.getName()))); -- -2.19.1 +2.19.2 diff --git a/Spigot-Server-Patches/0370-Prevent-rayTrace-from-loading-chunks.patch b/Spigot-Server-Patches/0369-Prevent-rayTrace-from-loading-chunks.patch similarity index 94% rename from Spigot-Server-Patches/0370-Prevent-rayTrace-from-loading-chunks.patch rename to Spigot-Server-Patches/0369-Prevent-rayTrace-from-loading-chunks.patch index 74fbc08b900a..9ea4fada3a94 100644 --- a/Spigot-Server-Patches/0370-Prevent-rayTrace-from-loading-chunks.patch +++ b/Spigot-Server-Patches/0369-Prevent-rayTrace-from-loading-chunks.patch @@ -1,4 +1,4 @@ -From b0f9bb4104252c176abf468b9563a0008409e688 Mon Sep 17 00:00:00 2001 +From a55fa31b0d23301861e55b4c70ebee7ad66c519d Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 26 Nov 2018 19:44:01 -0500 Subject: [PATCH] Prevent rayTrace from loading chunks @@ -7,7 +7,7 @@ ray tracing into an unloaded chunk should be treated as a miss this saves a ton of lag for when AI tries to raytrace near unloaded chunks. diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 7633a61342..bc231c7f29 100644 +index 7633a613..bc231c7f 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -932,7 +932,8 @@ public abstract class World implements IBlockAccess { @@ -31,5 +31,5 @@ index 7633a61342..bc231c7f29 100644 if (!flag1 || iblockdata1.getMaterial() == Material.PORTAL || iblockdata1.d(this, blockposition) != Block.k) { -- -2.19.1 +2.19.2 diff --git a/Spigot-Server-Patches/0371-Handle-Large-Packets-disconnecting-client.patch b/Spigot-Server-Patches/0370-Handle-Large-Packets-disconnecting-client.patch similarity index 95% rename from Spigot-Server-Patches/0371-Handle-Large-Packets-disconnecting-client.patch rename to Spigot-Server-Patches/0370-Handle-Large-Packets-disconnecting-client.patch index 4fe46ff061e4..3aa860fedd5f 100644 --- a/Spigot-Server-Patches/0371-Handle-Large-Packets-disconnecting-client.patch +++ b/Spigot-Server-Patches/0370-Handle-Large-Packets-disconnecting-client.patch @@ -1,4 +1,4 @@ -From 158c65a57917f6a0b3c27f5b67f834306e229194 Mon Sep 17 00:00:00 2001 +From 68670b9f2491fd93af0b802272f6d9f08ed75474 Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 27 Nov 2018 21:18:06 -0500 Subject: [PATCH] Handle Large Packets disconnecting client @@ -7,7 +7,7 @@ If a players inventory is too big to send in a single packet, split the inventory set into multiple packets instead. diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 3d32e0056..a7fcc14f2 100644 +index 3d32e005..a7fcc14f 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java @@ -112,6 +112,15 @@ public class NetworkManager extends SimpleChannelInboundHandler> { @@ -27,7 +27,7 @@ index 3d32e0056..a7fcc14f2 100644 if (throwable instanceof TimeoutException) { diff --git a/src/main/java/net/minecraft/server/Packet.java b/src/main/java/net/minecraft/server/Packet.java -index fdc142b75..b283e1557 100644 +index fdc142b7..b283e155 100644 --- a/src/main/java/net/minecraft/server/Packet.java +++ b/src/main/java/net/minecraft/server/Packet.java @@ -8,5 +8,10 @@ public interface Packet { @@ -42,7 +42,7 @@ index fdc142b75..b283e1557 100644 void a(T t0); } diff --git a/src/main/java/net/minecraft/server/PacketEncoder.java b/src/main/java/net/minecraft/server/PacketEncoder.java -index a6da6f5cc..4e263aa8d 100644 +index a6da6f5c..4e263aa8 100644 --- a/src/main/java/net/minecraft/server/PacketEncoder.java +++ b/src/main/java/net/minecraft/server/PacketEncoder.java @@ -44,11 +44,32 @@ public class PacketEncoder extends MessageToByteEncoder> { @@ -80,7 +80,7 @@ index a6da6f5cc..4e263aa8d 100644 } } diff --git a/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java b/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java -index bf47c8249..e054757d2 100644 +index bf47c824..e054757d 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java @@ -9,6 +9,15 @@ public class PacketPlayOutWindowItems implements Packet { @@ -100,5 +100,5 @@ index bf47c8249..e054757d2 100644 public PacketPlayOutWindowItems(int i, NonNullList nonnulllist) { -- -2.19.1 +2.19.2 diff --git a/Spigot-Server-Patches/0372-backport-SPIGOT-2719-Comparator-and-Observer-don-t-t.patch b/Spigot-Server-Patches/0371-backport-SPIGOT-2719-Comparator-and-Observer-don-t-t.patch similarity index 96% rename from Spigot-Server-Patches/0372-backport-SPIGOT-2719-Comparator-and-Observer-don-t-t.patch rename to Spigot-Server-Patches/0371-backport-SPIGOT-2719-Comparator-and-Observer-don-t-t.patch index e412e02214ab..f4e7d4fdfea7 100644 --- a/Spigot-Server-Patches/0372-backport-SPIGOT-2719-Comparator-and-Observer-don-t-t.patch +++ b/Spigot-Server-Patches/0371-backport-SPIGOT-2719-Comparator-and-Observer-don-t-t.patch @@ -1,4 +1,4 @@ -From 778d563e5b2d8141a1df1c4b3fc074928f6552c2 Mon Sep 17 00:00:00 2001 +From ae78e5026972a2c6190432b90775db89adab66da Mon Sep 17 00:00:00 2001 From: Amosar Date: Sat, 1 Dec 2018 20:00:22 +0000 Subject: [PATCH] backport: SPIGOT-2719: Comparator and Observer don't trigger @@ -6,7 +6,7 @@ Subject: [PATCH] backport: SPIGOT-2719: Comparator and Observer don't trigger diff --git a/src/main/java/net/minecraft/server/BlockObserver.java b/src/main/java/net/minecraft/server/BlockObserver.java -index 59e93e6f6..5836a7637 100644 +index 59e93e6f..5836a763 100644 --- a/src/main/java/net/minecraft/server/BlockObserver.java +++ b/src/main/java/net/minecraft/server/BlockObserver.java @@ -1,6 +1,7 @@ @@ -37,7 +37,7 @@ index 59e93e6f6..5836a7637 100644 world.a(blockposition, (Block) this, 2); } diff --git a/src/main/java/net/minecraft/server/BlockRedstoneComparator.java b/src/main/java/net/minecraft/server/BlockRedstoneComparator.java -index 78ad3374d..04d973d9a 100644 +index 78ad3374..04d973d9 100644 --- a/src/main/java/net/minecraft/server/BlockRedstoneComparator.java +++ b/src/main/java/net/minecraft/server/BlockRedstoneComparator.java @@ -4,6 +4,7 @@ import com.google.common.base.Predicate; diff --git a/work/CraftBukkit b/work/CraftBukkit index d7bebeff028a..acbc348e925c 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit d7bebeff028af7baf52105394529598f1c4093c4 +Subproject commit acbc348e925cbdbae41b2055d60bbe40031d470c diff --git a/work/Spigot b/work/Spigot index dcd16439b514..e8ded36bc9c1 160000 --- a/work/Spigot +++ b/work/Spigot @@ -1 +1 @@ -Subproject commit dcd16439b51429c18f1028bbe36ff805547050de +Subproject commit e8ded36bc9c1661fc04f83762e3e0e94a273787b From ac697484cfa116f97e436aebb26ec6cb9b3dcfd9 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Thu, 6 Dec 2018 22:09:08 -0500 Subject: [PATCH 38/90] Cleanup after plugins which don't sucessfully enable This change closes the plugin via the plugin manager, which disables the plugin, as intended, but also cleans up after the plugin, preventing any further errors or issues caused by tasks scheduled by the plugin before it failed. Backport of 1.13 cf772531f4fa25281b9cf17f362e465862234b78 --- .../0103-Close-Plugin-Class-Loaders-on-Disable.patch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Spigot-API-Patches/0103-Close-Plugin-Class-Loaders-on-Disable.patch b/Spigot-API-Patches/0103-Close-Plugin-Class-Loaders-on-Disable.patch index 9881e33aa598..812af2e5c779 100644 --- a/Spigot-API-Patches/0103-Close-Plugin-Class-Loaders-on-Disable.patch +++ b/Spigot-API-Patches/0103-Close-Plugin-Class-Loaders-on-Disable.patch @@ -1,4 +1,4 @@ -From 13d2ed50d6346f5c8eb7833dd99f7c61e8fd0b29 Mon Sep 17 00:00:00 2001 +From 8b9f3c48dcc40317ca51b6138eb6e3b766a8652c Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 1 May 2018 21:33:35 -0400 Subject: [PATCH] Close Plugin Class Loaders on Disable @@ -100,7 +100,7 @@ index bd0588a2..cb2b0b9c 100644 lookupNames.clear(); HandlerList.unregisterAll(); diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index 40fd71dc..3e87c3dd 100644 +index 40fd71dc..8b5cea64 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -317,7 +317,7 @@ public final class JavaPluginLoader implements PluginLoader { @@ -108,7 +108,7 @@ index 40fd71dc..3e87c3dd 100644 server.getLogger().log(Level.SEVERE, "Error occurred while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex); // Paper start - Disable plugins that fail to load - disablePlugin(jPlugin); -+ disablePlugin(jPlugin, true); // Paper - close Classloader on disable - She's dead jim ++ server.getPluginManager().disablePlugin(jPlugin, true); // Paper - close Classloader on disable - She's dead jim return; // Paper end } @@ -144,5 +144,5 @@ index 40fd71dc..3e87c3dd 100644 } } -- -2.17.1 +2.19.2 From 2ee16de8ae95a99953fe1cd6fef70d81a3a84f5d Mon Sep 17 00:00:00 2001 From: "Connor (Vectrix)" Date: Tue, 1 Jan 2019 19:32:33 +1300 Subject: [PATCH 39/90] Ensure the passenger player gets retracked by the vehicle player on disconnection (#1781) --- ...re-the-vehicle-doesn-t-track-the-pas.patch | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Spigot-Server-Patches/0372-Fix-an-issue-where-the-vehicle-doesn-t-track-the-pas.patch diff --git a/Spigot-Server-Patches/0372-Fix-an-issue-where-the-vehicle-doesn-t-track-the-pas.patch b/Spigot-Server-Patches/0372-Fix-an-issue-where-the-vehicle-doesn-t-track-the-pas.patch new file mode 100644 index 000000000000..177f90a28d9f --- /dev/null +++ b/Spigot-Server-Patches/0372-Fix-an-issue-where-the-vehicle-doesn-t-track-the-pas.patch @@ -0,0 +1,40 @@ +From 45f2b8707a23911141a1c20a4f9176060014091e Mon Sep 17 00:00:00 2001 +From: connorhartley +Date: Mon, 31 Dec 2018 18:54:23 +1300 +Subject: [PATCH] Fix an issue where the vehicle doesn't track the passenger + when they disconnect + + +diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +index d44c55d84..74bbba011 100644 +--- a/src/main/java/net/minecraft/server/Entity.java ++++ b/src/main/java/net/minecraft/server/Entity.java +@@ -2958,6 +2958,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper + return entity instanceof EntityHuman ? ((EntityHuman) entity).cZ() : !this.world.isClientSide; + } + ++ @Nullable Entity getVehicleDirect() { return this.bJ(); } // Paper - OBFHELPER + @Nullable + public Entity bJ() { + return this.au; +diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +index 6afb6cf7b..c1a2ddcf5 100644 +--- a/src/main/java/net/minecraft/server/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/EntityPlayer.java +@@ -1088,6 +1088,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + public void s() { + this.cu = true; + this.ejectPassengers(); ++ ++ // Paper start - "Fixes" an issue where the vehicle doesn't track the passenger disconnection dismount. ++ if (this.isPassenger() && this.getVehicleDirect() instanceof EntityLiving) { ++ this.stopRiding(); ++ } ++ // Paper end ++ + if (this.sleeping) { + this.a(true, false, false); + } +-- +2.20.1 + From af759c3e9850aff5391aad1dac3d88651c64ec99 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Sat, 12 Jan 2019 17:31:22 +0000 Subject: [PATCH 40/90] Address some issues with book limits (#1798) --- .../0368-Limit-Book-Sizes.patch | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/Spigot-Server-Patches/0368-Limit-Book-Sizes.patch b/Spigot-Server-Patches/0368-Limit-Book-Sizes.patch index aebda329b476..ae33a8278dce 100644 --- a/Spigot-Server-Patches/0368-Limit-Book-Sizes.patch +++ b/Spigot-Server-Patches/0368-Limit-Book-Sizes.patch @@ -1,11 +1,11 @@ -From a9f81124c623c9d1003357bb6c4c89ca834f3c2f Mon Sep 17 00:00:00 2001 +From 797d58776f9e4c4bc6e59a4d78d540d7fb069402 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 17 Nov 2018 00:08:54 -0500 Subject: [PATCH] Limit Book Sizes diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 332e90f8..0ac61f4d 100644 +index 332e90f86..0ac61f4de 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -320,4 +320,12 @@ public class PaperConfig { @@ -22,10 +22,10 @@ index 332e90f8..0ac61f4d 100644 + } } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index d6d2010d..ea999b70 100644 +index d6d2010d5..de62c3b76 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -2329,6 +2329,39 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -2329,6 +2329,45 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { this.player.a(packetplayinsettings); } @@ -40,24 +40,30 @@ index d6d2010d..ea999b70 100644 + String testString = pageList.getString(i); + int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length; + byteTotal += byteLength; -+ if (byteTotal > byteAllowed) { -+ PlayerConnection.LOGGER.warn(this.player.getName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size()); -+ minecraftServer.postToMainThread(() -> this.disconnect("Book too large!")); -+ return false; -+ } ++ + int length = testString.length(); -+ int multibytes = byteLength == length ? byteLength : (int) Math.round((double) byteLength / (double) length); -+ for (int x = 1; x < multibytes; x++) { -+ multiplier *= multiplier; ++ int multibytes = 0; ++ if (length != byteLength) { ++ for (char c : testString.toCharArray()) { ++ if (c > 127) { ++ multibytes++; ++ } ++ } + } + byteAllowed += (maxBookPageSize * Math.min(1, Math.max(0.1D, (double) length / 255D))) * multiplier; -+ multiplier *= multiplier; + + if (multibytes > 1) { -+ // penalize MB some more -+ byteAllowed -= length; ++ // penalize MB ++ byteAllowed -= multibytes; + } + } ++ ++ if (byteTotal > byteAllowed) { ++ PlayerConnection.LOGGER.warn(this.player.getName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size()); ++ minecraftServer.postToMainThread(() -> this.disconnect("Book too large!")); ++ return false; ++ } ++ + return true; + } + // Paper end @@ -65,7 +71,7 @@ index d6d2010d..ea999b70 100644 public void a(PacketPlayInCustomPayload packetplayincustompayload) { PlayerConnectionUtils.ensureMainThread(packetplayincustompayload, this, this.player.x()); String s = packetplayincustompayload.a(); -@@ -2362,6 +2395,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -2362,6 +2401,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { } if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack.getItem() == itemstack1.getItem()) { @@ -73,7 +79,7 @@ index d6d2010d..ea999b70 100644 itemstack1.a("pages", (NBTBase) itemstack.getTag().getList("pages", 8)); CraftEventFactory.handleEditBookEvent(player, itemstack1); // CraftBukkit } -@@ -2397,6 +2431,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -2397,6 +2437,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { } if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack1.getItem() == Items.WRITABLE_BOOK) { @@ -82,5 +88,5 @@ index d6d2010d..ea999b70 100644 itemstack2.a("author", (NBTBase) (new NBTTagString(this.player.getName()))); -- -2.19.2 +2.20.1 From e8f86cb97d5466c02e9e95384d727d7375c2b695 Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 15 Feb 2019 21:50:25 -0500 Subject: [PATCH 41/90] Allow Saving of Oversized Chunks - READ COMMIT DETAILS!!! Please test this build on a local TEST SERVER before sending to your live server! PaperMC is not responsible for any data loss to your chunks. ------------------------------------------------------------------- The Minecraft World Region File format has a hard cap of 1MB per chunk. This is due to the fact that the header of the file format only allocates a single byte for sector count, meaning a maximum of 256 sectors, at 4k per sector. This limit can be reached fairly easily with books, resulting in the chunk being unable to save to the world. Worse off, is that nothing printed when this occured, and silently performed a chunk rollback on next load. This leads to security risk with duplication and is being actively exploited. This patch catches the too large scenario, falls back and moves any large Entity or Tile Entity into a new compound, and this compound is saved into a different file. On Chunk Load, we check for oversized status, and if so, we load the extra file and merge the Entities and Tile Entities from the oversized chunk back into the level to then be loaded as normal. Once a chunk is returned back to normal size, the oversized flag will clear, and no extra data file will exist. This fix maintains compatability with all existing Anvil Region Format tools as it does not alter the save format. They will just not know about the extra entities. This fix also maintains compatability if someone switches server jars to one without this fix, as the data will remain in the oversized file. Once the server returns to a jar with this fix, the data will be restored. --- ...373-Allow-Saving-of-Oversized-Chunks.patch | 416 ++++++++++++++++++ 1 file changed, 416 insertions(+) create mode 100644 Spigot-Server-Patches/0373-Allow-Saving-of-Oversized-Chunks.patch diff --git a/Spigot-Server-Patches/0373-Allow-Saving-of-Oversized-Chunks.patch b/Spigot-Server-Patches/0373-Allow-Saving-of-Oversized-Chunks.patch new file mode 100644 index 000000000000..621025acf1f4 --- /dev/null +++ b/Spigot-Server-Patches/0373-Allow-Saving-of-Oversized-Chunks.patch @@ -0,0 +1,416 @@ +From 026320c912a5ce008130be4a5089eceea3a24da2 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Fri, 15 Feb 2019 01:08:19 -0500 +Subject: [PATCH] Allow Saving of Oversized Chunks + +The Minecraft World Region File format has a hard cap of 1MB per chunk. +This is due to the fact that the header of the file format only allocates +a single byte for sector count, meaning a maximum of 256 sectors, at 4k per sector. + +This limit can be reached fairly easily with books, resulting in the chunk being unable +to save to the world. Worse off, is that nothing printed when this occured, and silently +performed a chunk rollback on next load. + +This leads to security risk with duplication and is being actively exploited. + +This patch catches the too large scenario, falls back and moves any large Entity +or Tile Entity into a new compound, and this compound is saved into a different file. + +On Chunk Load, we check for oversized status, and if so, we load the extra file and +merge the Entities and Tile Entities from the oversized chunk back into the level to +then be loaded as normal. + +Once a chunk is returned back to normal size, the oversized flag will clear, and no +extra data file will exist. + +This fix maintains compatability with all existing Anvil Region Format tools as it +does not alter the save format. They will just not know about the extra entities. + +This fix also maintains compatability if someone switches server jars to one without +this fix, as the data will remain in the oversized file. Once the server returns +to a jar with this fix, the data will be restored. + +diff --git a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java +index 2162d3ad..8b5aeb1b 100644 +--- a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java ++++ b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java +@@ -39,6 +39,7 @@ public class NBTCompressedStreamTools { + + } + ++ public static NBTTagCompound readNBT(DataInputStream datainputstream) throws IOException { return a(datainputstream); } // Paper - OBFHELPER + public static NBTTagCompound a(DataInputStream datainputstream) throws IOException { + return a((DataInput) datainputstream, NBTReadLimiter.a); + } +@@ -59,6 +60,7 @@ public class NBTCompressedStreamTools { + } + } + ++ public static void writeNBT(NBTTagCompound nbttagcompound, DataOutput dataoutput) throws IOException { a(nbttagcompound, dataoutput); } // Paper - OBFHELPER + public static void a(NBTTagCompound nbttagcompound, DataOutput dataoutput) throws IOException { + a((NBTBase) nbttagcompound, dataoutput); + } +diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java +index d334d634..34f72c3d 100644 +--- a/src/main/java/net/minecraft/server/RegionFile.java ++++ b/src/main/java/net/minecraft/server/RegionFile.java +@@ -78,6 +78,7 @@ public class RegionFile { + } + header.clear(); + IntBuffer headerAsInts = header.asIntBuffer(); ++ initOversizedState(); + // Paper End + for (j = 0; j < 1024; ++j) { + k = headerAsInts.get(); // Paper +@@ -101,7 +102,7 @@ public class RegionFile { + } + + @Nullable +- public synchronized DataInputStream a(int i, int j) { ++ public synchronized DataInputStream getReadStream(int i, int j) { return a(i, j); } @Nullable public synchronized DataInputStream a(int i, int j) { // Paper - OBFHELPER + if (this.d(i, j)) { + return null; + } else { +@@ -149,8 +150,8 @@ public class RegionFile { + } + + @Nullable +- public DataOutputStream b(int i, int j) { +- return this.d(i, j) ? null : new DataOutputStream(new BufferedOutputStream(new DeflaterOutputStream(new RegionFile.ChunkBuffer(i, j)))); ++ public DataOutputStream getWriteStream(int i, int j) { return b(i, j); } @Nullable public DataOutputStream b(int i, int j) { // Paper - OBFHELPER ++ return this.d(i, j) ? null : new DataOutputStream(new RegionFile.ChunkBuffer(i, j)); // Paper - remove middleware, move deflate to .close() for dynamic levels + } + + protected synchronized void a(int i, int j, byte[] abyte, int k) { +@@ -161,7 +162,7 @@ public class RegionFile { + int k1 = (k + 5) / 4096 + 1; + + if (k1 >= 256) { +- return; ++ throw new ChunkTooLargeException(i, j, k1); // Paper - throw error instead + } + + if (i1 != 0 && j1 == k1) { +@@ -312,6 +313,101 @@ public class RegionFile { + logger.error("Error backing up corrupt file" + file.getAbsolutePath(), e); + } + } ++ ++ private final byte[] oversized = new byte[1024]; ++ private int oversizedCount = 0; ++ ++ private synchronized void initOversizedState() throws IOException { ++ File metaFile = getOversizedMetaFile(); ++ if (metaFile.exists()) { ++ final byte[] read = java.nio.file.Files.readAllBytes(metaFile.toPath()); ++ System.arraycopy(read, 0, oversized, 0, oversized.length); ++ for (byte temp : oversized) { ++ oversizedCount += temp; ++ } ++ } ++ } ++ ++ private static int getChunkIndex(int x, int z) { ++ return (x & 31) + (z & 31) * 32; ++ } ++ synchronized boolean isOversized(int x, int z) { ++ return this.oversized[getChunkIndex(x, z)] == 1; ++ } ++ synchronized void setOversized(int x, int z, boolean oversized) throws IOException { ++ final int offset = getChunkIndex(x, z); ++ boolean previous = this.oversized[offset] == 1; ++ this.oversized[offset] = (byte) (oversized ? 1 : 0); ++ if (!previous && oversized) { ++ oversizedCount++; ++ } else if (!oversized && previous) { ++ oversizedCount--; ++ } ++ if (previous && !oversized) { ++ File oversizedFile = getOversizedFile(x, z); ++ if (oversizedFile.exists()) { ++ oversizedFile.delete(); ++ } ++ } ++ if (oversizedCount > 0) { ++ if (previous != oversized) { ++ writeOversizedMeta(); ++ } ++ } else if (previous) { ++ File oversizedMetaFile = getOversizedMetaFile(); ++ if (oversizedMetaFile.exists()) { ++ oversizedMetaFile.delete(); ++ } ++ } ++ } ++ ++ private void writeOversizedMeta() throws IOException { ++ java.nio.file.Files.write(getOversizedMetaFile().toPath(), oversized); ++ } ++ ++ private File getOversizedMetaFile() { ++ return new File(getFile().getParentFile(), getFile().getName().replaceAll("\\.mca$", "") + ".oversized.nbt"); ++ } ++ ++ private File getOversizedFile(int x, int z) { ++ return new File(this.getFile().getParentFile(), this.getFile().getName().replaceAll("\\.mca$", "") + "_oversized_" + x + "_" + z + ".nbt"); ++ } ++ ++ void writeOversizedData(int x, int z, NBTTagCompound oversizedData) throws IOException { ++ File file = getOversizedFile(x, z); ++ try (DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new DeflaterOutputStream(new java.io.FileOutputStream(file), new java.util.zip.Deflater(java.util.zip.Deflater.BEST_COMPRESSION), 32 * 1024), 32 * 1024))) { ++ NBTCompressedStreamTools.writeNBT(oversizedData, out); ++ } ++ this.setOversized(x, z, true); ++ ++ } ++ ++ synchronized NBTTagCompound getOversizedData(int x, int z) throws IOException { ++ File file = getOversizedFile(x, z); ++ try (DataInputStream out = new DataInputStream(new BufferedInputStream(new InflaterInputStream(new java.io.FileInputStream(file))))) { ++ return NBTCompressedStreamTools.readNBT(out); ++ } ++ ++ } ++ ++ public class ChunkTooLargeException extends RuntimeException { ++ public ChunkTooLargeException(int x, int z, int sectors) { ++ super("Chunk " + x + "," + z + " of " + getFile().toString() + " is too large (" + sectors + "/256)"); ++ } ++ } ++ private static class DirectByteArrayOutputStream extends ByteArrayOutputStream { ++ public DirectByteArrayOutputStream() { ++ super(); ++ } ++ ++ public DirectByteArrayOutputStream(int size) { ++ super(size); ++ } ++ ++ public byte[] getBuffer() { ++ return this.buf; ++ } ++ } + // Paper end + + class ChunkBuffer extends ByteArrayOutputStream { +@@ -325,8 +421,40 @@ public class RegionFile { + this.c = j; + } + +- public void close() { +- RegionFile.this.a(this.b, this.c, this.buf, this.count); ++ public void close() throws IOException { ++ // Paper start - apply dynamic compression ++ int origLength = this.count; ++ byte[] buf = this.buf; ++ DirectByteArrayOutputStream out = compressData(buf, origLength); ++ byte[] bytes = out.getBuffer(); ++ int length = out.size(); ++ ++ RegionFile.this.a(this.b, this.c, bytes, length); // Paper - change to bytes/length ++ // Paper end ++ } ++ } ++ ++ private static DirectByteArrayOutputStream compressData(byte[] buf, int length) throws IOException { ++ final java.util.zip.Deflater deflater; ++ if (length > 1024 * 512) { ++ deflater = new java.util.zip.Deflater(9); ++ } else if (length > 1024 * 128) { ++ deflater = new java.util.zip.Deflater(8); ++ } else { ++ deflater = new java.util.zip.Deflater(6); ++ } ++ ++ ++ deflater.setInput(buf, 0, length); ++ deflater.finish(); ++ ++ DirectByteArrayOutputStream out = new DirectByteArrayOutputStream(length); ++ byte[] buffer = new byte[1024 * (length > 1024 * 124 ? 32 : 16)]; ++ while (!deflater.finished()) { ++ out.write(buffer, 0, deflater.deflate(buffer)); + } ++ out.close(); ++ deflater.end(); ++ return out; + } + } +diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java +index 15a09ab3..c260a797 100644 +--- a/src/main/java/net/minecraft/server/RegionFileCache.java ++++ b/src/main/java/net/minecraft/server/RegionFileCache.java +@@ -15,6 +15,7 @@ public class RegionFileCache { + + public static final Map a = new LinkedHashMap(PaperConfig.regionFileCacheSize, 0.75f, true); // Spigot - private -> public, Paper - HashMap -> LinkedHashMap + ++ public static synchronized RegionFile getRegionFile(File file, int i, int j) { return a(file, i, j); } // Paper - OBFHELPER + public static synchronized RegionFile a(File file, int i, int j) { + File file1 = new File(file, "region"); + File file2 = new File(file1, "r." + (i >> 5) + "." + (j >> 5) + ".mca"); +@@ -73,6 +74,129 @@ public class RegionFileCache { + itr.remove(); + } + } ++ private static void printOversizedLog(String msg, File file, int x, int z) { ++ org.apache.logging.log4j.LogManager.getLogger().fatal(msg + " (" + file.toString().replaceAll(".+[\\\\/]", "") + " - " + x + "," + z + ") Go clean it up to remove this message. /minecraft:tp " + (x<<4)+" 128 "+(z<<4) + " - DO NOT REPORT THIS TO PAPER - You may ask for help on Discord, but do not file an issue. These error messages can not be removed."); ++ } ++ ++ private static final int DEFAULT_SIZE_THRESHOLD = 1024 * 8; ++ private static final int OVERZEALOUS_THRESHOLD = 1024 * 2; ++ private static int SIZE_THRESHOLD = DEFAULT_SIZE_THRESHOLD; ++ private static void resetFilterThresholds() { ++ SIZE_THRESHOLD = Math.max(1024 * 4, Integer.getInteger("Paper.FilterThreshhold", DEFAULT_SIZE_THRESHOLD)); ++ } ++ static { ++ resetFilterThresholds(); ++ } ++ private static void writeRegion(File file, int x, int z, NBTTagCompound nbttagcompound) throws IOException { ++ RegionFile regionfile = getRegionFile(file, x, z); ++ ++ DataOutputStream out = regionfile.getWriteStream(x & 31, z & 31); ++ try { ++ NBTCompressedStreamTools.writeNBT(nbttagcompound, out); ++ out.close(); ++ regionfile.setOversized(x, z, false); ++ } catch (RegionFile.ChunkTooLargeException ignored) { ++ printOversizedLog("ChunkTooLarge! Someone is trying to duplicate.", file, x, z); ++ // Clone as we are now modifying it, don't want to corrupt the pending save state ++ nbttagcompound = (NBTTagCompound) nbttagcompound.clone(); ++ // Filter out TileEntities and Entities ++ NBTTagCompound oversizedData = filterChunkData(nbttagcompound); ++ //noinspection SynchronizationOnLocalVariableOrMethodParameter ++ synchronized (regionfile) { ++ out = regionfile.getWriteStream(x & 31, z & 31); ++ NBTCompressedStreamTools.writeNBT(nbttagcompound, out); ++ try { ++ out.close(); ++ // 2048 is below the min allowed, so it means we enter overzealous mode below ++ if (SIZE_THRESHOLD == OVERZEALOUS_THRESHOLD) { ++ resetFilterThresholds(); ++ } ++ } catch (RegionFile.ChunkTooLargeException e) { ++ printOversizedLog("ChunkTooLarge even after reduction. Trying in overzealous mode.", file, x, z); ++ // Eek, major fail. We have retry logic, so reduce threshholds and fall back ++ SIZE_THRESHOLD = OVERZEALOUS_THRESHOLD; ++ throw e; ++ } ++ ++ regionfile.writeOversizedData(x, z, oversizedData); ++ } ++ } catch (Exception e) { ++ e.printStackTrace(); ++ throw e; ++ } ++ ++ } ++ ++ private static NBTTagCompound filterChunkData(NBTTagCompound chunk) { ++ NBTTagCompound oversizedLevel = new NBTTagCompound(); ++ NBTTagCompound level = chunk.getCompound("Level"); ++ filterChunkList(level, oversizedLevel, "Entities"); ++ filterChunkList(level, oversizedLevel, "TileEntities"); ++ NBTTagCompound oversized = new NBTTagCompound(); ++ oversized.set("Level", oversizedLevel); ++ return oversized; ++ } ++ ++ private static void filterChunkList(NBTTagCompound level, NBTTagCompound extra, String key) { ++ NBTTagList list = level.getList(key, 10); ++ NBTTagList newList = extra.getList(key, 10); ++ for (Iterator iterator = list.list.iterator(); iterator.hasNext(); ) { ++ NBTBase object = iterator.next(); ++ if (getNBTSize(object) > SIZE_THRESHOLD) { ++ newList.add(object); ++ iterator.remove(); ++ } ++ } ++ level.set(key, list); ++ extra.set(key, newList); ++ } ++ ++ ++ private static NBTTagCompound readOversizedChunk(RegionFile regionfile, int i, int j) throws IOException { ++ synchronized (regionfile) { ++ try (DataInputStream datainputstream = regionfile.getReadStream(i & 31, j & 31)) { ++ NBTTagCompound oversizedData = regionfile.getOversizedData(i, j); ++ NBTTagCompound chunk = NBTCompressedStreamTools.readNBT(datainputstream); ++ if (oversizedData == null) { ++ return chunk; ++ } ++ NBTTagCompound oversizedLevel = oversizedData.getCompound("Level"); ++ NBTTagCompound level = chunk.getCompound("Level"); ++ ++ mergeChunkList(level, oversizedLevel, "Entities"); ++ mergeChunkList(level, oversizedLevel, "TileEntities"); ++ ++ chunk.set("Level", level); ++ ++ return chunk; ++ } catch (Throwable throwable) { ++ throwable.printStackTrace(); ++ throw throwable; ++ } ++ } ++ } ++ ++ private static void mergeChunkList(NBTTagCompound level, NBTTagCompound oversizedLevel, String key) { ++ NBTTagList levelList = level.getList(key, 10); ++ NBTTagList oversizedList = oversizedLevel.getList(key, 10); ++ ++ if (!oversizedList.isEmpty()) { ++ oversizedList.list.forEach(levelList::add); ++ level.set(key, levelList); ++ } ++ } ++ ++ private static int getNBTSize(NBTBase nbtBase) { ++ DataOutputStream test = new DataOutputStream(new org.apache.commons.io.output.NullOutputStream()); ++ try { ++ nbtBase.write(test); ++ return test.size(); ++ } catch (IOException e) { ++ e.printStackTrace(); ++ return 0; ++ } ++ } ++ + // Paper End + + public static synchronized void a() { +@@ -97,6 +221,12 @@ public class RegionFileCache { + // CraftBukkit start - call sites hoisted for synchronization + public static NBTTagCompound d(File file, int i, int j) throws IOException { // Paper - remove synchronization + RegionFile regionfile = a(file, i, j); ++ // Paper start ++ if (regionfile.isOversized(i, j)) { ++ printOversizedLog("Loading Oversized Chunk!", file, i, j); ++ return readOversizedChunk(regionfile, i, j); ++ } ++ // Paper end + + DataInputStream datainputstream = regionfile.a(i & 31, j & 31); + +@@ -108,11 +238,14 @@ public class RegionFileCache { + } + + 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); +- NBTCompressedStreamTools.a(nbttagcompound, (java.io.DataOutput) dataoutputstream); +- dataoutputstream.close(); ++ writeRegion(file, i, j, nbttagcompound); // Paper - moved to own method ++ // Paper start ++// RegionFile regionfile = a(file, i, j); ++// ++// DataOutputStream dataoutputstream = regionfile.b(i & 31, j & 31); ++// NBTCompressedStreamTools.a(nbttagcompound, (java.io.DataOutput) dataoutputstream); ++// dataoutputstream.close(); ++ // Paper end + } + // CraftBukkit end + +-- +2.20.1 + From 132c2c533da11d822c94b70a475ef7014e456be4 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 16 Feb 2019 18:28:09 -0500 Subject: [PATCH 42/90] Fix loot table restriction when replenish is disabled - Fixes #1860 --- ...-API-Replenishable-Lootables-Feature.patch | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/Spigot-Server-Patches/0126-LootTable-API-Replenishable-Lootables-Feature.patch b/Spigot-Server-Patches/0126-LootTable-API-Replenishable-Lootables-Feature.patch index a4991d92cdd8..5381d93acb2d 100644 --- a/Spigot-Server-Patches/0126-LootTable-API-Replenishable-Lootables-Feature.patch +++ b/Spigot-Server-Patches/0126-LootTable-API-Replenishable-Lootables-Feature.patch @@ -1,4 +1,4 @@ -From 242c1065f2370a39bf4b79f1da420b000c55d96c Mon Sep 17 00:00:00 2001 +From 884fab422d699408349283afb783f45eaa11b701 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 1 May 2016 21:19:14 -0400 Subject: [PATCH] LootTable API & Replenishable Lootables Feature @@ -11,7 +11,7 @@ This feature is good for long term worlds so that newer players do not suffer with "Every chest has been looted" diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index d96311f6bc..067cb233e4 100644 +index d96311f6..067cb233 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -303,4 +303,26 @@ public class PaperWorldConfig { @@ -43,7 +43,7 @@ index d96311f6bc..067cb233e4 100644 } diff --git a/src/main/java/com/destroystokyo/paper/loottable/CraftLootable.java b/src/main/java/com/destroystokyo/paper/loottable/CraftLootable.java new file mode 100644 -index 0000000000..36c36d158f +index 00000000..36c36d15 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/loottable/CraftLootable.java @@ -0,0 +1,12 @@ @@ -61,7 +61,7 @@ index 0000000000..36c36d158f +} diff --git a/src/main/java/com/destroystokyo/paper/loottable/CraftLootableBlockInventory.java b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableBlockInventory.java new file mode 100644 -index 0000000000..20d236c451 +index 00000000..20d236c4 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableBlockInventory.java @@ -0,0 +1,33 @@ @@ -100,7 +100,7 @@ index 0000000000..20d236c451 +} diff --git a/src/main/java/com/destroystokyo/paper/loottable/CraftLootableEntityInventory.java b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableEntityInventory.java new file mode 100644 -index 0000000000..1150dee01e +index 00000000..1150dee0 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableEntityInventory.java @@ -0,0 +1,31 @@ @@ -137,7 +137,7 @@ index 0000000000..1150dee01e +} diff --git a/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventory.java new file mode 100644 -index 0000000000..668097620f +index 00000000..66809762 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventory.java @@ -0,0 +1,88 @@ @@ -231,7 +231,7 @@ index 0000000000..668097620f +} diff --git a/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventoryData.java b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventoryData.java new file mode 100644 -index 0000000000..de2eff17e7 +index 00000000..be4b53b4 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventoryData.java @@ -0,0 +1,182 @@ @@ -287,8 +287,8 @@ index 0000000000..de2eff17e7 + return false; + } + -+ // ALWAYS process the first fill -+ if (this.lastFill == -1) { ++ // ALWAYS process the first fill or if the feature is disabled ++ if (this.lastFill == -1 || !this.lootable.getNMSWorld().paperConfig.autoReplenishLootables) { + return true; + } + @@ -418,7 +418,7 @@ index 0000000000..de2eff17e7 + } +} diff --git a/src/main/java/net/minecraft/server/EntityMinecartContainer.java b/src/main/java/net/minecraft/server/EntityMinecartContainer.java -index d6afa4aa61..50d7d34b80 100644 +index d6afa4aa..50d7d34b 100644 --- a/src/main/java/net/minecraft/server/EntityMinecartContainer.java +++ b/src/main/java/net/minecraft/server/EntityMinecartContainer.java @@ -6,17 +6,21 @@ import javax.annotation.Nullable; @@ -541,7 +541,7 @@ index d6afa4aa61..50d7d34b80 100644 + // Paper end } diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index 5047a57e9b..eae31653de 100644 +index 5047a57e..eae31653 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java @@ -229,6 +229,15 @@ public final class ItemStack { @@ -561,7 +561,7 @@ index 5047a57e9b..eae31653de 100644 for (BlockState blockstate : blocks) { blockstate.update(true, false); diff --git a/src/main/java/net/minecraft/server/TileEntityLootable.java b/src/main/java/net/minecraft/server/TileEntityLootable.java -index a97ad2037b..6185213046 100644 +index a97ad203..61852130 100644 --- a/src/main/java/net/minecraft/server/TileEntityLootable.java +++ b/src/main/java/net/minecraft/server/TileEntityLootable.java @@ -1,44 +1,50 @@ @@ -678,7 +678,7 @@ index a97ad2037b..6185213046 100644 + } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java -index 8328ed0052..266f87d7f1 100644 +index 8328ed00..266f87d7 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java @@ -60,7 +60,7 @@ public class CraftBlockEntityState extends CraftBlockState @@ -691,7 +691,7 @@ index 8328ed0052..266f87d7f1 100644 } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java -index 85f3bb2720..733c04ef75 100644 +index 85f3bb27..733c04ef 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java @@ -1,5 +1,6 @@ @@ -711,7 +711,7 @@ index 85f3bb2720..733c04ef75 100644 public CraftChest(final Block block) { super(block, TileEntityChest.class); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java b/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java -index 1dc8bfecd2..bfcf9b6c4d 100644 +index 1dc8bfec..bfcf9b6c 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java @@ -1,5 +1,6 @@ @@ -731,7 +731,7 @@ index 1dc8bfecd2..bfcf9b6c4d 100644 public CraftDispenser(final Block block) { super(block, TileEntityDispenser.class); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftHopper.java b/src/main/java/org/bukkit/craftbukkit/block/CraftHopper.java -index 6566554ab6..df156d0d92 100644 +index 6566554a..df156d0d 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftHopper.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftHopper.java @@ -1,5 +1,6 @@ @@ -751,7 +751,7 @@ index 6566554ab6..df156d0d92 100644 public CraftHopper(final Block block) { super(block, TileEntityHopper.class); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java b/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java -index c029a12441..c26f0b5afc 100644 +index c029a124..c26f0b5a 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java @@ -1,5 +1,6 @@ @@ -771,7 +771,7 @@ index c029a12441..c26f0b5afc 100644 public CraftShulkerBox(final Block block) { super(block, TileEntityShulkerBox.class); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java -index 69435c4576..4291edf252 100644 +index 69435c45..4291edf2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java @@ -1,5 +1,6 @@ @@ -791,7 +791,7 @@ index 69435c4576..4291edf252 100644 public CraftMinecartChest(CraftServer server, EntityMinecartChest entity) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java -index e9963e21cd..acb4dee04f 100644 +index e9963e21..acb4dee0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java @@ -1,5 +1,6 @@ @@ -811,5 +811,5 @@ index e9963e21cd..acb4dee04f 100644 CraftMinecartHopper(CraftServer server, EntityMinecartHopper entity) { -- -2.19.0 +2.20.1 From 64efe67de36f1cdb276b1b30839c16f5e8ad4f53 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 16 Feb 2019 18:28:12 -0500 Subject: [PATCH 43/90] Update default book configs to match 1.13.2 --- .../0368-Limit-Book-Sizes.patch | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Spigot-Server-Patches/0368-Limit-Book-Sizes.patch b/Spigot-Server-Patches/0368-Limit-Book-Sizes.patch index ae33a8278dce..9245ba9782a8 100644 --- a/Spigot-Server-Patches/0368-Limit-Book-Sizes.patch +++ b/Spigot-Server-Patches/0368-Limit-Book-Sizes.patch @@ -1,28 +1,34 @@ -From 797d58776f9e4c4bc6e59a4d78d540d7fb069402 Mon Sep 17 00:00:00 2001 +From cb5abe5576e8400081e6a1a552178d3f14bf7604 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 17 Nov 2018 00:08:54 -0500 Subject: [PATCH] Limit Book Sizes diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 332e90f86..0ac61f4de 100644 +index 332e90f8..27203eea 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -320,4 +320,12 @@ public class PaperConfig { +@@ -320,4 +320,18 @@ public class PaperConfig { tabSpamIncrement = getInt("settings.spam-limiter.tab-spam-increment", tabSpamIncrement); tabSpamLimit = getInt("settings.spam-limiter.tab-spam-limit", tabSpamLimit); } + + -+ public static int maxBookPageSize = 1024; -+ public static double maxBookTotalSizeMultiplier = 0.90D; ++ public static int maxBookPageSize = 2560; ++ public static double maxBookTotalSizeMultiplier = 0.98D; + private static void maxBookSize() { + maxBookPageSize = getInt("settings.book-size.page-max", maxBookPageSize); + maxBookTotalSizeMultiplier = getDouble("settings.book-size.total-multiplier", maxBookTotalSizeMultiplier); ++ if (maxBookPageSize == 1024 && maxBookTotalSizeMultiplier == 0.90D) { ++ config.set("settings.book-size.page-max", 2560); ++ config.set("settings.book-size.total-multiplier", 0.98D); ++ maxBookPageSize = 2560; ++ maxBookTotalSizeMultiplier = 0.98D; ++ } + } } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index d6d2010d5..de62c3b76 100644 +index d6d2010d..de62c3b7 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -2329,6 +2329,45 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { From 5719e128fa0c3282f8ee28f91bd8248cbcef9bec Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 23 Feb 2019 15:59:20 -0500 Subject: [PATCH 44/90] Updated Upstream (Spigot) This brings in Spigots Oversized Chunks fix so that servers migrating from Spigot 1.12 to Paper 1.12 can safely transition the save formats. Spigot Changes: 79a30d7d Allow Saving Large Chunks --- .../0063-Add-exception-reporting-event.patch | 30 +++++++------- .../0069-Chunk-Save-Reattempt.patch | 10 ++--- ...uce-IO-ops-opening-a-new-region-file.patch | 14 +++---- ...tect-and-repair-corrupt-Region-Files.patch | 41 +++++++++++-------- ...373-Allow-Saving-of-Oversized-Chunks.patch | 35 ++++++++++------ work/Spigot | 2 +- 6 files changed, 75 insertions(+), 57 deletions(-) diff --git a/Spigot-Server-Patches/0063-Add-exception-reporting-event.patch b/Spigot-Server-Patches/0063-Add-exception-reporting-event.patch index 4175c32b2f3e..4d3da8480e6f 100644 --- a/Spigot-Server-Patches/0063-Add-exception-reporting-event.patch +++ b/Spigot-Server-Patches/0063-Add-exception-reporting-event.patch @@ -1,4 +1,4 @@ -From 6ceadeb266a7fc9a4a41c7819ce49ec3e034b39c Mon Sep 17 00:00:00 2001 +From 1f25a64e8de47c04bf521861d9b57662227ac759 Mon Sep 17 00:00:00 2001 From: Joseph Hirschfeld Date: Thu, 3 Mar 2016 03:15:41 -0600 Subject: [PATCH] Add exception reporting event @@ -6,7 +6,7 @@ Subject: [PATCH] Add exception reporting event diff --git a/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java b/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java new file mode 100644 -index 000000000..93397188b +index 00000000..93397188 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java @@ -0,0 +1,38 @@ @@ -50,7 +50,7 @@ index 000000000..93397188b +} \ No newline at end of file diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 08d6ef09a..d5ef4ed0e 100644 +index c79d3a93..65952ea9 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -1,5 +1,6 @@ @@ -89,7 +89,7 @@ index 08d6ef09a..d5ef4ed0e 100644 } } diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 2b320cbd1..4e7e8e5fd 100644 +index 2b320cbd..4e7e8e5f 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -12,6 +12,7 @@ import java.util.Iterator; @@ -144,7 +144,7 @@ index 2b320cbd1..4e7e8e5fd 100644 } diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java -index 83322b85b..b943a9b20 100644 +index 83322b85..b943a9b2 100644 --- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java +++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java @@ -1,5 +1,7 @@ @@ -172,7 +172,7 @@ index 83322b85b..b943a9b20 100644 } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/PersistentCollection.java b/src/main/java/net/minecraft/server/PersistentCollection.java -index 936d6c640..50056f49a 100644 +index 936d6c64..50056f49 100644 --- a/src/main/java/net/minecraft/server/PersistentCollection.java +++ b/src/main/java/net/minecraft/server/PersistentCollection.java @@ -1,5 +1,6 @@ @@ -199,7 +199,7 @@ index 936d6c640..50056f49a 100644 } diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index 1ba26de5c..6a92b5af8 100644 +index c13e1eef..d2f08802 100644 --- a/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java @@ -1,5 +1,6 @@ @@ -209,7 +209,7 @@ index 1ba26de5c..6a92b5af8 100644 import com.google.common.collect.Lists; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; -@@ -82,6 +83,7 @@ public class RegionFile { +@@ -103,6 +104,7 @@ public class RegionFile { } } catch (IOException ioexception) { ioexception.printStackTrace(); @@ -217,7 +217,7 @@ index 1ba26de5c..6a92b5af8 100644 } } -@@ -209,6 +211,7 @@ public class RegionFile { +@@ -247,6 +249,7 @@ public class RegionFile { this.b(i, j, (int) (MinecraftServer.aw() / 1000L)); } catch (IOException ioexception) { ioexception.printStackTrace(); @@ -226,7 +226,7 @@ index 1ba26de5c..6a92b5af8 100644 } diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java -index c15a0d1f8..5f9e9ddef 100644 +index c15a0d1f..5f9e9dde 100644 --- a/src/main/java/net/minecraft/server/RegionFileCache.java +++ b/src/main/java/net/minecraft/server/RegionFileCache.java @@ -1,5 +1,6 @@ @@ -245,7 +245,7 @@ index c15a0d1f8..5f9e9ddef 100644 } diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index 1c7c187c7..68a045323 100644 +index 1c7c187c..68a04532 100644 --- a/src/main/java/net/minecraft/server/SpawnerCreature.java +++ b/src/main/java/net/minecraft/server/SpawnerCreature.java @@ -7,6 +7,7 @@ import java.util.Random; @@ -273,7 +273,7 @@ index 1c7c187c7..68a045323 100644 } diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java -index 9ff4f23ab..6fce3015f 100644 +index 9ff4f23a..6fce3015 100644 --- a/src/main/java/net/minecraft/server/VillageSiege.java +++ b/src/main/java/net/minecraft/server/VillageSiege.java @@ -1,5 +1,7 @@ @@ -293,7 +293,7 @@ index 9ff4f23ab..6fce3015f 100644 } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 89197281e..6be9c1815 100644 +index 89197281..6be9c181 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -1,5 +1,7 @@ @@ -329,7 +329,7 @@ index 89197281e..6be9c1815 100644 this.tileEntityListTick.remove(tileTickPosition--); continue; diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -index 93b9134d6..26753fac5 100644 +index 93b9134d..26753fac 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java @@ -15,6 +15,9 @@ import java.util.concurrent.atomic.AtomicReference; @@ -375,5 +375,5 @@ index 93b9134d6..26753fac5 100644 // (async tasks must live with race-conditions if they attempt to cancel between these few lines of code) } -- -2.18.0 +2.20.1 diff --git a/Spigot-Server-Patches/0069-Chunk-Save-Reattempt.patch b/Spigot-Server-Patches/0069-Chunk-Save-Reattempt.patch index e024da8af327..b6cbc2cd95ee 100644 --- a/Spigot-Server-Patches/0069-Chunk-Save-Reattempt.patch +++ b/Spigot-Server-Patches/0069-Chunk-Save-Reattempt.patch @@ -1,4 +1,4 @@ -From bc3a702f71fbd98ac83d02992c8df88a9207e765 Mon Sep 17 00:00:00 2001 +From 98431cfef4644e54f94e1379dce74e6648c497b9 Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 4 Mar 2013 23:46:10 -0500 Subject: [PATCH] Chunk Save Reattempt @@ -6,7 +6,7 @@ Subject: [PATCH] Chunk Save Reattempt We commonly have "Stream Closed" errors on chunk saving, so this code should re-try to save the chunk in the event of failure and hopefully prevent rollbacks. diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 4c3faa201..12bd558a7 100644 +index 4c3faa20..12bd558a 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -194,11 +194,16 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { @@ -28,10 +28,10 @@ index 4c3faa201..12bd558a7 100644 synchronized (lock) { if (this.b.get(chunkcoordintpair) == chunk.compoundSupplier) { this.b.remove(chunkcoordintpair); } }// Paper - This will not equal if a newer version is still pending diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index 6a92b5af8..5bcbd718f 100644 +index d2f08802..c3424a35 100644 --- a/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java -@@ -210,8 +210,7 @@ public class RegionFile { +@@ -248,8 +248,7 @@ public class RegionFile { this.b(i, j, (int) (MinecraftServer.aw() / 1000L)); } catch (IOException ioexception) { @@ -42,5 +42,5 @@ index 6a92b5af8..5bcbd718f 100644 } -- -2.18.0 +2.20.1 diff --git a/Spigot-Server-Patches/0098-Reduce-IO-ops-opening-a-new-region-file.patch b/Spigot-Server-Patches/0098-Reduce-IO-ops-opening-a-new-region-file.patch index 5245e68f9875..0a24c2e3ccb1 100644 --- a/Spigot-Server-Patches/0098-Reduce-IO-ops-opening-a-new-region-file.patch +++ b/Spigot-Server-Patches/0098-Reduce-IO-ops-opening-a-new-region-file.patch @@ -1,11 +1,11 @@ -From b4237ef0e075d98a14b87bfd673d34b96cb1d966 Mon Sep 17 00:00:00 2001 +From 65277bb5c79ac221f24ca1bded6e71b69f559815 Mon Sep 17 00:00:00 2001 From: Antony Riley Date: Tue, 29 Mar 2016 06:56:23 +0300 Subject: [PATCH] Reduce IO ops opening a new region file. diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index 5bcbd718f..2bd85e2d1 100644 +index c3424a35..eac8b22b 100644 --- a/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java @@ -8,9 +8,12 @@ import java.io.ByteArrayInputStream; @@ -21,7 +21,7 @@ index 5bcbd718f..2bd85e2d1 100644 import java.util.List; import java.util.zip.DeflaterOutputStream; import java.util.zip.GZIPInputStream; -@@ -67,8 +70,16 @@ public class RegionFile { +@@ -72,8 +75,16 @@ public class RegionFile { int k; @@ -37,9 +37,9 @@ index 5bcbd718f..2bd85e2d1 100644 - k = this.c.readInt(); + k = headerAsInts.get(); // Paper this.d[j] = k; - if (k != 0 && (k >> 8) + (k & 255) <= this.f.size()) { - for (int l = 0; l < (k & 255); ++l) { -@@ -78,7 +89,7 @@ public class RegionFile { + // Spigot start + int length = k & 255; +@@ -99,7 +110,7 @@ public class RegionFile { } for (j = 0; j < 1024; ++j) { @@ -49,5 +49,5 @@ index 5bcbd718f..2bd85e2d1 100644 } } catch (IOException ioexception) { -- -2.18.0 +2.20.1 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 index 3be82ad0dbf4..d210377896e3 100644 --- a/Spigot-Server-Patches/0363-Detect-and-repair-corrupt-Region-Files.patch +++ b/Spigot-Server-Patches/0363-Detect-and-repair-corrupt-Region-Files.patch @@ -1,4 +1,4 @@ -From ec510b0b41b7924da4737613c9c10441498eb46f Mon Sep 17 00:00:00 2001 +From 25f06715b685a629d93544f7a05d99c243b6d56e 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 @@ -11,12 +11,12 @@ I don't know why mojang only checks for 4096, when anything less than 8192 is a 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 +index eac8b22b..d58cda9a 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 { - +@@ -28,10 +28,10 @@ public class RegionFile { + private static final boolean ENABLE_EXTENDED_SAVE = Boolean.parseBoolean(System.getProperty("net.minecraft.server.RegionFile.enableExtendedSave", "true")); + // Spigot end private static final byte[] a = new byte[4096]; - private final File b; - private RandomAccessFile c; @@ -29,7 +29,7 @@ index 2bd85e2d..d334d634 100644 private List f; private int g; private long h; -@@ -40,10 +40,11 @@ public class RegionFile { +@@ -45,10 +45,11 @@ public class RegionFile { this.h = file.lastModified(); } @@ -44,17 +44,24 @@ index 2bd85e2d..d334d634 100644 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) { +@@ -96,22 +97,23 @@ public class RegionFile { + this.c.seek(j * 4 + 4); // Go back to where we were + } + } +- if (k != 0 && (k >> 8) + (length) <= this.f.size()) { ++ if (k > 0 && (k >> 8) > 1 && (k >> 8) + (length) <= this.f.size()) { // Paper >= 1 as 0/1 are the headers, and negative isnt valid + for (int l = 0; l < (length); ++l) { + // Spigot end this.f.set((k >> 8) + l, Boolean.valueOf(false)); } -- } -+ } else if (k != 0) deleteChunk(j); // Paper + } + // Spigot start +- else if (length > 0) { ++ else if (k != 0) { // Paper + org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Invalid chunk: ({0}, {1}) Offset: {2} Length: {3} runs off end file. {4}", new Object[]{j % 32, (int) (j / 32), k >> 8, length, file}); ++ deleteChunk(j); // Paper + } + // Spigot end } for (j = 0; j < 1024; ++j) { @@ -64,7 +71,7 @@ index 2bd85e2d..d334d634 100644 } } catch (IOException ioexception) { ioexception.printStackTrace(); -@@ -264,6 +265,55 @@ public class RegionFile { +@@ -302,6 +304,55 @@ public class RegionFile { } @@ -121,5 +128,5 @@ index 2bd85e2d..d334d634 100644 private final int b; -- -2.19.1 +2.20.1 diff --git a/Spigot-Server-Patches/0373-Allow-Saving-of-Oversized-Chunks.patch b/Spigot-Server-Patches/0373-Allow-Saving-of-Oversized-Chunks.patch index 621025acf1f4..01219eb3796a 100644 --- a/Spigot-Server-Patches/0373-Allow-Saving-of-Oversized-Chunks.patch +++ b/Spigot-Server-Patches/0373-Allow-Saving-of-Oversized-Chunks.patch @@ -1,4 +1,4 @@ -From 026320c912a5ce008130be4a5089eceea3a24da2 Mon Sep 17 00:00:00 2001 +From 0c66385b2ab612b92641c37518e15ba12530b3ff Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 15 Feb 2019 01:08:19 -0500 Subject: [PATCH] Allow Saving of Oversized Chunks @@ -51,10 +51,10 @@ index 2162d3ad..8b5aeb1b 100644 a((NBTBase) nbttagcompound, dataoutput); } diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index d334d634..34f72c3d 100644 +index d58cda9a..56783ab5 100644 --- a/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java -@@ -78,6 +78,7 @@ public class RegionFile { +@@ -83,6 +83,7 @@ public class RegionFile { } header.clear(); IntBuffer headerAsInts = header.asIntBuffer(); @@ -62,7 +62,7 @@ index d334d634..34f72c3d 100644 // Paper End for (j = 0; j < 1024; ++j) { k = headerAsInts.get(); // Paper -@@ -101,7 +102,7 @@ public class RegionFile { +@@ -123,7 +124,7 @@ public class RegionFile { } @Nullable @@ -71,7 +71,7 @@ index d334d634..34f72c3d 100644 if (this.d(i, j)) { return null; } else { -@@ -149,8 +150,8 @@ public class RegionFile { +@@ -179,8 +180,8 @@ public class RegionFile { } @Nullable @@ -82,16 +82,18 @@ index d334d634..34f72c3d 100644 } protected synchronized void a(int i, int j, byte[] abyte, int k) { -@@ -161,7 +162,7 @@ public class RegionFile { - int k1 = (k + 5) / 4096 + 1; +@@ -198,8 +199,9 @@ public class RegionFile { if (k1 >= 256) { -- return; -+ throw new ChunkTooLargeException(i, j, k1); // Paper - throw error instead + // Spigot start +- if (!ENABLE_EXTENDED_SAVE) return; ++ if (!USE_SPIGOT_OVERSIZED_METHOD) throw new ChunkTooLargeException(i, j, k1); // Paper - throw error instead + org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.WARNING,"Large Chunk Detected: ({0}, {1}) Size: {2} {3}", new Object[]{i, j, k1, this.b}); ++ if (!ENABLE_EXTENDED_SAVE) return; + // Spigot end } - if (i1 != 0 && j1 == k1) { -@@ -312,6 +313,101 @@ public class RegionFile { +@@ -351,6 +353,110 @@ public class RegionFile { logger.error("Error backing up corrupt file" + file.getAbsolutePath(), e); } } @@ -172,6 +174,15 @@ index d334d634..34f72c3d 100644 + + } + ++ private static final boolean USE_SPIGOT_OVERSIZED_METHOD = Boolean.getBoolean("Paper.useSpigotExtendedSaveMethod"); // Paper ++ static { ++ if (USE_SPIGOT_OVERSIZED_METHOD) { ++ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.SEVERE, "===================================="); ++ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.SEVERE, "Using Spigot Oversized Chunk save method. Warning this will result in extremely fragmented chunks, as well as making the entire region file unable to be to used in any other software but Forge or Spigot (not usable in Vanilla or CraftBukkit). Paper's method is highly recommended."); ++ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.SEVERE, "===================================="); ++ } ++ } ++ + public class ChunkTooLargeException extends RuntimeException { + public ChunkTooLargeException(int x, int z, int sectors) { + super("Chunk " + x + "," + z + " of " + getFile().toString() + " is too large (" + sectors + "/256)"); @@ -193,7 +204,7 @@ index d334d634..34f72c3d 100644 // Paper end class ChunkBuffer extends ByteArrayOutputStream { -@@ -325,8 +421,40 @@ public class RegionFile { +@@ -364,8 +470,40 @@ public class RegionFile { this.c = j; } diff --git a/work/Spigot b/work/Spigot index e8ded36bc9c1..79a30d7d26b9 160000 --- a/work/Spigot +++ b/work/Spigot @@ -1 +1 @@ -Subproject commit e8ded36bc9c1661fc04f83762e3e0e94a273787b +Subproject commit 79a30d7d26b9078dbf6071cbbfa060673bf117b2 From 1627071d5020f70b76e6a25b574c1b3ddc6f3788 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 23 Feb 2019 16:19:49 -0500 Subject: [PATCH 45/90] Improvements to Timings concurrency and lookup performance ConcurrentHashMap synchronizes on .computeIfAbsent even on hits, so this does a .get(key) first, which most of our use should be hits, and then falls back to the CHM computeIfAbsent for thread safe puts. Also improve concurrency on handler and group collections to use a synchronized list instead of an array deque for concurrency safety. --- Spigot-API-Patches/0003-Timings-v2.patch | 223 +++++------ ...kport-Timings-improvements-from-1.13.patch | 359 ------------------ 2 files changed, 114 insertions(+), 468 deletions(-) delete mode 100644 Spigot-API-Patches/0135-Backport-Timings-improvements-from-1.13.patch diff --git a/Spigot-API-Patches/0003-Timings-v2.patch b/Spigot-API-Patches/0003-Timings-v2.patch index f2e1cbcce917..368e91a5d678 100644 --- a/Spigot-API-Patches/0003-Timings-v2.patch +++ b/Spigot-API-Patches/0003-Timings-v2.patch @@ -1,4 +1,4 @@ -From 0644771327501a754ae14c834e50fc97f6417085 Mon Sep 17 00:00:00 2001 +From a501a552251e9189257a6b9dd5ebb679c32bedf2 Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 29 Feb 2016 18:48:17 -0600 Subject: [PATCH] Timings v2 @@ -671,10 +671,10 @@ index 00000000..916b6f9d +} diff --git a/src/main/java/co/aikar/timings/TimingHistory.java b/src/main/java/co/aikar/timings/TimingHistory.java new file mode 100644 -index 00000000..c2c2fb83 +index 00000000..87993256 --- /dev/null +++ b/src/main/java/co/aikar/timings/TimingHistory.java -@@ -0,0 +1,352 @@ +@@ -0,0 +1,347 @@ +/* + * This file is licensed under the MIT License (MIT). + * @@ -768,11 +768,13 @@ index 00000000..c2c2fb83 + } + this.totalTicks = ticks; + this.totalTime = FULL_SERVER_TICK.record.getTotalTime(); -+ this.entries = new TimingHistoryEntry[TimingsManager.HANDLERS.size()]; ++ synchronized (TimingsManager.HANDLERS) { ++ this.entries = new TimingHistoryEntry[TimingsManager.HANDLERS.size()]; + -+ int i = 0; -+ for (TimingHandler handler : TimingsManager.HANDLERS) { -+ entries[i++] = new TimingHistoryEntry(handler); ++ int i = 0; ++ for (TimingHandler handler : TimingsManager.HANDLERS) { ++ entries[i++] = new TimingHistoryEntry(handler); ++ } + } + + @@ -878,11 +880,11 @@ index 00000000..c2c2fb83 + + @SuppressWarnings("unchecked") + final Map entityCounts = MRUMapCache.of(LoadingMap.of( -+ new EnumMap(EntityType.class), Counter.LOADER ++ new EnumMap(EntityType.class), k -> new Counter() + )); + @SuppressWarnings("unchecked") + final Map tileEntityCounts = MRUMapCache.of(LoadingMap.of( -+ new EnumMap(Material.class), Counter.LOADER ++ new EnumMap(Material.class), k -> new Counter() + )); + + static class RegionId { @@ -1012,13 +1014,6 @@ index 00000000..c2c2fb83 + + private static class Counter { + private int count = 0; -+ @SuppressWarnings({"rawtypes", "SuppressionAnnotation", "Guava"}) -+ static Function LOADER = new LoadingMap.Feeder() { -+ @Override -+ public Counter apply() { -+ return new Counter(); -+ } -+ }; + public int increment() { + return ++count; + } @@ -1090,10 +1085,10 @@ index 00000000..0e114eb3 +} diff --git a/src/main/java/co/aikar/timings/TimingIdentifier.java b/src/main/java/co/aikar/timings/TimingIdentifier.java new file mode 100644 -index 00000000..623dda49 +index 00000000..812344bd --- /dev/null +++ b/src/main/java/co/aikar/timings/TimingIdentifier.java -@@ -0,0 +1,102 @@ +@@ -0,0 +1,109 @@ +/* + * This file is licensed under the MIT License (MIT). + * @@ -1119,12 +1114,15 @@ index 00000000..623dda49 + */ +package co.aikar.timings; + -+import com.google.common.base.Function; +import co.aikar.util.LoadingMap; -+import co.aikar.util.MRUMapCache; + -+import java.util.ArrayDeque; ++import java.util.ArrayList; ++import java.util.Collections; ++import java.util.List; +import java.util.Map; ++import java.util.Objects; ++import java.util.concurrent.ConcurrentHashMap; ++import java.util.concurrent.atomic.AtomicInteger; + +/** + *

Used as a basis for fast HashMap key comparisons for the Timing Map.

@@ -1135,15 +1133,8 @@ index 00000000..623dda49 + /** + * Holds all groups. Autoloads on request for a group by name. + */ -+ static final Map GROUP_MAP = MRUMapCache.of( -+ LoadingMap.newIdentityHashMap(new Function() { -+ @Override -+ public TimingGroup apply(String group) { -+ return new TimingGroup(group); -+ } -+ }, 64) -+ ); -+ static final TimingGroup DEFAULT_GROUP = getGroup("Minecraft"); ++ static final Map GROUP_MAP = LoadingMap.of(new ConcurrentHashMap<>(64, .5F), TimingGroup::new); ++ private static final TimingGroup DEFAULT_GROUP = getGroup("Minecraft"); + final String group; + final String name; + final TimingHandler groupHandler; @@ -1151,8 +1142,8 @@ index 00000000..623dda49 + private final int hashCode; + + TimingIdentifier(String group, String name, Timing groupHandler, boolean protect) { -+ this.group = group != null ? group.intern() : DEFAULT_GROUP.name; -+ this.name = name.intern(); ++ this.group = group != null ? group: DEFAULT_GROUP.name; ++ this.name = name; + this.groupHandler = groupHandler != null ? groupHandler.getTimingHandler() : null; + this.protect = protect; + this.hashCode = (31 * this.group.hashCode()) + this.name.hashCode(); @@ -1163,11 +1154,9 @@ index 00000000..623dda49 + return DEFAULT_GROUP; + } + -+ return GROUP_MAP.get(groupName.intern()); ++ return GROUP_MAP.get(groupName); + } + -+ // We are using .intern() on the strings so it is guaranteed to be an identity comparison. -+ @SuppressWarnings("StringEquality") + @Override + public boolean equals(Object o) { + if (o == null) { @@ -1175,7 +1164,7 @@ index 00000000..623dda49 + } + + TimingIdentifier that = (TimingIdentifier) o; -+ return group == that.group && name == that.name; ++ return Objects.equals(group, that.group) && Objects.equals(name, that.name); + } + + @Override @@ -1185,15 +1174,28 @@ index 00000000..623dda49 + + static class TimingGroup { + -+ private static int idPool = 1; -+ final int id = idPool++; ++ private static AtomicInteger idPool = new AtomicInteger(1); ++ final int id = idPool.getAndIncrement(); + + final String name; -+ ArrayDeque handlers = new ArrayDeque(64); ++ final List handlers = Collections.synchronizedList(new ArrayList<>(64)); + + private TimingGroup(String name) { + this.name = name; + } ++ ++ @Override ++ public boolean equals(Object o) { ++ if (this == o) return true; ++ if (o == null || getClass() != o.getClass()) return false; ++ TimingGroup that = (TimingGroup) o; ++ return id == that.id; ++ } ++ ++ @Override ++ public int hashCode() { ++ return id; ++ } + } +} diff --git a/src/main/java/co/aikar/timings/Timings.java b/src/main/java/co/aikar/timings/Timings.java @@ -1613,10 +1615,10 @@ index 00000000..56b10e89 +} diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java new file mode 100644 -index 00000000..df7f4259 +index 00000000..62f5115a --- /dev/null +++ b/src/main/java/co/aikar/timings/TimingsExport.java -@@ -0,0 +1,342 @@ +@@ -0,0 +1,347 @@ +/* + * This file is licensed under the MIT License (MIT). + * @@ -1772,21 +1774,26 @@ index 00000000..df7f4259 + + + Map handlers = createObject(); -+ for (TimingIdentifier.TimingGroup group : TimingIdentifier.GROUP_MAP.values()) { -+ for (TimingHandler id : group.handlers) { -+ if (!id.isTimed() && !id.isSpecial()) { -+ continue; ++ Map groupData; ++ synchronized (TimingIdentifier.GROUP_MAP) { ++ for (TimingIdentifier.TimingGroup group : TimingIdentifier.GROUP_MAP.values()) { ++ synchronized (group.handlers) { ++ for (TimingHandler id : group.handlers) { ++ if (!id.isTimed() && !id.isSpecial()) { ++ continue; ++ } ++ handlers.put(id.id, toArray( ++ group.id, ++ id.name ++ )); ++ } + } -+ handlers.put(id.id, toArray( -+ group.id, -+ id.name -+ )); + } -+ } + ++ groupData = toObjectMapper(TimingIdentifier.GROUP_MAP.values(), group -> pair(group.id, group.name)); ++ } + parent.put("idmap", createObject( -+ pair("groups", toObjectMapper( -+ TimingIdentifier.GROUP_MAP.values(), group -> pair(group.id, group.name))), ++ pair("groups", groupData), + pair("handlers", handlers), + pair("worlds", toObjectMapper(TimingHistory.worldMap.entrySet(), input -> pair(input.getValue(), input.getKey()))), + pair("tileentity", @@ -1961,10 +1968,10 @@ index 00000000..df7f4259 +} diff --git a/src/main/java/co/aikar/timings/TimingsManager.java b/src/main/java/co/aikar/timings/TimingsManager.java new file mode 100644 -index 00000000..58ed35e0 +index 00000000..06b67b96 --- /dev/null +++ b/src/main/java/co/aikar/timings/TimingsManager.java -@@ -0,0 +1,196 @@ +@@ -0,0 +1,191 @@ +/* + * This file is licensed under the MIT License (MIT). + * @@ -1990,45 +1997,36 @@ index 00000000..58ed35e0 + */ +package co.aikar.timings; + -+import com.google.common.base.Function; ++import co.aikar.util.LoadingMap; +import com.google.common.collect.EvictingQueue; +import org.bukkit.Bukkit; +import org.bukkit.Server; +import org.bukkit.command.Command; +import org.bukkit.plugin.Plugin; +import org.bukkit.plugin.java.PluginClassLoader; -+import co.aikar.util.LoadingMap; + -+import java.util.ArrayDeque; +import java.util.ArrayList; -+import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; ++import java.util.concurrent.ConcurrentHashMap; +import java.util.logging.Level; + +public final class TimingsManager { -+ static final Map TIMING_MAP = -+ Collections.synchronizedMap(LoadingMap.newHashMap( -+ new Function() { -+ @Override -+ public TimingHandler apply(TimingIdentifier id) { -+ return (id.protect ? -+ new UnsafeTimingHandler(id) : -+ new TimingHandler(id) -+ ); -+ } -+ }, -+ 256, .5F -+ )); ++ static final Map TIMING_MAP = LoadingMap.of( ++ new ConcurrentHashMap<>(4096, .5F), id -> (id.protect ? ++ new UnsafeTimingHandler(id) : ++ new TimingHandler(id) ++ ) ++ ); + public static final FullServerTickHandler FULL_SERVER_TICK = new FullServerTickHandler(); + public static final TimingHandler TIMINGS_TICK = Timings.ofSafe("Timings Tick", FULL_SERVER_TICK); + public static final Timing PLUGIN_GROUP_HANDLER = Timings.ofSafe("Plugins"); + public static List hiddenConfigs = new ArrayList(); + public static boolean privacy = false; + -+ static final Collection HANDLERS = new ArrayDeque(); -+ static final ArrayDeque MINUTE_REPORTS = new ArrayDeque(); ++ static final List HANDLERS = Collections.synchronizedList(new ArrayList<>(1024)); ++ static final List MINUTE_REPORTS = new ArrayList<>(64); + + static EvictingQueue HISTORY = EvictingQueue.create(12); + static TimingHandler CURRENT; @@ -2054,12 +2052,14 @@ index 00000000..58ed35e0 + if (Timings.timingsEnabled) { + boolean violated = FULL_SERVER_TICK.isViolated(); + -+ for (TimingHandler handler : HANDLERS) { -+ if (handler.isSpecial()) { -+ // We manually call this -+ continue; ++ synchronized (HANDLERS) { ++ for (TimingHandler handler : HANDLERS) { ++ if (handler.isSpecial()) { ++ // We manually call this ++ continue; ++ } ++ handler.processTick(violated); + } -+ handler.processTick(violated); + } + + TimingHistory.playerTicks += Bukkit.getOnlinePlayers().size(); @@ -2096,8 +2096,10 @@ index 00000000..58ed35e0 + } else { + // Soft resets only need to act on timings that have done something + // Handlers can only be modified on main thread. -+ for (TimingHandler timings : HANDLERS) { -+ timings.reset(false); ++ synchronized (HANDLERS) { ++ for (TimingHandler timings : HANDLERS) { ++ timings.reset(false); ++ } + } + } + @@ -2551,10 +2553,10 @@ index 00000000..24eae4be +} diff --git a/src/main/java/co/aikar/util/LoadingMap.java b/src/main/java/co/aikar/util/LoadingMap.java new file mode 100644 -index 00000000..1474384e +index 00000000..dfefda35 --- /dev/null +++ b/src/main/java/co/aikar/util/LoadingMap.java -@@ -0,0 +1,340 @@ +@@ -0,0 +1,343 @@ +/* + * This file is licensed under the MIT License (MIT). + * @@ -2580,20 +2582,14 @@ index 00000000..1474384e + */ +package co.aikar.util; + -+ -+import com.google.common.base.Function; -+import org.bukkit.Material; -+import co.aikar.timings.TimingHistory; -+import org.w3c.dom.css.Counter; -+ +import java.lang.reflect.Constructor; +import java.util.AbstractMap; +import java.util.Collection; -+import java.util.EnumMap; +import java.util.HashMap; +import java.util.IdentityHashMap; +import java.util.Map; +import java.util.Set; ++import java.util.function.Function; + +/** + * Allows you to pass a Loader function that when a key is accessed that doesn't exists, @@ -2610,16 +2606,16 @@ index 00000000..1474384e + * @param Key + * @param Value + */ -+public class LoadingMap extends AbstractMap { ++public class LoadingMap extends AbstractMap { + private final Map backingMap; -+ private final Function loader; ++ private final java.util.function.Function loader; + + /** + * Initializes an auto loading map using specified loader and backing map + * @param backingMap Map to wrap + * @param loader Loader + */ -+ public LoadingMap(Map backingMap, Function loader) { ++ public LoadingMap(Map backingMap, java.util.function.Function loader) { + this.backingMap = backingMap; + this.loader = loader; + } @@ -2634,7 +2630,7 @@ index 00000000..1474384e + * @return Map + */ + public static Map of(Map backingMap, Function loader) { -+ return new LoadingMap(backingMap, loader); ++ return new LoadingMap<>(backingMap, loader); + } + + /** @@ -2654,7 +2650,7 @@ index 00000000..1474384e + */ + public static Map newAutoMap(Map backingMap, final Class keyClass, + final Class valueClass) { -+ return new LoadingMap(backingMap, new AutoInstantiatingLoader(keyClass, valueClass)); ++ return new LoadingMap<>(backingMap, new AutoInstantiatingLoader<>(keyClass, valueClass)); + } + /** + * Creates a LoadingMap with an auto instantiating loader. @@ -2687,7 +2683,7 @@ index 00000000..1474384e + * @return Map that auto instantiates on .get() + */ + public static Map newHashAutoMap(final Class keyClass, final Class valueClass) { -+ return newAutoMap(new HashMap(), keyClass, valueClass); ++ return newAutoMap(new HashMap<>(), keyClass, valueClass); + } + + /** @@ -2718,7 +2714,7 @@ index 00000000..1474384e + * @return Map that auto instantiates on .get() + */ + public static Map newHashAutoMap(final Class keyClass, final Class valueClass, int initialCapacity, float loadFactor) { -+ return newAutoMap(new HashMap(initialCapacity, loadFactor), keyClass, valueClass); ++ return newAutoMap(new HashMap<>(initialCapacity, loadFactor), keyClass, valueClass); + } + + /** @@ -2746,7 +2742,7 @@ index 00000000..1474384e + * @return Map + */ + public static Map newHashMap(Function loader) { -+ return new LoadingMap(new HashMap(), loader); ++ return new LoadingMap<>(new HashMap<>(), loader); + } + + /** @@ -2754,13 +2750,25 @@ index 00000000..1474384e + * + * @param loader Loader to use + * @param initialCapacity Initial capacity to use ++ * @param Key Type of the Map ++ * @param Value Type of the Map ++ * @return Map ++ */ ++ public static Map newHashMap(Function loader, int initialCapacity) { ++ return new LoadingMap<>(new HashMap<>(initialCapacity), loader); ++ } ++ /** ++ * Initializes an auto loading map using a HashMap ++ * ++ * @param loader Loader to use ++ * @param initialCapacity Initial capacity to use + * @param loadFactor Load factor to use + * @param Key Type of the Map + * @param Value Type of the Map + * @return Map + */ + public static Map newHashMap(Function loader, int initialCapacity, float loadFactor) { -+ return new LoadingMap(new HashMap(initialCapacity, loadFactor), loader); ++ return new LoadingMap<>(new HashMap<>(initialCapacity, loadFactor), loader); + } + + /** @@ -2772,7 +2780,7 @@ index 00000000..1474384e + * @return Map + */ + public static Map newIdentityHashMap(Function loader) { -+ return new LoadingMap(new IdentityHashMap(), loader); ++ return new LoadingMap<>(new IdentityHashMap<>(), loader); + } + + /** @@ -2785,7 +2793,7 @@ index 00000000..1474384e + * @return Map + */ + public static Map newIdentityHashMap(Function loader, int initialCapacity) { -+ return new LoadingMap(new IdentityHashMap(initialCapacity), loader); ++ return new LoadingMap<>(new IdentityHashMap<>(initialCapacity), loader); + } + + @Override @@ -2802,14 +2810,11 @@ index 00000000..1474384e + + @Override + public V get(Object key) { -+ V res = backingMap.get(key); -+ if (res == null && key != null) { -+ res = loader.apply((K) key); -+ if (res != null) { -+ backingMap.put((K) key, res); -+ } ++ V v = backingMap.get(key); ++ if (v != null) { ++ return v; + } -+ return res; ++ return backingMap.computeIfAbsent((K) key, loader); + } + + public V put(K key, V value) {return backingMap.put(key, value);} @@ -2840,7 +2845,7 @@ index 00000000..1474384e + } + + public LoadingMap clone() { -+ return new LoadingMap(backingMap, loader); ++ return new LoadingMap<>(backingMap, loader); + } + + private static class AutoInstantiatingLoader implements Function { @@ -3907,5 +3912,5 @@ index 8d982974..7e89b97b 100644 - } } -- -2.18.0 +2.20.1 diff --git a/Spigot-API-Patches/0135-Backport-Timings-improvements-from-1.13.patch b/Spigot-API-Patches/0135-Backport-Timings-improvements-from-1.13.patch deleted file mode 100644 index 574d3fe12e46..000000000000 --- a/Spigot-API-Patches/0135-Backport-Timings-improvements-from-1.13.patch +++ /dev/null @@ -1,359 +0,0 @@ -From 89d13915b1039ffd557247d45a056339d20d149b Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Wed, 17 Oct 2018 21:58:27 -0400 -Subject: [PATCH] Backport Timings improvements from 1.13 - - -diff --git a/src/main/java/co/aikar/timings/TimingHistory.java b/src/main/java/co/aikar/timings/TimingHistory.java -index c2c2fb838..28d0954a3 100644 ---- a/src/main/java/co/aikar/timings/TimingHistory.java -+++ b/src/main/java/co/aikar/timings/TimingHistory.java -@@ -201,11 +201,11 @@ public class TimingHistory { - - @SuppressWarnings("unchecked") - final Map entityCounts = MRUMapCache.of(LoadingMap.of( -- new EnumMap(EntityType.class), Counter.LOADER -+ new EnumMap(EntityType.class), k -> new Counter() - )); - @SuppressWarnings("unchecked") - final Map tileEntityCounts = MRUMapCache.of(LoadingMap.of( -- new EnumMap(Material.class), Counter.LOADER -+ new EnumMap(Material.class), k -> new Counter() - )); - - static class RegionId { -@@ -335,13 +335,6 @@ public class TimingHistory { - - private static class Counter { - private int count = 0; -- @SuppressWarnings({"rawtypes", "SuppressionAnnotation", "Guava"}) -- static Function LOADER = new LoadingMap.Feeder() { -- @Override -- public Counter apply() { -- return new Counter(); -- } -- }; - public int increment() { - return ++count; - } -diff --git a/src/main/java/co/aikar/timings/TimingIdentifier.java b/src/main/java/co/aikar/timings/TimingIdentifier.java -index 623dda49c..636c7119a 100644 ---- a/src/main/java/co/aikar/timings/TimingIdentifier.java -+++ b/src/main/java/co/aikar/timings/TimingIdentifier.java -@@ -23,12 +23,13 @@ - */ - package co.aikar.timings; - --import com.google.common.base.Function; - import co.aikar.util.LoadingMap; --import co.aikar.util.MRUMapCache; - - import java.util.ArrayDeque; - import java.util.Map; -+import java.util.Objects; -+import java.util.concurrent.ConcurrentHashMap; -+import java.util.concurrent.atomic.AtomicInteger; - - /** - *

Used as a basis for fast HashMap key comparisons for the Timing Map.

-@@ -39,15 +40,8 @@ final class TimingIdentifier { - /** - * Holds all groups. Autoloads on request for a group by name. - */ -- static final Map GROUP_MAP = MRUMapCache.of( -- LoadingMap.newIdentityHashMap(new Function() { -- @Override -- public TimingGroup apply(String group) { -- return new TimingGroup(group); -- } -- }, 64) -- ); -- static final TimingGroup DEFAULT_GROUP = getGroup("Minecraft"); -+ static final Map GROUP_MAP = LoadingMap.of(new ConcurrentHashMap<>(64, .5F), TimingGroup::new); -+ private static final TimingGroup DEFAULT_GROUP = getGroup("Minecraft"); - final String group; - final String name; - final TimingHandler groupHandler; -@@ -55,8 +49,8 @@ final class TimingIdentifier { - private final int hashCode; - - TimingIdentifier(String group, String name, Timing groupHandler, boolean protect) { -- this.group = group != null ? group.intern() : DEFAULT_GROUP.name; -- this.name = name.intern(); -+ this.group = group != null ? group: DEFAULT_GROUP.name; -+ this.name = name; - this.groupHandler = groupHandler != null ? groupHandler.getTimingHandler() : null; - this.protect = protect; - this.hashCode = (31 * this.group.hashCode()) + this.name.hashCode(); -@@ -67,11 +61,9 @@ final class TimingIdentifier { - return DEFAULT_GROUP; - } - -- return GROUP_MAP.get(groupName.intern()); -+ return GROUP_MAP.get(groupName); - } - -- // We are using .intern() on the strings so it is guaranteed to be an identity comparison. -- @SuppressWarnings("StringEquality") - @Override - public boolean equals(Object o) { - if (o == null) { -@@ -79,7 +71,7 @@ final class TimingIdentifier { - } - - TimingIdentifier that = (TimingIdentifier) o; -- return group == that.group && name == that.name; -+ return Objects.equals(group, that.group) && Objects.equals(name, that.name); - } - - @Override -@@ -89,8 +81,8 @@ final class TimingIdentifier { - - static class TimingGroup { - -- private static int idPool = 1; -- final int id = idPool++; -+ private static AtomicInteger idPool = new AtomicInteger(1); -+ final int id = idPool.getAndIncrement(); - - final String name; - ArrayDeque handlers = new ArrayDeque(64); -@@ -98,5 +90,18 @@ final class TimingIdentifier { - private TimingGroup(String name) { - this.name = name; - } -+ -+ @Override -+ public boolean equals(Object o) { -+ if (this == o) return true; -+ if (o == null || getClass() != o.getClass()) return false; -+ TimingGroup that = (TimingGroup) o; -+ return id == that.id; -+ } -+ -+ @Override -+ public int hashCode() { -+ return id; -+ } - } - } -diff --git a/src/main/java/co/aikar/timings/TimingsManager.java b/src/main/java/co/aikar/timings/TimingsManager.java -index 58ed35e00..3b4401900 100644 ---- a/src/main/java/co/aikar/timings/TimingsManager.java -+++ b/src/main/java/co/aikar/timings/TimingsManager.java -@@ -23,45 +23,35 @@ - */ - package co.aikar.timings; - --import com.google.common.base.Function; -+import co.aikar.util.LoadingMap; - import com.google.common.collect.EvictingQueue; - import org.bukkit.Bukkit; - import org.bukkit.Server; - import org.bukkit.command.Command; - import org.bukkit.plugin.Plugin; - import org.bukkit.plugin.java.PluginClassLoader; --import co.aikar.util.LoadingMap; - --import java.util.ArrayDeque; - import java.util.ArrayList; --import java.util.Collection; --import java.util.Collections; - import java.util.List; - import java.util.Map; -+import java.util.concurrent.ConcurrentHashMap; - import java.util.logging.Level; - - public final class TimingsManager { -- static final Map TIMING_MAP = -- Collections.synchronizedMap(LoadingMap.newHashMap( -- new Function() { -- @Override -- public TimingHandler apply(TimingIdentifier id) { -- return (id.protect ? -- new UnsafeTimingHandler(id) : -- new TimingHandler(id) -- ); -- } -- }, -- 256, .5F -- )); -+ static final Map TIMING_MAP = LoadingMap.of( -+ new ConcurrentHashMap<>(4096, .5F), id -> (id.protect ? -+ new UnsafeTimingHandler(id) : -+ new TimingHandler(id) -+ ) -+ ); - public static final FullServerTickHandler FULL_SERVER_TICK = new FullServerTickHandler(); - public static final TimingHandler TIMINGS_TICK = Timings.ofSafe("Timings Tick", FULL_SERVER_TICK); - public static final Timing PLUGIN_GROUP_HANDLER = Timings.ofSafe("Plugins"); - public static List hiddenConfigs = new ArrayList(); - public static boolean privacy = false; - -- static final Collection HANDLERS = new ArrayDeque(); -- static final ArrayDeque MINUTE_REPORTS = new ArrayDeque(); -+ static final List HANDLERS = new ArrayList<>(1024); -+ static final List MINUTE_REPORTS = new ArrayList<>(64); - - static EvictingQueue HISTORY = EvictingQueue.create(12); - static TimingHandler CURRENT; -diff --git a/src/main/java/co/aikar/util/LoadingMap.java b/src/main/java/co/aikar/util/LoadingMap.java -index 1474384e8..9a4f9dca8 100644 ---- a/src/main/java/co/aikar/util/LoadingMap.java -+++ b/src/main/java/co/aikar/util/LoadingMap.java -@@ -23,20 +23,14 @@ - */ - package co.aikar.util; - -- --import com.google.common.base.Function; --import org.bukkit.Material; --import co.aikar.timings.TimingHistory; --import org.w3c.dom.css.Counter; -- - import java.lang.reflect.Constructor; - import java.util.AbstractMap; - import java.util.Collection; --import java.util.EnumMap; - import java.util.HashMap; - import java.util.IdentityHashMap; - import java.util.Map; - import java.util.Set; -+import java.util.function.Function; - - /** - * Allows you to pass a Loader function that when a key is accessed that doesn't exists, -@@ -53,16 +47,16 @@ import java.util.Set; - * @param Key - * @param Value - */ --public class LoadingMap extends AbstractMap { -+public class LoadingMap extends AbstractMap { - private final Map backingMap; -- private final Function loader; -+ private final java.util.function.Function loader; - - /** - * Initializes an auto loading map using specified loader and backing map - * @param backingMap Map to wrap - * @param loader Loader - */ -- public LoadingMap(Map backingMap, Function loader) { -+ public LoadingMap(Map backingMap, java.util.function.Function loader) { - this.backingMap = backingMap; - this.loader = loader; - } -@@ -77,7 +71,7 @@ public class LoadingMap extends AbstractMap { - * @return Map - */ - public static Map of(Map backingMap, Function loader) { -- return new LoadingMap(backingMap, loader); -+ return new LoadingMap<>(backingMap, loader); - } - - /** -@@ -97,7 +91,7 @@ public class LoadingMap extends AbstractMap { - */ - public static Map newAutoMap(Map backingMap, final Class keyClass, - final Class valueClass) { -- return new LoadingMap(backingMap, new AutoInstantiatingLoader(keyClass, valueClass)); -+ return new LoadingMap<>(backingMap, new AutoInstantiatingLoader<>(keyClass, valueClass)); - } - /** - * Creates a LoadingMap with an auto instantiating loader. -@@ -130,7 +124,7 @@ public class LoadingMap extends AbstractMap { - * @return Map that auto instantiates on .get() - */ - public static Map newHashAutoMap(final Class keyClass, final Class valueClass) { -- return newAutoMap(new HashMap(), keyClass, valueClass); -+ return newAutoMap(new HashMap<>(), keyClass, valueClass); - } - - /** -@@ -161,7 +155,7 @@ public class LoadingMap extends AbstractMap { - * @return Map that auto instantiates on .get() - */ - public static Map newHashAutoMap(final Class keyClass, final Class valueClass, int initialCapacity, float loadFactor) { -- return newAutoMap(new HashMap(initialCapacity, loadFactor), keyClass, valueClass); -+ return newAutoMap(new HashMap<>(initialCapacity, loadFactor), keyClass, valueClass); - } - - /** -@@ -189,9 +183,21 @@ public class LoadingMap extends AbstractMap { - * @return Map - */ - public static Map newHashMap(Function loader) { -- return new LoadingMap(new HashMap(), loader); -+ return new LoadingMap<>(new HashMap<>(), loader); - } - -+ /** -+ * Initializes an auto loading map using a HashMap -+ * -+ * @param loader Loader to use -+ * @param initialCapacity Initial capacity to use -+ * @param Key Type of the Map -+ * @param Value Type of the Map -+ * @return Map -+ */ -+ public static Map newHashMap(Function loader, int initialCapacity) { -+ return new LoadingMap<>(new HashMap<>(initialCapacity), loader); -+ } - /** - * Initializes an auto loading map using a HashMap - * -@@ -203,7 +209,7 @@ public class LoadingMap extends AbstractMap { - * @return Map - */ - public static Map newHashMap(Function loader, int initialCapacity, float loadFactor) { -- return new LoadingMap(new HashMap(initialCapacity, loadFactor), loader); -+ return new LoadingMap<>(new HashMap<>(initialCapacity, loadFactor), loader); - } - - /** -@@ -215,7 +221,7 @@ public class LoadingMap extends AbstractMap { - * @return Map - */ - public static Map newIdentityHashMap(Function loader) { -- return new LoadingMap(new IdentityHashMap(), loader); -+ return new LoadingMap<>(new IdentityHashMap<>(), loader); - } - - /** -@@ -228,7 +234,7 @@ public class LoadingMap extends AbstractMap { - * @return Map - */ - public static Map newIdentityHashMap(Function loader, int initialCapacity) { -- return new LoadingMap(new IdentityHashMap(initialCapacity), loader); -+ return new LoadingMap<>(new IdentityHashMap<>(initialCapacity), loader); - } - - @Override -@@ -245,14 +251,7 @@ public class LoadingMap extends AbstractMap { - - @Override - public V get(Object key) { -- V res = backingMap.get(key); -- if (res == null && key != null) { -- res = loader.apply((K) key); -- if (res != null) { -- backingMap.put((K) key, res); -- } -- } -- return res; -+ return backingMap.computeIfAbsent((K) key, loader); - } - - public V put(K key, V value) {return backingMap.put(key, value);} -@@ -283,7 +282,7 @@ public class LoadingMap extends AbstractMap { - } - - public LoadingMap clone() { -- return new LoadingMap(backingMap, loader); -+ return new LoadingMap<>(backingMap, loader); - } - - private static class AutoInstantiatingLoader implements Function { --- -2.19.1 - From 087a5e99b81efda8a0ad7c740827f0bba6032f54 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 28 Feb 2019 00:42:40 -0500 Subject: [PATCH 46/90] Strip extra Sign data to/from client - #1876 modified clients can send abnormally large data from the client to the server and it would get stored on the sign as sent. the client can barely render around 16 characters as-is, but formatting codes can get it to be more than 16 actual length. Set a limit of 80 which should give an average of 16 characters 2 sets of legacy formatting codes which should be plenty for all uses. This does not strip any existing data from the NBT as plugins may use this for storing data out of the rendered area. it only impacts data sent to and from the client. Set -DPaper.maxSignLength=XX to change limit or -1 to disable Also fix sign edit memory leak --- ...Strip-extra-Sign-data-to-from-client.patch | 77 +++++++++++++++++++ .../0375-Fix-sign-edit-memory-leak.patch | 47 +++++++++++ 2 files changed, 124 insertions(+) create mode 100644 Spigot-Server-Patches/0374-Strip-extra-Sign-data-to-from-client.patch create mode 100644 Spigot-Server-Patches/0375-Fix-sign-edit-memory-leak.patch diff --git a/Spigot-Server-Patches/0374-Strip-extra-Sign-data-to-from-client.patch b/Spigot-Server-Patches/0374-Strip-extra-Sign-data-to-from-client.patch new file mode 100644 index 000000000000..22ea1f513414 --- /dev/null +++ b/Spigot-Server-Patches/0374-Strip-extra-Sign-data-to-from-client.patch @@ -0,0 +1,77 @@ +From 2b5bbee0eb86a2486367181c384d7040b8c52656 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Wed, 27 Feb 2019 22:18:40 -0500 +Subject: [PATCH] Strip extra Sign data to/from client + +modified clients can send abnormally large data from the client +to the server and it would get stored on the sign as sent. + +the client can barely render around 16 characters as-is, but formatting +codes can get it to be more than 16 actual length. + +Set a limit of 80 which should give an average of 16 characters 2 +sets of legacy formatting codes which should be plenty for all uses. + +This does not strip any existing data from the NBT as plugins +may use this for storing data out of the rendered area. + +it only impacts data sent to and from the client. + +Set -DPaper.maxSignLength=XX to change limit or -1 to disable + +diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +index de62c3b7..cb47e54d 100644 +--- a/src/main/java/net/minecraft/server/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/PlayerConnection.java +@@ -2227,6 +2227,11 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { + String[] lines = new String[4]; + + for (int i = 0; i < astring.length; ++i) { ++ // Paper start - cap line length - modified clients can send longer data than normal ++ if (astring[i].length() > TileEntitySign.MAX_SIGN_LINE_LENGTH && TileEntitySign.MAX_SIGN_LINE_LENGTH > 0) { ++ astring[i] = astring[i].substring(0, TileEntitySign.MAX_SIGN_LINE_LENGTH); ++ } ++ // Paper end + lines[i] = SharedConstants.a(astring[i]); //Paper - Replaced with anvil color stripping method to stop exploits that allow colored signs to be created. + } + SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.server.getPlayer(this.player), lines); +diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java +index 67bd3bcb..786b2984 100644 +--- a/src/main/java/net/minecraft/server/TileEntitySign.java ++++ b/src/main/java/net/minecraft/server/TileEntitySign.java +@@ -9,16 +9,22 @@ public class TileEntitySign extends TileEntity { + public boolean isEditable = true; + private EntityHuman h; + private final CommandObjectiveExecutor i = new CommandObjectiveExecutor(); ++ public static final int MAX_SIGN_LINE_LENGTH = Integer.getInteger("Paper.maxSignLength", 80); // Paper + + public TileEntitySign() {} + ++ // Paper start + public NBTTagCompound save(NBTTagCompound nbttagcompound) { ++ return save(nbttagcompound, false); ++ } ++ public NBTTagCompound save(NBTTagCompound nbttagcompound, boolean filterLines) { ++ // Paper end + super.save(nbttagcompound); + + for (int i = 0; i < 4; ++i) { + String s = IChatBaseComponent.ChatSerializer.a(this.lines[i]); + +- nbttagcompound.setString("Text" + (i + 1), s); ++ nbttagcompound.setString("Text" + (i + 1), filterLines && MAX_SIGN_LINE_LENGTH > 0 && s.length() > MAX_SIGN_LINE_LENGTH ? s.substring(0, MAX_SIGN_LINE_LENGTH): s); // Paper + } + + // CraftBukkit start +@@ -105,7 +111,7 @@ public class TileEntitySign extends TileEntity { + } + + public NBTTagCompound d() { +- return this.save(new NBTTagCompound()); ++ return this.save(new NBTTagCompound(), true); // Paper - filter lines + } + + public boolean isFilteredNBT() { +-- +2.20.1 + diff --git a/Spigot-Server-Patches/0375-Fix-sign-edit-memory-leak.patch b/Spigot-Server-Patches/0375-Fix-sign-edit-memory-leak.patch new file mode 100644 index 000000000000..dc299737ba55 --- /dev/null +++ b/Spigot-Server-Patches/0375-Fix-sign-edit-memory-leak.patch @@ -0,0 +1,47 @@ +From 5a1e1396b62a291dc2f6a2b3ee92cce18b8ebd74 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Thu, 28 Feb 2019 00:15:28 -0500 +Subject: [PATCH] Fix sign edit memory leak + +when a player edits a sign, a reference to their Entity is never cleand up. + +diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +index cb47e54d..68728d43 100644 +--- a/src/main/java/net/minecraft/server/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/PlayerConnection.java +@@ -2211,7 +2211,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { + + TileEntitySign tileentitysign = (TileEntitySign) tileentity; + +- if (!tileentitysign.a() || tileentitysign.e() != this.player) { ++ if (!tileentitysign.a() || tileentitysign.signEditor == null || !tileentitysign.signEditor.equals(this.player.getUniqueID())) { // Paper + this.minecraftServer.warning("Player " + this.player.getName() + " just tried to change non-editable sign"); + this.sendPacket(tileentity.getUpdatePacket()); // CraftBukkit + return; +diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java +index 786b2984..e7d9d811 100644 +--- a/src/main/java/net/minecraft/server/TileEntitySign.java ++++ b/src/main/java/net/minecraft/server/TileEntitySign.java +@@ -10,6 +10,7 @@ public class TileEntitySign extends TileEntity { + private EntityHuman h; + private final CommandObjectiveExecutor i = new CommandObjectiveExecutor(); + public static final int MAX_SIGN_LINE_LENGTH = Integer.getInteger("Paper.maxSignLength", 80); // Paper ++ public java.util.UUID signEditor; // Paper + + public TileEntitySign() {} + +@@ -123,7 +124,10 @@ public class TileEntitySign extends TileEntity { + } + + public void a(EntityHuman entityhuman) { +- this.h = entityhuman; ++ // Paper start ++ //this.h = entityhuman; ++ signEditor = entityhuman != null ? entityhuman.getUniqueID() : null; ++ // Paper end + } + + public EntityHuman e() { +-- +2.20.1 + From 4ba151e59dc719d372eefa2030d3c7ab579f6012 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 28 Feb 2019 02:44:47 -0500 Subject: [PATCH 47/90] Fix incorrect check on vehicle for auto dismount This fixes an issue where players are dismounted from their horse on logout. --- ...2-Fix-an-issue-where-the-vehicle-doesn-t-track-the-pas.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Spigot-Server-Patches/0372-Fix-an-issue-where-the-vehicle-doesn-t-track-the-pas.patch b/Spigot-Server-Patches/0372-Fix-an-issue-where-the-vehicle-doesn-t-track-the-pas.patch index 177f90a28d9f..545437a8ee50 100644 --- a/Spigot-Server-Patches/0372-Fix-an-issue-where-the-vehicle-doesn-t-track-the-pas.patch +++ b/Spigot-Server-Patches/0372-Fix-an-issue-where-the-vehicle-doesn-t-track-the-pas.patch @@ -27,7 +27,7 @@ index 6afb6cf7b..c1a2ddcf5 100644 this.ejectPassengers(); + + // Paper start - "Fixes" an issue where the vehicle doesn't track the passenger disconnection dismount. -+ if (this.isPassenger() && this.getVehicleDirect() instanceof EntityLiving) { ++ if (this.isPassenger() && this.getVehicleDirect() instanceof EntityPlayer) { + this.stopRiding(); + } + // Paper end From 627b6dec02b91c9d9a2b7970fef4fc31b205b250 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Thu, 28 Feb 2019 18:48:57 +0000 Subject: [PATCH 48/90] Apply sign limits to signs text content --- ...Strip-extra-Sign-data-to-from-client.patch | 26 ++++++++++++------- .../0375-Fix-sign-edit-memory-leak.patch | 10 +++---- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/Spigot-Server-Patches/0374-Strip-extra-Sign-data-to-from-client.patch b/Spigot-Server-Patches/0374-Strip-extra-Sign-data-to-from-client.patch index 22ea1f513414..f688eb80e248 100644 --- a/Spigot-Server-Patches/0374-Strip-extra-Sign-data-to-from-client.patch +++ b/Spigot-Server-Patches/0374-Strip-extra-Sign-data-to-from-client.patch @@ -1,4 +1,4 @@ -From 2b5bbee0eb86a2486367181c384d7040b8c52656 Mon Sep 17 00:00:00 2001 +From 7c9f744502fe7d16b4ab37f51a5247b474609f9f Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 27 Feb 2019 22:18:40 -0500 Subject: [PATCH] Strip extra Sign data to/from client @@ -20,7 +20,7 @@ it only impacts data sent to and from the client. Set -DPaper.maxSignLength=XX to change limit or -1 to disable diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index de62c3b7..cb47e54d 100644 +index de62c3b76..cb47e54da 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -2227,6 +2227,11 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { @@ -36,10 +36,10 @@ index de62c3b7..cb47e54d 100644 } SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.server.getPlayer(this.player), lines); diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java -index 67bd3bcb..786b2984 100644 +index 67bd3bcbe..6e3359362 100644 --- a/src/main/java/net/minecraft/server/TileEntitySign.java +++ b/src/main/java/net/minecraft/server/TileEntitySign.java -@@ -9,16 +9,22 @@ public class TileEntitySign extends TileEntity { +@@ -9,15 +9,28 @@ public class TileEntitySign extends TileEntity { public boolean isEditable = true; private EntityHuman h; private final CommandObjectiveExecutor i = new CommandObjectiveExecutor(); @@ -56,14 +56,20 @@ index 67bd3bcb..786b2984 100644 super.save(nbttagcompound); for (int i = 0; i < 4; ++i) { - String s = IChatBaseComponent.ChatSerializer.a(this.lines[i]); +- String s = IChatBaseComponent.ChatSerializer.a(this.lines[i]); ++ // Paper start ++ String line = org.bukkit.craftbukkit.util.CraftChatMessage.fromComponent(lines[i]); ++ ++ if (filterLines && MAX_SIGN_LINE_LENGTH > 0 && line.length() > MAX_SIGN_LINE_LENGTH) { ++ line = line.substring(0, MAX_SIGN_LINE_LENGTH); ++ } -- nbttagcompound.setString("Text" + (i + 1), s); -+ nbttagcompound.setString("Text" + (i + 1), filterLines && MAX_SIGN_LINE_LENGTH > 0 && s.length() > MAX_SIGN_LINE_LENGTH ? s.substring(0, MAX_SIGN_LINE_LENGTH): s); // Paper ++ String s = IChatBaseComponent.ChatSerializer.a(org.bukkit.craftbukkit.util.CraftChatMessage.fromString(line)[0]); ++ // Paper end + nbttagcompound.setString("Text" + (i + 1), s); } - // CraftBukkit start -@@ -105,7 +111,7 @@ public class TileEntitySign extends TileEntity { +@@ -105,7 +118,7 @@ public class TileEntitySign extends TileEntity { } public NBTTagCompound d() { @@ -73,5 +79,5 @@ index 67bd3bcb..786b2984 100644 public boolean isFilteredNBT() { -- -2.20.1 +2.21.0 diff --git a/Spigot-Server-Patches/0375-Fix-sign-edit-memory-leak.patch b/Spigot-Server-Patches/0375-Fix-sign-edit-memory-leak.patch index dc299737ba55..9ed718012cee 100644 --- a/Spigot-Server-Patches/0375-Fix-sign-edit-memory-leak.patch +++ b/Spigot-Server-Patches/0375-Fix-sign-edit-memory-leak.patch @@ -1,4 +1,4 @@ -From 5a1e1396b62a291dc2f6a2b3ee92cce18b8ebd74 Mon Sep 17 00:00:00 2001 +From 48883162c25d782f0ba9e0c9f703f4dcdaa6b269 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 28 Feb 2019 00:15:28 -0500 Subject: [PATCH] Fix sign edit memory leak @@ -6,7 +6,7 @@ Subject: [PATCH] Fix sign edit memory leak when a player edits a sign, a reference to their Entity is never cleand up. diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index cb47e54d..68728d43 100644 +index cb47e54da..68728d436 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -2211,7 +2211,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { @@ -19,7 +19,7 @@ index cb47e54d..68728d43 100644 this.sendPacket(tileentity.getUpdatePacket()); // CraftBukkit return; diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java -index 786b2984..e7d9d811 100644 +index 6e3359362..a320fc8e9 100644 --- a/src/main/java/net/minecraft/server/TileEntitySign.java +++ b/src/main/java/net/minecraft/server/TileEntitySign.java @@ -10,6 +10,7 @@ public class TileEntitySign extends TileEntity { @@ -30,7 +30,7 @@ index 786b2984..e7d9d811 100644 public TileEntitySign() {} -@@ -123,7 +124,10 @@ public class TileEntitySign extends TileEntity { +@@ -130,7 +131,10 @@ public class TileEntitySign extends TileEntity { } public void a(EntityHuman entityhuman) { @@ -43,5 +43,5 @@ index 786b2984..e7d9d811 100644 public EntityHuman e() { -- -2.20.1 +2.21.0 From c66f02b1794c85f39f2e7164adf697f2b4e3aedc Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Thu, 28 Feb 2019 19:10:22 +0000 Subject: [PATCH 49/90] Backport: Fix NPE during server initialization from server list pings --- ...0275-Implement-extended-PaperServerListPingEvent.patch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Spigot-Server-Patches/0275-Implement-extended-PaperServerListPingEvent.patch b/Spigot-Server-Patches/0275-Implement-extended-PaperServerListPingEvent.patch index d30b180f4941..08c92a02ee68 100644 --- a/Spigot-Server-Patches/0275-Implement-extended-PaperServerListPingEvent.patch +++ b/Spigot-Server-Patches/0275-Implement-extended-PaperServerListPingEvent.patch @@ -1,4 +1,4 @@ -From 25ff513d84565b3f16325cd6e338d2837fcad079 Mon Sep 17 00:00:00 2001 +From b46e189801a09043a8b19db57db7ff8a84fa08a5 Mon Sep 17 00:00:00 2001 From: Minecrell Date: Wed, 11 Oct 2017 15:56:26 +0200 Subject: [PATCH] Implement extended PaperServerListPingEvent @@ -60,7 +60,7 @@ index 000000000..a2a409e63 +} diff --git a/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java new file mode 100644 -index 000000000..350410527 +index 000000000..a85466bc7 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java @@ -0,0 +1,112 @@ @@ -90,7 +90,7 @@ index 000000000..350410527 + private GameProfile[] originalSample; + + private StandardPaperServerListPingEventImpl(MinecraftServer server, NetworkManager networkManager, ServerPing ping) { -+ super(server, new PaperStatusClient(networkManager), ping.getServerData().getProtocolVersion(), server.server.getServerIcon()); ++ super(server, new PaperStatusClient(networkManager), ping.getServerData() != null ? ping.getServerData().getProtocolVersion() : -1, server.server.getServerIcon()); + this.originalSample = ping.getPlayers() == null ? null : ping.getPlayers().getSample(); // GH-1473 - pre-tick race condition NPE + } + @@ -264,5 +264,5 @@ index cc1f3ac96..4f9fd4bc6 100644 } -- -2.18.0 +2.21.0 From 3d60b705bac4d4aa727e12e4893b4d0ad72566e5 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Sun, 3 Mar 2019 15:26:25 -0500 Subject: [PATCH 50/90] Backport: Fire PlayerArmorChangeEvent for more cases --- Spigot-Server-Patches/0247-Add-PlayerArmorChangeEvent.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Spigot-Server-Patches/0247-Add-PlayerArmorChangeEvent.patch b/Spigot-Server-Patches/0247-Add-PlayerArmorChangeEvent.patch index 8a04bbb53643..bb1e82f92157 100644 --- a/Spigot-Server-Patches/0247-Add-PlayerArmorChangeEvent.patch +++ b/Spigot-Server-Patches/0247-Add-PlayerArmorChangeEvent.patch @@ -20,7 +20,7 @@ index 44335fd2d..9adcabd4f 100644 if (!ItemStack.matches(itemstack1, itemstack)) { + // Paper start - PlayerArmorChangeEvent -+ if (this instanceof EntityPlayer && enumitemslot.getType() == EnumItemSlot.Function.ARMOR && !itemstack.getItem().equals(itemstack1.getItem())) { ++ if (this instanceof EntityPlayer && enumitemslot.getType() == EnumItemSlot.Function.ARMOR) { + final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack); + final org.bukkit.inventory.ItemStack newItem = CraftItemStack.asBukkitCopy(itemstack1); + new PlayerArmorChangeEvent((Player) this.getBukkitEntity(), PlayerArmorChangeEvent.SlotType.valueOf(enumitemslot.name()), oldItem, newItem).callEvent(); From 013f8d2c7761340a7535e9a135cfdd6e62eb29b8 Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 4 Mar 2019 23:34:48 -0500 Subject: [PATCH 51/90] Remove outbound string length limits on signs, improve codepoint logic now 80 chars counts multi sized code points the same so 80 chinese characters would be allowed too. Removed outbound limit as it doesn't solve the chunk oversize problem. proper fix for chunk sending in another patch next. --- ...374-Add-Stricter-Client-Sign-limits.patch} | 50 ++++--------------- .../0375-Fix-sign-edit-memory-leak.patch | 8 +-- 2 files changed, 15 insertions(+), 43 deletions(-) rename Spigot-Server-Patches/{0374-Strip-extra-Sign-data-to-from-client.patch => 0374-Add-Stricter-Client-Sign-limits.patch} (56%) diff --git a/Spigot-Server-Patches/0374-Strip-extra-Sign-data-to-from-client.patch b/Spigot-Server-Patches/0374-Add-Stricter-Client-Sign-limits.patch similarity index 56% rename from Spigot-Server-Patches/0374-Strip-extra-Sign-data-to-from-client.patch rename to Spigot-Server-Patches/0374-Add-Stricter-Client-Sign-limits.patch index f688eb80e248..fd744ad32f5a 100644 --- a/Spigot-Server-Patches/0374-Strip-extra-Sign-data-to-from-client.patch +++ b/Spigot-Server-Patches/0374-Add-Stricter-Client-Sign-limits.patch @@ -1,7 +1,7 @@ -From 7c9f744502fe7d16b4ab37f51a5247b474609f9f Mon Sep 17 00:00:00 2001 +From 5f53285851beaedf12b297903c55b69e200b08e5 Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 27 Feb 2019 22:18:40 -0500 -Subject: [PATCH] Strip extra Sign data to/from client +Subject: [PATCH] Add Stricter Client Sign limits modified clients can send abnormally large data from the client to the server and it would get stored on the sign as sent. @@ -15,31 +15,34 @@ sets of legacy formatting codes which should be plenty for all uses. This does not strip any existing data from the NBT as plugins may use this for storing data out of the rendered area. -it only impacts data sent to and from the client. +it only impacts data sent to and from client to extend mojangs limit. Set -DPaper.maxSignLength=XX to change limit or -1 to disable diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index de62c3b76..cb47e54da 100644 +index de62c3b76..64520f174 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -2227,6 +2227,11 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -2227,6 +2227,14 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { String[] lines = new String[4]; for (int i = 0; i < astring.length; ++i) { + // Paper start - cap line length - modified clients can send longer data than normal + if (astring[i].length() > TileEntitySign.MAX_SIGN_LINE_LENGTH && TileEntitySign.MAX_SIGN_LINE_LENGTH > 0) { -+ astring[i] = astring[i].substring(0, TileEntitySign.MAX_SIGN_LINE_LENGTH); ++ int offset = astring[i].codePoints().limit(TileEntitySign.MAX_SIGN_LINE_LENGTH).map(Character::charCount).sum(); ++ if (offset > astring.length) { ++ astring[i] = astring[i].substring(0, offset); ++ } + } + // Paper end lines[i] = SharedConstants.a(astring[i]); //Paper - Replaced with anvil color stripping method to stop exploits that allow colored signs to be created. } SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.server.getPlayer(this.player), lines); diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java -index 67bd3bcbe..6e3359362 100644 +index 67bd3bcbe..81f74c56b 100644 --- a/src/main/java/net/minecraft/server/TileEntitySign.java +++ b/src/main/java/net/minecraft/server/TileEntitySign.java -@@ -9,15 +9,28 @@ public class TileEntitySign extends TileEntity { +@@ -9,6 +9,7 @@ public class TileEntitySign extends TileEntity { public boolean isEditable = true; private EntityHuman h; private final CommandObjectiveExecutor i = new CommandObjectiveExecutor(); @@ -47,37 +50,6 @@ index 67bd3bcbe..6e3359362 100644 public TileEntitySign() {} -+ // Paper start - public NBTTagCompound save(NBTTagCompound nbttagcompound) { -+ return save(nbttagcompound, false); -+ } -+ public NBTTagCompound save(NBTTagCompound nbttagcompound, boolean filterLines) { -+ // Paper end - super.save(nbttagcompound); - - for (int i = 0; i < 4; ++i) { -- String s = IChatBaseComponent.ChatSerializer.a(this.lines[i]); -+ // Paper start -+ String line = org.bukkit.craftbukkit.util.CraftChatMessage.fromComponent(lines[i]); -+ -+ if (filterLines && MAX_SIGN_LINE_LENGTH > 0 && line.length() > MAX_SIGN_LINE_LENGTH) { -+ line = line.substring(0, MAX_SIGN_LINE_LENGTH); -+ } - -+ String s = IChatBaseComponent.ChatSerializer.a(org.bukkit.craftbukkit.util.CraftChatMessage.fromString(line)[0]); -+ // Paper end - nbttagcompound.setString("Text" + (i + 1), s); - } - -@@ -105,7 +118,7 @@ public class TileEntitySign extends TileEntity { - } - - public NBTTagCompound d() { -- return this.save(new NBTTagCompound()); -+ return this.save(new NBTTagCompound(), true); // Paper - filter lines - } - - public boolean isFilteredNBT() { -- 2.21.0 diff --git a/Spigot-Server-Patches/0375-Fix-sign-edit-memory-leak.patch b/Spigot-Server-Patches/0375-Fix-sign-edit-memory-leak.patch index 9ed718012cee..3b820f5c6b6c 100644 --- a/Spigot-Server-Patches/0375-Fix-sign-edit-memory-leak.patch +++ b/Spigot-Server-Patches/0375-Fix-sign-edit-memory-leak.patch @@ -1,4 +1,4 @@ -From 48883162c25d782f0ba9e0c9f703f4dcdaa6b269 Mon Sep 17 00:00:00 2001 +From 695d16c229fc12b625aaadb92150e044fa9872f3 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 28 Feb 2019 00:15:28 -0500 Subject: [PATCH] Fix sign edit memory leak @@ -6,7 +6,7 @@ Subject: [PATCH] Fix sign edit memory leak when a player edits a sign, a reference to their Entity is never cleand up. diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index cb47e54da..68728d436 100644 +index 64520f174..e837a553e 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -2211,7 +2211,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { @@ -19,7 +19,7 @@ index cb47e54da..68728d436 100644 this.sendPacket(tileentity.getUpdatePacket()); // CraftBukkit return; diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java -index 6e3359362..a320fc8e9 100644 +index 81f74c56b..4ff2c8480 100644 --- a/src/main/java/net/minecraft/server/TileEntitySign.java +++ b/src/main/java/net/minecraft/server/TileEntitySign.java @@ -10,6 +10,7 @@ public class TileEntitySign extends TileEntity { @@ -30,7 +30,7 @@ index 6e3359362..a320fc8e9 100644 public TileEntitySign() {} -@@ -130,7 +131,10 @@ public class TileEntitySign extends TileEntity { +@@ -118,7 +119,10 @@ public class TileEntitySign extends TileEntity { } public void a(EntityHuman entityhuman) { From d70aa91fd3949279474fcedaf35a3679ef2eb596 Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 4 Mar 2019 23:35:10 -0500 Subject: [PATCH 52/90] don't check convert signs boolean every sign save that lookup isn't "cheap", and synchronizes so cache it to a boolean instead --- ...ConvertSigns-boolean-every-sign-save.patch | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Spigot-Server-Patches/0376-Don-t-check-ConvertSigns-boolean-every-sign-save.patch diff --git a/Spigot-Server-Patches/0376-Don-t-check-ConvertSigns-boolean-every-sign-save.patch b/Spigot-Server-Patches/0376-Don-t-check-ConvertSigns-boolean-every-sign-save.patch new file mode 100644 index 000000000000..7773986c3119 --- /dev/null +++ b/Spigot-Server-Patches/0376-Don-t-check-ConvertSigns-boolean-every-sign-save.patch @@ -0,0 +1,32 @@ +From 1c6d78c9728258f137fab6a15efaf16a01429b73 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sat, 2 Mar 2019 11:11:29 -0500 +Subject: [PATCH] Don't check ConvertSigns boolean every sign save + +property lookups arent super cheap. they synchronize, validate +and check security managers. + +diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java +index 4ff2c8480..95de8b055 100644 +--- a/src/main/java/net/minecraft/server/TileEntitySign.java ++++ b/src/main/java/net/minecraft/server/TileEntitySign.java +@@ -10,6 +10,7 @@ public class TileEntitySign extends TileEntity { + private EntityHuman h; + private final CommandObjectiveExecutor i = new CommandObjectiveExecutor(); + public static final int MAX_SIGN_LINE_LENGTH = Integer.getInteger("Paper.maxSignLength", 80); // Paper ++ private static final boolean CONVERT_LEGACY_SIGNS = Boolean.getBoolean("convertLegacySigns"); + public java.util.UUID signEditor; // Paper + + public TileEntitySign() {} +@@ -24,7 +25,7 @@ public class TileEntitySign extends TileEntity { + } + + // CraftBukkit start +- if (Boolean.getBoolean("convertLegacySigns")) { ++ if (CONVERT_LEGACY_SIGNS) { // Paper + nbttagcompound.setBoolean("Bukkit.isConverted", true); + } + // CraftBukkit end +-- +2.21.0 + From ab99f9da5234b70c7bcf358197016066a8a24875 Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 4 Mar 2019 23:35:33 -0500 Subject: [PATCH 53/90] Handle Excessive Signs in Chunks creating too large of packets Also adds a limit to stop sending Sign data to client after 500 signs per chunk to limit client lag. Use -DPaper.excessiveSignsLimit=500 to configure that limit, or -1 to disable the limit and let your players be abused. fixes #1878 --- ...-Signs-in-Chunks-creating-too-large-.patch | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 Spigot-Server-Patches/0377-Handle-Excessive-Signs-in-Chunks-creating-too-large-.patch diff --git a/Spigot-Server-Patches/0377-Handle-Excessive-Signs-in-Chunks-creating-too-large-.patch b/Spigot-Server-Patches/0377-Handle-Excessive-Signs-in-Chunks-creating-too-large-.patch new file mode 100644 index 000000000000..447ebf373eff --- /dev/null +++ b/Spigot-Server-Patches/0377-Handle-Excessive-Signs-in-Chunks-creating-too-large-.patch @@ -0,0 +1,88 @@ +From c73ffdd999a7b85cabc341b0a721f1ab10a55a11 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sat, 2 Mar 2019 14:55:01 -0500 +Subject: [PATCH] Handle Excessive Signs in Chunks creating too large of + packets + +Also adds a limit to stop sending Sign data to client after 500 +signs per chunk to limit client lag. + +Use -DPaper.excessiveSignsLimit=500 to configure that limit, or -1 +to disable the limit and let your players be abused. + +diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java +index a7fcc14f2..95c7eba96 100644 +--- a/src/main/java/net/minecraft/server/NetworkManager.java ++++ b/src/main/java/net/minecraft/server/NetworkManager.java +@@ -223,6 +223,15 @@ public class NetworkManager extends SimpleChannelInboundHandler> { + }); + } + ++ // Paper start ++ java.util.List extraPackets = packet.getExtraPackets(); ++ if (extraPackets != null && !extraPackets.isEmpty()) { ++ for (Packet extraPacket : extraPackets) { ++ this.dispatchPacket(extraPacket, agenericfuturelistener); ++ } ++ } ++ // Paper end ++ + } + + // Paper start - Async-Anti-Xray - Stop dispatching further packets and return false if the peeked packet is a chunk packet which is not ready +diff --git a/src/main/java/net/minecraft/server/Packet.java b/src/main/java/net/minecraft/server/Packet.java +index b283e1557..668d47089 100644 +--- a/src/main/java/net/minecraft/server/Packet.java ++++ b/src/main/java/net/minecraft/server/Packet.java +@@ -9,6 +9,7 @@ public interface Packet { + void b(PacketDataSerializer packetdataserializer) throws IOException; + + // Paper start ++ default java.util.List getExtraPackets() { return null; } + default boolean packetTooLarge(NetworkManager manager) { + return false; + } +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +index 306a6b7cd..4fe7c9956 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +@@ -28,6 +28,13 @@ public class PacketPlayOutMapChunk implements Packet { + } + // Paper end + ++ // Paper start ++ private final java.util.List extraPackets = new java.util.ArrayList<>(); ++ private static final int SKIP_EXCESSIVE_SIGNS_LIMIT = Integer.getInteger("Paper.excessiveSignsLimit", 500); ++ public java.util.List getExtraPackets() { ++ return extraPackets; ++ } ++ // Paper end + public PacketPlayOutMapChunk(Chunk chunk, int i) { + PacketPlayOutMapChunkInfo packetPlayOutMapChunkInfo = chunk.world.chunkPacketBlockController.getPacketPlayOutMapChunkInfo(this, chunk, i); // Paper - Anti-Xray - Add chunk packet info + this.a = chunk.locX; +@@ -46,6 +53,7 @@ public class PacketPlayOutMapChunk implements Packet { + this.c = this.writeChunk(new PacketDataSerializer(this.g()), chunk, flag, i, packetPlayOutMapChunkInfo); // Paper - Anti-Xray - Add chunk packet info + this.e = Lists.newArrayList(); + Iterator iterator = chunk.getTileEntities().entrySet().iterator(); ++ int totalSigns = 0; // Paper + + while (iterator.hasNext()) { + Entry entry = (Entry) iterator.next(); +@@ -54,6 +62,14 @@ public class PacketPlayOutMapChunk implements Packet { + int j = blockposition.getY() >> 4; + + if (this.e() || (i & 1 << j) != 0) { ++ // Paper start - send signs separately ++ if (tileentity instanceof TileEntitySign) { ++ if (SKIP_EXCESSIVE_SIGNS_LIMIT < 0 || ++totalSigns < SKIP_EXCESSIVE_SIGNS_LIMIT) { ++ extraPackets.add(tileentity.getUpdatePacket()); ++ } ++ continue; ++ } ++ // Paper end + NBTTagCompound nbttagcompound = tileentity.d(); + + this.e.add(nbttagcompound); +-- +2.21.0 + From 0b1a9b2e8fe7387c68fc17ce134eb1949d5b0fb9 Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 4 Mar 2019 23:35:56 -0500 Subject: [PATCH 54/90] MC-145260: Fix Whitelist On/Off inconsistency - Fixes #1880 Mojang stored whitelist state in 2 places (Whitelist Object, PlayerList) some things checked PlayerList, some checked object. This moves everything to the Whitelist object. --- ...0-Fix-Whitelist-On-Off-inconsistency.patch | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 Spigot-Server-Patches/0378-MC-145260-Fix-Whitelist-On-Off-inconsistency.patch diff --git a/Spigot-Server-Patches/0378-MC-145260-Fix-Whitelist-On-Off-inconsistency.patch b/Spigot-Server-Patches/0378-MC-145260-Fix-Whitelist-On-Off-inconsistency.patch new file mode 100644 index 000000000000..77c7763cdd67 --- /dev/null +++ b/Spigot-Server-Patches/0378-MC-145260-Fix-Whitelist-On-Off-inconsistency.patch @@ -0,0 +1,66 @@ +From 6370a90529e458d939522ed6a66f2d04f6b49e9c Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sat, 2 Mar 2019 16:12:35 -0500 +Subject: [PATCH] MC-145260: Fix Whitelist On/Off inconsistency + +mojang stored whitelist state in 2 places (Whitelist Object, PlayerList) + +some things checked PlayerList, some checked object. This moves +everything to the Whitelist object. + +https://github.com/PaperMC/Paper/issues/1880 + +diff --git a/src/main/java/net/minecraft/server/JsonList.java b/src/main/java/net/minecraft/server/JsonList.java +index 93111cc24..2a259758b 100644 +--- a/src/main/java/net/minecraft/server/JsonList.java ++++ b/src/main/java/net/minecraft/server/JsonList.java +@@ -65,6 +65,7 @@ public class JsonList> { + return this.e; + } + ++ public void setEnabled(boolean flag) { a(flag); } // Paper - OBFHeLPER + public void a(boolean flag) { + this.e = flag; + } +diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +index 44ced604a..80e9c9200 100644 +--- a/src/main/java/net/minecraft/server/PlayerList.java ++++ b/src/main/java/net/minecraft/server/PlayerList.java +@@ -64,7 +64,7 @@ public abstract class PlayerList { + // private final Map p; + // CraftBukkit end + public IPlayerFileData playerFileData; +- private boolean hasWhitelist; ++ //private boolean hasWhitelist; // Paper - moved to whitelist object so not duplicated + protected int maxPlayers; + private int s; + private EnumGamemode t; +@@ -1215,9 +1215,9 @@ public abstract class PlayerList { + } + public boolean isWhitelisted(GameProfile gameprofile, org.bukkit.event.player.PlayerLoginEvent loginEvent) { + boolean isOp = this.operators.d(gameprofile); +- boolean isWhitelisted = !this.hasWhitelist || isOp || this.whitelist.d(gameprofile); ++ boolean isWhitelisted = !this.getHasWhitelist() || isOp || this.whitelist.d(gameprofile); + final com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent event; +- event = new com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent(MCUtil.toBukkit(gameprofile), this.hasWhitelist, isWhitelisted, isOp, org.spigotmc.SpigotConfig.whitelistMessage); ++ event = new com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent(MCUtil.toBukkit(gameprofile), this.getHasWhitelist(), isWhitelisted, isOp, org.spigotmc.SpigotConfig.whitelistMessage); + event.callEvent(); + if (!event.isWhitelisted()) { + if (loginEvent != null) { +@@ -1366,11 +1366,11 @@ public abstract class PlayerList { + } + + public boolean getHasWhitelist() { +- return this.hasWhitelist; ++ return this.whitelist.isEnabled(); // Paper + } + + public void setHasWhitelist(boolean flag) { +- this.hasWhitelist = flag; ++ this.whitelist.setEnabled(flag); // Paper + } + + public List b(String s) { +-- +2.21.0 + From 677997fa9eeed6b9f741f8d0c7d68f0a137d72c2 Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 4 Mar 2019 23:44:24 -0500 Subject: [PATCH 55/90] Remove Entity slice debug logs As per 1.13, we have no evidence these illegal states are causing issues we can identify, so just going to hide the fact its happening (but still have the code to auto fix it) --- ...d-detect-illegal-Entity-slice-state.patch} | 32 +++++++------------ .../0347-Entity-add-to-world-fixes.patch | 14 ++++---- ...the-dupe-uuid-and-entity-log-changes.patch | 16 +++++----- 3 files changed, 26 insertions(+), 36 deletions(-) rename Spigot-Server-Patches/{0340-Add-some-Debug-to-Chunk-Entity-slices.patch => 0340-Monitor-and-detect-illegal-Entity-slice-state.patch} (66%) diff --git a/Spigot-Server-Patches/0340-Add-some-Debug-to-Chunk-Entity-slices.patch b/Spigot-Server-Patches/0340-Monitor-and-detect-illegal-Entity-slice-state.patch similarity index 66% rename from Spigot-Server-Patches/0340-Add-some-Debug-to-Chunk-Entity-slices.patch rename to Spigot-Server-Patches/0340-Monitor-and-detect-illegal-Entity-slice-state.patch index 271f4fb86be4..3330f5f86dae 100644 --- a/Spigot-Server-Patches/0340-Add-some-Debug-to-Chunk-Entity-slices.patch +++ b/Spigot-Server-Patches/0340-Monitor-and-detect-illegal-Entity-slice-state.patch @@ -1,18 +1,18 @@ -From cb60a9794593e7752a415d3f558e8b789054c2eb Mon Sep 17 00:00:00 2001 +From 3e0934988343ec1ba1f5950d8302636c306ebc0d Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 23 Jul 2018 22:44:23 -0400 -Subject: [PATCH] Add some Debug to Chunk Entity slices +Subject: [PATCH] Monitor and detect illegal Entity slice state -If we detect unexpected state, log and try to recover +If we detect unexpected state, try to recover This should hopefully avoid duplicate entities ever being created if the entity was to end up in 2 different chunk slices diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index ce66bb780d..2a5d1c90b4 100644 +index e5c900a85..e4d5e65c8 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -681,8 +681,34 @@ public class Chunk { +@@ -681,8 +681,27 @@ public class Chunk { entity.ab = this.locX; entity.ac = k; entity.ad = this.locZ; @@ -22,24 +22,17 @@ index ce66bb780d..2a5d1c90b4 100644 + List entitySlice = this.entitySlices[k]; + boolean inThis = entitySlice.contains(entity); + List currentSlice = entity.entitySlice; -+ if ((currentSlice != null && currentSlice.contains(entity)) || inThis) { ++ if (inThis || (currentSlice != null && currentSlice.contains(entity))) { + if (currentSlice == entitySlice || inThis) { -+ LogManager.getLogger().warn(entity + " was already in this chunk section! Report this to https://github.com/PaperMC/Paper/issues/1302"); -+ new Throwable().printStackTrace(); + return; + } else { -+ LogManager.getLogger().warn(entity + " is still in another ChunkSection! Report this to https://github.com/PaperMC/Paper/issues/1302"); -+ + Chunk chunk = entity.getCurrentChunk(); + if (chunk != null) { -+ if (chunk != this) { -+ LogManager.getLogger().warn(entity + " was in another chunk at that! " + chunk.locX + "," + chunk.locZ); -+ } + chunk.removeEntity(entity); + } else { + removeEntity(entity); + } -+ new Throwable().printStackTrace(); ++ currentSlice.remove(entity); // Just incase the above did not remove from this target slice + } + } + entity.entitySlice = entitySlice; @@ -48,20 +41,17 @@ index ce66bb780d..2a5d1c90b4 100644 this.markDirty(); entity.setCurrentChunk(this); entityCounts.increment(entity.getMinecraftKeyString()); -@@ -725,6 +751,12 @@ public class Chunk { +@@ -725,6 +744,9 @@ public class Chunk { } // Paper start + if (entity.entitySlice == null || !entity.entitySlice.contains(entity) || entitySlices[i] == entity.entitySlice) { + entity.entitySlice = null; -+ } else { -+ LogManager.getLogger().warn(entity + " was removed from a entitySlice we did not expect. Report this to https://github.com/PaperMC/Paper/issues/1302"); -+ new Throwable().printStackTrace(); + } if (!this.entitySlices[i].remove(entity)) { return; } this.markDirty(); entity.setCurrentChunk(null); -@@ -955,6 +987,7 @@ public class Chunk { +@@ -955,6 +977,7 @@ public class Chunk { } // Spigot End entity.setCurrentChunk(null); // Paper @@ -70,7 +60,7 @@ index ce66bb780d..2a5d1c90b4 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 eb8904a728..86b0b84335 100644 +index b761524f0..a2654690f 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -59,6 +59,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper @@ -82,5 +72,5 @@ index eb8904a728..86b0b84335 100644 static boolean isLevelAtLeast(NBTTagCompound tag, int level) { return tag.hasKey("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level; -- -2.18.0 +2.21.0 diff --git a/Spigot-Server-Patches/0347-Entity-add-to-world-fixes.patch b/Spigot-Server-Patches/0347-Entity-add-to-world-fixes.patch index 506a7aae7534..e0cdf5392129 100644 --- a/Spigot-Server-Patches/0347-Entity-add-to-world-fixes.patch +++ b/Spigot-Server-Patches/0347-Entity-add-to-world-fixes.patch @@ -1,4 +1,4 @@ -From 28915916c310632997ed1146e1f86bc7d89ac53e Mon Sep 17 00:00:00 2001 +From 006c7fd9553064cea0bc6a4d4dc0afb7535e6de5 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 @@ -14,10 +14,10 @@ Fix this by differing entity add to world for all entities at the same time 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 +index e4d5e65c8..0a3f00c3b 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 { +@@ -879,6 +879,7 @@ public class Chunk { this.world.b(this.tileEntities.values()); List[] aentityslice = this.entitySlices; // Spigot int i = aentityslice.length; @@ -25,7 +25,7 @@ index dfa4a4bf..523d10e8 100644 for (int j = 0; j < i; ++j) { List entityslice = aentityslice[j]; // Spigot -@@ -936,10 +937,12 @@ public class Chunk { +@@ -926,10 +927,12 @@ public class Chunk { thisChunk.put(entity.uniqueID, entity); } } @@ -41,7 +41,7 @@ index dfa4a4bf..523d10e8 100644 } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 4a16f7ac..04d0fa1d 100644 +index 4a16f7ac7..04d0fa1df 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 { @@ -70,7 +70,7 @@ index 4a16f7ac..04d0fa1d 100644 } 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 +index 1244baf45..a14b5e061 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 { @@ -83,5 +83,5 @@ index 1244baf4..a14b5e06 100644 } else { if (!(entity instanceof EntityHuman)) { -- -2.19.1 +2.21.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 index 25e983ade1d8..cb49ba6f4d36 100644 --- 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 @@ -1,11 +1,11 @@ -From 82ae87163d6936053ea6476cf58a3115948a1892 Mon Sep 17 00:00:00 2001 +From eb1f52537e3d7166a3d72850715cd6ec8d6c8160 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 +index ed1475351..ba299afc4 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 { @@ -34,10 +34,10 @@ index ed147535..ba299afc 100644 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 +index 4f88db79a..4060fd274 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 { +@@ -878,7 +878,7 @@ public class Chunk { List entityslice = aentityslice[j]; // Spigot // Paper start DuplicateUUIDMode mode = world.paperConfig.duplicateUUIDMode; @@ -46,7 +46,7 @@ index 6541f5af..00c46fe5 100644 Map thisChunk = new HashMap<>(); for (Iterator iterator = ((List) entityslice).iterator(); iterator.hasNext(); ) { Entity entity = iterator.next(); -@@ -903,27 +903,26 @@ public class Chunk { +@@ -893,27 +893,26 @@ public class Chunk { && java.util.Objects.equals(other.getSaveID(), entity.getSaveID()) && entity.getBukkitEntity().getLocation().distance(other.getBukkitEntity().getLocation()) < world.paperConfig.duplicateUUIDDeleteRange ) { @@ -80,7 +80,7 @@ index 6541f5af..00c46fe5 100644 } } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index bcbdadbd..7633a613 100644 +index bcbdadbd3..7633a6134 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 { @@ -92,7 +92,7 @@ index bcbdadbd..7633a613 100644 { @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 +index b19942e0f..d29420dd4 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 { @@ -140,5 +140,5 @@ index b19942e0..d29420dd 100644 old.addedToWorldStack.printStackTrace(); } else { -- -2.19.1 +2.21.0 From 14eac29ac6bc2d8ea9bdc58b39b35e116c273e24 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 24 Mar 2019 17:34:36 -0400 Subject: [PATCH 56/90] Backport Timings Improvements --- Spigot-API-Patches/0003-Timings-v2.patch | 178 +++++++++++------------ 1 file changed, 81 insertions(+), 97 deletions(-) diff --git a/Spigot-API-Patches/0003-Timings-v2.patch b/Spigot-API-Patches/0003-Timings-v2.patch index 368e91a5d678..db88b51151c5 100644 --- a/Spigot-API-Patches/0003-Timings-v2.patch +++ b/Spigot-API-Patches/0003-Timings-v2.patch @@ -1,4 +1,4 @@ -From a501a552251e9189257a6b9dd5ebb679c32bedf2 Mon Sep 17 00:00:00 2001 +From aaba994557e85de97413e978b93bdd9b1c63d969 Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 29 Feb 2016 18:48:17 -0600 Subject: [PATCH] Timings v2 @@ -6,16 +6,16 @@ Subject: [PATCH] Timings v2 diff --git a/src/main/java/co/aikar/timings/FullServerTickHandler.java b/src/main/java/co/aikar/timings/FullServerTickHandler.java new file mode 100644 -index 00000000..4d8b633e +index 00000000..597d39a3 --- /dev/null +++ b/src/main/java/co/aikar/timings/FullServerTickHandler.java -@@ -0,0 +1,82 @@ +@@ -0,0 +1,81 @@ +package co.aikar.timings; + +import static co.aikar.timings.TimingsManager.*; + +public class FullServerTickHandler extends TimingHandler { -+ private static final TimingIdentifier IDENTITY = new TimingIdentifier("Minecraft", "Full Server Tick", null, false); ++ private static final TimingIdentifier IDENTITY = new TimingIdentifier("Minecraft", "Full Server Tick", null); + final TimingData minuteData; + double avgFreeMemory = -1D; + double avgUsedMemory = -1D; @@ -62,8 +62,7 @@ index 00000000..4d8b633e + long start = System.nanoTime(); + TimingsManager.tick(); + long diff = System.nanoTime() - start; -+ CURRENT = TIMINGS_TICK; -+ TIMINGS_TICK.addDiff(diff); ++ TIMINGS_TICK.addDiff(diff, null); + // addDiff for TIMINGS_TICK incremented this, bring it back down to 1 per tick. + record.setCurTickCount(record.getCurTickCount()-1); + @@ -248,10 +247,10 @@ index 00000000..feddcdbd +} diff --git a/src/main/java/co/aikar/timings/Timing.java b/src/main/java/co/aikar/timings/Timing.java new file mode 100644 -index 00000000..b2260104 +index 00000000..be860865 --- /dev/null +++ b/src/main/java/co/aikar/timings/Timing.java -@@ -0,0 +1,76 @@ +@@ -0,0 +1,77 @@ +/* + * This file is licensed under the MIT License (MIT). + * @@ -314,8 +313,9 @@ index 00000000..b2260104 + void stopTimingIfSync(); + + /** -+ * Stops timing and disregards current timing data. ++ * @deprecated Doesn't do anything - Removed + */ ++ @Deprecated + void abort(); + + /** @@ -456,10 +456,10 @@ index 00000000..f222d6b7 +} diff --git a/src/main/java/co/aikar/timings/TimingHandler.java b/src/main/java/co/aikar/timings/TimingHandler.java new file mode 100644 -index 00000000..916b6f9d +index 00000000..d9375833 --- /dev/null +++ b/src/main/java/co/aikar/timings/TimingHandler.java -@@ -0,0 +1,209 @@ +@@ -0,0 +1,196 @@ +/* + * This file is licensed under the MIT License (MIT). + * @@ -487,16 +487,22 @@ index 00000000..916b6f9d + +import co.aikar.util.LoadingIntMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -+import org.bukkit.Bukkit; + ++import java.util.ArrayDeque; ++import java.util.Deque; ++import java.util.concurrent.atomic.AtomicInteger; +import java.util.logging.Level; ++import java.util.logging.Logger; ++ ++import org.bukkit.Bukkit; + +class TimingHandler implements Timing { + -+ private static int idPool = 1; -+ final int id = idPool++; ++ private static AtomicInteger idPool = new AtomicInteger(1); ++ static Deque TIMING_STACK = new ArrayDeque<>(); ++ final int id = idPool.getAndIncrement(); + -+ final String name; ++ final TimingIdentifier identifier; + private final boolean verbose; + + private final Int2ObjectOpenHashMap children = new LoadingIntMap<>(TimingData::new); @@ -509,17 +515,10 @@ index 00000000..916b6f9d + private boolean added; + private boolean timed; + private boolean enabled; -+ private TimingHandler parent; + + TimingHandler(TimingIdentifier id) { -+ if (id.name.startsWith("##")) { -+ verbose = true; -+ this.name = id.name.substring(3); -+ } else { -+ this.name = id.name; -+ verbose = false; -+ } -+ ++ this.identifier = id; ++ this.verbose = id.name.startsWith("##"); + this.record = new TimingData(this.id); + this.groupHandler = id.groupHandler; + @@ -546,55 +545,46 @@ index 00000000..916b6f9d + + @Override + public Timing startTimingIfSync() { -+ if (Bukkit.isPrimaryThread()) { -+ startTiming(); -+ } ++ startTiming(); + return this; + } + + @Override + public void stopTimingIfSync() { -+ if (Bukkit.isPrimaryThread()) { -+ stopTiming(); -+ } ++ stopTiming(); + } + + public Timing startTiming() { -+ if (enabled && ++timingDepth == 1) { ++ if (enabled && Bukkit.isPrimaryThread() && ++timingDepth == 1) { + start = System.nanoTime(); -+ parent = TimingsManager.CURRENT; -+ TimingsManager.CURRENT = this; ++ TIMING_STACK.addLast(this); + } + return this; + } + + public void stopTiming() { -+ if (enabled && --timingDepth == 0 && start != 0) { -+ if (!Bukkit.isPrimaryThread()) { -+ Bukkit.getLogger().log(Level.SEVERE, "stopTiming called async for " + name); -+ new Throwable().printStackTrace(); -+ start = 0; -+ return; ++ if (enabled && timingDepth > 0 && Bukkit.isPrimaryThread() && --timingDepth == 0 && start != 0) { ++ TimingHandler last = TIMING_STACK.removeLast(); ++ if (last != this) { ++ Logger.getGlobal().log(Level.SEVERE, "TIMING_STACK_CORRUPTION - Report this to Paper! ( " + this.identifier + ":" + last +")", new Throwable()); ++ TIMING_STACK.addLast(last); // Add it back + } -+ addDiff(System.nanoTime() - start); ++ addDiff(System.nanoTime() - start, TIMING_STACK.peekLast()); ++ + start = 0; + } + } + + @Override -+ public void abort() { -+ if (enabled && timingDepth > 0) { -+ start = 0; -+ } ++ public final void abort() { ++ + } + -+ void addDiff(long diff) { -+ if (TimingsManager.CURRENT == this) { -+ TimingsManager.CURRENT = parent; -+ if (parent != null) { -+ parent.children.get(id).add(diff); -+ } ++ void addDiff(long diff, TimingHandler parent) { ++ if (parent != null) { ++ parent.children.get(id).add(diff); + } ++ + record.add(diff); + if (!added) { + added = true; @@ -602,15 +592,13 @@ index 00000000..916b6f9d + TimingsManager.HANDLERS.add(this); + } + if (groupHandler != null) { -+ groupHandler.addDiff(diff); ++ groupHandler.addDiff(diff, parent); + groupHandler.children.get(id).add(diff); + } + } + + /** + * Reset this timer, setting all values to zero. -+ * -+ * @param full + */ + void reset(boolean full) { + record.reset(); @@ -640,8 +628,7 @@ index 00000000..916b6f9d + } + + /** -+ * This is simply for the Closeable interface so it can be used with -+ * try-with-resources () ++ * This is simply for the Closeable interface so it can be used with try-with-resources () + */ + @Override + public void close() { @@ -671,10 +658,10 @@ index 00000000..916b6f9d +} diff --git a/src/main/java/co/aikar/timings/TimingHistory.java b/src/main/java/co/aikar/timings/TimingHistory.java new file mode 100644 -index 00000000..87993256 +index 00000000..d84c36d2 --- /dev/null +++ b/src/main/java/co/aikar/timings/TimingHistory.java -@@ -0,0 +1,347 @@ +@@ -0,0 +1,344 @@ +/* + * This file is licensed under the MIT License (MIT). + * @@ -768,16 +755,13 @@ index 00000000..87993256 + } + this.totalTicks = ticks; + this.totalTime = FULL_SERVER_TICK.record.getTotalTime(); -+ synchronized (TimingsManager.HANDLERS) { -+ this.entries = new TimingHistoryEntry[TimingsManager.HANDLERS.size()]; ++ this.entries = new TimingHistoryEntry[TimingsManager.HANDLERS.size()]; + -+ int i = 0; -+ for (TimingHandler handler : TimingsManager.HANDLERS) { -+ entries[i++] = new TimingHistoryEntry(handler); -+ } ++ int i = 0; ++ for (TimingHandler handler : TimingsManager.HANDLERS) { ++ entries[i++] = new TimingHistoryEntry(handler); + } + -+ + // Information about all loaded chunks/entities + //noinspection unchecked + this.worlds = toObjectMapper(Bukkit.getWorlds(), new Function() { @@ -1085,10 +1069,10 @@ index 00000000..0e114eb3 +} diff --git a/src/main/java/co/aikar/timings/TimingIdentifier.java b/src/main/java/co/aikar/timings/TimingIdentifier.java new file mode 100644 -index 00000000..812344bd +index 00000000..86bf5505 --- /dev/null +++ b/src/main/java/co/aikar/timings/TimingIdentifier.java -@@ -0,0 +1,109 @@ +@@ -0,0 +1,112 @@ +/* + * This file is licensed under the MIT License (MIT). + * @@ -1138,14 +1122,12 @@ index 00000000..812344bd + final String group; + final String name; + final TimingHandler groupHandler; -+ final boolean protect; + private final int hashCode; + -+ TimingIdentifier(String group, String name, Timing groupHandler, boolean protect) { ++ TimingIdentifier(String group, String name, Timing groupHandler) { + this.group = group != null ? group: DEFAULT_GROUP.name; + this.name = name; + this.groupHandler = groupHandler != null ? groupHandler.getTimingHandler() : null; -+ this.protect = protect; + this.hashCode = (31 * this.group.hashCode()) + this.name.hashCode(); + } + @@ -1172,6 +1154,11 @@ index 00000000..812344bd + return hashCode; + } + ++ @Override ++ public String toString() { ++ return "TimingIdentifier{id=" + group + ":" + name +'}'; ++ } ++ + static class TimingGroup { + + private static AtomicInteger idPool = new AtomicInteger(1); @@ -1200,7 +1187,7 @@ index 00000000..812344bd +} diff --git a/src/main/java/co/aikar/timings/Timings.java b/src/main/java/co/aikar/timings/Timings.java new file mode 100644 -index 00000000..32e4bb1e +index 00000000..04ac8643 --- /dev/null +++ b/src/main/java/co/aikar/timings/Timings.java @@ -0,0 +1,284 @@ @@ -1280,7 +1267,7 @@ index 00000000..32e4bb1e + */ + public static Timing of(Plugin plugin, String name, Timing groupHandler) { + Preconditions.checkNotNull(plugin, "Plugin can not be null"); -+ return TimingsManager.getHandler(plugin.getName(), name, groupHandler, true); ++ return TimingsManager.getHandler(plugin.getName(), name, groupHandler); + } + + /** @@ -1485,7 +1472,7 @@ index 00000000..32e4bb1e + } + + static TimingHandler ofSafe(String groupName, String name, Timing groupHandler) { -+ return TimingsManager.getHandler(groupName, name, groupHandler, false); ++ return TimingsManager.getHandler(groupName, name, groupHandler); + } +} diff --git a/src/main/java/co/aikar/timings/TimingsCommand.java b/src/main/java/co/aikar/timings/TimingsCommand.java @@ -1615,10 +1602,10 @@ index 00000000..56b10e89 +} diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java new file mode 100644 -index 00000000..62f5115a +index 00000000..40546c05 --- /dev/null +++ b/src/main/java/co/aikar/timings/TimingsExport.java -@@ -0,0 +1,347 @@ +@@ -0,0 +1,352 @@ +/* + * This file is licensed under the MIT License (MIT). + * @@ -1782,9 +1769,14 @@ index 00000000..62f5115a + if (!id.isTimed() && !id.isSpecial()) { + continue; + } ++ ++ String name = id.identifier.name; ++ if (name.startsWith("##")) { ++ name = name.substring(3); ++ } + handlers.put(id.id, toArray( + group.id, -+ id.name ++ name + )); + } + } @@ -1968,10 +1960,10 @@ index 00000000..62f5115a +} diff --git a/src/main/java/co/aikar/timings/TimingsManager.java b/src/main/java/co/aikar/timings/TimingsManager.java new file mode 100644 -index 00000000..06b67b96 +index 00000000..9319ed94 --- /dev/null +++ b/src/main/java/co/aikar/timings/TimingsManager.java -@@ -0,0 +1,191 @@ +@@ -0,0 +1,183 @@ +/* + * This file is licensed under the MIT License (MIT). + * @@ -2014,10 +2006,7 @@ index 00000000..06b67b96 + +public final class TimingsManager { + static final Map TIMING_MAP = LoadingMap.of( -+ new ConcurrentHashMap<>(4096, .5F), id -> (id.protect ? -+ new UnsafeTimingHandler(id) : -+ new TimingHandler(id) -+ ) ++ new ConcurrentHashMap<>(4096, .5F), TimingHandler::new + ); + public static final FullServerTickHandler FULL_SERVER_TICK = new FullServerTickHandler(); + public static final TimingHandler TIMINGS_TICK = Timings.ofSafe("Timings Tick", FULL_SERVER_TICK); @@ -2025,11 +2014,10 @@ index 00000000..06b67b96 + public static List hiddenConfigs = new ArrayList(); + public static boolean privacy = false; + -+ static final List HANDLERS = Collections.synchronizedList(new ArrayList<>(1024)); ++ static final List HANDLERS = new ArrayList<>(1024); + static final List MINUTE_REPORTS = new ArrayList<>(64); + + static EvictingQueue HISTORY = EvictingQueue.create(12); -+ static TimingHandler CURRENT; + static long timingStart = 0; + static long historyStart = 0; + static boolean needsFullReset = false; @@ -2052,14 +2040,12 @@ index 00000000..06b67b96 + if (Timings.timingsEnabled) { + boolean violated = FULL_SERVER_TICK.isViolated(); + -+ synchronized (HANDLERS) { -+ for (TimingHandler handler : HANDLERS) { -+ if (handler.isSpecial()) { -+ // We manually call this -+ continue; -+ } -+ handler.processTick(violated); ++ for (TimingHandler handler : HANDLERS) { ++ if (handler.isSpecial()) { ++ // We manually call this ++ continue; + } ++ handler.processTick(violated); + } + + TimingHistory.playerTicks += Bukkit.getOnlinePlayers().size(); @@ -2096,10 +2082,8 @@ index 00000000..06b67b96 + } else { + // Soft resets only need to act on timings that have done something + // Handlers can only be modified on main thread. -+ synchronized (HANDLERS) { -+ for (TimingHandler timings : HANDLERS) { -+ timings.reset(false); -+ } ++ for (TimingHandler timings : HANDLERS) { ++ timings.reset(false); + } + } + @@ -2110,8 +2094,8 @@ index 00000000..06b67b96 + historyStart = System.currentTimeMillis(); + } + -+ static TimingHandler getHandler(String group, String name, Timing parent, boolean protect) { -+ return TIMING_MAP.get(new TimingIdentifier(group, name, parent, protect)); ++ static TimingHandler getHandler(String group, String name, Timing parent) { ++ return TIMING_MAP.get(new TimingIdentifier(group, name, parent)); + } + + @@ -3912,5 +3896,5 @@ index 8d982974..7e89b97b 100644 - } } -- -2.20.1 +2.21.0 From f81358ab8c51ac29873b63c7a2ea78098464283d Mon Sep 17 00:00:00 2001 From: AgentTroll Date: Sun, 24 Mar 2019 17:45:55 -0400 Subject: [PATCH 57/90] Update entity Metadata for all tracked players --- ...ity-Metadata-for-all-tracked-players.patch | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Spigot-Server-Patches/0379-Update-entity-Metadata-for-all-tracked-players.patch diff --git a/Spigot-Server-Patches/0379-Update-entity-Metadata-for-all-tracked-players.patch b/Spigot-Server-Patches/0379-Update-entity-Metadata-for-all-tracked-players.patch new file mode 100644 index 000000000000..209972927574 --- /dev/null +++ b/Spigot-Server-Patches/0379-Update-entity-Metadata-for-all-tracked-players.patch @@ -0,0 +1,22 @@ +From 2a1cb415c509d8a702897d35f3f67ca359dd5412 Mon Sep 17 00:00:00 2001 +From: AgentTroll +Date: Sun, 24 Mar 2019 17:44:01 -0400 +Subject: [PATCH] Update entity Metadata for all tracked players + + +diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +index e837a553e..8c20bcd14 100644 +--- a/src/main/java/net/minecraft/server/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/PlayerConnection.java +@@ -1674,7 +1674,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { + + if (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory.getItemInHand().getItem() != origItem) { + // Refresh the current entity metadata +- this.sendPacket(new PacketPlayOutEntityMetadata(entity.getId(), entity.datawatcher, true)); ++ entity.tracker.broadcast(new PacketPlayOutEntityMetadata(entity.getId(), entity.datawatcher, true)); // Paper - update entity for all players + } + + if (event.isCancelled()) { +-- +2.21.0 + From 745476f4dadbbc7b567307271be859dc7bd3cbba Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 24 Mar 2019 18:09:51 -0400 Subject: [PATCH 58/90] don't go below 0 for pickupDelay, breaks picking up items vanilla checks for == 0 Fixes #1911 --- ...-for-pickupDelay-breaks-picking-up-i.patch | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Spigot-Server-Patches/0380-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch diff --git a/Spigot-Server-Patches/0380-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch b/Spigot-Server-Patches/0380-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch new file mode 100644 index 000000000000..a0b37e16e169 --- /dev/null +++ b/Spigot-Server-Patches/0380-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch @@ -0,0 +1,22 @@ +From e6a5d8a54a604baab979eb2219656538a43aa72c Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sun, 24 Mar 2019 18:08:36 -0400 +Subject: [PATCH] don't go below 0 for pickupDelay, breaks picking up items + +vanilla checks for == 0 + +diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java +index 099bc7551..2c99cc2f1 100644 +--- a/src/main/java/net/minecraft/server/EntityItem.java ++++ b/src/main/java/net/minecraft/server/EntityItem.java +@@ -72,6 +72,7 @@ public class EntityItem extends Entity implements HopperPusher { + // CraftBukkit start - Use wall time for pickup and despawn timers + int elapsedTicks = MinecraftServer.currentTick - this.lastTick; + if (this.pickupDelay != 32767) this.pickupDelay -= elapsedTicks; ++ this.pickupDelay = Math.max(0, this.pickupDelay); // Paper - don't go below 0 + if (this.age != -32768) this.age += elapsedTicks; + this.lastTick = MinecraftServer.currentTick; + // CraftBukkit end +-- +2.21.0 + From 2d68918daa82d3ead1c2c464832883ecd7622b8d Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 24 Mar 2019 18:15:10 -0400 Subject: [PATCH 59/90] missed a spot for pickupDelay fix --- ...below-0-for-pickupDelay-breaks-picking-up-i.patch | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Spigot-Server-Patches/0380-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch b/Spigot-Server-Patches/0380-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch index a0b37e16e169..63671ab19c11 100644 --- a/Spigot-Server-Patches/0380-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch +++ b/Spigot-Server-Patches/0380-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch @@ -1,4 +1,4 @@ -From e6a5d8a54a604baab979eb2219656538a43aa72c Mon Sep 17 00:00:00 2001 +From d63702b300dcb1f907edaee82655c70bac81910e Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 24 Mar 2019 18:08:36 -0400 Subject: [PATCH] don't go below 0 for pickupDelay, breaks picking up items @@ -6,7 +6,7 @@ Subject: [PATCH] don't go below 0 for pickupDelay, breaks picking up items vanilla checks for == 0 diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index 099bc7551..2c99cc2f1 100644 +index 099bc7551..4fafb4977 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java @@ -72,6 +72,7 @@ public class EntityItem extends Entity implements HopperPusher { @@ -17,6 +17,14 @@ index 099bc7551..2c99cc2f1 100644 if (this.age != -32768) this.age += elapsedTicks; this.lastTick = MinecraftServer.currentTick; // CraftBukkit end +@@ -160,6 +161,7 @@ public class EntityItem extends Entity implements HopperPusher { + // CraftBukkit start - Use wall time for pickup and despawn timers + int elapsedTicks = MinecraftServer.currentTick - this.lastTick; + if (this.pickupDelay != 32767) this.pickupDelay -= elapsedTicks; ++ this.pickupDelay = Math.max(0, this.pickupDelay); // Paper - don't go below 0 + if (this.age != -32768) this.age += elapsedTicks; + this.lastTick = MinecraftServer.currentTick; + // CraftBukkit end -- 2.21.0 From 1073a39560a522a2e6e66b506582d68ac70673c9 Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 26 Mar 2019 00:42:12 -0400 Subject: [PATCH 60/90] Fix plugin errors corrupting timings stack plugins that threw an error could get timings thrown off in its state this likely led to inconsistent and unexplainable data in timings reports. this ensures that exceptions will still stopTiming and let the system auto self recover from corrupt stacks too. --- Spigot-API-Patches/0003-Timings-v2.patch | 64 ++++++++++++----- .../0018-Add-exception-reporting-event.patch | 22 +++--- ...0-Allow-Reloading-of-Command-Aliases.patch | 8 +-- Spigot-Server-Patches/0009-Timings-v2.patch | 69 ++++++++++--------- 4 files changed, 97 insertions(+), 66 deletions(-) diff --git a/Spigot-API-Patches/0003-Timings-v2.patch b/Spigot-API-Patches/0003-Timings-v2.patch index db88b51151c5..3c181c5f12fa 100644 --- a/Spigot-API-Patches/0003-Timings-v2.patch +++ b/Spigot-API-Patches/0003-Timings-v2.patch @@ -1,4 +1,4 @@ -From aaba994557e85de97413e978b93bdd9b1c63d969 Mon Sep 17 00:00:00 2001 +From 5ecd59c7f8a08d76faaa561f750665fd4ed6f18d Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 29 Feb 2016 18:48:17 -0600 Subject: [PATCH] Timings v2 @@ -160,7 +160,7 @@ index 00000000..8c43e206 +} diff --git a/src/main/java/co/aikar/timings/TimedEventExecutor.java b/src/main/java/co/aikar/timings/TimedEventExecutor.java new file mode 100644 -index 00000000..feddcdbd +index 00000000..34e52ec4 --- /dev/null +++ b/src/main/java/co/aikar/timings/TimedEventExecutor.java @@ -0,0 +1,81 @@ @@ -240,9 +240,9 @@ index 00000000..feddcdbd + executor.execute(listener, event); + return; + } -+ timings.startTiming(); -+ executor.execute(listener, event); -+ timings.stopTiming(); ++ try (Timing ignored = timings.startTiming()) { ++ executor.execute(listener, event); ++ } + } +} diff --git a/src/main/java/co/aikar/timings/Timing.java b/src/main/java/co/aikar/timings/Timing.java @@ -456,10 +456,10 @@ index 00000000..f222d6b7 +} diff --git a/src/main/java/co/aikar/timings/TimingHandler.java b/src/main/java/co/aikar/timings/TimingHandler.java new file mode 100644 -index 00000000..d9375833 +index 00000000..1b813cf7 --- /dev/null +++ b/src/main/java/co/aikar/timings/TimingHandler.java -@@ -0,0 +1,196 @@ +@@ -0,0 +1,202 @@ +/* + * This file is licensed under the MIT License (MIT). + * @@ -564,10 +564,16 @@ index 00000000..d9375833 + + public void stopTiming() { + if (enabled && timingDepth > 0 && Bukkit.isPrimaryThread() && --timingDepth == 0 && start != 0) { -+ TimingHandler last = TIMING_STACK.removeLast(); -+ if (last != this) { -+ Logger.getGlobal().log(Level.SEVERE, "TIMING_STACK_CORRUPTION - Report this to Paper! ( " + this.identifier + ":" + last +")", new Throwable()); -+ TIMING_STACK.addLast(last); // Add it back ++ TimingHandler last; ++ while ((last = TIMING_STACK.removeLast()) != this) { ++ last.timingDepth = 0; ++ String reportTo; ++ if ("minecraft".equals(last.identifier.group)) { ++ reportTo = "Paper! This is a potential bug in Paper"; ++ } else { ++ reportTo = "the plugin " + last.identifier.group + "(Look for errors above this in the logs)"; ++ } ++ Logger.getGlobal().log(Level.SEVERE, "TIMING_STACK_CORRUPTION - Report this to " + reportTo + " (" + last.identifier +" did not stopTiming)", new Throwable()); + } + addDiff(System.nanoTime() - start, TIMING_STACK.peekLast()); + @@ -3225,10 +3231,18 @@ index 00000000..5527e7c8 + +} diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java -index 1b5b37bf..bdc0de8c 100644 +index 1b5b37bf..22fe0663 100644 --- a/src/main/java/org/bukkit/command/SimpleCommandMap.java +++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java -@@ -31,7 +31,7 @@ public class SimpleCommandMap implements CommandMap { +@@ -10,6 +10,7 @@ import java.util.List; + import java.util.Map; + import java.util.regex.Pattern; + ++import co.aikar.timings.Timing; + import org.apache.commons.lang.Validate; + import org.bukkit.Location; + import org.bukkit.Server; +@@ -31,7 +32,7 @@ public class SimpleCommandMap implements CommandMap { register("bukkit", new VersionCommand("version")); register("bukkit", new ReloadCommand("reload")); register("bukkit", new PluginsCommand("plugins")); @@ -3237,7 +3251,7 @@ index 1b5b37bf..bdc0de8c 100644 } public void setFallbackCommands() { -@@ -60,6 +60,7 @@ public class SimpleCommandMap implements CommandMap { +@@ -60,6 +61,7 @@ public class SimpleCommandMap implements CommandMap { * {@inheritDoc} */ public boolean register(String label, String fallbackPrefix, Command command) { @@ -3245,7 +3259,7 @@ index 1b5b37bf..bdc0de8c 100644 label = label.toLowerCase(java.util.Locale.ENGLISH).trim(); fallbackPrefix = fallbackPrefix.toLowerCase(java.util.Locale.ENGLISH).trim(); boolean registered = register(label, command, false, fallbackPrefix); -@@ -135,6 +136,12 @@ public class SimpleCommandMap implements CommandMap { +@@ -135,16 +137,22 @@ public class SimpleCommandMap implements CommandMap { return false; } @@ -3256,8 +3270,24 @@ index 1b5b37bf..bdc0de8c 100644 + // Paper end + try { - target.timings.startTiming(); // Spigot - // Note: we don't return the result of target.execute as thats success / failure, we return handled (true) or not handled (false) +- target.timings.startTiming(); // Spigot +- // Note: we don't return the result of target.execute as thats success / failure, we return handled (true) or not handled (false) +- target.execute(sender, sentCommandLabel, Arrays.copyOfRange(args, 1, args.length)); +- target.timings.stopTiming(); // Spigot ++ try (Timing ignored = target.timings.startTiming()) { // Paper - use try with resources ++ // Note: we don't return the result of target.execute as thats success / failure, we return handled (true) or not handled (false) ++ target.execute(sender, sentCommandLabel, Arrays.copyOfRange(args, 1, args.length)); ++ } + } catch (CommandException ex) { +- target.timings.stopTiming(); // Spigot ++ //target.timings.stopTiming(); // Spigot // Paper + throw ex; + } catch (Throwable ex) { +- target.timings.stopTiming(); // Spigot ++ //target.timings.stopTiming(); // Spigot // Paper + throw new CommandException("Unhandled exception executing '" + commandLine + "' in " + target, ex); + } + diff --git a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java deleted file mode 100644 index bba914d7..00000000 diff --git a/Spigot-API-Patches/0018-Add-exception-reporting-event.patch b/Spigot-API-Patches/0018-Add-exception-reporting-event.patch index 5bb289420278..a76dda75e9bb 100644 --- a/Spigot-API-Patches/0018-Add-exception-reporting-event.patch +++ b/Spigot-API-Patches/0018-Add-exception-reporting-event.patch @@ -1,4 +1,4 @@ -From b8567d82eae818cbf98656b6107c703d49d19916 Mon Sep 17 00:00:00 2001 +From ac7d29681dd2be932b84ca9bb270906521656edc Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Mon, 29 Feb 2016 20:24:35 -0600 Subject: [PATCH] Add exception reporting event @@ -458,28 +458,28 @@ index 00000000..5582999f + } +} diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java -index bdc0de8c..4aea03c6 100644 +index 22fe0663..154b7d91 100644 --- a/src/main/java/org/bukkit/command/SimpleCommandMap.java +++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java -@@ -10,6 +10,9 @@ import java.util.List; - import java.util.Map; +@@ -11,6 +11,9 @@ import java.util.Map; import java.util.regex.Pattern; + import co.aikar.timings.Timing; +import com.destroystokyo.paper.event.server.ServerExceptionEvent; +import com.destroystokyo.paper.exception.ServerCommandException; +import com.destroystokyo.paper.exception.ServerTabCompleteException; import org.apache.commons.lang.Validate; import org.bukkit.Location; import org.bukkit.Server; -@@ -148,11 +151,14 @@ public class SimpleCommandMap implements CommandMap { - target.execute(sender, sentCommandLabel, Arrays.copyOfRange(args, 1, args.length)); - target.timings.stopTiming(); // Spigot +@@ -149,11 +152,14 @@ public class SimpleCommandMap implements CommandMap { + target.execute(sender, sentCommandLabel, Arrays.copyOfRange(args, 1, args.length)); + } } catch (CommandException ex) { + server.getPluginManager().callEvent(new ServerExceptionEvent(new ServerCommandException(ex, target, sender, args))); // Paper - target.timings.stopTiming(); // Spigot + //target.timings.stopTiming(); // Spigot // Paper throw ex; } catch (Throwable ex) { - target.timings.stopTiming(); // Spigot + //target.timings.stopTiming(); // Spigot // Paper - throw new CommandException("Unhandled exception executing '" + commandLine + "' in " + target, ex); + String msg = "Unhandled exception executing '" + commandLine + "' in " + target; + server.getPluginManager().callEvent(new ServerExceptionEvent(new ServerCommandException(ex, target, sender, args))); // Paper @@ -487,7 +487,7 @@ index bdc0de8c..4aea03c6 100644 } // return true as command was handled -@@ -225,7 +231,9 @@ public class SimpleCommandMap implements CommandMap { +@@ -226,7 +232,9 @@ public class SimpleCommandMap implements CommandMap { } catch (CommandException ex) { throw ex; } catch (Throwable ex) { @@ -592,5 +592,5 @@ index 80c152ba..b88f31ca 100644 } } -- -2.17.0 (Apple Git-106) +2.21.0 diff --git a/Spigot-API-Patches/0040-Allow-Reloading-of-Command-Aliases.patch b/Spigot-API-Patches/0040-Allow-Reloading-of-Command-Aliases.patch index 741745be5961..e4005ecc73fb 100644 --- a/Spigot-API-Patches/0040-Allow-Reloading-of-Command-Aliases.patch +++ b/Spigot-API-Patches/0040-Allow-Reloading-of-Command-Aliases.patch @@ -1,4 +1,4 @@ -From 4596b1efcb3648ea18ebf94eb07b49ee90c734e1 Mon Sep 17 00:00:00 2001 +From 092987e5e264aae797401bdbab3bc9c4df9a186c Mon Sep 17 00:00:00 2001 From: willies952002 Date: Mon, 28 Nov 2016 10:16:39 -0500 Subject: [PATCH] Allow Reloading of Command Aliases @@ -55,10 +55,10 @@ index 30d60247..938959aa 100644 + // Paper end } diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java -index 4aea03c6..63d27392 100644 +index 154b7d91..474cf4c3 100644 --- a/src/main/java/org/bukkit/command/SimpleCommandMap.java +++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java -@@ -282,4 +282,10 @@ public class SimpleCommandMap implements CommandMap { +@@ -283,4 +283,10 @@ public class SimpleCommandMap implements CommandMap { } } } @@ -97,5 +97,5 @@ index f331a442..a977045d 100644 confirmed = true; } else { -- -2.17.0 (Apple Git-106) +2.21.0 diff --git a/Spigot-Server-Patches/0009-Timings-v2.patch b/Spigot-Server-Patches/0009-Timings-v2.patch index 81216043dbbb..98549a69a3cc 100644 --- a/Spigot-Server-Patches/0009-Timings-v2.patch +++ b/Spigot-Server-Patches/0009-Timings-v2.patch @@ -1,4 +1,4 @@ -From 5e253ec4989164677875afdb670324f72b6161bf Mon Sep 17 00:00:00 2001 +From 7e842b6dd25d4f24f0109bcc0a403066220c9795 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 3 Mar 2016 04:00:11 -0600 Subject: [PATCH] Timings v2 @@ -6,7 +6,7 @@ Subject: [PATCH] Timings v2 diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java new file mode 100644 -index 00000000..c6405aa1 +index 000000000..c6405aa1b --- /dev/null +++ b/src/main/java/co/aikar/timings/MinecraftTimings.java @@ -0,0 +1,128 @@ @@ -140,7 +140,7 @@ index 00000000..c6405aa1 +} diff --git a/src/main/java/co/aikar/timings/TimedChunkGenerator.java b/src/main/java/co/aikar/timings/TimedChunkGenerator.java new file mode 100644 -index 00000000..089154f6 +index 000000000..089154f62 --- /dev/null +++ b/src/main/java/co/aikar/timings/TimedChunkGenerator.java @@ -0,0 +1,131 @@ @@ -277,7 +277,7 @@ index 00000000..089154f6 +} diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java new file mode 100644 -index 00000000..e0ad559b +index 000000000..e0ad559b7 --- /dev/null +++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java @@ -0,0 +1,99 @@ @@ -381,7 +381,7 @@ index 00000000..e0ad559b + } +} diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 5ab2cf6e..b5795b6d 100644 +index 5ab2cf6ee..b5795b6d3 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -14,11 +14,14 @@ import java.util.concurrent.TimeUnit; @@ -425,7 +425,7 @@ index 5ab2cf6e..b5795b6d 100644 + } } diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java -index 2dca6dbc..35231096 100644 +index 2dca6dbcb..352310960 100644 --- a/src/main/java/net/minecraft/server/Block.java +++ b/src/main/java/net/minecraft/server/Block.java @@ -35,6 +35,15 @@ public class Block { @@ -445,7 +445,7 @@ index 2dca6dbc..35231096 100644 public static int getId(Block block) { return Block.REGISTRY.a(block); // CraftBukkit - decompile error diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 801dd26d..2c706f07 100644 +index 801dd26d5..2c706f07e 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -938,7 +938,7 @@ public class Chunk { @@ -493,7 +493,7 @@ index 801dd26d..2c706f07 100644 private void z() { diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 86973cb9..bd006ef7 100644 +index 86973cb98..bd006ef74 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -204,7 +204,7 @@ public class ChunkProviderServer implements IChunkProvider { @@ -506,7 +506,7 @@ index 86973cb9..bd006ef7 100644 this.chunkLoader.saveChunk(this.world, chunk, unloaded); // Spigot } catch (IOException ioexception) { diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 50ec3adb..a401dec6 100644 +index 50ec3adb8..a401dec60 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -423,7 +423,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { @@ -546,7 +546,7 @@ index 50ec3adb..a401dec6 100644 // return chunk; // CraftBukkit } diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index e1cb96a8..8f2afcc3 100644 +index e1cb96a88..8f2afcc32 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java @@ -24,7 +24,7 @@ import java.io.PrintStream; @@ -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 2bb23c7b..375f9d03 100644 +index 2bb23c7b2..375f9d03f 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; @@ -638,7 +638,7 @@ index 2bb23c7b..375f9d03 100644 public void recalcPosition() { diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 0026f29d..d15cfdd7 100644 +index 0026f29d5..d15cfdd76 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -31,7 +31,7 @@ import org.bukkit.event.entity.EntityTeleportEvent; @@ -709,7 +709,7 @@ index 0026f29d..d15cfdd7 100644 } diff --git a/src/main/java/net/minecraft/server/EntityTracker.java b/src/main/java/net/minecraft/server/EntityTracker.java -index ce012402..a60f9460 100644 +index ce0124020..a60f94608 100644 --- a/src/main/java/net/minecraft/server/EntityTracker.java +++ b/src/main/java/net/minecraft/server/EntityTracker.java @@ -175,7 +175,7 @@ public class EntityTracker { @@ -740,7 +740,7 @@ index ce012402..a60f9460 100644 } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index c1a8816b..8d08b536 100644 +index c1a8816b4..8d08b536a 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -48,8 +48,8 @@ import org.bukkit.Bukkit; @@ -887,7 +887,7 @@ index c1a8816b..8d08b536 100644 this.methodProfiler.b(); } diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index eeac3499..e4ed2e99 100644 +index eeac34998..e4ed2e991 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -1,5 +1,6 @@ @@ -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 8efcb831..27a6d1e2 100644 +index 8efcb8317..27a6d1e20 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; @@ -1051,7 +1051,7 @@ index 8efcb831..27a6d1e2 100644 // CraftBukkit end } diff --git a/src/main/java/net/minecraft/server/PlayerConnectionUtils.java b/src/main/java/net/minecraft/server/PlayerConnectionUtils.java -index f74b0679..1fc632e0 100644 +index f74b06794..1fc632e0c 100644 --- a/src/main/java/net/minecraft/server/PlayerConnectionUtils.java +++ b/src/main/java/net/minecraft/server/PlayerConnectionUtils.java @@ -1,15 +1,21 @@ @@ -1081,7 +1081,7 @@ index f74b0679..1fc632e0 100644 + // Paper end } diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index d4acbed0..1d9f3e3d 100644 +index d4acbed0c..1d9f3e3dd 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -1,5 +1,6 @@ @@ -1105,7 +1105,7 @@ index d4acbed0..1d9f3e3d 100644 public void addWhitelist(GameProfile gameprofile) { diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java -index 74e3f42c..66a80a77 100644 +index 74e3f42cd..66a80a776 100644 --- a/src/main/java/net/minecraft/server/StructureGenerator.java +++ b/src/main/java/net/minecraft/server/StructureGenerator.java @@ -1,5 +1,7 @@ @@ -1147,7 +1147,7 @@ index 74e3f42c..66a80a77 100644 return flag; } diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index 29069b75..081e56f4 100644 +index 29069b753..081e56f48 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java @@ -4,12 +4,13 @@ import javax.annotation.Nullable; @@ -1167,7 +1167,7 @@ index 29069b75..081e56f4 100644 private static final RegistryMaterials> f = new RegistryMaterials(); protected World world; diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 843320ff..d902e263 100644 +index 843320ffb..d902e2630 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -19,11 +19,11 @@ import com.google.common.collect.Maps; @@ -1273,7 +1273,7 @@ index 843320ff..d902e263 100644 public boolean b(AxisAlignedBB axisalignedbb) { diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index c891629b..95964c55 100644 +index c891629bd..95964c550 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -308,13 +308,13 @@ public class WorldServer extends World implements IAsyncTaskHandler { @@ -1407,7 +1407,7 @@ index c891629b..95964c55 100644 // CraftBukkit start diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 14851a3a..9042deed 100644 +index 14851a3a5..9042deed6 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1756,12 +1756,31 @@ public final class CraftServer implements Server { @@ -1444,7 +1444,7 @@ index 14851a3a..9042deed 100644 org.spigotmc.RestartCommand.restart(); diff --git a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java deleted file mode 100644 -index 666d1eb9..00000000 +index 666d1eb9e..000000000 --- a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java +++ /dev/null @@ -1,175 +0,0 @@ @@ -1624,7 +1624,7 @@ index 666d1eb9..00000000 - } -} diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java -index 3a95b446..b5efb9c3 100644 +index 3a95b4465..b5efb9c3f 100644 --- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java +++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java @@ -1,6 +1,8 @@ @@ -1668,7 +1668,7 @@ index 3a95b446..b5efb9c3 100644 public void callStage3(QueuedChunk queuedChunk, Chunk chunk, Runnable runnable) throws RuntimeException { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 137b101a..cd99801f 100644 +index 137b101a7..cd99801ff 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -41,7 +41,7 @@ import org.bukkit.configuration.serialization.DelegateDeserialization; @@ -1694,7 +1694,7 @@ index 137b101a..cd99801f 100644 public Player.Spigot spigot() diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -index f11bd754..93b9134d 100644 +index f11bd7545..93b9134d6 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java @@ -14,6 +14,7 @@ import java.util.concurrent.atomic.AtomicInteger; @@ -1770,7 +1770,7 @@ index f11bd754..93b9134d 100644 private boolean isReady(final int currentTick) { diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java -index 7e7ce9a8..46029ce2 100644 +index 7e7ce9a81..f688a796d 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java @@ -1,8 +1,8 @@ @@ -1831,9 +1831,10 @@ index 7e7ce9a8..46029ce2 100644 } public void run() { -+ if (timings != null && isSync()) timings.startTiming(); // Paper - task.run(); -+ if (timings != null && isSync()) timings.stopTiming(); // Paper +- task.run(); ++ try (Timing ignored = timings.startTiming()) { // Paper ++ task.run(); ++ } // Paper } long getPeriod() { @@ -1852,7 +1853,7 @@ index 7e7ce9a8..46029ce2 100644 - // Spigot end } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java b/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java -index e52ef47b..3d90b342 100644 +index e52ef47b7..3d90b3426 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java @@ -5,6 +5,7 @@ import org.bukkit.util.CachedServerIcon; @@ -1864,7 +1865,7 @@ index e52ef47b..3d90b342 100644 this.value = value; } diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index 2bd690fd..38be7ed7 100644 +index 2bd690fdf..38be7ed71 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java @@ -29,7 +29,7 @@ import net.minecraft.server.EntityWither; @@ -1926,5 +1927,5 @@ index 2bd690fd..38be7ed7 100644 } } -- -2.19.2 +2.21.0 From 5e4ae76bc3e57f2a779dcf5a5c1c666758ebaf49 Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 26 Mar 2019 01:39:57 -0400 Subject: [PATCH 61/90] Fix null task issue with timings --- Spigot-API-Patches/0003-Timings-v2.patch | 8 +++++--- Spigot-Server-Patches/0009-Timings-v2.patch | 21 +++++++++++---------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Spigot-API-Patches/0003-Timings-v2.patch b/Spigot-API-Patches/0003-Timings-v2.patch index 3c181c5f12fa..1ddd82ab9459 100644 --- a/Spigot-API-Patches/0003-Timings-v2.patch +++ b/Spigot-API-Patches/0003-Timings-v2.patch @@ -1,4 +1,4 @@ -From 5ecd59c7f8a08d76faaa561f750665fd4ed6f18d Mon Sep 17 00:00:00 2001 +From 39d1fdb91886c053e524bfc65ee8ce80ad364bb4 Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 29 Feb 2016 18:48:17 -0600 Subject: [PATCH] Timings v2 @@ -93,10 +93,10 @@ index 00000000..597d39a3 +} diff --git a/src/main/java/co/aikar/timings/NullTimingHandler.java b/src/main/java/co/aikar/timings/NullTimingHandler.java new file mode 100644 -index 00000000..8c43e206 +index 00000000..3222c8c2 --- /dev/null +++ b/src/main/java/co/aikar/timings/NullTimingHandler.java -@@ -0,0 +1,61 @@ +@@ -0,0 +1,63 @@ +/* + * This file is licensed under the MIT License (MIT). + * @@ -123,6 +123,8 @@ index 00000000..8c43e206 +package co.aikar.timings; + +public final class NullTimingHandler implements Timing { ++ public static final Timing NULL = new NullTimingHandler(); ++ + @Override + public Timing startTiming() { + return this; diff --git a/Spigot-Server-Patches/0009-Timings-v2.patch b/Spigot-Server-Patches/0009-Timings-v2.patch index 98549a69a3cc..1bf6c3f78bbd 100644 --- a/Spigot-Server-Patches/0009-Timings-v2.patch +++ b/Spigot-Server-Patches/0009-Timings-v2.patch @@ -1,4 +1,4 @@ -From 7e842b6dd25d4f24f0109bcc0a403066220c9795 Mon Sep 17 00:00:00 2001 +From 5c2b7e485fb417cedb926d24b98af63c462aa607 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 3 Mar 2016 04:00:11 -0600 Subject: [PATCH] Timings v2 @@ -6,7 +6,7 @@ Subject: [PATCH] Timings v2 diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java new file mode 100644 -index 000000000..c6405aa1b +index 000000000..baea97382 --- /dev/null +++ b/src/main/java/co/aikar/timings/MinecraftTimings.java @@ -0,0 +1,128 @@ @@ -63,7 +63,7 @@ index 000000000..c6405aa1b + */ + public static Timing getPluginTaskTimings(BukkitTask bukkitTask, long period) { + if (!bukkitTask.isSync()) { -+ return null; ++ return NullTimingHandler.NULL; + } + Plugin plugin; + @@ -1770,12 +1770,13 @@ index f11bd7545..93b9134d6 100644 private boolean isReady(final int currentTick) { diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java -index 7e7ce9a81..f688a796d 100644 +index 7e7ce9a81..70252ef30 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java -@@ -1,8 +1,8 @@ +@@ -1,8 +1,9 @@ package org.bukkit.craftbukkit.scheduler; ++import co.aikar.timings.NullTimingHandler; import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.SpigotTimings; // Spigot -import org.spigotmc.CustomTimingsHandler; // Spigot @@ -1784,7 +1785,7 @@ index 7e7ce9a81..f688a796d 100644 import org.bukkit.plugin.Plugin; import org.bukkit.scheduler.BukkitTask; -@@ -25,11 +25,11 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot +@@ -25,11 +26,11 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot */ private volatile long period; private long nextRun; @@ -1798,7 +1799,7 @@ index 7e7ce9a81..f688a796d 100644 CraftTask() { this(null, null, CraftTask.NO_REPEATING, CraftTask.NO_REPEATING); } -@@ -38,26 +38,12 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot +@@ -38,26 +39,12 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot this(null, task, CraftTask.NO_REPEATING, CraftTask.NO_REPEATING); } @@ -1823,11 +1824,11 @@ index 7e7ce9a81..f688a796d 100644 - CraftTask(final Plugin plugin, final Runnable task, final int id, final long period) { - this(null, plugin, task, id, period); - // Spigot end -+ timings = task != null ? MinecraftTimings.getPluginTaskTimings(this, period) : null; // Paper ++ timings = task != null ? MinecraftTimings.getPluginTaskTimings(this, period) : NullTimingHandler.NULL; // Paper } public final int getTaskId() { -@@ -73,7 +59,9 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot +@@ -73,7 +60,9 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot } public void run() { @@ -1838,7 +1839,7 @@ index 7e7ce9a81..f688a796d 100644 } long getPeriod() { -@@ -122,13 +110,4 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot +@@ -122,13 +111,4 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot setPeriod(CraftTask.CANCEL); return true; } From e0847a4cea008c39a72e6cfeea1486a8d01b16c3 Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 29 Mar 2019 00:03:53 -0400 Subject: [PATCH 62/90] Reuse buffers for chunk compression to optimize memory use Instead of allocating a buffer for every chunk compression, reuse the same 64k sized buffer. Also stopped doing dynamic compression levels. It wasn't helping enough. This will improve memory usage and zlib performance of chunk compression. --- ...373-Allow-Saving-of-Oversized-Chunks.patch | 74 ++++++++++--------- 1 file changed, 40 insertions(+), 34 deletions(-) diff --git a/Spigot-Server-Patches/0373-Allow-Saving-of-Oversized-Chunks.patch b/Spigot-Server-Patches/0373-Allow-Saving-of-Oversized-Chunks.patch index 01219eb3796a..6be761dfb20c 100644 --- a/Spigot-Server-Patches/0373-Allow-Saving-of-Oversized-Chunks.patch +++ b/Spigot-Server-Patches/0373-Allow-Saving-of-Oversized-Chunks.patch @@ -1,4 +1,4 @@ -From 0c66385b2ab612b92641c37518e15ba12530b3ff Mon Sep 17 00:00:00 2001 +From bd0b04c85e7127c741ae442a8183085f7a1d1d72 Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 15 Feb 2019 01:08:19 -0500 Subject: [PATCH] Allow Saving of Oversized Chunks @@ -31,7 +31,7 @@ this fix, as the data will remain in the oversized file. Once the server returns to a jar with this fix, the data will be restored. diff --git a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java -index 2162d3ad..8b5aeb1b 100644 +index 2162d3ad3..8b5aeb1b0 100644 --- a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java +++ b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java @@ -39,6 +39,7 @@ public class NBTCompressedStreamTools { @@ -51,7 +51,7 @@ index 2162d3ad..8b5aeb1b 100644 a((NBTBase) nbttagcompound, dataoutput); } diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index d58cda9a..56783ab5 100644 +index d58cda9aa..542a35d13 100644 --- a/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java @@ -83,6 +83,7 @@ public class RegionFile { @@ -87,7 +87,7 @@ index d58cda9a..56783ab5 100644 if (k1 >= 256) { // Spigot start - if (!ENABLE_EXTENDED_SAVE) return; -+ if (!USE_SPIGOT_OVERSIZED_METHOD) throw new ChunkTooLargeException(i, j, k1); // Paper - throw error instead ++ if (!USE_SPIGOT_OVERSIZED_METHOD && !RegionFileCache.isOverzealous()) throw new ChunkTooLargeException(i, j, k1); // Paper - throw error instead org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.WARNING,"Large Chunk Detected: ({0}, {1}) Size: {2} {3}", new Object[]{i, j, k1, this.b}); + if (!ENABLE_EXTENDED_SAVE) return; // Spigot end @@ -204,7 +204,7 @@ index d58cda9a..56783ab5 100644 // Paper end class ChunkBuffer extends ByteArrayOutputStream { -@@ -364,8 +470,40 @@ public class RegionFile { +@@ -364,8 +470,36 @@ public class RegionFile { this.c = j; } @@ -219,36 +219,32 @@ index d58cda9a..56783ab5 100644 + int length = out.size(); + + RegionFile.this.a(this.b, this.c, bytes, length); // Paper - change to bytes/length -+ // Paper end -+ } -+ } + } + } + ++ private static final byte[] compressionBuffer = new byte[1024 * 64]; // 64k fits most standard chunks input size even, ideally 1 pass through zlib ++ private static final java.util.zip.Deflater deflater = new java.util.zip.Deflater(); ++ // since file IO is single threaded, no benefit to using per-region file buffers/synchronization, we can change that later if it becomes viable. + private static DirectByteArrayOutputStream compressData(byte[] buf, int length) throws IOException { -+ final java.util.zip.Deflater deflater; -+ if (length > 1024 * 512) { -+ deflater = new java.util.zip.Deflater(9); -+ } else if (length > 1024 * 128) { -+ deflater = new java.util.zip.Deflater(8); -+ } else { -+ deflater = new java.util.zip.Deflater(6); -+ } ++ synchronized (deflater) { ++ deflater.setInput(buf, 0, length); ++ deflater.finish(); + + -+ deflater.setInput(buf, 0, length); -+ deflater.finish(); ++ DirectByteArrayOutputStream out = new DirectByteArrayOutputStream(length); ++ while (!deflater.finished()) { ++ out.write(compressionBuffer, 0, deflater.deflate(compressionBuffer)); ++ } ++ out.close(); ++ deflater.reset(); ++ return out; ++ } ++ } ++ // Paper end + -+ DirectByteArrayOutputStream out = new DirectByteArrayOutputStream(length); -+ byte[] buffer = new byte[1024 * (length > 1024 * 124 ? 32 : 16)]; -+ while (!deflater.finished()) { -+ out.write(buffer, 0, deflater.deflate(buffer)); - } -+ out.close(); -+ deflater.end(); -+ return out; - } } diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java -index 15a09ab3..c260a797 100644 +index 15a09ab36..daa7e997a 100644 --- a/src/main/java/net/minecraft/server/RegionFileCache.java +++ b/src/main/java/net/minecraft/server/RegionFileCache.java @@ -15,6 +15,7 @@ public class RegionFileCache { @@ -259,7 +255,7 @@ index 15a09ab3..c260a797 100644 public static synchronized RegionFile a(File file, int i, int j) { File file1 = new File(file, "region"); File file2 = new File(file1, "r." + (i >> 5) + "." + (j >> 5) + ".mca"); -@@ -73,6 +74,129 @@ public class RegionFileCache { +@@ -73,6 +74,139 @@ public class RegionFileCache { itr.remove(); } } @@ -268,7 +264,8 @@ index 15a09ab3..c260a797 100644 + } + + private static final int DEFAULT_SIZE_THRESHOLD = 1024 * 8; -+ private static final int OVERZEALOUS_THRESHOLD = 1024 * 2; ++ private static final int OVERZEALOUS_TOTAL_THRESHOLD = 1024 * 64; ++ private static final int OVERZEALOUS_THRESHOLD = 1024; + private static int SIZE_THRESHOLD = DEFAULT_SIZE_THRESHOLD; + private static void resetFilterThresholds() { + SIZE_THRESHOLD = Math.max(1024 * 4, Integer.getInteger("Paper.FilterThreshhold", DEFAULT_SIZE_THRESHOLD)); @@ -276,6 +273,11 @@ index 15a09ab3..c260a797 100644 + static { + resetFilterThresholds(); + } ++ ++ static boolean isOverzealous() { ++ return SIZE_THRESHOLD == OVERZEALOUS_THRESHOLD; ++ } ++ + private static void writeRegion(File file, int x, int z, NBTTagCompound nbttagcompound) throws IOException { + RegionFile regionfile = getRegionFile(file, x, z); + @@ -329,11 +331,15 @@ index 15a09ab3..c260a797 100644 + private static void filterChunkList(NBTTagCompound level, NBTTagCompound extra, String key) { + NBTTagList list = level.getList(key, 10); + NBTTagList newList = extra.getList(key, 10); ++ int totalSize = 0; + for (Iterator iterator = list.list.iterator(); iterator.hasNext(); ) { + NBTBase object = iterator.next(); -+ if (getNBTSize(object) > SIZE_THRESHOLD) { ++ int nbtSize = getNBTSize(object); ++ if (nbtSize > SIZE_THRESHOLD || (SIZE_THRESHOLD == OVERZEALOUS_THRESHOLD && totalSize > OVERZEALOUS_TOTAL_THRESHOLD)) { + newList.add(object); + iterator.remove(); ++ } else { ++ totalSize += nbtSize; + } + } + level.set(key, list); @@ -389,7 +395,7 @@ index 15a09ab3..c260a797 100644 // Paper End public static synchronized void a() { -@@ -97,6 +221,12 @@ public class RegionFileCache { +@@ -97,6 +231,12 @@ public class RegionFileCache { // CraftBukkit start - call sites hoisted for synchronization public static NBTTagCompound d(File file, int i, int j) throws IOException { // Paper - remove synchronization RegionFile regionfile = a(file, i, j); @@ -402,7 +408,7 @@ index 15a09ab3..c260a797 100644 DataInputStream datainputstream = regionfile.a(i & 31, j & 31); -@@ -108,11 +238,14 @@ public class RegionFileCache { +@@ -108,11 +248,14 @@ public class RegionFileCache { } public static void e(File file, int i, int j, NBTTagCompound nbttagcompound) throws IOException { // Paper - remove synchronization @@ -423,5 +429,5 @@ index 15a09ab3..c260a797 100644 // CraftBukkit end -- -2.20.1 +2.21.0 From 3b0b967c78ca4018294d4cd261a51de602e9bf16 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Sun, 7 Apr 2019 06:25:40 -0400 Subject: [PATCH 63/90] Allow disabling village sieges entirely Fixes GH-1944 --- .../0381-Allow-disabling-village-sieges.patch | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Spigot-Server-Patches/0381-Allow-disabling-village-sieges.patch diff --git a/Spigot-Server-Patches/0381-Allow-disabling-village-sieges.patch b/Spigot-Server-Patches/0381-Allow-disabling-village-sieges.patch new file mode 100644 index 000000000000..01d0fc7e071d --- /dev/null +++ b/Spigot-Server-Patches/0381-Allow-disabling-village-sieges.patch @@ -0,0 +1,37 @@ +From e7ec410152443120d21bc738121f9ccea800518b Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Sun, 7 Apr 2019 06:22:54 -0400 +Subject: [PATCH] Allow disabling village sieges + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index ba299afc..319b5b95 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -587,4 +587,10 @@ public class PaperWorldConfig { + this.armorStandTick = this.getBoolean("armor-stands-tick", this.armorStandTick); + log("ArmorStand ticking is " + (this.armorStandTick ? "enabled" : "disabled") + " by default"); + } ++ ++ public boolean villageSiegesEnabled = true; ++ private void villageSiegesEnabled() { ++ this.villageSiegesEnabled = getBoolean("game-mechanics.village-sieges-enabled", this.villageSiegesEnabled); ++ log("Village sieges are " + (this.villageSiegesEnabled ? "enabled" : "disabled")); ++ } + } +diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +index d29420dd..e545e976 100644 +--- a/src/main/java/net/minecraft/server/WorldServer.java ++++ b/src/main/java/net/minecraft/server/WorldServer.java +@@ -334,7 +334,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { + this.methodProfiler.c("village"); + timings.doVillages.startTiming(); // Spigot + this.villages.tick(); +- this.siegeManager.a(); ++ if (paperConfig.villageSiegesEnabled) { this.siegeManager.a(); } // Paper - Allow disabling village sieges + timings.doVillages.stopTiming(); // Spigot + this.methodProfiler.c("portalForcer"); + timings.doPortalForcer.startTiming(); // Spigot +-- +2.21.0 + From b8c184a4d998809f36f728a1064be5e796b79f8c Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Sun, 7 Apr 2019 06:53:59 -0400 Subject: [PATCH 64/90] Backport changes to deprecated CustomTimingsHandler This will allow us to build against JDK11 which is good since it seems like this will be sticking around for a while. --- Spigot-API-Patches/0003-Timings-v2.patch | 91 +++++++++++++++--------- 1 file changed, 56 insertions(+), 35 deletions(-) diff --git a/Spigot-API-Patches/0003-Timings-v2.patch b/Spigot-API-Patches/0003-Timings-v2.patch index 1ddd82ab9459..6516773ba694 100644 --- a/Spigot-API-Patches/0003-Timings-v2.patch +++ b/Spigot-API-Patches/0003-Timings-v2.patch @@ -1,4 +1,4 @@ -From 39d1fdb91886c053e524bfc65ee8ce80ad364bb4 Mon Sep 17 00:00:00 2001 +From 199ec5e113fd5ba5d362cc12be1144b26fe9fccc Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 29 Feb 2016 18:48:17 -0600 Subject: [PATCH] Timings v2 @@ -3698,10 +3698,10 @@ index 5ca863b3..04804706 100644 + public String getData(); // Spigot +} diff --git a/src/main/java/org/spigotmc/CustomTimingsHandler.java b/src/main/java/org/spigotmc/CustomTimingsHandler.java -index 8d982974..7e89b97b 100644 +index 8d982974..40aa8a19 100644 --- a/src/main/java/org/spigotmc/CustomTimingsHandler.java +++ b/src/main/java/org/spigotmc/CustomTimingsHandler.java -@@ -1,165 +1,76 @@ +@@ -1,165 +1,104 @@ +/* + * This file is licensed under the MIT License (MIT). + * @@ -3744,7 +3744,6 @@ index 8d982974..7e89b97b 100644 +import co.aikar.timings.Timing; +import co.aikar.timings.Timings; +import co.aikar.timings.TimingsManager; -+import sun.reflect.Reflection; -import org.bukkit.Bukkit; -import org.bukkit.World; @@ -3765,6 +3764,8 @@ index 8d982974..7e89b97b 100644 +@Deprecated +public final class CustomTimingsHandler { + private final Timing handler; ++ private static Boolean sunReflectAvailable; ++ private static Method getCallerClass; - private static Queue HANDLERS = new ConcurrentLinkedQueue(); - /*========================================================================*/ @@ -3777,24 +3778,25 @@ index 8d982974..7e89b97b 100644 - private long curTickTotal = 0; - private long violations = 0; + public CustomTimingsHandler(String name) { -+ Timing timing; ++ if (sunReflectAvailable == null) { ++ String javaVer = System.getProperty("java.version"); ++ String[] elements = javaVer.split("\\."); - public CustomTimingsHandler(String name) - { - this( name, null ); - } -+ Plugin plugin = null; -+ try { -+ plugin = TimingsManager.getPluginByClassloader(Reflection.getCallerClass(2)); -+ } catch (Exception ignored) {} - +- - public CustomTimingsHandler(String name, CustomTimingsHandler parent) - { - this.name = name; - this.parent = parent; - HANDLERS.add( this ); - } -- ++ int major = Integer.parseInt(elements.length >= 2 ? elements[1] : javaVer); ++ if (major <= 8) { ++ sunReflectAvailable = true; + - /** - * Prints the timings and extra data to the given stream. - * @@ -3810,21 +3812,18 @@ index 8d982974..7e89b97b 100644 - if ( count == 0 ) - { - continue; -+ new AuthorNagException("Deprecated use of CustomTimingsHandler. Please Switch to Timings.of ASAP").printStackTrace(); -+ if (plugin != null) { -+ timing = Timings.of(plugin, "(Deprecated API) " + name); -+ } else { -+ try { -+ final Method ofSafe = TimingsManager.class.getMethod("getHandler", String.class, String.class, Timing.class, boolean.class); -+ timing = (Timing) ofSafe.invoke("Minecraft", "(Deprecated API) " + name, null, true); -+ } catch (Exception e) { -+ Bukkit.getLogger().log(Level.SEVERE, "This handler could not be registered"); -+ timing = Timings.NULL_HANDLER; ++ try { ++ Class reflection = Class.forName("sun.reflect.Reflection"); ++ getCallerClass = reflection.getMethod("getCallerClass", int.class); ++ } catch (ClassNotFoundException | NoSuchMethodException ignored) { ++ } ++ } else { ++ sunReflectAvailable = false; } - long avg = time / count; - - printStream.println( " " + timings.name + " Time: " + time + " Count: " + count + " Avg: " + avg + " Violations: " + timings.violations ); - } +- } - printStream.println( "# Version " + Bukkit.getVersion() ); - int entities = 0; - int livingEntities = 0; @@ -3832,11 +3831,10 @@ index 8d982974..7e89b97b 100644 - { - entities += world.getEntities().size(); - livingEntities += world.getLivingEntities().size(); -- } + } - printStream.println( "# Entities " + entities ); - printStream.println( "# LivingEntities " + livingEntities ); -+ handler = timing; - } +- } - /** - * Resets all timings. @@ -3848,12 +3846,15 @@ index 8d982974..7e89b97b 100644 - for ( CustomTimingsHandler timings : HANDLERS ) - { - timings.reset(); -- } -- } ++ Class calling = null; ++ if (sunReflectAvailable) { ++ try { ++ calling = (Class) getCallerClass.invoke(null, 2); ++ } catch (IllegalAccessException | java.lang.reflect.InvocationTargetException ignored) { + } + } - TimingsCommand.timingStart = System.nanoTime(); - } -+ public void startTiming() { handler.startTiming(); } -+ public void stopTiming() { handler.stopTiming(); } - /** - * Ticked every tick by CraftBukkit to count the number of times a timer @@ -3874,7 +3875,8 @@ index 8d982974..7e89b97b 100644 - } - } - } -- ++ Timing timing; + - /** - * Starts timing to track a section of code. - */ @@ -3890,7 +3892,11 @@ index 8d982974..7e89b97b 100644 - } - } - } -- ++ Plugin plugin = null; ++ try { ++ plugin = TimingsManager.getPluginByClassloader(calling); ++ } catch (Exception ignored) {} + - /** - * Stops timing a section of code. - */ @@ -3910,10 +3916,22 @@ index 8d982974..7e89b97b 100644 - if ( parent != null ) - { - parent.stopTiming(); -- } -- } -- } -- ++ new AuthorNagException("Deprecated use of CustomTimingsHandler. Please Switch to Timings.of ASAP").printStackTrace(); ++ if (plugin != null) { ++ timing = Timings.of(plugin, "(Deprecated API) " + name); ++ } else { ++ try { ++ final Method ofSafe = TimingsManager.class.getMethod("getHandler", String.class, String.class, Timing.class); ++ ofSafe.setAccessible(true); ++ timing = (Timing) ofSafe.invoke(null, "Minecraft", "(Deprecated API) " + name, null); ++ } catch (Exception e) { ++ Bukkit.getLogger().log(Level.SEVERE, "This handler could not be registered"); ++ timing = Timings.NULL_HANDLER; + } + } ++ handler = timing; + } + - /** - * Reset this timer, setting all values to zero. - */ @@ -3926,6 +3944,9 @@ index 8d982974..7e89b97b 100644 - start = 0; - timingDepth = 0; - } ++ public void startTiming() { handler.startTiming(); } ++ public void stopTiming() { handler.stopTiming(); } ++ } -- 2.21.0 From 8f7f4cfb3c4ec4d7dbeb502b1f66977115ffe5c6 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Sun, 14 Apr 2019 21:05:37 +0100 Subject: [PATCH 65/90] Don't drop items into the world if BlockPlaceEvent is cancelled (Fixes #1970) --- ...-into-the-world-if-BlockPlaceEvent-i.patch | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Spigot-Server-Patches/0382-Don-t-drop-items-into-the-world-if-BlockPlaceEvent-i.patch diff --git a/Spigot-Server-Patches/0382-Don-t-drop-items-into-the-world-if-BlockPlaceEvent-i.patch b/Spigot-Server-Patches/0382-Don-t-drop-items-into-the-world-if-BlockPlaceEvent-i.patch new file mode 100644 index 000000000000..931808f6c0a0 --- /dev/null +++ b/Spigot-Server-Patches/0382-Don-t-drop-items-into-the-world-if-BlockPlaceEvent-i.patch @@ -0,0 +1,38 @@ +From f560ea0c9401e8a2d36c3d01bf9a7084c867bf70 Mon Sep 17 00:00:00 2001 +From: Shane Freeder +Date: Sun, 14 Apr 2019 20:59:16 +0100 +Subject: [PATCH] Don't drop items into the world if BlockPlaceEvent is + cancelled + + +diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java +index 53e0688d96..c5f5fa4e74 100644 +--- a/src/main/java/net/minecraft/server/ItemStack.java ++++ b/src/main/java/net/minecraft/server/ItemStack.java +@@ -187,12 +187,15 @@ public final class ItemStack { + } + } + } ++ world.captureDrops = new java.util.ArrayList<>(); // Paper - Don't drop items if block place is cancelled + EnumInteractionResult enuminteractionresult = this.getItem().a(entityhuman, world, blockposition, enumhand, enumdirection, f, f1, f2); + int newData = this.getData(); + int newCount = this.getCount(); + this.setCount(oldCount); + this.setData(oldData); + world.captureBlockStates = false; ++ List drops = world.captureDrops; // Paper - Don't drop items if block place is cancelled ++ world.captureDrops = null; // Paper - Don't drop items if block place is cancelled + if (enuminteractionresult == EnumInteractionResult.SUCCESS && world.captureTreeGeneration && world.capturedBlockStates.size() > 0) { + world.captureTreeGeneration = false; + Location location = new Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()); +@@ -254,6 +257,7 @@ public final class ItemStack { + this.setData(newData); + this.setCount(newCount); + } ++ if (drops != null) drops.forEach(world::addEntity); // Paper - Don't drop items if block place is cancelled + + for (Map.Entry e : world.capturedTileEntities.entrySet()) { + world.setTileEntity(e.getKey(), e.getValue()); +-- +2.21.0 + From f59f630b7bc58c6b8ef6f4e32642c5cdc8586a5e Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Sun, 2 Jun 2019 21:44:15 -0500 Subject: [PATCH 66/90] Backport some fixes from newer versions MC-114618 EntityAreaEffectCloud negative size fix Option to prevent players from moving into unloaded chunks Fixes GH-2114 --- ...tityAreaEffectCloud-from-going-negat.patch | 43 ++++++++++++ ...event-players-from-moving-into-unloa.patch | 69 +++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 Spigot-Server-Patches/0383-MC-114618-Fix-EntityAreaEffectCloud-from-going-negat.patch create mode 100644 Spigot-Server-Patches/0384-Add-option-to-prevent-players-from-moving-into-unloa.patch diff --git a/Spigot-Server-Patches/0383-MC-114618-Fix-EntityAreaEffectCloud-from-going-negat.patch b/Spigot-Server-Patches/0383-MC-114618-Fix-EntityAreaEffectCloud-from-going-negat.patch new file mode 100644 index 000000000000..affb67bc230f --- /dev/null +++ b/Spigot-Server-Patches/0383-MC-114618-Fix-EntityAreaEffectCloud-from-going-negat.patch @@ -0,0 +1,43 @@ +From 14567b0450b943b00f8a36375b813f5efd73f4d8 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +Date: Sun, 2 Jun 2019 21:12:42 -0500 +Subject: [PATCH] MC-114618 - Fix EntityAreaEffectCloud from going negative + + +diff --git a/src/main/java/net/minecraft/server/EntityAreaEffectCloud.java b/src/main/java/net/minecraft/server/EntityAreaEffectCloud.java +index ec579e7f1..9e5da2a0f 100644 +--- a/src/main/java/net/minecraft/server/EntityAreaEffectCloud.java ++++ b/src/main/java/net/minecraft/server/EntityAreaEffectCloud.java +@@ -174,6 +174,12 @@ public class EntityAreaEffectCloud extends Entity { + super.B_(); + boolean flag = this.q(); + float f = this.getRadius(); ++ // Paper start - fix MC-114618 ++ if (f < 0.5F) { ++ this.die(); ++ return; ++ } ++ // Paper end + + if (this.world.isClientSide) { + EnumParticle enumparticle = this.getParticle(); +@@ -253,10 +259,12 @@ public class EntityAreaEffectCloud extends Entity { + + if (this.radiusPerTick != 0.0F) { + f += this.radiusPerTick; +- if (f < 0.5F) { +- this.die(); +- return; +- } ++ // Paper start - moved up - fix MC-114618 ++ //if (f < 0.5F) { ++ // this.die(); ++ // return; ++ //} ++ // Paper end + + this.setRadius(f); + } +-- +2.21.0 + diff --git a/Spigot-Server-Patches/0384-Add-option-to-prevent-players-from-moving-into-unloa.patch b/Spigot-Server-Patches/0384-Add-option-to-prevent-players-from-moving-into-unloa.patch new file mode 100644 index 000000000000..14f2fff2f08c --- /dev/null +++ b/Spigot-Server-Patches/0384-Add-option-to-prevent-players-from-moving-into-unloa.patch @@ -0,0 +1,69 @@ +From 252d777181440ac9c14bbbb85a26bcc42f498fb2 Mon Sep 17 00:00:00 2001 +From: Gabriele C +Date: Mon, 22 Oct 2018 17:34:10 +0200 +Subject: [PATCH] Add option to prevent players from moving into unloaded + chunks #1551 + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index 319b5b95d..897bb49b4 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -593,4 +593,10 @@ public class PaperWorldConfig { + this.villageSiegesEnabled = getBoolean("game-mechanics.village-sieges-enabled", this.villageSiegesEnabled); + log("Village sieges are " + (this.villageSiegesEnabled ? "enabled" : "disabled")); + } ++ ++ public boolean preventMovingIntoUnloadedChunks = false; ++ private void preventMovingIntoUnloadedChunks() { ++ preventMovingIntoUnloadedChunks = getBoolean("prevent-moving-into-unloaded-chunks", false); ++ log("Prevent players from moving into unloaded chunks: " + (this.preventMovingIntoUnloadedChunks ? "enabled" : "disabled")); ++ } + } +diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +index 8c20bcd14..59d526329 100644 +--- a/src/main/java/net/minecraft/server/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/PlayerConnection.java +@@ -343,6 +343,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { + } + speed *= 2f; // TODO: Get the speed of the vehicle instead of the player + ++ // Paper start - Prevent moving into unloaded chunks ++ if (player.world.paperConfig.preventMovingIntoUnloadedChunks && !worldserver.isChunkLoaded((int) Math.floor(packetplayinvehiclemove.getX()) >> 4, (int) Math.floor(packetplayinvehiclemove.getZ()) >> 4, false)) { ++ this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity)); ++ return; ++ } ++ // Paper end ++ + if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && (!this.minecraftServer.R() || !this.minecraftServer.Q().equals(entity.getName()))) { // Spigot + // CraftBukkit end + PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getName(), this.player.getName(), Double.valueOf(d6), Double.valueOf(d7), Double.valueOf(d8)); +@@ -539,9 +546,9 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { + double d1 = this.player.locY; + double d2 = this.player.locZ; + double d3 = this.player.locY; +- double d4 = packetplayinflying.a(this.player.locX); ++ double d4 = packetplayinflying.a(this.player.locX); double toX = d4; // Paper - OBFHELPER + double d5 = packetplayinflying.b(this.player.locY); +- double d6 = packetplayinflying.c(this.player.locZ); ++ double d6 = packetplayinflying.c(this.player.locZ); double toZ = d6; // Paper - OBFHELPER + float f = packetplayinflying.a(this.player.yaw); + float f1 = packetplayinflying.b(this.player.pitch); + double d7 = d4 - this.l; +@@ -581,6 +588,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { + speed = player.abilities.walkSpeed * 10f; + } + ++ // Paper start - Prevent moving into unloaded chunks ++ if (player.world.paperConfig.preventMovingIntoUnloadedChunks && (this.player.locX != toX || this.player.locZ != toZ) && !worldserver.isChunkLoaded((int) Math.floor(toX) >> 4, (int) Math.floor(toZ) >> 4, false)) { ++ this.internalTeleport(this.player.locX, this.player.locY, this.player.locZ, this.player.yaw, this.player.pitch, Collections.emptySet()); ++ return; ++ } ++ // Paper end ++ + if (!this.player.L() && (!this.player.x().getGameRules().getBoolean("disableElytraMovementCheck") || !this.player.cP())) { + float f2 = this.player.cP() ? 300.0F : 100.0F; + +-- +2.21.0 + From cf582da30c7169cbc93d2a6c8f7d8ae949db8070 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Mon, 24 Jun 2019 05:58:10 -0700 Subject: [PATCH 67/90] Anti-Xray improvements (#2226) --- Spigot-Server-Patches/0235-Anti-Xray.patch | 47 +++++++++++++--------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/Spigot-Server-Patches/0235-Anti-Xray.patch b/Spigot-Server-Patches/0235-Anti-Xray.patch index 219c94908ad0..1fc6deaa2e68 100644 --- a/Spigot-Server-Patches/0235-Anti-Xray.patch +++ b/Spigot-Server-Patches/0235-Anti-Xray.patch @@ -1,4 +1,4 @@ -From cc816d3a76029cb78e56a85a0d040a2789f7a91e Mon Sep 17 00:00:00 2001 +From 43881865d6d00ffa28c426548fb6f4ff0a0839b4 Mon Sep 17 00:00:00 2001 From: stonar96 Date: Thu, 21 Sep 2017 00:38:47 +0200 Subject: [PATCH] Anti-Xray @@ -91,13 +91,15 @@ index 0000000000..6833cfad25 +} diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java new file mode 100644 -index 0000000000..2dc0655a93 +index 0000000000..558188fa1d --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java -@@ -0,0 +1,640 @@ +@@ -0,0 +1,647 @@ +package com.destroystokyo.paper.antixray; + ++import java.util.ArrayList; +import java.util.HashSet; ++import java.util.List; +import java.util.Set; +import java.util.concurrent.Executors; +import java.util.concurrent.ExecutorService; @@ -153,7 +155,10 @@ index 0000000000..2dc0655a93 + executorService = null; + } + ++ List toObfuscate; ++ + if (engineMode == EngineMode.HIDE) { ++ toObfuscate = paperWorldConfig.hiddenBlocks; + predefinedBlockData = null; + predefinedBlockDataStone = new IBlockData[] {Blocks.STONE.getBlockData()}; + predefinedBlockDataNetherrack = new IBlockData[] {Blocks.NETHERRACK.getBlockData()}; @@ -164,12 +169,14 @@ index 0000000000..2dc0655a93 + predefinedBlockDataBitsNetherrackGlobal = new int[] {Block.REGISTRY_ID.getId(Blocks.NETHERRACK.getBlockData())}; + predefinedBlockDataBitsEndStoneGlobal = new int[] {Block.REGISTRY_ID.getId(Blocks.END_STONE.getBlockData())}; + } else { ++ toObfuscate = new ArrayList<>(paperWorldConfig.replacementBlocks); + Set predefinedBlockDataSet = new HashSet(); + + for (Object id : paperWorldConfig.hiddenBlocks) { + Block block = Block.getByName(String.valueOf(id)); + + if (block != null && !block.isTileEntity()) { ++ toObfuscate.add(id); + predefinedBlockDataSet.add(block.getBlockData()); + } + } @@ -192,7 +199,7 @@ index 0000000000..2dc0655a93 + predefinedBlockDataBitsEndStoneGlobal = null; + } + -+ for (Object id : (engineMode == EngineMode.HIDE) ? paperWorldConfig.hiddenBlocks : paperWorldConfig.replacementBlocks) { ++ for (Object id : toObfuscate) { + Block block = Block.getByName(String.valueOf(id)); + + if (block != null) { @@ -1008,7 +1015,7 @@ index 0000000000..8ea2beb597 + } +} diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 663a41e9e7..0226b96f30 100644 +index 663a41e9e7..0226b96f30 100755 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -158,7 +158,7 @@ public class Chunk { @@ -1039,7 +1046,7 @@ index 663a41e9e7..0226b96f30 100644 this.initLighting(); } diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 14f88e91db..bcce5e8b7e 100644 +index 14f88e91db..bcce5e8b7e 100755 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -416,7 +416,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { @@ -1052,7 +1059,7 @@ index 14f88e91db..bcce5e8b7e 100644 NibbleArray nibblearray = new NibbleArray(nbttagcompound1.getByteArray("Data")); NibbleArray nibblearray1 = nbttagcompound1.hasKeyOfType("Add", 7) ? new NibbleArray(nbttagcompound1.getByteArray("Add")) : null; diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index afdc4a779a..aae227fdb0 100644 +index afdc4a779a..aae227fdb0 100755 --- a/src/main/java/net/minecraft/server/ChunkSection.java +++ b/src/main/java/net/minecraft/server/ChunkSection.java @@ -9,9 +9,15 @@ public class ChunkSection { @@ -1092,7 +1099,7 @@ index afdc4a779a..aae227fdb0 100644 int xx = i & 15; int yy = (i >> 8) & 15; diff --git a/src/main/java/net/minecraft/server/DataBits.java b/src/main/java/net/minecraft/server/DataBits.java -index fa0fd8a9c8..401dc7cdc5 100644 +index fa0fd8a9c8..401dc7cdc5 100755 --- a/src/main/java/net/minecraft/server/DataBits.java +++ b/src/main/java/net/minecraft/server/DataBits.java @@ -51,6 +51,7 @@ public class DataBits { @@ -1104,7 +1111,7 @@ index fa0fd8a9c8..401dc7cdc5 100644 return this.a; } diff --git a/src/main/java/net/minecraft/server/DataPalette.java b/src/main/java/net/minecraft/server/DataPalette.java -index 5765b25888..d522611ecb 100644 +index 5765b25888..d522611ecb 100755 --- a/src/main/java/net/minecraft/server/DataPalette.java +++ b/src/main/java/net/minecraft/server/DataPalette.java @@ -4,8 +4,10 @@ import javax.annotation.Nullable; @@ -1119,7 +1126,7 @@ index 5765b25888..d522611ecb 100644 IBlockData a(int i); diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java -index 2cb462b8e3..67784b4a67 100644 +index 2cb462b8e3..67784b4a67 100755 --- a/src/main/java/net/minecraft/server/DataPaletteBlock.java +++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java @@ -2,22 +2,55 @@ package net.minecraft.server; @@ -1227,7 +1234,7 @@ index 2cb462b8e3..67784b4a67 100644 } diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java -index d0b67d8fd6..eeaa625d2f 100644 +index d0b67d8fd6..eeaa625d2f 100755 --- a/src/main/java/net/minecraft/server/EntityFallingBlock.java +++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java @@ -74,6 +74,7 @@ public class EntityFallingBlock extends Entity { @@ -1247,7 +1254,7 @@ index d0b67d8fd6..eeaa625d2f 100644 if (block instanceof BlockFalling) { ((BlockFalling) block).a(this.world, blockposition, this.block, iblockdata); diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java -index e148901e53..61fbdeb6ac 100644 +index e148901e53..61fbdeb6ac 100755 --- a/src/main/java/net/minecraft/server/Explosion.java +++ b/src/main/java/net/minecraft/server/Explosion.java @@ -228,6 +228,7 @@ public class Explosion { @@ -1259,7 +1266,7 @@ index e148901e53..61fbdeb6ac 100644 if (flag) { double d0 = (double) ((float) blockposition.getX() + this.world.random.nextFloat()); diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index d583cced66..2eddb68d7b 100644 +index d583cced66..2eddb68d7b 100755 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java @@ -62,7 +62,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { @@ -1358,7 +1365,7 @@ index d583cced66..2eddb68d7b 100644 public QueuedPacket(Packet packet, GenericFutureListener>... agenericfuturelistener) { this.a = packet; diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java -index c1273e988e..d71734df81 100644 +index c1273e988e..d71734df81 100755 --- a/src/main/java/net/minecraft/server/PacketDataSerializer.java +++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java @@ -33,6 +33,7 @@ public class PacketDataSerializer extends ByteBuf { @@ -1370,7 +1377,7 @@ index c1273e988e..d71734df81 100644 for (int j = 1; j < 5; ++j) { if ((i & -1 << j * 7) == 0) { diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -index d16669bcc3..306a6b7cd3 100644 +index d16669bcc3..306a6b7cd3 100755 --- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java @@ -8,6 +8,10 @@ import java.util.Iterator; @@ -1463,7 +1470,7 @@ index d16669bcc3..306a6b7cd3 100644 if (flag) { packetdataserializer.writeBytes(chunksection.getSkyLightArray().asBytes()); diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 48a008e0a7..395386f295 100644 +index 48a008e0a7..395386f295 100755 --- a/src/main/java/net/minecraft/server/PlayerChunk.java +++ b/src/main/java/net/minecraft/server/PlayerChunk.java @@ -134,6 +134,8 @@ public class PlayerChunk { @@ -1493,7 +1500,7 @@ index 48a008e0a7..395386f295 100644 } else { this.a((Packet) (new PacketPlayOutMultiBlockChange(this.dirtyCount, this.dirtyBlocks, this.chunk))); diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java -index a49b5c81a8..5ec7f5819f 100644 +index a49b5c81a8..5ec7f5819f 100755 --- a/src/main/java/net/minecraft/server/PlayerInteractManager.java +++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java @@ -200,6 +200,8 @@ public class PlayerInteractManager { @@ -1506,7 +1513,7 @@ index a49b5c81a8..5ec7f5819f 100644 public void a(BlockPosition blockposition) { diff --git a/src/main/java/net/minecraft/server/RegistryBlockID.java b/src/main/java/net/minecraft/server/RegistryBlockID.java -index 03894df54c..76f6f35bb9 100644 +index 03894df54c..76f6f35bb9 100755 --- a/src/main/java/net/minecraft/server/RegistryBlockID.java +++ b/src/main/java/net/minecraft/server/RegistryBlockID.java @@ -47,6 +47,7 @@ public class RegistryBlockID implements Registry { @@ -1518,7 +1525,7 @@ index 03894df54c..76f6f35bb9 100644 return this.a.size(); } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 90f946e57a..ea67b61b2b 100644 +index 90f946e57a..ea67b61b2b 100755 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -35,6 +35,8 @@ import org.bukkit.generator.ChunkGenerator; @@ -1595,5 +1602,5 @@ index 9942f0c750..2da6edc63e 100644 } } -- -2.18.0 +2.21.0 From 0626875a59227680a0a7036c7a1bb8fb0f4f21ff Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Sat, 29 Jun 2019 21:00:16 -0700 Subject: [PATCH 68/90] Queue log events when log buffer is full This should resolve out of order logs when the buffer is full --- ...334-Use-asynchronous-Log4j-2-loggers.patch | 31 ++++++++++++++++--- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/Spigot-Server-Patches/0334-Use-asynchronous-Log4j-2-loggers.patch b/Spigot-Server-Patches/0334-Use-asynchronous-Log4j-2-loggers.patch index fe727e67caec..eb32ec60f802 100644 --- a/Spigot-Server-Patches/0334-Use-asynchronous-Log4j-2-loggers.patch +++ b/Spigot-Server-Patches/0334-Use-asynchronous-Log4j-2-loggers.patch @@ -1,11 +1,11 @@ -From 03f5b3714e9388890e9261da44070032119ae5ad Mon Sep 17 00:00:00 2001 +From 278d18093d088586a50ef35a69393e8266091de9 Mon Sep 17 00:00:00 2001 From: Minecrell Date: Tue, 17 Jul 2018 16:42:17 +0200 Subject: [PATCH] Use asynchronous Log4j 2 loggers diff --git a/pom.xml b/pom.xml -index 7fa70efe8..132843880 100644 +index 7fa70efe80..132843880a 100644 --- a/pom.xml +++ b/pom.xml @@ -110,6 +110,14 @@ @@ -23,13 +23,34 @@ index 7fa70efe8..132843880 100644 junit +diff --git a/src/main/java/com/destroystokyo/paper/log/LogFullPolicy.java b/src/main/java/com/destroystokyo/paper/log/LogFullPolicy.java +new file mode 100644 +index 0000000000..dceb121bcc +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/log/LogFullPolicy.java +@@ -0,0 +1,13 @@ ++package com.destroystokyo.paper.log; ++ ++import org.apache.logging.log4j.Level; ++import org.apache.logging.log4j.core.async.AsyncQueueFullPolicy; ++import org.apache.logging.log4j.core.async.EventRoute; ++ ++public final class LogFullPolicy implements AsyncQueueFullPolicy { ++ ++ @Override ++ public EventRoute getRoute(final long backgroundThreadId, final Level level) { ++ return EventRoute.ENQUEUE; ++ } ++} diff --git a/src/main/resources/log4j2.component.properties b/src/main/resources/log4j2.component.properties new file mode 100644 -index 000000000..ee7c90784 +index 0000000000..ee683079c1 --- /dev/null +++ b/src/main/resources/log4j2.component.properties -@@ -0,0 +1 @@ +@@ -0,0 +1,2 @@ +Log4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector ++log4j2.AsyncQueueFullPolicy=com.destroystokyo.paper.log.LogFullPolicy +\ No newline at end of file -- -2.18.0 +2.22.0 From 77cce8236ff09d52730b66c7a146265ce3415185 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Sun, 14 Jul 2019 13:37:14 -0500 Subject: [PATCH 69/90] Backport map maker workflow fix for #2221 --- ...tityAreaEffectCloud-from-going-negat.patch | 25 +++---------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/Spigot-Server-Patches/0383-MC-114618-Fix-EntityAreaEffectCloud-from-going-negat.patch b/Spigot-Server-Patches/0383-MC-114618-Fix-EntityAreaEffectCloud-from-going-negat.patch index affb67bc230f..573617286bf4 100644 --- a/Spigot-Server-Patches/0383-MC-114618-Fix-EntityAreaEffectCloud-from-going-negat.patch +++ b/Spigot-Server-Patches/0383-MC-114618-Fix-EntityAreaEffectCloud-from-going-negat.patch @@ -1,11 +1,11 @@ -From 14567b0450b943b00f8a36375b813f5efd73f4d8 Mon Sep 17 00:00:00 2001 +From b2d8b2c49ad9f2ba6155e0d668c9dab0e446138c Mon Sep 17 00:00:00 2001 From: William Blake Galbreath Date: Sun, 2 Jun 2019 21:12:42 -0500 Subject: [PATCH] MC-114618 - Fix EntityAreaEffectCloud from going negative diff --git a/src/main/java/net/minecraft/server/EntityAreaEffectCloud.java b/src/main/java/net/minecraft/server/EntityAreaEffectCloud.java -index ec579e7f1..9e5da2a0f 100644 +index ec579e7f..836d368b 100644 --- a/src/main/java/net/minecraft/server/EntityAreaEffectCloud.java +++ b/src/main/java/net/minecraft/server/EntityAreaEffectCloud.java @@ -174,6 +174,12 @@ public class EntityAreaEffectCloud extends Entity { @@ -13,7 +13,7 @@ index ec579e7f1..9e5da2a0f 100644 boolean flag = this.q(); float f = this.getRadius(); + // Paper start - fix MC-114618 -+ if (f < 0.5F) { ++ if (f < 0.0F) { + this.die(); + return; + } @@ -21,23 +21,6 @@ index ec579e7f1..9e5da2a0f 100644 if (this.world.isClientSide) { EnumParticle enumparticle = this.getParticle(); -@@ -253,10 +259,12 @@ public class EntityAreaEffectCloud extends Entity { - - if (this.radiusPerTick != 0.0F) { - f += this.radiusPerTick; -- if (f < 0.5F) { -- this.die(); -- return; -- } -+ // Paper start - moved up - fix MC-114618 -+ //if (f < 0.5F) { -+ // this.die(); -+ // return; -+ //} -+ // Paper end - - this.setRadius(f); - } -- -2.21.0 +2.22.0 From 1dfc5fe0cbd65fb8a98005026c81f8d9eb3125bb Mon Sep 17 00:00:00 2001 From: nothub <48992448+nothub@users.noreply.github.com> Date: Mon, 24 May 2021 21:34:27 +0200 Subject: [PATCH 70/90] shellcheck --- scripts/testServer.sh | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/scripts/testServer.sh b/scripts/testServer.sh index 0a7cfbf25e1c..b31655269424 100755 --- a/scripts/testServer.sh +++ b/scripts/testServer.sh @@ -8,14 +8,15 @@ minecraftversion=$(cat "$workdir/BuildData/info.json" | grep minecraftVersion | decompiledir="$workdir/Minecraft/$minecraftversion" gitcmd="git -c commit.gpgsign=false" + # # FUNCTIONS # -. $basedir/scripts/functions.sh +. "${basedir}"/scripts/functions.sh updateTest() { paperstash - $gitcmd reset --hard origin/master + ${gitcmd} reset --hard origin/master paperunstash } @@ -24,20 +25,22 @@ papertestdir="${PAPER_TEST_DIR:-$workdir/test-server}" mkdir -p "$papertestdir" cd "$papertestdir" + # # SKELETON CHECK # -if [ ! -d .git ]; then - $gitcmd init - $gitcmd remote add origin ${PAPER_TEST_SKELETON:-https://github.com/PaperMC/PaperTestServer} - $gitcmd fetch origin + +if [[ ! -d .git ]]; then + ${gitcmd} init + ${gitcmd} remote add origin ${PAPER_TEST_SKELETON:-git@github.com:PaperMC/PaperTestServer.git} + ${gitcmd} fetch origin updateTest -elif [ "$2" == "update" ] || [ "$3" == "update" ]; then +elif [[ "$2" == "update" ]] || [[ "$3" == "update" ]]; then updateTest fi -if [ ! -f server.properties ] || [ ! -d plugins ]; then +if [[ ! -f server.properties ]] || [[ ! -d plugins ]]; then echo " " echo " Checking out Test Server Skeleton" updateTest @@ -60,12 +63,13 @@ if [ -z "$(grep true eula.txt 2>/dev/null)" ]; then echo "eula=true" > eula.txt fi + # # JAR CHECK # jar="$basedir/Paper-Server/target/paper-${minecraftversion}.jar" -if [ ! -f "$jar" ] || [ "$2" == "build" ] || [ "$3" == "build" ]; then +if [[ ! -f "$jar" ]] || [[ "$2" == "build" ]] || [[ "$3" == "build" ]]; then ( echo "Building Paper" cd "$basedir" @@ -85,24 +89,25 @@ baseargs="$baseargs -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=50 -XX baseargs="$baseargs -XX:InitiatingHeapOccupancyPercent=10 -XX:G1MixedGCLiveThresholdPercent=50 " baseargs="$baseargs -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5100" -cmd="java ${PAPER_TEST_BASE_JVM_ARGS:-$baseargs} ${PAPER_TEST_EXTRA_JVM_ARGS} -jar $jar" +cmd="java ${PAPER_TEST_BASE_JVM_ARGS:-$baseargs} ${PAPER_TEST_EXTRA_JVM_ARGS} -jar \"$jar\"" screen_command="screen -DURS papertest $cmd" tmux_command="tmux new-session -A -s Paper -n 'Paper Test' -c '$(pwd)' '$cmd'" + # # MULTIPLEXER CHOICE # multiplex=${PAPER_TEST_MULTIPLEXER} -if [ "$multiplex" == "screen" ]; then +if [[ "$multiplex" == "screen" ]]; then if command -v "screen" >/dev/null 2>&1 ; then cmd="$screen_command" else echo "screen not found" exit 1 fi -elif [ "$multiplex" == "tmux" ] ; then +elif [[ "$multiplex" == "tmux" ]] ; then if command -v "tmux" >/dev/null 2>&1 ; then cmd="$tmux_command" else @@ -120,12 +125,13 @@ else fi fi + # # START / LOG # -if [ ! -z "$PAPER_TEST_COMMAND_WRAPPER" ]; then - $PAPER_TEST_COMMAND_WRAPPER $cmd +if [[ ! -z "$PAPER_TEST_COMMAND_WRAPPER" ]]; then + ${PAPER_TEST_COMMAND_WRAPPER} ${cmd} else echo "Running command: $cmd" echo "In directory: $(pwd)" From 36644c984a46da9c1ff6c50e1c950d6fb36dd0ed Mon Sep 17 00:00:00 2001 From: nothub <48992448+nothub@users.noreply.github.com> Date: Mon, 24 May 2021 21:34:54 +0200 Subject: [PATCH 71/90] skeleton origin --- scripts/testServer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/testServer.sh b/scripts/testServer.sh index b31655269424..b0f82a54e2b5 100755 --- a/scripts/testServer.sh +++ b/scripts/testServer.sh @@ -33,7 +33,7 @@ cd "$papertestdir" if [[ ! -d .git ]]; then ${gitcmd} init - ${gitcmd} remote add origin ${PAPER_TEST_SKELETON:-git@github.com:PaperMC/PaperTestServer.git} + ${gitcmd} remote add origin ${PAPER_TEST_SKELETON:-git@github.com:nothub/paper-1.12.2-test-server.git} ${gitcmd} fetch origin updateTest elif [[ "$2" == "update" ]] || [[ "$3" == "update" ]]; then From d4e2f15570e72ed283ca1e76da166116342c7c16 Mon Sep 17 00:00:00 2001 From: nothub <48992448+nothub@users.noreply.github.com> Date: Mon, 24 May 2021 21:54:16 +0200 Subject: [PATCH 72/90] readme, contrib --- CONTRIB-TLDR.md | 81 +++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 43 +++++--------------------- 2 files changed, 88 insertions(+), 36 deletions(-) create mode 100644 CONTRIB-TLDR.md diff --git a/CONTRIB-TLDR.md b/CONTRIB-TLDR.md new file mode 100644 index 000000000000..6221a424060b --- /dev/null +++ b/CONTRIB-TLDR.md @@ -0,0 +1,81 @@ +#### compile + +To compile Paper, you need __JDK 8__, __maven__, and an internet connection. Clone this repo, run `./paper jar` from __ +bash__, grab `paperclip.jar`. + +#### build jar + +(in project root!) +`./paper jar` + +#### create a patch + +move to `./Paper-Server` or `./Paper-API` +work on files in (probably) `Paper-Server` +to finalize patch +(in the sub repo folder!) +`git add .` +`git commit` + +#### convert committed changes to patch + +(in project root!) +`./paper rebuild` +`./paper jar` + +#### run test server + +(in project root!) +`./paper test` + +#### prepare pull request + +when everything is fine: +(in project root!) +`git checkout -b antigravity-generator-patch` +`git add Spigot-Server-Patches/0420-antigravity-generator-patch.patch` +`git commit` +`git push --set-upstream origin antigravity-generator-patch` + +#### edit patches (continue working on saved state) + +(in project root!) +run `./paper edit server`, for the patch you want to edit, replace the prefix `pick` with `edit`. +save and close the file, `./Paper-Server` is prepared now. +do code changes and when done, run: `./paper edit continue` +see [CONTRIBUTING.md](https://github.com/nothub/paper-1.12.2/blob/master/CONTRIBUTING.md) Modifying Patches -> Method 1 + +#### patch untouched vanilla code + +if you want to patch code that is not yet listed in the Paper-Server subrepo: +go to `./work/Minecraft/1.12.2/net/minecraft/server`, check for the thing that need patching +open `./scripts/importmcdev.sh` and add the corresponding import to the list +in project root, run: `./paper patch` +the needed classes should be listed in `./Paper-Server` now +for everything advanced, read [CONTRIBUTING.md](https://github.com/nothub/paper-1.12.2/blob/master/CONTRIBUTING.md) + +#### sha1 information is lacking or useless / could not build fake ancestor + +``` +error: sha1 information is lacking or useless (src/main/java/net/minecraft/server/PathfinderGoalSelector.java). +error: could not build fake ancestor +hint: Use 'git am --show-current-patch=diff' to see the failed patch +Patch failed at 0153 configurable pathfinder goal selection delay +When you have resolved this problem, run "git am --continue". +If you prefer to skip this patch, run "git am --skip" instead. +To restore the original branch and stop patching, run "git am --abort". + Something did not apply cleanly to Paper-Server. + Please review above details and finish the apply then + save the changes with rebuildPatches.sh + + Because you're on Windows you'll need to finish the AM, + rebuild all patches, and then re-run the patch apply again. + Consider using the scripts with Windows Subsystem for Linux. +Failed to apply Paper Patches +Failed to build Paper +``` + +an error with this message (sha1 information is lacking or useless / could not build fake ancestor) is most likely +caused by a missing import in `./scripts/importmcdev.sh`. + +for further info, read: [CONTRIBUTING.md](https://github.com/nothub/paper-1.12.2/blob/master/CONTRIBUTING.md) diff --git a/README.md b/README.md index 07cf3229076f..43995a89b71d 100644 --- a/README.md +++ b/README.md @@ -1,41 +1,12 @@ -Paper [![Build Status](https://destroystokyo.com/ci/job/Paper/badge/icon)](https://destroystokyo.com/ci/job/Paper/) -=========== +## paper-1.12.2 -High performance Spigot fork that aims to fix gameplay and mechanics inconsistencies. +lazy fork of [Paper](https://github.com/PaperMC/Paper/tree/ver/1.12.2) for mc version 1.12.2 -[IRC Support and Project Discussion](http://irc.spi.gt/iris/?channels=paper) +#### contributing -[Discord](https://discord.gg/jETyjUw) +[CONTRIB-TLDR.md](https://github.com/nothub/paper-1.12.2/blob/master/CONTRIB-TLDR.md) +#### thanks -Documentation ------- -Access the Paper docs here: [paper.readthedocs.io](https://paper.readthedocs.io/) -Access the Paper API javadocs here: [destroystokyo.com/javadocs](https://destroystokyo.com/javadocs/) - -How To (Server Admins) ------- -Paperclip is a jar file that you can download and run just like a normal jar file. - -Download a copy of paperclip.jar from [our build server, here](https://destroystokyo.com/ci/job/PaperSpigot/). - -Run the Paperclip jar directly from your server. Just like old times - -Paper requires [**Java 8**](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) or above. - -How To (Compiling Jar From Source) ------- -To compile Paper, you need JDK 8, maven, and an internet connection. - -Clone this repo, run `./paper jar` from *bash*, get files. - -How To (Pull Request) ------- -See [Contributing](CONTRIBUTING.md) - -Special Thanks To: -------------- - -![YourKit-Logo](https://www.yourkit.com/images/yklogo.png) - -[YourKit](http://www.yourkit.com/), makers of the outstanding java profiler, support open source projects of all kinds with their full featured [Java](https://www.yourkit.com/java/profiler/index.jsp) and [.NET](https://www.yourkit.com/.net/profiler/index.jsp) application profilers. We thank them for granting Paper an OSS license so that we can make our software the best it can be. +[Paper](https://github.com/PaperMC/Paper/tree/ver/1.12.2), [Bukkit](https://bukkit.org) +and [Spigot](https://spigotmc.org) <3 From a254fdce92ffab01903d0416bd1af5a65323bc41 Mon Sep 17 00:00:00 2001 From: nothub <48992448+nothub@users.noreply.github.com> Date: Mon, 24 May 2021 22:05:32 +0200 Subject: [PATCH 73/90] metrics opt in --- .../0385-metrics-opt-in.patch | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Spigot-Server-Patches/0385-metrics-opt-in.patch diff --git a/Spigot-Server-Patches/0385-metrics-opt-in.patch b/Spigot-Server-Patches/0385-metrics-opt-in.patch new file mode 100644 index 000000000000..315241b66ae1 --- /dev/null +++ b/Spigot-Server-Patches/0385-metrics-opt-in.patch @@ -0,0 +1,22 @@ +From cb8685c24d0c5f27458066bb2fe06a1689a94d6c Mon Sep 17 00:00:00 2001 +From: nothub <48992448+nothub@users.noreply.github.com> +Date: Mon, 24 May 2021 22:02:48 +0200 +Subject: [PATCH] metrics-opt-in + + +diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java +index e257d6b3..c3230f5e 100644 +--- a/src/main/java/com/destroystokyo/paper/Metrics.java ++++ b/src/main/java/com/destroystokyo/paper/Metrics.java +@@ -555,7 +555,7 @@ public class Metrics { + if (!config.isSet("serverUuid")) { + + // Add default values +- config.addDefault("enabled", true); ++ config.addDefault("enabled", false); + // Every server gets it's unique random id. + config.addDefault("serverUuid", UUID.randomUUID().toString()); + // Should failed request be logged? +-- +2.25.1 + From 6c71df1039691d0962baf93cf4d9fee30e1b366e Mon Sep 17 00:00:00 2001 From: nothub <48992448+nothub@users.noreply.github.com> Date: Mon, 24 May 2021 22:09:30 +0200 Subject: [PATCH 74/90] dependabot --- .github/dependabot.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000000..db4a20b1cc80 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,16 @@ +version: 2 +updates: + - package-ecosystem: "maven" + directory: "/" + schedule: + interval: "daily" + time: "12:00" + timezone: "Europe/Berlin" + assignees: + - "nothub" + reviewers: + - "nothub" + commit-message: + prefix: "maven" + include: "scope" + From 29e615b2617fd342c9389f034d2194ce9c95b841 Mon Sep 17 00:00:00 2001 From: nothub <48992448+nothub@users.noreply.github.com> Date: Mon, 24 May 2021 22:27:17 +0200 Subject: [PATCH 75/90] github ci --- .github/workflows/release.yml | 54 +++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 38 ++++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000000..a7d9df74f7b3 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,54 @@ +name: release + +on: + push: + tags: + - '*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + + - name: checkout changes + uses: actions/checkout@v2 + + - name: get commit info + run: echo "SHA=$GITHUB_SHA" >> $GITHUB_ENV + + - name: prepare java 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + + - name: prepare depdendency cache + uses: actions/cache@v2 + with: + path: ~/.m2 + key: '${{ runner.os }}-m2-${{ hashFiles(''**/pom.xml'') }}' + restore-keys: '${{ runner.os }}-m2' + + - name: prepare git config + run: git config --global user.name "CI Slave Bot" + + - name: build paper + run: ./paper jar + + - name: prepare release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + body: automated release at commit ${{ env.SHA }} + draft: false + prerelease: false + + - name: upload release + uses: csexton/release-asset-action@v2 + with: + file: "paperclip.jar" + github-token: ${{ secrets.GITHUB_TOKEN }} + release-url: ${{ steps.create_release.outputs.upload_url }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000000..6709be8bd466 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,38 @@ +name: test + +on: + push: + branches: + - '*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + + - name: checkout changes + uses: actions/checkout@v2 + + - name: get commit info + run: echo "SHA=$GITHUB_SHA" >> $GITHUB_ENV + + - name: prepare java 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + + - name: prepare depdendency cache + uses: actions/cache@v2 + with: + path: ~/.m2 + key: '${{ runner.os }}-m2-${{ hashFiles(''**/pom.xml'') }}' + restore-keys: '${{ runner.os }}-m2' + + - name: prepare git config + run: git config --global user.name "CI Slave Bot" + + - name: patch paper + run: ./paper patch + + - name: test + run: mvn test --file pom.xml --batch-mode --errors --show-version From 6bd2c7a2351ec66318f4925b2bea9a835030eecf Mon Sep 17 00:00:00 2001 From: nothub <48992448+nothub@users.noreply.github.com> Date: Mon, 24 May 2021 22:42:36 +0200 Subject: [PATCH 76/90] disable ci maven dependency caching --- .github/workflows/release.yml | 7 ------- .github/workflows/test.yml | 7 ------- 2 files changed, 14 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a7d9df74f7b3..d4b3f8e1de1b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,13 +21,6 @@ jobs: with: java-version: 1.8 - - name: prepare depdendency cache - uses: actions/cache@v2 - with: - path: ~/.m2 - key: '${{ runner.os }}-m2-${{ hashFiles(''**/pom.xml'') }}' - restore-keys: '${{ runner.os }}-m2' - - name: prepare git config run: git config --global user.name "CI Slave Bot" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6709be8bd466..014437de9819 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,13 +21,6 @@ jobs: with: java-version: 1.8 - - name: prepare depdendency cache - uses: actions/cache@v2 - with: - path: ~/.m2 - key: '${{ runner.os }}-m2-${{ hashFiles(''**/pom.xml'') }}' - restore-keys: '${{ runner.os }}-m2' - - name: prepare git config run: git config --global user.name "CI Slave Bot" From 1d3ca6196fb13eb644f5006e31bff5f17a364ffd Mon Sep 17 00:00:00 2001 From: nothub <48992448+nothub@users.noreply.github.com> Date: Mon, 24 May 2021 23:07:57 +0200 Subject: [PATCH 77/90] tag release at epoch script --- scripts/release.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 scripts/release.sh diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100755 index 000000000000..9e19090ad677 --- /dev/null +++ b/scripts/release.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "${BASH_SOURCE[0]}")"/.. + +while true; do + read -p "Do you really want to PUBLISH a new RELEASE?" yn + case $yn in + [Yy]*) git tag "$(date +%s)" && git push origin --tags && exit 0 ;; + [Nn]*) echo "Aborted!" ; exit 1 ;; + * ) echo "answer yes or no";; + esac +done From 618705b6554e30cdc92186c6c1eb2bf6a3dd89e9 Mon Sep 17 00:00:00 2001 From: nothub <48992448+nothub@users.noreply.github.com> Date: Mon, 24 May 2021 23:11:42 +0200 Subject: [PATCH 78/90] rename ci jobs --- .github/workflows/release.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d4b3f8e1de1b..feba310b6789 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,7 @@ on: - '*' jobs: - build: + release: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 014437de9819..5d1fb78662f0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,7 +6,7 @@ on: - '*' jobs: - build: + test: runs-on: ubuntu-latest steps: From 64b49df1bfcd38b739a4925fccb12593bbe65d3b Mon Sep 17 00:00:00 2001 From: nothub <48992448+nothub@users.noreply.github.com> Date: Mon, 24 May 2021 23:30:45 +0200 Subject: [PATCH 79/90] map icon limit --- .../0386-map-icon-limit.patch | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Spigot-Server-Patches/0386-map-icon-limit.patch diff --git a/Spigot-Server-Patches/0386-map-icon-limit.patch b/Spigot-Server-Patches/0386-map-icon-limit.patch new file mode 100644 index 000000000000..7dc880d507e6 --- /dev/null +++ b/Spigot-Server-Patches/0386-map-icon-limit.patch @@ -0,0 +1,43 @@ +From 8a6ac673856546d7ca4e5c3313361b6ed96bb3ae Mon Sep 17 00:00:00 2001 +From: nothub <48992448+nothub@users.noreply.github.com> +Date: Mon, 24 May 2021 23:27:47 +0200 +Subject: [PATCH] map-icon-limit + + +diff --git a/src/main/java/net/minecraft/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java +index 59173605..74ca2aa5 100644 +--- a/src/main/java/net/minecraft/server/WorldMap.java ++++ b/src/main/java/net/minecraft/server/WorldMap.java +@@ -10,6 +10,7 @@ import javax.annotation.Nullable; + + // CraftBukkit start + import java.util.UUID; ++import java.util.concurrent.atomic.AtomicInteger; // paper-1.12.2 + + import org.bukkit.craftbukkit.CraftServer; + import org.bukkit.craftbukkit.CraftWorld; +@@ -321,7 +322,10 @@ public class WorldMap extends PersistentBase { + // Paper start + private void addSeenPlayers(java.util.Collection icons) { + org.bukkit.entity.Player player = (org.bukkit.entity.Player) trackee.getBukkitEntity(); ++ AtomicInteger counter = new AtomicInteger(); // paper-1.12.2 + WorldMap.this.decorations.forEach((uuid, mapIcon) -> { ++ counter.getAndIncrement(); // paper-1.12.2 ++ if (counter.get() > 64) return; // paper-1.12.2 + // If this cursor is for a player check visibility with vanish system + org.bukkit.entity.Player other = org.bukkit.Bukkit.getPlayer(uuid); // Spigot + if (other == null || player.canSee(other)) { +@@ -356,8 +360,10 @@ public class WorldMap extends PersistentBase { + java.util.Collection icons = new java.util.ArrayList(); + if (vanillaMaps) addSeenPlayers(icons); // Paper + ++ int counter = 0; // paper-1.12.2 + for ( org.bukkit.map.MapCursor cursor : render.cursors) { + ++ if (++counter > 64) break; // paper-1.12.2 + if (cursor.isVisible()) { + icons.add(new MapIcon(MapIcon.Type.a(cursor.getRawType()), cursor.getX(), cursor.getY(), cursor.getDirection())); + } +-- +2.25.1 + From 2c29cf067ed5326e8b7fbadfdc9f8c70147b372b Mon Sep 17 00:00:00 2001 From: nothub <48992448+nothub@users.noreply.github.com> Date: Mon, 24 May 2021 23:38:02 +0200 Subject: [PATCH 80/90] markdown is hard --- CONTRIB-TLDR.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIB-TLDR.md b/CONTRIB-TLDR.md index 6221a424060b..5855bc5c033b 100644 --- a/CONTRIB-TLDR.md +++ b/CONTRIB-TLDR.md @@ -1,7 +1,7 @@ #### compile -To compile Paper, you need __JDK 8__, __maven__, and an internet connection. Clone this repo, run `./paper jar` from __ -bash__, grab `paperclip.jar`. +To compile Paper, you need __JDK 8__, __maven__, and an internet connection. +Clone this repo, run `./paper jar` from __bash__, grab `paperclip.jar`. #### build jar From 17036c390e3db594b7ecaf3baedc57d7c1ea4f2b Mon Sep 17 00:00:00 2001 From: nothub <48992448+nothub@users.noreply.github.com> Date: Mon, 24 May 2021 23:52:22 +0200 Subject: [PATCH 81/90] make pathfinder selection delay configurable --- ...hfinder-selection-delay-configurable.patch | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Spigot-Server-Patches/0387-pathfinder-selection-delay-configurable.patch diff --git a/Spigot-Server-Patches/0387-pathfinder-selection-delay-configurable.patch b/Spigot-Server-Patches/0387-pathfinder-selection-delay-configurable.patch new file mode 100644 index 000000000000..e33b046318ca --- /dev/null +++ b/Spigot-Server-Patches/0387-pathfinder-selection-delay-configurable.patch @@ -0,0 +1,45 @@ +From aa52612b73d380073aed9f065f723808ee5133b4 Mon Sep 17 00:00:00 2001 +From: nothub <48992448+nothub@users.noreply.github.com> +Date: Mon, 24 May 2021 23:49:44 +0200 +Subject: [PATCH] pathfinder selection delay configurable + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java +index d8b0a8688..5c04e3a9f 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java +@@ -334,4 +334,10 @@ public class PaperConfig { + maxBookTotalSizeMultiplier = 0.98D; + } + } ++ ++ public static int pathfinderGoalSelectionDelay = 9; ++ private static void pathfinderGoalSelectionDelay() { ++ pathfinderGoalSelectionDelay = getInt("settings.pathfinder.goal-selection-delay", pathfinderGoalSelectionDelay); ++ } ++ + } +diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java +index c15961602..089b6b746 100644 +--- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java ++++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java +@@ -6,6 +6,7 @@ import java.util.Set; + import javax.annotation.Nullable; + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; ++import com.destroystokyo.paper.PaperConfig; + + public class PathfinderGoalSelector { + +@@ -14,7 +15,7 @@ public class PathfinderGoalSelector { + private final Set c = Sets.newLinkedHashSet(); + private final MethodProfiler d; + private int e; +- private int f = 3; ++ private int f = PaperConfig.pathfinderGoalSelectionDelay; + private int g; + + public PathfinderGoalSelector(MethodProfiler methodprofiler) { +-- +2.25.1 + From 9f41d9a94014f43bb9ba1a32ed37461d6b7d2436 Mon Sep 17 00:00:00 2001 From: nothub <48992448+nothub@users.noreply.github.com> Date: Mon, 24 May 2021 23:58:45 +0200 Subject: [PATCH 82/90] add missing PathfinderGoalSelector --- scripts/importmcdev.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/importmcdev.sh b/scripts/importmcdev.sh index 16fdcab66f96..faff6a21e9ae 100755 --- a/scripts/importmcdev.sh +++ b/scripts/importmcdev.sh @@ -104,6 +104,7 @@ import PathfinderAbstract import PathfinderGoal import PathfinderGoalFloat import PathfinderGoalGotoTarget +import PathfinderGoalSelector import PathfinderWater import PersistentScoreboard import PersistentVillage From 6b0cf2bc2d1243787b09e4609fcaaf7c90cfb49d Mon Sep 17 00:00:00 2001 From: nothub <48992448+nothub@users.noreply.github.com> Date: Tue, 25 May 2021 00:16:00 +0200 Subject: [PATCH 83/90] do not contact paper devs --- .../0388-do-not-contact-paper-devs.patch | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 Spigot-Server-Patches/0388-do-not-contact-paper-devs.patch diff --git a/Spigot-Server-Patches/0388-do-not-contact-paper-devs.patch b/Spigot-Server-Patches/0388-do-not-contact-paper-devs.patch new file mode 100644 index 000000000000..fc8e311ff7e0 --- /dev/null +++ b/Spigot-Server-Patches/0388-do-not-contact-paper-devs.patch @@ -0,0 +1,67 @@ +From f3e62607302b45c3db533555e5138e8fcfcdcfb4 Mon Sep 17 00:00:00 2001 +From: nothub <48992448+nothub@users.noreply.github.com> +Date: Tue, 25 May 2021 00:12:26 +0200 +Subject: [PATCH] do not contact paper devs + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java +index 5c04e3a9..d1001605 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java +@@ -33,12 +33,8 @@ public class PaperConfig { + + "As you can see, there's tons to configure. Some options may impact gameplay, so use\n" + + "with caution, and make sure you know what each option does before configuring.\n" + + "\n" +- + "If you need help with the configuration or have any questions related to Paper,\n" +- + "join us in our IRC channel.\n" +- + "\n" +- + "IRC: #paper @ irc.spi.gt ( http://irc.spi.gt/iris/?channels=paper )\n" +- + "Wiki: https://paper.readthedocs.org/ \n" +- + "Paper Forums: https://aquifermc.org/ \n"; ++ + "!This fork is not an official Paper release so please do not annoy the paper devs! \n" ++ + "!If you need help with your setup, please use the latest official Paper release, not this fork! \n"; + /*========================================================================*/ + public static YamlConfiguration config; + static int version; +diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java +index 93dc6983..86d6bad9 100644 +--- a/src/main/java/org/spigotmc/WatchdogThread.java ++++ b/src/main/java/org/spigotmc/WatchdogThread.java +@@ -73,8 +73,8 @@ public class WatchdogThread extends Thread + 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" ); ++ log.log( Level.SEVERE, "!This fork is not an official Paper release so please do not annoy the paper devs!" ); ++ log.log( Level.SEVERE, "!If you need help with your setup, please use the latest official Paper release, not this fork!" ); + log.log( Level.SEVERE, "Paper version: " + Bukkit.getServer().getVersion() ); + // + if(net.minecraft.server.World.haveWeSilencedAPhysicsCrash) +@@ -98,12 +98,12 @@ 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, "--- DO NOT REPORT THIS - 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!):" ); ++ log.log( Level.SEVERE, "Server thread dump (Look for plugins doing dumb shit here!):" ); + dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().primaryThread.getId(), Integer.MAX_VALUE ), log ); + log.log( Level.SEVERE, "------------------------------" ); + // +@@ -117,7 +117,7 @@ public class WatchdogThread extends Thread + 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, "--- DO NOT REPORT THIS - THIS IS NOT A BUG OR A CRASH ---"); + } + + +-- +2.25.1 + From 63119d4247f00342517cd8cdc5fa33fafc143ced Mon Sep 17 00:00:00 2001 From: nothub <48992448+nothub@users.noreply.github.com> Date: Tue, 25 May 2021 00:17:41 +0200 Subject: [PATCH 84/90] update paperclip subrepo --- work/Paperclip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/work/Paperclip b/work/Paperclip index d0395f6304db..6776c66987a0 160000 --- a/work/Paperclip +++ b/work/Paperclip @@ -1 +1 @@ -Subproject commit d0395f6304db49e4472dab9dbf247e994a1122b8 +Subproject commit 6776c66987a021a1c0db55b2e21c883660acc19f From 24b2cdbb2fdc585e905e72c4044f0f70483311d7 Mon Sep 17 00:00:00 2001 From: nothub <48992448+nothub@users.noreply.github.com> Date: Tue, 25 May 2021 00:45:08 +0200 Subject: [PATCH 85/90] chunk dupe --- Spigot-Server-Patches/0389-chunk-dupe.patch | 64 +++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 Spigot-Server-Patches/0389-chunk-dupe.patch diff --git a/Spigot-Server-Patches/0389-chunk-dupe.patch b/Spigot-Server-Patches/0389-chunk-dupe.patch new file mode 100644 index 000000000000..c5f78aad6fa2 --- /dev/null +++ b/Spigot-Server-Patches/0389-chunk-dupe.patch @@ -0,0 +1,64 @@ +From 04ddc31c9e32dbd0775972c48de7f70dcb6914aa Mon Sep 17 00:00:00 2001 +From: nothub <48992448+nothub@users.noreply.github.com> +Date: Tue, 25 May 2021 00:42:15 +0200 +Subject: [PATCH] chunk dupe + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java +index d1001605..4e6e2511 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java +@@ -336,4 +336,11 @@ public class PaperConfig { + pathfinderGoalSelectionDelay = getInt("settings.pathfinder.goal-selection-delay", pathfinderGoalSelectionDelay); + } + ++ public static boolean chunkDupeAllow = true; ++ public static boolean chunkDupeLog = true; ++ private static void chunkOverloadDupe() { ++ chunkDupeAllow = getBoolean("settings.chunk-dupe.allow", chunkDupeAllow); ++ chunkDupeLog = getBoolean("settings.chunk-dupe.log", chunkDupeLog); ++ } ++ + } +diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java +index 542a35d1..a2c13308 100644 +--- a/src/main/java/net/minecraft/server/RegionFile.java ++++ b/src/main/java/net/minecraft/server/RegionFile.java +@@ -20,6 +20,8 @@ import java.util.zip.GZIPInputStream; + import java.util.zip.InflaterInputStream; + import javax.annotation.Nullable; + ++import com.destroystokyo.paper.PaperConfig; ++ + public class RegionFile { + + // Spigot start +@@ -27,6 +29,10 @@ public class RegionFile { + // So we extend this to use the REAL size when the count is maxed by seeking to that section and reading the length. + private static final boolean ENABLE_EXTENDED_SAVE = Boolean.parseBoolean(System.getProperty("net.minecraft.server.RegionFile.enableExtendedSave", "true")); + // Spigot end ++ ++ private static final boolean CHUNK_DUPE_ALLOW = PaperConfig.chunkDupeAllow; // paper-1.12.2 ++ private static final boolean CHUNK_DUPE_LOG = PaperConfig.chunkDupeLog; // paper-1.12.2 ++ + private static final byte[] a = new byte[4096]; + private final File b;private File getFile() { return b; } // Paper - OBFHELPER + private RandomAccessFile c;private RandomAccessFile getDataFile() { return c; } // Paper - OBFHELPER +@@ -198,6 +204,14 @@ public class RegionFile { + int k1 = (k + 5) / 4096 + 1; + + if (k1 >= 256) { ++ // paper-1.12.2 start ++ if (CHUNK_DUPE_ALLOW) { ++ if (CHUNK_DUPE_LOG) { ++ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.WARNING,"Chunk dupe Detected: ({0}, {1}) {2}", new Object[]{i, j, this.b}); ++ } ++ return; ++ } ++ // paper-1.12.2 end + // Spigot start + if (!USE_SPIGOT_OVERSIZED_METHOD && !RegionFileCache.isOverzealous()) throw new ChunkTooLargeException(i, j, k1); // Paper - throw error instead + org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.WARNING,"Large Chunk Detected: ({0}, {1}) Size: {2} {3}", new Object[]{i, j, k1, this.b}); +-- +2.25.1 + From 2fb61fb67168caee04d7e66a0d1f0e540911c703 Mon Sep 17 00:00:00 2001 From: nothub <48992448+nothub@users.noreply.github.com> Date: Tue, 25 May 2021 00:48:55 +0200 Subject: [PATCH 86/90] sane config defaults --- .../0390-sane-defaults.patch | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Spigot-Server-Patches/0390-sane-defaults.patch diff --git a/Spigot-Server-Patches/0390-sane-defaults.patch b/Spigot-Server-Patches/0390-sane-defaults.patch new file mode 100644 index 000000000000..f1f07dfe7bc3 --- /dev/null +++ b/Spigot-Server-Patches/0390-sane-defaults.patch @@ -0,0 +1,32 @@ +From 71eb00865faa41618e05721c83c170fa1d78151a Mon Sep 17 00:00:00 2001 +From: nothub <48992448+nothub@users.noreply.github.com> +Date: Tue, 25 May 2021 00:47:10 +0200 +Subject: [PATCH] sane defaults + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java +index 4e6e2511..6142a8c3 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java +@@ -331,14 +331,14 @@ public class PaperConfig { + } + } + +- public static int pathfinderGoalSelectionDelay = 9; +- private static void pathfinderGoalSelectionDelay() { ++ public static int pathfinderGoalSelectionDelay = 3; ++ private static void pathfinder() { + pathfinderGoalSelectionDelay = getInt("settings.pathfinder.goal-selection-delay", pathfinderGoalSelectionDelay); + } + +- public static boolean chunkDupeAllow = true; ++ public static boolean chunkDupeAllow = false; + public static boolean chunkDupeLog = true; +- private static void chunkOverloadDupe() { ++ private static void chunkDupe() { + chunkDupeAllow = getBoolean("settings.chunk-dupe.allow", chunkDupeAllow); + chunkDupeLog = getBoolean("settings.chunk-dupe.log", chunkDupeLog); + } +-- +2.25.1 + From 1bf321109b10413fac470d06471b1088d94f4c00 Mon Sep 17 00:00:00 2001 From: nothub <48992448+nothub@users.noreply.github.com> Date: Tue, 25 May 2021 00:51:42 +0200 Subject: [PATCH 87/90] maven dependency caching --- .github/ISSUE_TEMPLATE/feature_request.md | 17 ----------------- .github/workflows/release.yml | 7 +++++++ .github/workflows/test.yml | 7 +++++++ 3 files changed, 14 insertions(+), 17 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 066b2d920a28..000000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index feba310b6789..08bb1fb62021 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,6 +21,13 @@ jobs: with: java-version: 1.8 + - name: prepare depdendency cache + uses: actions/cache@v2 + with: + path: ~/.m2 + key: '${{ runner.os }}-m2-${{ hashFiles(''**/pom.xml'') }}' + restore-keys: '${{ runner.os }}-m2' + - name: prepare git config run: git config --global user.name "CI Slave Bot" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5d1fb78662f0..b15fdd6df393 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,6 +21,13 @@ jobs: with: java-version: 1.8 + - name: prepare depdendency cache + uses: actions/cache@v2 + with: + path: ~/.m2 + key: '${{ runner.os }}-m2-${{ hashFiles(''**/pom.xml'') }}' + restore-keys: '${{ runner.os }}-m2' + - name: prepare git config run: git config --global user.name "CI Slave Bot" From e50c9ab8ca280c3eba047edf7f7232f54d24641d Mon Sep 17 00:00:00 2001 From: nothub <48992448+nothub@users.noreply.github.com> Date: Tue, 25 May 2021 01:07:02 +0200 Subject: [PATCH 88/90] configurable brand name --- .../0391-configurable-brand-name.patch | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 Spigot-Server-Patches/0391-configurable-brand-name.patch diff --git a/Spigot-Server-Patches/0391-configurable-brand-name.patch b/Spigot-Server-Patches/0391-configurable-brand-name.patch new file mode 100644 index 000000000000..7bb6ce348c8c --- /dev/null +++ b/Spigot-Server-Patches/0391-configurable-brand-name.patch @@ -0,0 +1,94 @@ +From b7e5cc528ec87f92058d8b90e03c98aaa5f5efdb Mon Sep 17 00:00:00 2001 +From: nothub <48992448+nothub@users.noreply.github.com> +Date: Tue, 25 May 2021 01:04:03 +0200 +Subject: [PATCH] configurable brand name + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java +index 6142a8c3..d2f2bb74 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java +@@ -343,4 +343,9 @@ public class PaperConfig { + chunkDupeLog = getBoolean("settings.chunk-dupe.log", chunkDupeLog); + } + ++ public static String brand = "Paper"; ++ private static void brand() { ++ brand = getString("settings.brand", brand); ++ } ++ + } +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 3b982f99..981a6c4e 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -1,7 +1,7 @@ + package net.minecraft.server; + ++import com.destroystokyo.paper.PaperConfig; + import com.google.common.collect.Lists; +-import com.google.common.collect.Queues; + import com.google.common.util.concurrent.Futures; + import com.google.common.util.concurrent.ListenableFuture; + import com.google.common.util.concurrent.ListenableFutureTask; +@@ -27,7 +27,6 @@ import java.util.ArrayList; + import java.util.Arrays; + import java.util.Collections; + import java.util.Date; +-import java.util.Iterator; + import java.util.List; + import java.util.Queue; + import java.util.Random; +@@ -35,7 +34,6 @@ import java.util.UUID; + import java.util.concurrent.Callable; + import java.util.concurrent.Executors; + import java.util.concurrent.FutureTask; +-import java.util.function.Supplier; + import javax.annotation.Nullable; + import javax.imageio.ImageIO; + import org.apache.commons.lang3.Validate; +@@ -43,9 +41,6 @@ import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + // CraftBukkit start + import joptsimple.OptionSet; +-import org.bukkit.Bukkit; +-import org.bukkit.craftbukkit.CraftServer; +-import org.bukkit.craftbukkit.Main; + // CraftBukkit end + import org.spigotmc.SlackActivityAccountant; // Spigot + import co.aikar.timings.MinecraftTimings; // Paper +@@ -1155,8 +1150,9 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs + + } + ++ private static final String BRAND_NAME = PaperConfig.brand; // paper-1.12.2 + public String getServerModName() { +- return "Paper"; //Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla! ++ return BRAND_NAME; //Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla! // paper-1.12.2 + } + + public CrashReport b(CrashReport crashreport) { +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index 7c82e18b..68f7a480 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -23,6 +23,7 @@ import java.util.regex.Pattern; + + import javax.imageio.ImageIO; + ++import com.destroystokyo.paper.PaperConfig; + import net.minecraft.server.*; + + import org.bukkit.BanList; +@@ -140,7 +141,7 @@ import javax.annotation.Nonnull; // Paper + + + public final class CraftServer implements Server { +- private final String serverName = "Paper"; ++ private final String serverName = PaperConfig.brand; // paper-1.12.2 + private final String serverVersion; + private final String bukkitVersion = Versioning.getBukkitVersion(); + private final Logger logger = Logger.getLogger("Minecraft"); +-- +2.25.1 + From 41953c52f719325db80a04bf33313a4328a996a0 Mon Sep 17 00:00:00 2001 From: nothub <48992448+nothub@users.noreply.github.com> Date: Tue, 25 May 2021 01:07:52 +0200 Subject: [PATCH 89/90] release desc --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 08bb1fb62021..d6b176cbc234 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,7 +42,7 @@ jobs: with: tag_name: ${{ github.ref }} release_name: ${{ github.ref }} - body: automated release at commit ${{ env.SHA }} + body: release at commit ${{ env.SHA }} draft: false prerelease: false From 717ef63e4734e81cede397df7060000e04a70ba2 Mon Sep 17 00:00:00 2001 From: nothub <48992448+nothub@users.noreply.github.com> Date: Tue, 25 May 2021 01:38:38 +0200 Subject: [PATCH 90/90] test server http origin --- scripts/testServer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/testServer.sh b/scripts/testServer.sh index b0f82a54e2b5..5d7ad2d7a1b7 100755 --- a/scripts/testServer.sh +++ b/scripts/testServer.sh @@ -33,7 +33,7 @@ cd "$papertestdir" if [[ ! -d .git ]]; then ${gitcmd} init - ${gitcmd} remote add origin ${PAPER_TEST_SKELETON:-git@github.com:nothub/paper-1.12.2-test-server.git} + ${gitcmd} remote add origin ${PAPER_TEST_SKELETON:-https://github.com/nothub/paper-1.12.2-test-server} ${gitcmd} fetch origin updateTest elif [[ "$2" == "update" ]] || [[ "$3" == "update" ]]; then