Use BigDecimal to improve accracy of TPS results - long live 20 TPS!

It's always been commonly said to 'ignore' that TPS was '19.X', that
it was fine.

I suspect that the inaccuracy of floating point math resulted in us
losing precision over time, making it difficult to actually get back to 20,
as you know the fun 0.1 + 0.1 ... 9 more times != 1 problem.

BigDecimal supports working with doubles with higher precision.

This change makes it so our RollingAverage class maintains all of the data
using BigDecimal and using BigDecimal arithematic operations.

This ensures we have extremely high precision, enabling us to
actually be able print '20 TPS' when TPS is perfect.
This commit is contained in:
Aikar 2018-09-17 22:32:37 -04:00
parent 2b349bb02b
commit 3aaba8c301
No known key found for this signature in database
GPG key ID: 401ADFC9891FAAFE
11 changed files with 68 additions and 64 deletions

View file

@ -1,4 +1,4 @@
From cf80f60fecc7b5c5eb6ae69985789c8cdadffc0c Mon Sep 17 00:00:00 2001 From c72a223551fa640d606dc0281553972891d52411 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Tue, 1 Mar 2016 23:09:29 -0600 Date: Tue, 1 Mar 2016 23:09:29 -0600
Subject: [PATCH] Further improve server tick loop Subject: [PATCH] Further improve server tick loop
@ -12,7 +12,7 @@ Previous implementation did not calculate TPS correctly.
Switch to a realistic rolling average and factor in std deviation as an extra reporting variable Switch to a realistic rolling average and factor in std deviation as an extra reporting variable
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 788f0519a8..13c6021ffa 100644 index 788f0519a8..d6ea4ae532 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -146,7 +146,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati @@ -146,7 +146,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
@ -42,7 +42,7 @@ index 788f0519a8..13c6021ffa 100644
} }
// Spigot Start // Spigot Start
@@ -697,6 +697,53 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati @@ -697,6 +697,57 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
{ {
return ( avg * exp ) + ( tps * ( 1 - exp ) ); return ( avg * exp ) + ( tps * ( 1 - exp ) );
} }
@ -59,44 +59,48 @@ index 788f0519a8..13c6021ffa 100644
+ public static class RollingAverage { + public static class RollingAverage {
+ private final int size; + private final int size;
+ private long time; + private long time;
+ private double total; + private java.math.BigDecimal total;
+ private int index = 0; + private int index = 0;
+ private final double[] samples; + private final java.math.BigDecimal[] samples;
+ private final long[] times; + private final long[] times;
+ +
+ RollingAverage(int size) { + RollingAverage(int size) {
+ this.size = size; + this.size = size;
+ this.time = size * SEC_IN_NANO; + this.time = size * SEC_IN_NANO;
+ this.total = TPS * SEC_IN_NANO * size; + this.total = dec(TPS).multiply(dec(SEC_IN_NANO)).multiply(dec(size));
+ this.samples = new double[size]; + this.samples = new java.math.BigDecimal[size];
+ this.times = new long[size]; + this.times = new long[size];
+ for (int i = 0; i < size; i++) { + for (int i = 0; i < size; i++) {
+ this.samples[i] = TPS; + this.samples[i] = dec(TPS);
+ this.times[i] = SEC_IN_NANO; + this.times[i] = SEC_IN_NANO;
+ } + }
+ } + }
+ +
+ public void add(double x, long t) { + private static java.math.BigDecimal dec(long t) {
+ return new java.math.BigDecimal(t);
+ }
+ public void add(java.math.BigDecimal x, long t) {
+ time -= times[index]; + time -= times[index];
+ total -= samples[index] * times[index]; + total = total.subtract(samples[index].multiply(dec(times[index])));
+ samples[index] = x; + samples[index] = x;
+ times[index] = t; + times[index] = t;
+ time += t; + time += t;
+ total += x * t; + total = total.add(x.multiply(dec(t)));
+ if (++index == size) { + if (++index == size) {
+ index = 0; + index = 0;
+ } + }
+ } + }
+ +
+ public double getAverage() { + public double getAverage() {
+ return total / time; + return total.divide(dec(time), 30, java.math.RoundingMode.HALF_UP).doubleValue();
+ } + }
+ } + }
+ private static final java.math.BigDecimal TPS_BASE = new java.math.BigDecimal(1E9).multiply(new java.math.BigDecimal(SAMPLE_INTERVAL));
+ // Paper End + // Paper End
// Spigot End // Spigot End
public void run() { public void run() {
@@ -709,29 +756,47 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati @@ -709,29 +760,47 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
// Spigot start // Spigot start
Arrays.fill( recentTps, 20 ); Arrays.fill( recentTps, 20 );
@ -138,7 +142,7 @@ index 788f0519a8..13c6021ffa 100644
- recentTps[1] = calcTps( recentTps[1], 0.9835, currentTps ); // 1/exp(5sec/5min) - recentTps[1] = calcTps( recentTps[1], 0.9835, currentTps ); // 1/exp(5sec/5min)
- recentTps[2] = calcTps( recentTps[2], 0.9945, currentTps ); // 1/exp(5sec/15min) - recentTps[2] = calcTps( recentTps[2], 0.9945, currentTps ); // 1/exp(5sec/15min)
+ final long diff = curTime - tickSection; + final long diff = curTime - tickSection;
+ double currentTps = 1E9 / diff * SAMPLE_INTERVAL; + java.math.BigDecimal currentTps = TPS_BASE.divide(new java.math.BigDecimal(diff), 30, java.math.RoundingMode.HALF_UP);
+ tps1.add(currentTps, diff); + tps1.add(currentTps, diff);
+ tps5.add(currentTps, diff); + tps5.add(currentTps, diff);
+ tps15.add(currentTps, diff); + tps15.add(currentTps, diff);
@ -220,5 +224,5 @@ index be2e31deae..6d21c32692 100644
return ( ( tps > 18.0 ) ? ChatColor.GREEN : ( tps > 16.0 ) ? ChatColor.YELLOW : ChatColor.RED ).toString() return ( ( tps > 18.0 ) ? ChatColor.GREEN : ( tps > 16.0 ) ? ChatColor.YELLOW : ChatColor.RED ).toString()
+ ( ( tps > 20.0 ) ? "*" : "" ) + Math.min( Math.round( tps * 100.0 ) / 100.0, 20.0 ); + ( ( tps > 20.0 ) ? "*" : "" ) + Math.min( Math.round( tps * 100.0 ) / 100.0, 20.0 );
-- --
2.18.0 2.19.0

View file

@ -1,4 +1,4 @@
From daa5867fc7ca974cdb1bb4ff0505eab29fa2a6a8 Mon Sep 17 00:00:00 2001 From 3d33437ccf59ffaab3dd7b23e615245d9f4b2882 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net> From: Byteflux <byte@byteflux.net>
Date: Wed, 2 Mar 2016 00:52:31 -0600 Date: Wed, 2 Mar 2016 00:52:31 -0600
Subject: [PATCH] Lighting Queue Subject: [PATCH] Lighting Queue
@ -102,7 +102,7 @@ index 4622e92b05..d4bebddab0 100644
IMMEDIATE, QUEUED, CHECK; IMMEDIATE, QUEUED, CHECK;
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 0034956af9..1379b574ef 100644 index 68212aa26e..046973a4ed 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -314,6 +314,7 @@ public class ChunkProviderServer implements IChunkProvider { @@ -314,6 +314,7 @@ public class ChunkProviderServer implements IChunkProvider {
@ -114,10 +114,10 @@ index 0034956af9..1379b574ef 100644
// Update neighbor counts // Update neighbor counts
for (int x = -2; x < 3; x++) { for (int x = -2; x < 3; x++) {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 13c6021ffa..30541dfa5a 100644 index d6ea4ae532..5086fe4027 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -890,7 +890,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati @@ -894,7 +894,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
protected void a(BooleanSupplier booleansupplier) { protected void a(BooleanSupplier booleansupplier) {
co.aikar.timings.TimingsManager.FULL_SERVER_TICK.startTiming(); // Paper co.aikar.timings.TimingsManager.FULL_SERVER_TICK.startTiming(); // Paper
this.slackActivityAccountant.tickStarted(); // Spigot this.slackActivityAccountant.tickStarted(); // Spigot
@ -126,7 +126,7 @@ index 13c6021ffa..30541dfa5a 100644
++this.ticks; ++this.ticks;
if (this.S) { if (this.S) {
@@ -948,6 +948,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati @@ -952,6 +952,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
this.methodProfiler.e(); this.methodProfiler.e();
this.methodProfiler.e(); this.methodProfiler.e();
org.spigotmc.WatchdogThread.tick(); // Spigot org.spigotmc.WatchdogThread.tick(); // Spigot
@ -233,7 +233,7 @@ index 0000000000..60562f1fd2
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 929875340f..0fe8a97f24 100644 index 499d64ea2c..e06da6bef9 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -335,7 +335,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc @@ -335,7 +335,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@ -246,5 +246,5 @@ index 929875340f..0fe8a97f24 100644
} }
-- --
2.18.0 2.19.0

View file

@ -1,4 +1,4 @@
From 52f7d263cd8e5c77095afbcec33f0d0c7da006f6 Mon Sep 17 00:00:00 2001 From d82e6a9a1c15815dea09b2b38f2239e6f606bc93 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net> From: Byteflux <byte@byteflux.net>
Date: Wed, 2 Mar 2016 11:59:48 -0600 Date: Wed, 2 Mar 2016 11:59:48 -0600
Subject: [PATCH] Optimize explosions Subject: [PATCH] Optimize explosions
@ -124,10 +124,10 @@ index 2620c4c2bd..a31e07b903 100644
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 30541dfa5a..bbd476bb0e 100644 index 5086fe4027..abed6bb977 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1055,6 +1055,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati @@ -1059,6 +1059,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
worldserver.getTracker().updatePlayers(); worldserver.getTracker().updatePlayers();
this.methodProfiler.e(); this.methodProfiler.e();
this.methodProfiler.e(); this.methodProfiler.e();
@ -136,7 +136,7 @@ index 30541dfa5a..bbd476bb0e 100644
} }
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0fe8a97f24..c8b9c10f12 100644 index e06da6bef9..c823cef341 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -24,6 +24,7 @@ import org.apache.logging.log4j.Logger; @@ -24,6 +24,7 @@ import org.apache.logging.log4j.Logger;
@ -156,5 +156,5 @@ index 0fe8a97f24..c8b9c10f12 100644
public CraftWorld getWorld() { public CraftWorld getWorld() {
return this.world; return this.world;
-- --
2.18.0 2.19.0

View file

@ -1,4 +1,4 @@
From aff5924a9a8620c7c5df00a1c59c7e6948da74ca Mon Sep 17 00:00:00 2001 From e812bdd5c6d798f90b0f361e2c3c4c14c624e69c Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Thu, 28 Apr 2016 00:57:27 -0400 Date: Thu, 28 Apr 2016 00:57:27 -0400
Subject: [PATCH] remove null possibility for getServer singleton Subject: [PATCH] remove null possibility for getServer singleton
@ -6,7 +6,7 @@ Subject: [PATCH] remove null possibility for getServer singleton
to stop IDE complaining about potential NPE to stop IDE complaining about potential NPE
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 9675d5a100..ca5e4cd65a 100644 index 74c84dda69..eb6ada935f 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -73,6 +73,7 @@ import co.aikar.timings.MinecraftTimings; // Paper @@ -73,6 +73,7 @@ import co.aikar.timings.MinecraftTimings; // Paper
@ -26,7 +26,7 @@ index 9675d5a100..ca5e4cd65a 100644
this.ac = new ResourceManager(EnumResourcePackType.SERVER_DATA); this.ac = new ResourceManager(EnumResourcePackType.SERVER_DATA);
this.resourcePackRepository = new ResourcePackRepository(ResourcePackLoader::new); this.resourcePackRepository = new ResourcePackRepository(ResourcePackLoader::new);
this.ag = new CraftingManager(); this.ag = new CraftingManager();
@@ -1824,7 +1827,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati @@ -1828,7 +1831,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
// CraftBukkit start // CraftBukkit start
@Deprecated @Deprecated
public static MinecraftServer getServer() { public static MinecraftServer getServer() {
@ -36,5 +36,5 @@ index 9675d5a100..ca5e4cd65a 100644
// CraftBukkit end // CraftBukkit end
} }
-- --
2.18.0 2.19.0

View file

@ -1,4 +1,4 @@
From 9f76fd012fc287fe9431be02ace4cca22fbb3568 Mon Sep 17 00:00:00 2001 From 41c8d7f3f017c9bc08a29c044b8b8cb5ff87dc15 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Mon, 19 Sep 2016 23:16:39 -0400 Date: Mon, 19 Sep 2016 23:16:39 -0400
Subject: [PATCH] Auto Save Improvements Subject: [PATCH] Auto Save Improvements
@ -96,7 +96,7 @@ index 3c9c3cd41d..8d1264879b 100644
public boolean isEmpty() { public boolean isEmpty() {
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 7417660e4d..7a972f4187 100644 index 9739288b53..a35eac043c 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -241,7 +241,7 @@ public class ChunkProviderServer implements IChunkProvider { @@ -241,7 +241,7 @@ public class ChunkProviderServer implements IChunkProvider {
@ -109,7 +109,7 @@ index 7417660e4d..7a972f4187 100644
} }
} }
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index faf733f824..c6903559ef 100644 index 3d83900298..690cff8828 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java --- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -37,6 +37,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @@ -37,6 +37,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@ -121,7 +121,7 @@ index faf733f824..c6903559ef 100644
public final MinecraftServer server; public final MinecraftServer server;
public final PlayerInteractManager playerInteractManager; public final PlayerInteractManager playerInteractManager;
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 13d3315b9c..a367cbf52b 100644 index 04d8c108b4..a547ee5ca1 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -148,6 +148,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati @@ -148,6 +148,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
@ -132,7 +132,7 @@ index 13d3315b9c..a367cbf52b 100644
public final Thread primaryThread; public final Thread primaryThread;
public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>(); public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
public int autosavePeriod; public int autosavePeriod;
@@ -938,22 +939,30 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati @@ -942,22 +943,30 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
this.m.b().a(agameprofile); this.m.b().a(agameprofile);
} }
@ -207,7 +207,7 @@ index 02dbb8c6c3..73d72ef7e3 100644
public WhiteList getWhitelist() { public WhiteList getWhitelist() {
return this.whitelist; return this.whitelist;
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 4be3a6ae94..59b5a04581 100644 index c5201697d5..ca2e027cda 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -872,8 +872,9 @@ public class WorldServer extends World implements IAsyncTaskHandler { @@ -872,8 +872,9 @@ public class WorldServer extends World implements IAsyncTaskHandler {
@ -230,5 +230,5 @@ index 4be3a6ae94..59b5a04581 100644
timings.worldSaveChunks.startTiming(); // Paper timings.worldSaveChunks.startTiming(); // Paper
chunkproviderserver.a(flag); chunkproviderserver.a(flag);
-- --
2.18.0 2.19.0

View file

@ -1,4 +1,4 @@
From 0c93b5203a664b15f2e7386ee0db2fef3c3996da Mon Sep 17 00:00:00 2001 From a692cab3eb7c7235b2f678201ee701c77bab00a3 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net> From: Minecrell <minecrell@minecrell.net>
Date: Fri, 9 Jun 2017 19:03:43 +0200 Date: Fri, 9 Jun 2017 19:03:43 +0200
Subject: [PATCH] Use TerminalConsoleAppender for console improvements Subject: [PATCH] Use TerminalConsoleAppender for console improvements
@ -185,7 +185,7 @@ index dabad6b055..fc7e244f8b 100644
System.setOut(new PrintStream(new LoggerOutputStream(logger, Level.INFO), true)); System.setOut(new PrintStream(new LoggerOutputStream(logger, Level.INFO), true));
System.setErr(new PrintStream(new LoggerOutputStream(logger, Level.WARN), true)); System.setErr(new PrintStream(new LoggerOutputStream(logger, Level.WARN), true));
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 08ce98d071..464db5ebb8 100644 index 8d345a0502..6a3d5fdff4 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -61,7 +61,6 @@ import org.apache.commons.lang3.Validate; @@ -61,7 +61,6 @@ import org.apache.commons.lang3.Validate;
@ -224,7 +224,7 @@ index 08ce98d071..464db5ebb8 100644
Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this)); Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));
this.serverThread = primaryThread = new Thread(this, "Server thread"); // Moved from main this.serverThread = primaryThread = new Thread(this, "Server thread"); // Moved from main
@@ -873,7 +876,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati @@ -877,7 +880,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
} finally { } finally {
// CraftBukkit start - Restore terminal to original settings // CraftBukkit start - Restore terminal to original settings
try { try {
@ -233,7 +233,7 @@ index 08ce98d071..464db5ebb8 100644
} catch (Exception ignored) { } catch (Exception ignored) {
} }
// CraftBukkit end // CraftBukkit end
@@ -1361,7 +1364,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati @@ -1365,7 +1368,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
} }
public void sendMessage(IChatBaseComponent ichatbasecomponent) { public void sendMessage(IChatBaseComponent ichatbasecomponent) {
@ -588,5 +588,5 @@ index 5cee8f00ef..08b6bb7f97 100644
<AppenderRef ref="TerminalConsole" level="info"/> <AppenderRef ref="TerminalConsole" level="info"/>
</Root> </Root>
-- --
2.18.0 2.19.0

View file

@ -1,4 +1,4 @@
From de16e4a606f31cb9b6b141bbaf62e7dee398aaaa Mon Sep 17 00:00:00 2001 From 2289cdf49428ff3f05fc5249b217e7714bd013ef Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Mon, 15 Jan 2018 22:11:48 -0500 Date: Mon, 15 Jan 2018 22:11:48 -0500
Subject: [PATCH] Basic PlayerProfile API Subject: [PATCH] Basic PlayerProfile API
@ -429,10 +429,10 @@ index dce1417aff..f7856897f6 100644
* Calculates distance between 2 entities * Calculates distance between 2 entities
* @param e1 * @param e1
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 464db5ebb8..3e99221619 100644 index 6a3d5fdff4..65204c259e 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1185,7 +1185,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati @@ -1189,7 +1189,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
*/ // CraftBukkit end */ // CraftBukkit end
String s1 = "."; // PAIL? String s1 = "."; // PAIL?
@ -441,7 +441,7 @@ index 464db5ebb8..3e99221619 100644
MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService(); MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService();
GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository(); GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository();
UserCache usercache = new UserCache(gameprofilerepository, new File(s1, MinecraftServer.a.getName())); UserCache usercache = new UserCache(gameprofilerepository, new File(s1, MinecraftServer.a.getName()));
@@ -1634,6 +1634,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati @@ -1638,6 +1638,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
this.G = i; this.G = i;
} }
@ -523,5 +523,5 @@ index a9e9cc6f4e..c79e673fbf 100644
// Paper end // Paper end
} }
-- --
2.18.0 2.19.0

View file

@ -1,4 +1,4 @@
From eb14bec3aaf4d58dcc435f072644624a86930288 Mon Sep 17 00:00:00 2001 From b8cd035f90d7ba0fdcc33d98a62cae9bfd67d8b7 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net> From: Minecrell <minecrell@minecrell.net>
Date: Wed, 11 Oct 2017 15:56:26 +0200 Date: Wed, 11 Oct 2017 15:56:26 +0200
Subject: [PATCH] Implement extended PaperServerListPingEvent Subject: [PATCH] Implement extended PaperServerListPingEvent
@ -177,7 +177,7 @@ index 0000000000..350410527b
+ +
+} +}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 3e99221619..2e9836d8f9 100644 index 65204c259e..18eeee5106 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
@ -188,7 +188,7 @@ index 3e99221619..2e9836d8f9 100644
import com.google.common.base.Stopwatch; import com.google.common.base.Stopwatch;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
@@ -939,7 +940,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati @@ -943,7 +944,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
if (i - this.Y >= 5000000000L) { if (i - this.Y >= 5000000000L) {
this.Y = i; this.Y = i;
this.m.setPlayerSample(new ServerPing.ServerPingPlayerSample(this.z(), this.y())); this.m.setPlayerSample(new ServerPing.ServerPingPlayerSample(this.z(), this.y()));
@ -197,7 +197,7 @@ index 3e99221619..2e9836d8f9 100644
int j = MathHelper.nextInt(this.n, 0, this.y() - agameprofile.length); int j = MathHelper.nextInt(this.n, 0, this.y() - agameprofile.length);
for (int k = 0; k < agameprofile.length; ++k) { for (int k = 0; k < agameprofile.length; ++k) {
@@ -1296,10 +1297,12 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati @@ -1300,10 +1301,12 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
return "1.13.1"; return "1.13.1";
} }
@ -272,5 +272,5 @@ index 9584950c63..eed96c60c5 100644
} }
-- --
2.18.0 2.19.0

View file

@ -1,4 +1,4 @@
From 29c6ea2f197ad1b8bee4d635a5e25fbbe0b87c46 Mon Sep 17 00:00:00 2001 From 8f69fa82dcee69d86893451d8eaec5bf90b7c6ee Mon Sep 17 00:00:00 2001
From: miclebrick <miclebrick@outlook.com> From: miclebrick <miclebrick@outlook.com>
Date: Wed, 8 Aug 2018 15:30:52 -0400 Date: Wed, 8 Aug 2018 15:30:52 -0400
Subject: [PATCH] Add Early Warning Feature to WatchDog Subject: [PATCH] Add Early Warning Feature to WatchDog
@ -37,10 +37,10 @@ index cc2e4ad3bd..54f088c242 100644
public static int tabSpamLimit = 500; public static int tabSpamLimit = 500;
private static void tabSpamLimiters() { private static void tabSpamLimiters() {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 2e9836d8f9..8b8cbde2b9 100644 index 18eeee5106..6fa54386e8 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -792,6 +792,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati @@ -796,6 +796,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
this.a(this.m); this.a(this.m);
// Spigot start // Spigot start
@ -164,5 +164,5 @@ index 57a4748a30..19df383e06 100644
{ {
interrupt(); interrupt();
-- --
2.18.0 2.19.0

View file

@ -1,4 +1,4 @@
From 70ef7c45ece2b8ded83760ceec98c5138a9e4939 Mon Sep 17 00:00:00 2001 From 961790f1215deed4f84868d2d0c9d42267f341cc Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Wed, 27 Apr 2016 22:09:52 -0400 Date: Wed, 27 Apr 2016 22:09:52 -0400
Subject: [PATCH] Optimize Hoppers Subject: [PATCH] Optimize Hoppers
@ -47,10 +47,10 @@ index 9326eaa2a9..4641113f9d 100644
itemstack.d(this.B()); itemstack.d(this.B());
if (this.tag != null) { if (this.tag != null) {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 8b8cbde2b9..80e8b023cf 100644 index 6fa54386e8..eb3fc836fb 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1046,7 +1046,8 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati @@ -1050,7 +1050,8 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
// CraftBukkit - dropTickTime // CraftBukkit - dropTickTime
for (Iterator iterator = this.getWorlds().iterator(); iterator.hasNext();) { for (Iterator iterator = this.getWorlds().iterator(); iterator.hasNext();) {
@ -301,5 +301,5 @@ index 5ba009c7cf..a8cf160fe4 100644
flag = true; flag = true;
} else if (a(itemstack1, itemstack)) { } else if (a(itemstack1, itemstack)) {
-- --
2.18.0 2.19.0

View file

@ -1,4 +1,4 @@
From 392e56c668c62dfb7dcc4b4ba99dbba03c210d33 Mon Sep 17 00:00:00 2001 From d6e66d04c997b32aa5563503de5a61f0b09a6507 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Sun, 16 Sep 2018 00:00:16 -0400 Date: Sun, 16 Sep 2018 00:00:16 -0400
Subject: [PATCH] Fix major memory leaks in ExpiringMap Subject: [PATCH] Fix major memory leaks in ExpiringMap
@ -180,7 +180,7 @@ index 4006f5a69c..d64c143017 100644
} }
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 80e8b023cf..70a609efcc 100644 index eb3fc836fb..81cda5df56 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -155,6 +155,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati @@ -155,6 +155,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
@ -191,7 +191,7 @@ index 80e8b023cf..70a609efcc 100644
// CraftBukkit end // CraftBukkit end
// Spigot start // Spigot start
public static final int TPS = 20; public static final int TPS = 20;
@@ -995,6 +996,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati @@ -999,6 +1000,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
this.methodProfiler.e(); this.methodProfiler.e();
org.spigotmc.WatchdogThread.tick(); // Spigot org.spigotmc.WatchdogThread.tick(); // Spigot
PaperLightingQueue.processQueue(startTime); // Paper PaperLightingQueue.processQueue(startTime); // Paper