testserver/CraftBukkit-Patches/0077-Add-Optional-Tick-Shuf...

44 lines
1.8 KiB
Diff
Raw Normal View History

2015-04-09 03:18:56 +00:00
From f0840f434bc9354b1b6a6c7dd52df98f4fb728b5 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
2015-02-28 11:36:22 +00:00
index 42188fa..931ab66 100644
--- a/src/main/java/net/minecraft/server/ServerConnection.java
+++ b/src/main/java/net/minecraft/server/ServerConnection.java
2015-02-28 11:36:22 +00:00
@@ -123,6 +123,13 @@ public class ServerConnection {
List list = this.h;
2015-02-28 11:36:22 +00:00
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 )
+ {
2015-02-28 11:36:22 +00:00
+ Collections.shuffle( this.h );
+ }
+ // Spigot End
2015-02-28 11:36:22 +00:00
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
2014-11-28 01:17:45 +00:00
index a0d88ec..f19d415 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -273,4 +273,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 );
+ }
}
--
2014-11-28 01:17:45 +00:00
2.1.0