Merge tick shuffling branch into master.
Dieser Commit ist enthalten in:
Ursprung
d3f7cce233
Commit
6bf69c66f3
@ -1,4 +1,4 @@
|
||||
From 1d5b81555def55b67178090ba0e5f3ecf27f5bda Mon Sep 17 00:00:00 2001
|
||||
From 95e52dc06241d2a34781b0c4258c99d900ea3c44 Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <md_5@live.com.au>
|
||||
Date: Sun, 1 Dec 2013 15:10:48 +1100
|
||||
Subject: [PATCH] mc-dev imports
|
||||
@ -1969,6 +1969,114 @@ index 0000000..900ed68
|
||||
+ return regionfile.b(i & 31, j & 31);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java
|
||||
new file mode 100644
|
||||
index 0000000..3691094
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/minecraft/server/ServerConnection.java
|
||||
@@ -0,0 +1,102 @@
|
||||
+package net.minecraft.server;
|
||||
+
|
||||
+import java.net.InetAddress;
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.Collections;
|
||||
+import java.util.Iterator;
|
||||
+import java.util.List;
|
||||
+import java.util.concurrent.Callable;
|
||||
+
|
||||
+import net.minecraft.util.com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
+import net.minecraft.util.io.netty.bootstrap.ServerBootstrap;
|
||||
+import net.minecraft.util.io.netty.channel.ChannelFuture;
|
||||
+import net.minecraft.util.io.netty.channel.nio.NioEventLoopGroup;
|
||||
+import net.minecraft.util.io.netty.channel.socket.nio.NioServerSocketChannel;
|
||||
+import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener;
|
||||
+import org.apache.logging.log4j.LogManager;
|
||||
+import org.apache.logging.log4j.Logger;
|
||||
+
|
||||
+public class ServerConnection {
|
||||
+
|
||||
+ private static final Logger b = LogManager.getLogger();
|
||||
+ private static final NioEventLoopGroup c = new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty IO #%d").setDaemon(true).build());
|
||||
+ private final MinecraftServer d;
|
||||
+ public volatile boolean a;
|
||||
+ private final List e = Collections.synchronizedList(new ArrayList());
|
||||
+ private final List f = Collections.synchronizedList(new ArrayList());
|
||||
+
|
||||
+ public ServerConnection(MinecraftServer minecraftserver) {
|
||||
+ this.d = minecraftserver;
|
||||
+ this.a = true;
|
||||
+ }
|
||||
+
|
||||
+ public void a(InetAddress inetaddress, int i) {
|
||||
+ List list = this.e;
|
||||
+
|
||||
+ synchronized (this.e) {
|
||||
+ this.e.add(((ServerBootstrap) ((ServerBootstrap) (new ServerBootstrap()).channel(NioServerSocketChannel.class)).childHandler(new ServerConnectionChannel(this)).group(c).localAddress(inetaddress, i)).bind().syncUninterruptibly());
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public void b() {
|
||||
+ this.a = false;
|
||||
+ Iterator iterator = this.e.iterator();
|
||||
+
|
||||
+ while (iterator.hasNext()) {
|
||||
+ ChannelFuture channelfuture = (ChannelFuture) iterator.next();
|
||||
+
|
||||
+ channelfuture.channel().close().syncUninterruptibly();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public void c() {
|
||||
+ List list = this.f;
|
||||
+
|
||||
+ synchronized (this.f) {
|
||||
+ Iterator iterator = this.f.iterator();
|
||||
+
|
||||
+ while (iterator.hasNext()) {
|
||||
+ NetworkManager networkmanager = (NetworkManager) iterator.next();
|
||||
+
|
||||
+ if (!networkmanager.d()) {
|
||||
+ iterator.remove();
|
||||
+ if (networkmanager.f() != null) {
|
||||
+ networkmanager.getPacketListener().a(networkmanager.f());
|
||||
+ } else if (networkmanager.getPacketListener() != null) {
|
||||
+ networkmanager.getPacketListener().a(new ChatComponentText("Disconnected"));
|
||||
+ }
|
||||
+ } else {
|
||||
+ try {
|
||||
+ networkmanager.a();
|
||||
+ } catch (Exception exception) {
|
||||
+ if (networkmanager.c()) {
|
||||
+ CrashReport crashreport = CrashReport.a(exception, "Ticking memory connection");
|
||||
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Ticking connection");
|
||||
+
|
||||
+ crashreportsystemdetails.a("Connection", (Callable) (new CrashReportServerConnection(this, networkmanager)));
|
||||
+ throw new ReportedException(crashreport);
|
||||
+ }
|
||||
+
|
||||
+ b.warn("Failed to handle packet for " + networkmanager.getSocketAddress(), exception);
|
||||
+ ChatComponentText chatcomponenttext = new ChatComponentText("Internal server error");
|
||||
+
|
||||
+ networkmanager.handle(new PacketPlayOutKickDisconnect(chatcomponenttext), new GenericFutureListener[] { new ServerConnectionFuture(this, networkmanager, chatcomponenttext)});
|
||||
+ networkmanager.g();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public MinecraftServer d() {
|
||||
+ return this.d;
|
||||
+ }
|
||||
+
|
||||
+ static List a(ServerConnection serverconnection) {
|
||||
+ return serverconnection.f;
|
||||
+ }
|
||||
+
|
||||
+ static MinecraftServer b(ServerConnection serverconnection) {
|
||||
+ return serverconnection.d;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/ServerStatisticManager.java b/src/main/java/net/minecraft/server/ServerStatisticManager.java
|
||||
new file mode 100644
|
||||
index 0000000..2f980cb
|
||||
|
43
CraftBukkit-Patches/0103-Add-Optional-Tick-Shuffling.patch
Normale Datei
43
CraftBukkit-Patches/0103-Add-Optional-Tick-Shuffling.patch
Normale Datei
@ -0,0 +1,43 @@
|
||||
From a78bccdc4d9a40df173696163ad9e7ddbf167afe 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 3691094..c91ed8e 100644
|
||||
--- a/src/main/java/net/minecraft/server/ServerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/ServerConnection.java
|
||||
@@ -53,6 +53,13 @@ public class ServerConnection {
|
||||
List list = this.f;
|
||||
|
||||
synchronized (this.f) {
|
||||
+ // 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.f );
|
||||
+ }
|
||||
+ // Spigot End
|
||||
Iterator iterator = this.f.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
index d26b621..552266b 100755
|
||||
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
@@ -260,4 +260,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 );
|
||||
+ }
|
||||
}
|
||||
--
|
||||
1.8.3.2
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren