Update CraftBukkit to Minecraft 1.5.1

This commit is contained in:
Travis Watkins
2013-03-20 15:09:23 -05:00
parent 6aaa1e83df
commit 696543cf3f
21 changed files with 307 additions and 231 deletions

View File

@@ -57,28 +57,28 @@ public class DedicatedServerConnectionThread extends Thread {
while (this.e.a) {
try {
Socket socket = this.d.accept();
InetAddress inetaddress = socket.getInetAddress();
long i = System.currentTimeMillis();
HashMap hashmap = this.b;
// CraftBukkit start
// CraftBukkit start - connection throttle
InetAddress address = socket.getInetAddress();
long currentTime = System.currentTimeMillis();
if (((MinecraftServer) this.e.d()).server == null) {
socket.close();
continue;
}
connectionThrottle = ((MinecraftServer) this.e.d()).server.getConnectionThrottle();
// CraftBukkit end
synchronized (this.b) {
if (this.b.containsKey(inetaddress) && !b(inetaddress) && i - ((Long) this.b.get(inetaddress)).longValue() < connectionThrottle) {
this.b.put(inetaddress, Long.valueOf(i));
if (this.b.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - ((Long) this.b.get(address)).longValue() < connectionThrottle) {
this.b.put(address, Long.valueOf(currentTime));
socket.close();
continue;
}
this.b.put(inetaddress, Long.valueOf(i));
this.b.put(address, Long.valueOf(currentTime));
}
// CraftBukkit end
PendingConnection pendingconnection = new PendingConnection(this.e.d(), socket, "Connection #" + this.c++);
@@ -103,10 +103,6 @@ public class DedicatedServerConnectionThread extends Thread {
}
}
private static boolean b(InetAddress inetaddress) {
return "127.0.0.1".equals(inetaddress.getHostAddress());
}
public void a(InetAddress inetaddress) {
if (inetaddress != null) {
HashMap hashmap = this.b;