Пример #1
0
 public void OnPlayerDeath(ClientDeathEventArgs e)
 {
     if (e.EventCanceled) return;
     _plugin.Server.Broadcast(e.Client.GetOwner().DisplayName + " went splat");
 }
Пример #2
0
 private void OnPlayerDeath(ClientDeathEventArgs e)
 {
     foreach (EventListener el in Plugins)
     {
         IPlayerListener pl = (IPlayerListener)el.Listener;
         if (el.Event == Event.PlayerDied)
             pl.OnPlayerDeath(e);
     }
 }
Пример #3
0
        /// <summary>
        /// Handles the death of the Client.
        /// </summary>
        /// <param name="hitBy">Who killed the current Client.</param>
        internal override void HandleDeath(EntityBase killedBy = null, string deathBy = "")
        {
            //Event
            ClientDeathEventArgs clientDeath = new ClientDeathEventArgs(Client, deathBy, killedBy);
            Client.Owner.Server.PluginManager.CallEvent(Event.PlayerDied, clientDeath);
            if (clientDeath.EventCanceled) { return; }
            killedBy = clientDeath.KilledBy as EntityBase;
            //End Event


            // TODO: Add config option for none/global/local death messages
            // ...Or maybe make messages a plugin?
            string deathMessage = string.Empty;

            if (killedBy == null && deathBy == "") // Generic message
            {
                deathBy = "mysteriously!";
            }
            else if (killedBy is Player)
            {
                var p = (Player)killedBy;
                deathBy = "by " + p.DisplayName + " using" + Server.Items.ItemName(Inventory[Inventory.ActiveSlot].Type);
            }
            else if (killedBy is Mob)
            {
                var m = (Mob) killedBy;
                deathBy = "by " + m.Type;
            }

            deathMessage = DisplayName + " was killed " + deathBy;

            SendUpdateOnDeath(deathMessage);

            DoDeath(killedBy);
        }
 public void OnPlayerDeath(ClientDeathEventArgs e)
 {
 }