Avoid negative server ping player sample counts. Fixes #1067 (#1068)

This commit is contained in:
Minecrell 2018-03-30 18:53:15 +02:00
parent bfa2eab01f
commit c37016f476

View File

@ -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
}
--