Skip to content

Commit

Permalink
player death: add keep_inventory context
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Feb 11, 2023
1 parent b3df77d commit fc6f4e7
Showing 1 changed file with 2 additions and 0 deletions.
Expand Up @@ -47,6 +47,7 @@ public class EntityDeathScriptEvent extends BukkitScriptEvent implements Listene
// <context.cause> returns an ElementTag of the cause of the death. See <@link language damage cause> for a list of possible damage causes.
// <context.drops> returns a ListTag of all pending item drops.
// <context.xp> returns an ElementTag of the amount of experience to be dropped.
// <context.keep_inventory> returns true if the player dying is set to keep their inventory, false if not, or null if the dying entity is not a player.
//
// @Determine
// ElementTag to change the death message.
Expand Down Expand Up @@ -162,6 +163,7 @@ public ObjectTag getContext(String name) {
case "message": return event instanceof PlayerDeathEvent ? new ElementTag(PaperAPITools.instance.getDeathMessage((PlayerDeathEvent) event)) : null;
case "cause": return cause;
case "xp": return new ElementTag(event.getDroppedExp());
case "keep_inventory": return event instanceof PlayerDeathEvent ? new ElementTag(((PlayerDeathEvent) event).getKeepInventory()) : null;
case "drops":
ListTag list = new ListTag();
for (ItemStack stack : event.getDrops()) {
Expand Down

0 comments on commit fc6f4e7

Please sign in to comment.