public void OnPlayerKicked(ClientKickedEventArgs e)
        {
            if (e.EventCanceled || string.IsNullOrEmpty(e.Client.Username))
                return;

            SchematicAction unused;
            if (_plugin.Actions.ContainsKey(e.Client.Username))
                _plugin.Actions.TryRemove(e.Client.Username, out unused);
        }
 public void OnPlayerKicked(ClientKickedEventArgs e)
 {
 }
示例#3
0
 private void OnPlayerKicked(ClientKickedEventArgs e)
 {
     foreach (EventListener el in Plugins)
     {
         IPlayerListener pl = (IPlayerListener)el.Listener;
         if (el.Event == Event.PlayerKicked)
             pl.OnPlayerKicked(e);
     }
 }
示例#4
0
文件: Client.cs 项目: OBASI/c-raft
        /// <summary>
        /// Disconnect the client with the given reason.
        /// </summary>
        /// <param name="reason">The reason to be displayed to the player.</param>
        public void Kick(string reason)
        {
            //Event
            ClientKickedEventArgs e = new ClientKickedEventArgs(this, reason);
            Server.PluginManager.CallEvent(Event.PlayerKicked, e);
            if (e.EventCanceled) return;
            reason = e.Message;
            //End Event

            if(_player != null && _player.LoggedIn)
                Save();

            SendPacket(new DisconnectPacket
            {
                Reason = reason
            });
        }