spigot/CraftBukkit-Patches/0055-Add-Optional-Tick-Shuffling.patch

44 lines
1.8 KiB
Diff
Raw Normal View History

2018-12-06 10:00:00 +11:00
From 1faaea85c8920660d974ff8fae764208bf7b83f6 Mon Sep 17 00:00:00 2001
2014-04-12 14:18:37 +10:00
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
2018-12-06 10:00:00 +11:00
index 9e36530b9..1c0950fd7 100644
2014-04-12 14:18:37 +10:00
--- a/src/main/java/net/minecraft/server/ServerConnection.java
+++ b/src/main/java/net/minecraft/server/ServerConnection.java
2018-07-15 10:00:00 +10:00
@@ -102,6 +102,13 @@ public class ServerConnection {
List list = this.g;
2014-04-12 14:18:37 +10:00
2018-07-15 10:00:00 +10:00
synchronized (this.g) {
2014-04-12 14:18:37 +10:00
+ // 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 )
+ {
2018-07-15 10:00:00 +10:00
+ Collections.shuffle( this.g );
2014-04-12 14:18:37 +10:00
+ }
+ // Spigot End
2018-07-15 10:00:00 +10:00
Iterator iterator = this.g.iterator();
2014-04-12 14:18:37 +10:00
while (iterator.hasNext()) {
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
2018-08-26 12:00:00 +10:00
index 0b5a2fa33..7e56289bc 100644
2014-04-12 14:18:37 +10:00
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -284,4 +284,10 @@ public class SpigotConfig
2014-04-12 14:18:37 +10:00
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 );
+ }
}
--
2018-11-14 14:20:34 +11:00
2.19.1
2014-04-12 14:18:37 +10:00