3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-17 03:50:08 +01:00

Handle case where currentTick could be negative

@Aikar is there a better way to handle this?
Dieser Commit ist enthalten in:
Thinkofdeath 2014-03-26 15:18:11 +00:00
Ursprung 321d00dbd5
Commit fdfc07bd39

Datei anzeigen

@ -1,4 +1,4 @@
From 92495f9ed485c619523e3d5e4be1d122b590e6a3 Mon Sep 17 00:00:00 2001 From dbc277885ec999d8e9ea208555b85b0e4baa34c1 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Sun, 24 Feb 2013 20:45:20 +1100 Date: Sun, 24 Feb 2013 20:45:20 +1100
Subject: [PATCH] Enable Improved Ping Sending Subject: [PATCH] Enable Improved Ping Sending
@ -17,7 +17,7 @@ index 8d98a70..4c06a42 100644
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) {
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 5b0590e..8b3d757 100644 index 5b0590e..273439a 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java --- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -779,6 +779,25 @@ public abstract class PlayerList { @@ -779,6 +779,25 @@ public abstract class PlayerList {
@ -27,7 +27,7 @@ index 5b0590e..8b3d757 100644
+ // Spigot start + // Spigot start
+ if ( !players.isEmpty() ) + if ( !players.isEmpty() )
+ { + {
+ int index = MinecraftServer.currentTick % this.players.size(); + int index = Math.abs( MinecraftServer.currentTick ) % this.players.size();
+ EntityPlayer player = (EntityPlayer) this.players.get( index ); + EntityPlayer player = (EntityPlayer) this.players.get( index );
+ if ( player.lastPing == -1 || Math.abs( player.ping - player.lastPing ) > 20 ) + if ( player.lastPing == -1 || Math.abs( player.ping - player.lastPing ) > 20 )
+ { + {
@ -47,5 +47,5 @@ index 5b0590e..8b3d757 100644
public void sendAll(Packet packet) { public void sendAll(Packet packet) {
-- --
1.8.3.2 1.8.5.2.msysgit.0