diff options
author | Tahg <tahgtahv@gmail.com> | 2012-01-13 10:20:30 -0500 |
---|---|---|
committer | Tahg <tahgtahv@gmail.com> | 2012-01-13 10:20:30 -0500 |
commit | 24fe96ada898e00f5b89d269d230b9e7e6d70b1d (patch) | |
tree | e9f47aa3114169187af5e4aadf4d61a76d364f48 /src | |
parent | b4f215e9130aa5037033bd827968031d0e50aef9 (diff) | |
download | craftbukkit-24fe96ada898e00f5b89d269d230b9e7e6d70b1d.tar craftbukkit-24fe96ada898e00f5b89d269d230b9e7e6d70b1d.tar.gz craftbukkit-24fe96ada898e00f5b89d269d230b9e7e6d70b1d.tar.lz craftbukkit-24fe96ada898e00f5b89d269d230b9e7e6d70b1d.tar.xz craftbukkit-24fe96ada898e00f5b89d269d230b9e7e6d70b1d.zip |
Add fix for new login protocol
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/net/minecraft/server/Packet1Login.java | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/Packet1Login.java b/src/main/java/net/minecraft/server/Packet1Login.java new file mode 100644 index 00000000..6504ebfd --- /dev/null +++ b/src/main/java/net/minecraft/server/Packet1Login.java @@ -0,0 +1,82 @@ +package net.minecraft.server; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; // CraftBukkit + +public class Packet1Login extends Packet { + + public int a; + public String name; + public long c; + public WorldType d; + public int e; + public byte f; + public byte g; + public byte h; + public byte i; + + public Packet1Login() {} + + public Packet1Login(String s, int i, long j, WorldType worldtype, int k, byte b0, byte b1, byte b2, byte b3) { + this.name = s; + this.a = i; + this.c = j; + this.d = worldtype; + this.f = b0; + this.g = b1; + this.e = k; + this.h = b2; + this.i = b3; + } + + public void a(DataInputStream datainputstream) throws IOException { // CraftBukkit + this.a = datainputstream.readInt(); + this.name = a(datainputstream, 16); + if (this.a < 23) return; // CraftBukkit + this.c = datainputstream.readLong(); + String s = a(datainputstream, 16); + + this.d = WorldType.a(s); + if (this.d == null) { + this.d = WorldType.NORMAL; + } + + this.e = datainputstream.readInt(); + this.f = datainputstream.readByte(); + this.g = datainputstream.readByte(); + this.h = datainputstream.readByte(); + this.i = datainputstream.readByte(); + } + + public void a(DataOutputStream dataoutputstream) throws IOException { // CraftBukkit + dataoutputstream.writeInt(this.a); + a(this.name, dataoutputstream); + dataoutputstream.writeLong(this.c); + if (this.d == null) { + a("", dataoutputstream); + } else { + a(this.d.name(), dataoutputstream); + } + + dataoutputstream.writeInt(this.e); + dataoutputstream.writeByte(this.f); + dataoutputstream.writeByte(this.g); + dataoutputstream.writeByte(this.h); + dataoutputstream.writeByte(this.i); + } + + public void a(NetHandler nethandler) { + nethandler.a(this); + } + + public int a() { + int i = 0; + + if (this.d != null) { + i = this.d.name().length(); + } + + return 4 + this.name.length() + 4 + 7 + 4 + i; + } +} |