mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-11 09:23:42 +01:00
43 lines
1.8 KiB
Diff
43 lines
1.8 KiB
Diff
From 61113aa5f7710ecae31ddc374322342efc928f17 Mon Sep 17 00:00:00 2001
|
|
From: md_5 <git@md-5.net>
|
|
Date: Mon, 27 Jan 2014 08:39:26 +1100
|
|
Subject: [PATCH] Add Optional Tick Shuffling
|
|
|
|
This prevents players from 'gaming' the server, and strategically relogging to increase their position in the tick order.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java
|
|
index 968a1b7..827bfaf 100644
|
|
--- a/src/main/java/net/minecraft/server/ServerConnection.java
|
|
+++ b/src/main/java/net/minecraft/server/ServerConnection.java
|
|
@@ -123,6 +123,13 @@ public class ServerConnection {
|
|
List list = this.h;
|
|
|
|
synchronized (this.h) {
|
|
+ // Spigot Start
|
|
+ // This prevents players from 'gaming' the server, and strategically relogging to increase their position in the tick order
|
|
+ if ( org.spigotmc.SpigotConfig.playerShuffle > 0 && MinecraftServer.currentTick % org.spigotmc.SpigotConfig.playerShuffle == 0 )
|
|
+ {
|
|
+ Collections.shuffle( this.h );
|
|
+ }
|
|
+ // Spigot End
|
|
Iterator iterator = this.h.iterator();
|
|
|
|
while (iterator.hasNext()) {
|
|
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
|
index 936c860..83e575f 100644
|
|
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
|
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
|
@@ -274,4 +274,10 @@ public class SpigotConfig
|
|
playerSample = getInt( "settings.sample-count", 12 );
|
|
System.out.println( "Server Ping Player Sample Count: " + playerSample );
|
|
}
|
|
+
|
|
+ public static int playerShuffle;
|
|
+ private static void playerShuffle()
|
|
+ {
|
|
+ playerShuffle = getInt( "settings.player-shuffle", 0 );
|
|
+ }
|
|
}
|
|
--
|
|
2.5.0
|
|
|