namespace Minecraft.Server.FourKit.Event.Entity;
using FourKitEntity = Minecraft.Server.FourKit.Entity;
using Minecraft.Server.FourKit.Inventory;
///
/// Thrown whenever a Player dies.
///
public class PlayerDeathEvent : EntityDeathEvent
{
private string _deathMessage;
private int _newExp;
private int _newLevel;
private bool _keepLevel;
private bool _keepInventory;
internal PlayerDeathEvent(FourKitEntity.Player player, List drops, int droppedExp, string deathMessage)
: this(player, drops, droppedExp, 0, deathMessage)
{
}
///
/// Creates a new .
///
/// The Player who died.
/// The items to drop when the player dies.
/// The amount of experience to drop.
/// The new EXP the Player should have at respawn.
/// The death message to display.
public PlayerDeathEvent(FourKitEntity.Player player, List drops, int droppedExp, int newExp, string deathMessage)
: base(player, drops, droppedExp)
{
_deathMessage = deathMessage;
_newExp = newExp;
_newLevel = 0;
_keepLevel = false;
_keepInventory = false;
}
///
/// Returns the Entity involved in this event.
///
/// Entity who is involved in this event.
public new FourKitEntity.Player getEntity() => (FourKitEntity.Player)entity;
///
/// Get the death message that will appear to everyone on the server.
///
/// Message to appear to other players on the server.
public string getDeathMessage() => _deathMessage;
///
/// Set the death message that will appear to everyone on the server.
///
/// Message to appear to other players on the server.
public void setDeathMessage(string deathMessage) => _deathMessage = deathMessage;
///
/// Gets how much EXP the Player should have at respawn.
/// This does not indicate how much EXP should be dropped, please see
/// for that.
///
/// New EXP of the respawned player.
public int getNewExp() => _newExp;
///
/// Sets how much EXP the Player should have at respawn.
/// This does not indicate how much EXP should be dropped, please see
/// for that.
///
/// New EXP of the respawned player.
public void setNewExp(int exp) => _newExp = exp;
///
/// Gets the Level the Player should have at respawn.
///
/// New Level of the respawned player.
public int getNewLevel() => _newLevel;
///
/// Sets the Level the Player should have at respawn.
///
/// New Level of the respawned player.
public void setNewLevel(int level) => _newLevel = level;
///
/// Gets if the Player should keep all EXP at respawn.
/// This flag overrides other EXP settings.
///
/// true if Player should keep all pre-death exp.
public bool getKeepLevel() => _keepLevel;
///
/// Sets if the Player should keep all EXP at respawn.
/// This overrides all other EXP settings.
///
/// true to keep all current value levels.
public void setKeepLevel(bool keepLevel) => _keepLevel = keepLevel;
///
/// Gets if the Player keeps inventory on death.
///
/// true if the player keeps inventory on death.
public bool getKeepInventory() => _keepInventory;
///
/// Sets if the Player keeps inventory on death.
///
/// true to keep the inventory.
public void setKeepInventory(bool keepInventory) => _keepInventory = keepInventory;
}