/// <summary> /// Runs when a player dies and runs the PlayerDeath event /// </summary> protected void ProcessDeath(int DeadPlayerSlot, bool PVPDeath) { TSPlayer murderer = null, murdered = null; PlayerDeathEventArgs args; int lastHitterSlot = default(int); //get the last hitter ID out of the dictionary lock (__pvpDictMutex) { if (PVPDamage.ContainsKey(DeadPlayerSlot)) { lastHitterSlot = PVPDamage[DeadPlayerSlot]; PVPDamage.Remove(DeadPlayerSlot); } } murderer = TShockAPI.TShock.Players.ElementAtOrDefault(lastHitterSlot); murdered = TShockAPI.TShock.Players.ElementAtOrDefault(DeadPlayerSlot); args = new PlayerDeathEventArgs(murderer, murdered); if (PlayerDeath != null) { PlayerDeath(this, args); } }