Example #1
0
        void OnConnectionSuccessful(Player player, ClientMessage.GiveClientInfo data)
        {
            // Assign the requested name and send the final Server copy of the player data
            player.Data.SetName(data.Name);

            Logger.Log(this, "Player {0} connected.", player.Data.Name);

            // Inform the player that the connection was successful
            player.NotifyConnectionSuccess();

            // Send the player the latest version of their server-side data (they need to know their GUID)
            player.UpdatePlayerInfo(player.Data);

            // Send server update
            player.UpdateServerInfo(SettingsLoader.Values.Server);

            // Send Player Joined message.
            NotifyPlayerEvent(player, PlayerAction.Connected);

            // Trigger event.
            if (PlayerConnected != null)
            {
                PlayerConnected(this, player);
            }

            // Assign callback
            player.OnMessage += OnPlayerMessage;
        }
        void OnConnectionSuccessful(Player player, ClientMessage.GiveClientInfo data)
        {
            // Assign the requested name and send the final Server copy of the player data
            player.Data.SetName(data.Name);

            Logger.Log(this, "Player {0} connected.", player.Data.Name);

            // Inform the player that the connection was successful
            player.NotifyConnectionSuccess();

            // Send the player the latest version of their server-side data (they need to know their GUID)
            player.UpdatePlayerInfo(player.Data);

            // Send server update
            player.UpdateServerInfo(SettingsLoader.Values.Server);

            // Send Player Joined message.
            NotifyPlayerEvent(player, PlayerAction.Connected);

            // Trigger event.
            if (PlayerConnected != null)
                PlayerConnected(this, player);

            // Assign callback
            player.OnMessage += OnPlayerMessage;
        }