From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Tue, 24 Dec 2019 00:35:31 +0000 Subject: [PATCH] PlayerDeathEvent#shouldDropExperience diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java +++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java @@ -0,0 +0,0 @@ package org.bukkit.event.entity; import java.util.List; + +import org.bukkit.GameMode; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; @@ -0,0 +0,0 @@ public class PlayerDeathEvent extends EntityDeathEvent { private boolean keepLevel = false; private boolean keepInventory = false; // Paper start + private boolean doExpDrop; + public PlayerDeathEvent(@NotNull final Player player, @NotNull final List drops, final int droppedExp, @Nullable final net.kyori.adventure.text.Component adventure$deathMessage) { this(player, drops, droppedExp, 0, adventure$deathMessage, null); } @@ -0,0 +0,0 @@ public class PlayerDeathEvent extends EntityDeathEvent { } public PlayerDeathEvent(@NotNull final Player player, @NotNull final List drops, final int droppedExp, final int newExp, final int newTotalExp, final int newLevel, @Nullable final net.kyori.adventure.text.Component adventure$deathMessage, @Nullable String deathMessage) { + this(player, drops, droppedExp, newExp, newTotalExp, newLevel, adventure$deathMessage, deathMessage, true); + } + + public PlayerDeathEvent(@NotNull final Player player, @NotNull final List drops, final int droppedExp, final int newExp, final int newTotalExp, final int newLevel, @Nullable final net.kyori.adventure.text.Component adventure$deathMessage, @Nullable String deathMessage, boolean doExpDrop) { super(player, drops, droppedExp); this.newExp = newExp; this.newTotalExp = newTotalExp; this.newLevel = newLevel; this.deathMessage = deathMessage; this.adventure$deathMessage = adventure$deathMessage; + this.doExpDrop = doExpDrop; } // Paper end @@ -0,0 +0,0 @@ public class PlayerDeathEvent extends EntityDeathEvent { @Deprecated // Paper public PlayerDeathEvent(@NotNull final Player player, @NotNull final List drops, final int droppedExp, final int newExp, final int newTotalExp, final int newLevel, @Nullable final String deathMessage) { + this(player, drops, droppedExp, newExp, newTotalExp, newLevel, deathMessage, true); + } + + @Deprecated // Paper + public PlayerDeathEvent(@NotNull final Player player, @NotNull final List drops, final int droppedExp, final int newExp, final int newTotalExp, final int newLevel, @Nullable final String deathMessage, boolean doExpDrop) { super(player, drops, droppedExp); this.newExp = newExp; this.newTotalExp = newTotalExp; @@ -0,0 +0,0 @@ public class PlayerDeathEvent extends EntityDeathEvent { public List getItemsToKeep() { return itemsToKeep; } + + /** + * @return should experience be dropped from this death + */ + public boolean shouldDropExperience() { + return doExpDrop; + } + + /** + * @param doExpDrop sets if experience should be dropped from this death + */ + public void setShouldDropExperience(boolean doExpDrop) { + this.doExpDrop = doExpDrop; + } // Paper end @NotNull