diff options
author | SpaceManiac <tad.hardesty@platymuus.com> | 2012-03-03 12:38:36 -0600 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2012-03-09 11:46:06 -0500 |
commit | a602d5c8c1eb93671fd9073291dff8ea89db1bd8 (patch) | |
tree | d6abaee32df4de32946ed5b70a8dd47892d89803 /src/main/java/net/minecraft/server/NetLoginHandler.java | |
parent | 97669f8d90d782091b5b6bc3d1c724229c8797ec (diff) | |
download | craftbukkit-a602d5c8c1eb93671fd9073291dff8ea89db1bd8.tar craftbukkit-a602d5c8c1eb93671fd9073291dff8ea89db1bd8.tar.gz craftbukkit-a602d5c8c1eb93671fd9073291dff8ea89db1bd8.tar.lz craftbukkit-a602d5c8c1eb93671fd9073291dff8ea89db1bd8.tar.xz craftbukkit-a602d5c8c1eb93671fd9073291dff8ea89db1bd8.zip |
[Bleeding] Implemented getting the hostname a player used to log in. Addresses BUKKIT-984
Diffstat (limited to 'src/main/java/net/minecraft/server/NetLoginHandler.java')
-rw-r--r-- | src/main/java/net/minecraft/server/NetLoginHandler.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/NetLoginHandler.java b/src/main/java/net/minecraft/server/NetLoginHandler.java index 83f0afb9..3337f6b6 100644 --- a/src/main/java/net/minecraft/server/NetLoginHandler.java +++ b/src/main/java/net/minecraft/server/NetLoginHandler.java @@ -22,6 +22,7 @@ public class NetLoginHandler extends NetHandler { private String g = null; private Packet1Login h = null; private String loginKey = Long.toString(random.nextLong(), 16); // CraftBukkit - Security fix + public String hostname = ""; // CraftBukkit - add field public NetLoginHandler(MinecraftServer minecraftserver, Socket socket, String s) { this.server = minecraftserver; @@ -60,6 +61,12 @@ public class NetLoginHandler extends NetHandler { } public void a(Packet2Handshake packet2handshake) { + // CraftBukkit start + int i = packet2handshake.a.indexOf(';'); + if (i == -1) { + this.hostname = ""; + } else this.hostname = packet2handshake.a.substring(i + 1); + // CraftBukkit end if (this.server.onlineMode) { this.loginKey = Long.toString(random.nextLong(), 16); this.networkManager.queue(new Packet2Handshake(this.loginKey)); @@ -92,7 +99,7 @@ public class NetLoginHandler extends NetHandler { } public void b(Packet1Login packet1login) { - EntityPlayer entityplayer = this.server.serverConfigurationManager.attemptLogin(this, packet1login.name); + EntityPlayer entityplayer = this.server.serverConfigurationManager.attemptLogin(this, packet1login.name, this.hostname); // CraftBukkit - add hostname parameter if (entityplayer != null) { this.server.serverConfigurationManager.b(entityplayer); |