@@ -18,6 +20,8 @@ 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<ItemStack> drops, final int droppedExp, @Nullable final net.kyori.adventure.text.Component adventure$deathMessage) {
@@ -27,12 +31,17 @@ public class PlayerDeathEvent extends EntityDeathEvent {
}
public PlayerDeathEvent(@NotNull final Player player, @NotNull final List<ItemStack> 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) {
+ public PlayerDeathEvent(@NotNull final Player player, @NotNull final List<ItemStack> 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) {
@@ -47,6 +56,11 @@ public class PlayerDeathEvent extends EntityDeathEvent {
@Deprecated // Paper
public PlayerDeathEvent(@NotNull final Player player, @NotNull final List<ItemStack> drops, final int droppedExp, final int newExp, final int newTotalExp, final int newLevel, @Nullable final String deathMessage) {
+ public PlayerDeathEvent(@NotNull final Player player, @NotNull final List<ItemStack> 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;
@@ -88,6 +102,20 @@ public class PlayerDeathEvent extends EntityDeathEvent {
public List<ItemStack> 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) {