diff --git a/Spigot-Server-Patches/Add-exception-reporting-event.patch b/Spigot-Server-Patches/Add-exception-reporting-event.patch index 0102456444..b3bab39a55 100644 --- a/Spigot-Server-Patches/Add-exception-reporting-event.patch +++ b/Spigot-Server-Patches/Add-exception-reporting-event.patch @@ -305,8 +305,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import com.google.common.base.Predicate; @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { } catch (Throwable throwable1) { - // Paper start - Prevent tile entity and entity crashes entity.tickTimer.stopTiming(); + // Paper start - Prevent tile entity and entity crashes - System.err.println("Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX + "," + entity.locY + "," + entity.locZ); + String msg = "Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX + "," + entity.locY + "," + entity.locZ; + System.err.println(msg); @@ -316,9 +316,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 continue; // Paper end @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { + this.methodProfiler.b(); } catch (Throwable throwable2) { // Paper start - Prevent tile entity and entity crashes - tileentity.tickTimer.stopTiming(); - System.err.println("TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ()); + String msg = "TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ(); + System.err.println(msg); diff --git a/Spigot-Server-Patches/Allow-for-toggling-of-spawn-chunks.patch b/Spigot-Server-Patches/Allow-for-toggling-of-spawn-chunks.patch index b0eb154e37..008a276c2e 100644 --- a/Spigot-Server-Patches/Allow-for-toggling-of-spawn-chunks.patch +++ b/Spigot-Server-Patches/Allow-for-toggling-of-spawn-chunks.patch @@ -24,11 +24,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - }); this.getServer().addWorld(this.world); // CraftBukkit end + timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings + this.keepSpawnInMemory = this.paperConfig.keepSpawnInMemory; // Paper - timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); + } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Always-tick-falling-blocks.patch b/Spigot-Server-Patches/Always-tick-falling-blocks.patch index 0d10a136d0..93141bee8c 100644 --- a/Spigot-Server-Patches/Always-tick-falling-blocks.patch +++ b/Spigot-Server-Patches/Always-tick-falling-blocks.patch @@ -8,42 +8,14 @@ diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java -@@ -0,0 +0,0 @@ package org.spigotmc; - - import java.util.List; - import java.util.Set; --import net.minecraft.server.AxisAlignedBB; --import net.minecraft.server.Chunk; --import net.minecraft.server.Entity; --import net.minecraft.server.EntityAmbient; --import net.minecraft.server.EntityAnimal; --import net.minecraft.server.EntityArrow; --import net.minecraft.server.EntityComplexPart; --import net.minecraft.server.EntityCreature; --import net.minecraft.server.EntityCreeper; --import net.minecraft.server.EntityEnderCrystal; --import net.minecraft.server.EntityEnderDragon; --import net.minecraft.server.EntityFireball; --import net.minecraft.server.EntityFireworks; --import net.minecraft.server.EntityHuman; --import net.minecraft.server.EntityLiving; --import net.minecraft.server.EntityMonster; --import net.minecraft.server.EntityProjectile; --import net.minecraft.server.EntitySheep; --import net.minecraft.server.EntitySlice; --import net.minecraft.server.EntitySlime; --import net.minecraft.server.EntityTNTPrimed; --import net.minecraft.server.EntityVillager; --import net.minecraft.server.EntityWeather; --import net.minecraft.server.EntityWither; --import net.minecraft.server.MathHelper; --import net.minecraft.server.MinecraftServer; --import net.minecraft.server.World; -+ -+import net.minecraft.server.*; - import org.bukkit.craftbukkit.SpigotTimings; - - public class ActivationRange +@@ -0,0 +0,0 @@ import net.minecraft.server.EntityCreature; + import net.minecraft.server.EntityCreeper; + import net.minecraft.server.EntityEnderCrystal; + import net.minecraft.server.EntityEnderDragon; ++import net.minecraft.server.EntityFallingBlock; // Paper + import net.minecraft.server.EntityFireball; + import net.minecraft.server.EntityFireworks; + import net.minecraft.server.EntityHuman; @@ -0,0 +0,0 @@ public class ActivationRange || entity instanceof EntityFireball || entity instanceof EntityWeather diff --git a/Spigot-Server-Patches/Chunk-save-queue-improvements.patch b/Spigot-Server-Patches/Chunk-save-queue-improvements.patch index d2ae6dfca6..9094e5ae1b 100644 --- a/Spigot-Server-Patches/Chunk-save-queue-improvements.patch +++ b/Spigot-Server-Patches/Chunk-save-queue-improvements.patch @@ -30,8 +30,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -0,0 +0,0 @@ public class PaperConfig { - } - return time; + public static void chunkLoadThreads() { + minChunkLoadThreads = Math.min(6, getInt("settings.min-chunk-load-threads", 2)); // Keep people from doing stupid things with max of 6 } + + public static boolean enableFileIOThreadSleep; diff --git a/Spigot-Server-Patches/Configurable-Chunk-IO-Thread-Base-Count.patch b/Spigot-Server-Patches/Configurable-Chunk-IO-Thread-Base-Count.patch index c29e2a5fa9..09a4def695 100644 --- a/Spigot-Server-Patches/Configurable-Chunk-IO-Thread-Base-Count.patch +++ b/Spigot-Server-Patches/Configurable-Chunk-IO-Thread-Base-Count.patch @@ -12,14 +12,52 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return config.getString(path, config.getString(path)); } +- private static void timings() { +- boolean timings = getBoolean("timings.enabled", true); +- boolean verboseTimings = getBoolean("timings.verbose", true); +- TimingsManager.privacy = getBoolean("timings.server-name-privacy", false); +- TimingsManager.hiddenConfigs = getList("timings.hidden-config-entries", Lists.newArrayList("database", "settings.bungeecord-addresses")); +- int timingHistoryInterval = getInt("timings.history-interval", 300); +- int timingHistoryLength = getInt("timings.history-length", 3600); +- +- +- Timings.setVerboseTimingsEnabled(verboseTimings); +- Timings.setTimingsEnabled(timings); +- Timings.setHistoryInterval(timingHistoryInterval * 20); +- Timings.setHistoryLength(timingHistoryLength * 20); +- +- Bukkit.getLogger().log(Level.INFO, "Spigot Timings: " + timings + +- " - Verbose: " + verboseTimings + +- " - Interval: " + timeSummary(Timings.getHistoryInterval() / 20) + +- " - Length: " + timeSummary(Timings.getHistoryLength() / 20)); +- } +- +- protected static String timeSummary(int seconds) { +- String time = ""; +- if (seconds > 60 * 60) { +- time += TimeUnit.SECONDS.toHours(seconds) + "h"; +- seconds /= 60; +- } +- +- if (seconds > 0) { +- time += TimeUnit.SECONDS.toMinutes(seconds) + "m"; +- } +- return time; +- } +- + public static boolean useInteractLimiter; + private static void useInteractLimiter() { + useInteractLimiter = getBoolean("settings.limit-player-interactions", true); +@@ -0,0 +0,0 @@ public class PaperConfig { + Bukkit.getLogger().log(Level.INFO, "Disabling player interaction limiter, your server may be more vulnerable to malicious users"); + } + } ++ + public static int minChunkLoadThreads = 2; + public static void chunkLoadThreads() { + minChunkLoadThreads = Math.min(6, getInt("settings.min-chunk-load-threads", 2)); // Keep people from doing stupid things with max of 6 + } -+ - public static boolean useInteractLimiter; - private static void useInteractLimiter() { - useInteractLimiter = getBoolean("settings.limit-player-interactions", true); + } diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java diff --git a/Spigot-Server-Patches/Disable-spigot-tick-limiters.patch b/Spigot-Server-Patches/Disable-spigot-tick-limiters.patch index 2ad4d90d41..fe05d7edfb 100644 --- a/Spigot-Server-Patches/Disable-spigot-tick-limiters.patch +++ b/Spigot-Server-Patches/Disable-spigot-tick-limiters.patch @@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - guardEntityList = true; // Spigot // CraftBukkit start - Use field for loop variable + co.aikar.timings.TimingHistory.entityTicks += this.entityList.size(); // Paper int entitiesThisCycle = 0; - if (tickPosition < 0) tickPosition = 0; - for (entityLimiter.initTick(); diff --git a/Spigot-Server-Patches/EAR-Fix-bug-with-teleporting-entities.patch b/Spigot-Server-Patches/EAR-Fix-bug-with-teleporting-entities.patch index 0f0de7d2b8..459469a17e 100644 --- a/Spigot-Server-Patches/EAR-Fix-bug-with-teleporting-entities.patch +++ b/Spigot-Server-Patches/EAR-Fix-bug-with-teleporting-entities.patch @@ -36,12 +36,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java @@ -0,0 +0,0 @@ public class ActivationRange - SpigotTimings.checkIfActiveTimer.startTiming(); + { // Never safe to skip fireworks or entities not yet added to chunk // PAIL: inChunk - if ( !entity.aa || entity instanceof EntityFireworks ) { + if ( !entity.isAddedToChunk() || entity instanceof EntityFireworks ) { // Paper - EAR: Fix bug with teleporting entities - SpigotTimings.checkIfActiveTimer.stopTiming(); return true; } + -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Fix-redstone-lag-issues.patch b/Spigot-Server-Patches/Fix-redstone-lag-issues.patch index 7274f40da9..07d6899f6c 100644 --- a/Spigot-Server-Patches/Fix-redstone-lag-issues.patch +++ b/Spigot-Server-Patches/Fix-redstone-lag-issues.patch @@ -50,8 +50,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.methodProfiler.a("cleaning"); @@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { - this.U.add(nextticklistentry); } + timings.scheduledBlocksCleanup.stopTiming(); // Paper + // Paper start - Allow redstone ticks to bypass the tickNextTickListCap + if (paperConfig.tickNextTickListCapIgnoresRedstone) { @@ -73,5 +73,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.methodProfiler.b(); this.methodProfiler.a("ticking"); - Iterator iterator = this.U.iterator(); + timings.scheduledBlocksTicking.startTiming(); // Paper -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Prevent-tile-entity-and-entity-crashes.patch b/Spigot-Server-Patches/Prevent-tile-entity-and-entity-crashes.patch index 179bffb413..135644f6c9 100644 --- a/Spigot-Server-Patches/Prevent-tile-entity-and-entity-crashes.patch +++ b/Spigot-Server-Patches/Prevent-tile-entity-and-entity-crashes.patch @@ -27,15 +27,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - this.g(entity); - SpigotTimings.tickEntityTimer.stopTiming(); // Spigot + entity.tickTimer.stopTiming(); // Paper } catch (Throwable throwable1) { + entity.tickTimer.stopTiming(); - crashreport1 = CrashReport.a(throwable1, "Ticking entity"); - crashreportsystemdetails1 = crashreport1.a("Entity being ticked"); - entity.appendEntityCrashDetails(crashreportsystemdetails1); - throw new ReportedException(crashreport1); + // Paper start - Prevent tile entity and entity crashes -+ SpigotTimings.tickEntityTimer.stopTiming(); + System.err.println("Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX + "," + entity.locY + "," + entity.locZ); + throwable1.printStackTrace(); + entity.dead = true; @@ -53,7 +52,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - tileentity.a(crashreportsystemdetails1); - throw new ReportedException(crashreport1); + // Paper start - Prevent tile entity and entity crashes -+ tileentity.tickTimer.stopTiming(); + System.err.println("TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ()); + throwable2.printStackTrace(); + tilesThisCycle--; diff --git a/Spigot-Server-Patches/Timings-v2.patch b/Spigot-Server-Patches/Timings-v2.patch index 3f975e3db4..681ed48ce5 100644 --- a/Spigot-Server-Patches/Timings-v2.patch +++ b/Spigot-Server-Patches/Timings-v2.patch @@ -218,8 +218,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public class PaperConfig { @@ -0,0 +0,0 @@ public class PaperConfig { - Bukkit.getLogger().log(Level.INFO, "Disabling player interaction limiter, your server may be more vulnerable to malicious users"); - } + config.addDefault(path, def); + return config.getString(path, config.getString(path)); } + + private static void timings() { @@ -554,9 +554,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public static boolean haveWeSilencedAPhysicsCrash; public static String blockLocation; @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { + }); this.getServer().addWorld(this.world); // CraftBukkit end - this.keepSpawnInMemory = this.paperConfig.keepSpawnInMemory; // Paper - timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings + timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); @@ -584,8 +584,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit start - Use field for loop variable + co.aikar.timings.TimingHistory.entityTicks += this.entityList.size(); // Paper int entitiesThisCycle = 0; - // Paper start - Disable tick limiters - //if (tickPosition < 0) tickPosition = 0; + if (tickPosition < 0) tickPosition = 0; + for (entityLimiter.initTick(); @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { this.methodProfiler.a("tick"); if (!entity.dead && !(entity instanceof EntityPlayer)) { @@ -596,12 +596,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - SpigotTimings.tickEntityTimer.stopTiming(); // Spigot + entity.tickTimer.stopTiming(); // Paper } catch (Throwable throwable1) { - // Paper start - Prevent tile entity and entity crashes -- SpigotTimings.tickEntityTimer.stopTiming(); + entity.tickTimer.stopTiming(); - System.err.println("Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX + "," + entity.locY + "," + entity.locZ); - throwable1.printStackTrace(); - entity.dead = true; + crashreport1 = CrashReport.a(throwable1, "Ticking entity"); + crashreportsystemdetails1 = crashreport1.a("Entity being ticked"); + entity.appendEntityCrashDetails(crashreportsystemdetails1); @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { } @@ -688,10 +686,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } + timings.scheduledBlocksCleanup.stopTiming(); // Paper - // Paper start - Allow redstone ticks to bypass the tickNextTickListCap - if (paperConfig.tickNextTickListCapIgnoresRedstone) { -@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { - this.methodProfiler.b(); this.methodProfiler.a("ticking"); + timings.scheduledBlocksTicking.startTiming(); // Paper @@ -1109,10 +1103,10 @@ diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java -@@ -0,0 +0,0 @@ import java.util.List; - import java.util.Set; - - import net.minecraft.server.*; +@@ -0,0 +0,0 @@ import net.minecraft.server.EntityWither; + import net.minecraft.server.MathHelper; + import net.minecraft.server.MinecraftServer; + import net.minecraft.server.World; -import org.bukkit.craftbukkit.SpigotTimings; +import co.aikar.timings.SpigotTimings; @@ -1125,7 +1119,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - SpigotTimings.checkIfActiveTimer.startTiming(); // Never safe to skip fireworks or entities not yet added to chunk // PAIL: inChunk - if ( !entity.isAddedToChunk() || entity instanceof EntityFireworks ) { // Paper - EAR: Fix bug with teleporting entities + if ( !entity.aa || entity instanceof EntityFireworks ) { - SpigotTimings.checkIfActiveTimer.stopTiming(); return true; } diff --git a/Spigot-Server-Patches/Toggle-for-player-interact-limiter.patch b/Spigot-Server-Patches/Toggle-for-player-interact-limiter.patch index f5e967afb7..13dfedc66f 100644 --- a/Spigot-Server-Patches/Toggle-for-player-interact-limiter.patch +++ b/Spigot-Server-Patches/Toggle-for-player-interact-limiter.patch @@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -0,0 +0,0 @@ public class PaperConfig { - config.addDefault(path, def); - return config.getString(path, config.getString(path)); + } + return time; } + + public static boolean useInteractLimiter;