public override void HandlePacket(Zone Zone, Client Sender, MCSharpServer Server) { StatusPong pong = new StatusPong(); pong.Payload = Payload; Sender.SendPacket(pong); Sender.Disconnect(DisconnectReason.ServerListPingCompleted); }
public override void HandlePacket(Zone Zone, Client Sender, MCSharpServer Server) { StatusResponse response = new StatusResponse(); response.MaxPlayers = Server.MaxPlayers; response.OnlinePlayers = Server.PlayerCount; response.Version = Sender.Version; response.ServerDescription = Server.ServerDescription; Sender.SendPacket(response); }
public override void HandlePacket(Zone Zone, Client Sender, MCSharpServer Server) { Sender.Version = Version; ClientConnectionConfirmedInfo confirmationInfo = new ClientConnectionConfirmedInfo(); confirmationInfo.ConnectedClient = Sender; if (NextState == ConnectionState.Login) { confirmationInfo.ConnectionPurpose = ConnectionPurpose.LoginAndPlay; } else { confirmationInfo.ConnectionPurpose = ConnectionPurpose.ServerListPing; } if ((Version > Server.MaximumAcceptedVersion || Version < Server.MinimumAcceptedVersion) && NextState == ConnectionState.Login) { Sender.SetState(NextState); Chat Message = new Chat(); Message.Components.Add(new ChatComponent("This server only accepts minecraft versions ranging from ")); Message.Components.Add(new ChatComponent(Server.MinimumAcceptedVersion.VersionName + " to " + Server.MaximumAcceptedVersion.VersionName, ChatSyle.Bold, ChatColor.Purple)); Sender.Disconnect(DisconnectReason.ClientMinecraftVersionNotAccepted, Message); } else if (Server.PlayerCount >= Server.MaxPlayers && NextState == ConnectionState.Login) { Sender.SetState(NextState); Chat Message = new Chat(); Message.Components.Add(new ChatComponent("This server is at its maximum capacity of ")); Message.Components.Add(new ChatComponent(Server.MaxPlayers + " players.", ChatSyle.Bold, ChatColor.Purple)); Sender.Disconnect(DisconnectReason.ServerAtMaxCapacity, Message); } else { Sender.ConnectionConfirmed = true; Server.confirmClient(confirmationInfo); Sender.SetState(NextState); } }
public override void HandlePacket(Zone Zone, Client Sender, MCSharpServer Server) { return; }
public abstract void HandlePacket(Zone Zone, Client Sender, MCSharpServer Server);