public void SendLoginSequence() { foreach(Client client in Server.GetAuthenticatedClients()) { if(client.Username == Username) client.Stop(); } _player = new Player(Server, Server.AllocateEntity(), this); _player.Permissions = _player.PermHandler.LoadClientPermission(this); Load(); if (!_player.World.Running) { Stop(); return; } SendLoginRequest(); SendSpawnPosition(false); SendInitialTime(false); _player.UpdateChunks(4, CancellationToken.None, true, false); SendInitialPosition(false); }
internal void SendLoginSequence() { foreach(Client client in Server.GetAuthenticatedClients()) { if(client.Username == Username) client.Stop(); } _player = new Player(Server, Server.AllocateEntity(), this); _player.Permissions = _player.PermHandler.LoadClientPermission(this); Load(); if (!_player.World.Running) { Stop(); return; } SendLoginRequest(); _player.UpdateChunks(4, CancellationToken.None, true, false); SendSpawnPosition(false); _player.InitializeInventory(); _player.InitializeHealth(); SendInitialPosition(false); SendInitialTime(false); SetGameMode(); _player.OnJoined(); Server.AddEntity(_player, false); Server.AddAuthenticatedClient(this); SendMotd(); StartKeepAliveTimer(); _player.UpdateEntities(); Server.SendEntityToNearbyPlayers(_player.World, _player); Server.FreeConnectionSlot(); }
internal void SendLoginSequence() { foreach (Client client in Server.GetAuthenticatedClients()) { if (client.Username == Username) client.Stop(); } _player = new Player(Server, Server.AllocateEntity(), this); IBanSystem banSystem = _player.GetServer().GetBanSystem(); if (ChraftConfig.WhiteList) { //todo has permission instead of can use command if (!_player.CanUseCommand("chraft.whitelist.exempt") && !banSystem.IsOnWhiteList(_player.Name)) { _player.GetClient().Kick(ChraftConfig.WhiteListMesasge); return; } } IIpBans ipBan = banSystem.GetIpBan(_player.GetClient().IpAddress); IBans ban = _player.GetBan(); if (ipBan != null) { if (DateTime.Compare(ipBan.Duration, new DateTime(1900, 01, 01, 00, 00, 00)) == 0 || ipBan.Duration >= DateTime.Now) { _player.GetClient().Kick("Banned: " + ipBan.Reason); return; } banSystem.RemoveFromIpBanList(_player.GetClient().IpAddress); } if (ban != null) { if (DateTime.Compare(ban.Duration, new DateTime(1900, 01, 01, 00, 00, 00)) == 0 || ban.Duration >= DateTime.Now) { _player.GetClient().Kick("Banned: " + ban.Reason); return; } banSystem.RemoveFromBanList(_player.Name); } _player.Permissions = _player.PermHandler.LoadClientPermission(this); Load(); if (!_player.World.Running) { Stop(); return; } SendLoginRequest(); SendInitialTime(false); _player.UpdateChunks(4, CancellationToken.None, true, false); SendSpawnPosition(false); SendInitialPosition(false); SendInitialTime(false); SetGameMode(); _player.InitializeInventory(); _player.InitializeHealth(); _player.SendUpdateExperience(); _player.OnJoined(); Server.AddEntity(_player, false); Server.AddAuthenticatedClient(this); SendMotd(); StartKeepAliveTimer(); _player.UpdateEntities(); Server.SendEntityToNearbyPlayers(_player.World, _player); Server.FreeConnectionSlot(); }
public void SendLoginSequence() { _player = new Player(Server, Server.AllocateEntity(), this); Server.AddEntity(_player, false); Server.AddAuthenticatedClient(this); Authenticated = true; _player.Permissions = _player.PermHandler.LoadClientPermission(this); Load(); SendLoginRequest(); SendSpawnPosition(false); SendInitialTime(false); _player.UpdateChunks(2, true, CancellationToken.None); SendInitialPosition(false); }