Archiviert
13
0
Dieses Repository wurde am 2024-12-25 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
Paper-Old/src/main/java/net/minecraft/server/NetworkAcceptThread.java

47 Zeilen
1.6 KiB
Java

package net.minecraft.server;
import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
class NetworkAcceptThread extends Thread {
final MinecraftServer a;
final NetworkListenThread b;
NetworkAcceptThread(NetworkListenThread networklistenthread, String s, MinecraftServer minecraftserver) {
super(s);
this.b = networklistenthread;
this.a = minecraftserver;
}
public void run() {
while (this.b.b) {
try {
Socket socket = NetworkListenThread.a(this.b).accept();
if (socket != null) {
synchronized (NetworkListenThread.b(this.b)) {
InetAddress inetaddress = socket.getInetAddress();
if (NetworkListenThread.b(this.b).containsKey(inetaddress) && System.currentTimeMillis() - ((Long) NetworkListenThread.b(this.b).get(inetaddress)).longValue() < 4000L) { // CraftBukkit
NetworkListenThread.b(this.b).put(inetaddress, Long.valueOf(System.currentTimeMillis()));
socket.close();
continue;
}
NetworkListenThread.b(this.b).put(inetaddress, Long.valueOf(System.currentTimeMillis()));
}
NetLoginHandler netloginhandler = new NetLoginHandler(this.a, socket, "Connection #" + NetworkListenThread.c(this.b));
NetworkListenThread.a(this.b, netloginhandler);
}
} catch (IOException ioexception) {
ioexception.printStackTrace();
}
}
}
}