Update for 1.4_00_01 -- if you bypassed Bukkit, you will most likely break.

This commit is contained in:
Erik Broes
2011-04-20 19:05:14 +02:00
parent ac9f297445
commit 483a878b8b
116 changed files with 3155 additions and 3207 deletions

View File

@@ -2,15 +2,13 @@ package net.minecraft.server;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.SocketException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.io.IOException; // CraftBukkit
public class NetworkManager {
@@ -18,10 +16,10 @@ public class NetworkManager {
public static int b;
public static int c;
private Object e = new Object();
public Socket f; // CraftBukkit private->public
public Socket socket; // CraftBukkit -- private->public
private final SocketAddress g;
private DataInputStream h;
private DataOutputStream i;
private DataInputStream input;
private DataOutputStream output;
private boolean j = true;
private List k = Collections.synchronizedList(new ArrayList());
private List l = Collections.synchronizedList(new ArrayList());
@@ -39,25 +37,18 @@ public class NetworkManager {
private int w = 50;
public NetworkManager(Socket socket, String s, NetHandler nethandler) {
this.f = socket;
this.socket = socket;
this.g = socket.getRemoteSocketAddress();
this.n = nethandler;
// Craftbukkit start
try {
socket.setSoTimeout(30000);
socket.setSoTimeout(30000); // Craftbukkit start
socket.setTrafficClass(24);
} catch (SocketException socketexception) {
this.input = new DataInputStream(socket.getInputStream());
this.output = new DataOutputStream(socket.getOutputStream());
} catch (IOException socketexception) {
System.err.println(socketexception.getMessage());
}
try {
this.h = new DataInputStream(socket.getInputStream());
this.i = new DataOutputStream(socket.getOutputStream());
} catch (IOException ex) {
Logger.getLogger(NetworkManager.class.getName()).log(Level.SEVERE, null, ex);
}
// Craftbukkit end
this.q = new NetworkReaderThread(this, s + " read thread");
this.p = new NetworkWriterThread(this, s + " write thread");
@@ -90,7 +81,7 @@ public class NetworkManager {
Object object;
Packet packet;
if (!this.l.isEmpty() && (this.d == 0 || System.currentTimeMillis() - ((Packet) this.l.get(0)).j >= (long) this.d)) {
if (!this.l.isEmpty() && (this.d == 0 || System.currentTimeMillis() - ((Packet) this.l.get(0)).timestamp >= (long) this.d)) {
flag = false;
object = this.e;
synchronized (this.e) {
@@ -98,10 +89,10 @@ public class NetworkManager {
this.v -= packet.a() + 1;
}
Packet.a(packet, this.i);
Packet.a(packet, this.output);
}
if ((flag || this.w-- <= 0) && !this.m.isEmpty() && (this.d == 0 || System.currentTimeMillis() - ((Packet) this.m.get(0)).j >= (long) this.d)) {
if ((flag || this.w-- <= 0) && !this.m.isEmpty() && (this.d == 0 || System.currentTimeMillis() - ((Packet) this.m.get(0)).timestamp >= (long) this.d)) {
flag = false;
object = this.e;
synchronized (this.e) {
@@ -109,7 +100,7 @@ public class NetworkManager {
this.v -= packet.a() + 1;
}
Packet.a(packet, this.i);
Packet.a(packet, this.output);
this.w = 50;
}
@@ -127,7 +118,7 @@ public class NetworkManager {
private void f() {
try {
Packet packet = Packet.b(this.h);
Packet packet = Packet.b(this.input);
if (packet != null) {
this.k.add(packet);
@@ -155,22 +146,22 @@ public class NetworkManager {
this.j = false;
try {
this.h.close();
this.h = null;
this.input.close();
this.input = null;
} catch (Throwable throwable) {
;
}
try {
this.i.close();
this.i = null;
this.output.close();
this.output = null;
} catch (Throwable throwable1) {
;
}
try {
this.f.close();
this.f = null;
this.socket.close();
this.socket = null;
} catch (Throwable throwable2) {
;
}
@@ -203,7 +194,7 @@ public class NetworkManager {
}
}
public SocketAddress b() {
public SocketAddress getSocketAddress() {
return this.g;
}