mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +01:00
Add Optional Tick Shuffling
This prevents players from 'gaming' the server, and strategically relogging to increase their position in the tick order. By: md_5 <git@md-5.net>
This commit is contained in:
parent
23c02d0942
commit
b26b6dadb0
2 changed files with 20 additions and 0 deletions
|
@ -29,3 +29,17 @@
|
|||
public SocketAddress startMemoryChannel() {
|
||||
List list = this.channels;
|
||||
ChannelFuture channelfuture;
|
||||
@@ -153,6 +163,13 @@
|
||||
List list = this.connections;
|
||||
|
||||
synchronized (this.connections) {
|
||||
+ // 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.connections );
|
||||
+ }
|
||||
+ // Spigot End
|
||||
Iterator<Connection> iterator = this.connections.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
|
|
|
@ -278,4 +278,10 @@ public class SpigotConfig
|
|||
SpigotConfig.playerSample = SpigotConfig.getInt( "settings.sample-count", 12 );
|
||||
System.out.println( "Server Ping Player Sample Count: " + SpigotConfig.playerSample );
|
||||
}
|
||||
|
||||
public static int playerShuffle;
|
||||
private static void playerShuffle()
|
||||
{
|
||||
SpigotConfig.playerShuffle = SpigotConfig.getInt( "settings.player-shuffle", 0 );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue