diff options
author | mbax <matt@phozop.net> | 2013-11-04 07:07:38 -0600 |
---|---|---|
committer | Wesley Wolfe <weswolf@aol.com> | 2013-11-30 19:26:12 -0600 |
commit | 2726696652179a5ead7dc07dd39edf7dfda687f7 (patch) | |
tree | ff78e22fdd4fc01889a5f6cc482b599f965cd93a /src/main/java/net/minecraft/server/HandshakeListener.java | |
parent | ff8b70fbb7a96b9d2ff078afcf3b3ff90f200981 (diff) | |
download | craftbukkit-2726696652179a5ead7dc07dd39edf7dfda687f7.tar craftbukkit-2726696652179a5ead7dc07dd39edf7dfda687f7.tar.gz craftbukkit-2726696652179a5ead7dc07dd39edf7dfda687f7.tar.lz craftbukkit-2726696652179a5ead7dc07dd39edf7dfda687f7.tar.xz craftbukkit-2726696652179a5ead7dc07dd39edf7dfda687f7.zip |
Update CraftBukkit to Minecraft 1.7.2
Diffstat (limited to 'src/main/java/net/minecraft/server/HandshakeListener.java')
-rw-r--r-- | src/main/java/net/minecraft/server/HandshakeListener.java | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java new file mode 100644 index 00000000..b7f67758 --- /dev/null +++ b/src/main/java/net/minecraft/server/HandshakeListener.java @@ -0,0 +1,54 @@ +package net.minecraft.server; + +import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener; + +public class HandshakeListener implements PacketHandshakingInListener { + + private final MinecraftServer a; + private final NetworkManager b; + + public HandshakeListener(MinecraftServer minecraftserver, NetworkManager networkmanager) { + this.a = minecraftserver; + this.b = networkmanager; + } + + public void a(PacketHandshakingInSetProtocol packethandshakinginsetprotocol) { + switch (ProtocolOrdinalWrapper.a[packethandshakinginsetprotocol.c().ordinal()]) { + case 1: + this.b.a(EnumProtocol.LOGIN); + ChatComponentText chatcomponenttext; + + if (packethandshakinginsetprotocol.d() > 4) { + chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.7.2"); + this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext), new GenericFutureListener[0]); + this.b.a((IChatBaseComponent) chatcomponenttext); + } else if (packethandshakinginsetprotocol.d() < 4) { + chatcomponenttext = new ChatComponentText("Outdated client! Please use 1.7.2"); + this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext), new GenericFutureListener[0]); + this.b.a((IChatBaseComponent) chatcomponenttext); + } else { + this.b.a((PacketListener) (new LoginListener(this.a, this.b))); + ((LoginListener) this.b.getPacketListener()).hostname = packethandshakinginsetprotocol.b + ":" + packethandshakinginsetprotocol.c; // CraftBukkit - set hostname + } + break; + + case 2: + this.b.a(EnumProtocol.STATUS); + this.b.a((PacketListener) (new PacketStatusListener(this.a, this.b))); + break; + + default: + throw new UnsupportedOperationException("Invalid intention " + packethandshakinginsetprotocol.c()); + } + } + + public void a(IChatBaseComponent ichatbasecomponent) {} + + public void a(EnumProtocol enumprotocol, EnumProtocol enumprotocol1) { + if (enumprotocol1 != EnumProtocol.LOGIN && enumprotocol1 != EnumProtocol.STATUS) { + throw new UnsupportedOperationException("Invalid state " + enumprotocol1); + } + } + + public void a() {} +} |