From c37016f476b1d1d79b67ddfafdb740df9030e203 Mon Sep 17 00:00:00 2001 From: Minecrell Date: Fri, 30 Mar 2018 18:53:15 +0200 Subject: [PATCH] Avoid negative server ping player sample counts. Fixes #1067 (#1068) --- ...nt-extended-PaperServerListPingEvent.patch | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/Spigot-Server-Patches/Implement-extended-PaperServerListPingEvent.patch b/Spigot-Server-Patches/Implement-extended-PaperServerListPingEvent.patch index 83b3c7b758..0eaf36b588 100644 --- a/Spigot-Server-Patches/Implement-extended-PaperServerListPingEvent.patch +++ b/Spigot-Server-Patches/Implement-extended-PaperServerListPingEvent.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Implement extended PaperServerListPingEvent diff --git a/src/main/java/com/destroystokyo/paper/network/PaperServerListPingEventImpl.java b/src/main/java/com/destroystokyo/paper/network/PaperServerListPingEventImpl.java new file mode 100644 -index 000000000..c1a8e295b +index 00000000..c1a8e295 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/network/PaperServerListPingEventImpl.java @@ -0,0 +0,0 @@ @@ -43,7 +43,7 @@ index 000000000..c1a8e295b +} diff --git a/src/main/java/com/destroystokyo/paper/network/PaperStatusClient.java b/src/main/java/com/destroystokyo/paper/network/PaperStatusClient.java new file mode 100644 -index 000000000..a2a409e63 +index 00000000..a2a409e6 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/network/PaperStatusClient.java @@ -0,0 +0,0 @@ @@ -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 00000000..35041052 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java @@ -0,0 +0,0 @@ @@ -177,7 +177,7 @@ index 000000000..350410527 + +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 579f0ba0d..99cfe1ae5 100644 +index 579f0ba0..99cfe1ae 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs @@ -203,7 +203,7 @@ index 579f0ba0d..99cfe1ae5 100644 return this.v.getMaxPlayers(); } diff --git a/src/main/java/net/minecraft/server/PacketStatusListener.java b/src/main/java/net/minecraft/server/PacketStatusListener.java -index 313bb0007..f3c25367d 100644 +index 313bb000..f3c25367 100644 --- a/src/main/java/net/minecraft/server/PacketStatusListener.java +++ b/src/main/java/net/minecraft/server/PacketStatusListener.java @@ -0,0 +0,0 @@ public class PacketStatusListener implements PacketStatusInListener { @@ -226,7 +226,7 @@ index 313bb0007..f3c25367d 100644 // CraftBukkit end } diff --git a/src/main/java/net/minecraft/server/ServerPing.java b/src/main/java/net/minecraft/server/ServerPing.java -index 981582212..ac161f505 100644 +index 98158221..ac161f50 100644 --- a/src/main/java/net/minecraft/server/ServerPing.java +++ b/src/main/java/net/minecraft/server/ServerPing.java @@ -0,0 +0,0 @@ public class ServerPing { @@ -250,4 +250,17 @@ index 981582212..ac161f505 100644 public void a(GameProfile[] agameprofile) { this.c = agameprofile; } +diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java +index cc1f3ac9..4f9fd4bc 100644 +--- a/src/main/java/org/spigotmc/SpigotConfig.java ++++ b/src/main/java/org/spigotmc/SpigotConfig.java +@@ -0,0 +0,0 @@ public class SpigotConfig + public static int playerSample; + private static void playerSample() + { +- playerSample = getInt( "settings.sample-count", 12 ); ++ playerSample = Math.max(getInt( "settings.sample-count", 12 ), 0); // Paper - Avoid negative counts + Bukkit.getLogger().log( Level.INFO, "Server Ping Player Sample Count: {0}", playerSample ); // Paper - Use logger + } + -- \ No newline at end of file