Login and Disconnect
This commit is contained in:
@@ -13,12 +13,12 @@ import mc.core.Config;
|
||||
import mc.core.chat.ChatProcessor;
|
||||
import mc.core.network.CSPacket;
|
||||
import mc.core.network.proto_1_12_2.State;
|
||||
import mc.core.network.proto_1_12_2.packets.HandshakePacket;
|
||||
import mc.core.network.proto_1_12_2.packets.PingPacket;
|
||||
import mc.core.network.proto_1_12_2.packets.StatusRequestPacket;
|
||||
import mc.core.network.proto_1_12_2.packets.StatusResponsePacket;
|
||||
import mc.core.network.proto_1_12_2.packets.*;
|
||||
import mc.core.player.Player;
|
||||
import mc.core.player.PlayerManager;
|
||||
import mc.core.text.Text;
|
||||
import mc.core.text.TextColor;
|
||||
import mc.core.text.TextStyle;
|
||||
import mc.core.world.World;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -69,6 +69,7 @@ public class PacketHandler extends SimpleChannelInboundHandler<CSPacket> {
|
||||
|
||||
private void onHandshake(Channel channel, HandshakePacket packet) {
|
||||
if (packet.getNextState().equals(State.UNKNOWN)) return;
|
||||
log.debug("New state: {}", packet.getNextState());
|
||||
channel.attr(ATTR_STATE).set(packet.getNextState());
|
||||
}
|
||||
|
||||
@@ -88,4 +89,9 @@ public class PacketHandler extends SimpleChannelInboundHandler<CSPacket> {
|
||||
if (!channel.attr(ATTR_STATE).get().equals(State.STATUS)) return;
|
||||
channel.writeAndFlush(packet);
|
||||
}
|
||||
|
||||
private void onLoginStart(Channel channel, LoginStartPacket packet) {
|
||||
if (!channel.attr(ATTR_STATE).get().equals(State.LOGIN)) return;
|
||||
channel.writeAndFlush(new DisconnectPacket(Text.of("Server is not ready :(", null, TextStyle.ITALIC)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user