commands, camera, messages, overlay, ..
This commit is contained in:
parent
75f91dbf4c
commit
d45cd7ec2c
126 changed files with 854 additions and 628 deletions
41
java/src/game/network/HandshakeHandlerTCP.java
Executable file
41
java/src/game/network/HandshakeHandlerTCP.java
Executable file
|
@ -0,0 +1,41 @@
|
|||
package game.network;
|
||||
|
||||
import game.Server;
|
||||
import game.init.Config;
|
||||
import game.packet.HPacketHandshake;
|
||||
import game.packet.RPacketDisconnect;
|
||||
|
||||
public class HandshakeHandlerTCP extends HandshakeHandler
|
||||
{
|
||||
private final Server server;
|
||||
private final NetConnection networkManager;
|
||||
|
||||
public HandshakeHandlerTCP(Server serverIn, NetConnection netManager)
|
||||
{
|
||||
this.server = serverIn;
|
||||
this.networkManager = netManager;
|
||||
}
|
||||
|
||||
public void processHandshake(HPacketHandshake packetIn)
|
||||
{
|
||||
if(packetIn.getProtocolVersion() == 0) {
|
||||
this.networkManager.closeChannel("Inkompatibel!");
|
||||
return;
|
||||
}
|
||||
this.networkManager.setConnectionState(PacketRegistry.LOGIN);
|
||||
if (packetIn.getProtocolVersion() != Config.PROTOCOL)
|
||||
{
|
||||
String comp;
|
||||
if(packetIn.getProtocolVersion() < Config.PROTOCOL)
|
||||
comp = "Der Server nutzt eine neuere Version: " + Config.VERSION;
|
||||
else
|
||||
comp = "Der Server nutzt eine ältere Version: " + Config.VERSION;
|
||||
this.networkManager.sendPacket(new RPacketDisconnect(comp));
|
||||
this.networkManager.closeChannel(comp);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.networkManager.setNetHandler(new LoginHandler(this.server, this.networkManager));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue