Update CraftBukkit to Minecraft 1.4.4.
This commit is contained in:
@@ -13,13 +13,19 @@ public class Packet51MapChunk extends Packet {
|
||||
public int b;
|
||||
public int c;
|
||||
public int d;
|
||||
// CraftBukkit start - private -> public
|
||||
public byte[] buffer;
|
||||
public byte[] inflatedBuffer;
|
||||
public boolean e;
|
||||
public int size;
|
||||
// CraftBukkit end
|
||||
private byte[] buffer;
|
||||
private byte[] inflatedBuffer;
|
||||
private boolean e;
|
||||
private int size;
|
||||
private static byte[] buildBuffer = new byte[196864];
|
||||
// CraftBukkit start
|
||||
static final ThreadLocal<Deflater> localDeflater = new ThreadLocal<Deflater>() {
|
||||
@Override
|
||||
protected Deflater initialValue() {
|
||||
return new Deflater(Deflater.DEFAULT_COMPRESSION);
|
||||
}
|
||||
};
|
||||
// CraftBukkit end
|
||||
|
||||
public Packet51MapChunk() {
|
||||
this.lowPriority = true;
|
||||
@@ -36,7 +42,7 @@ public class Packet51MapChunk extends Packet {
|
||||
this.d = chunkmap.c;
|
||||
this.c = chunkmap.b;
|
||||
|
||||
/* CraftBukkit start - compression moved to new thread
|
||||
/* CraftBukkit start - moved to compress()
|
||||
try {
|
||||
this.inflatedBuffer = chunkmap.a;
|
||||
deflater.setInput(chunkmap.a, 0, chunkmap.a.length);
|
||||
@@ -48,9 +54,25 @@ public class Packet51MapChunk extends Packet {
|
||||
}
|
||||
*/
|
||||
this.inflatedBuffer = chunkmap.a;
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
// Add compression method
|
||||
public void compress() {
|
||||
if (this.buffer != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Deflater deflater = localDeflater.get();
|
||||
deflater.reset();
|
||||
deflater.setInput(this.inflatedBuffer);
|
||||
deflater.finish();
|
||||
|
||||
this.buffer = new byte[this.inflatedBuffer.length + 100];
|
||||
|
||||
this.size = deflater.deflate(this.buffer);
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public void a(DataInputStream datainputstream) throws IOException {
|
||||
this.a = datainputstream.readInt();
|
||||
this.b = datainputstream.readInt();
|
||||
@@ -91,6 +113,7 @@ public class Packet51MapChunk extends Packet {
|
||||
}
|
||||
|
||||
public void a(DataOutputStream dataoutputstream) throws IOException { // CraftBukkit - throws IOException
|
||||
compress(); // CraftBukkit
|
||||
dataoutputstream.writeInt(this.a);
|
||||
dataoutputstream.writeInt(this.b);
|
||||
dataoutputstream.writeBoolean(this.e);
|
||||
|
||||
Reference in New Issue
Block a user