mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-27 04:55:47 +01:00
57dd397155
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: b999860d SPIGOT-2304: Add LootGenerateEvent CraftBukkit Changes:77fd87e4
SPIGOT-2304: Implement LootGenerateEventa1a705ee
SPIGOT-5566: Doused campfires & fires should call EntityChangeBlockEvent41712edd
SPIGOT-5707: PersistentDataHolder not Persistent on API dropped Item
65 lines
2.4 KiB
Diff
65 lines
2.4 KiB
Diff
From 7f0238c8822f58e59c5b1f515102d82827c8f015 Mon Sep 17 00:00:00 2001
|
|
From: Shane Freeder <theboyetronic@gmail.com>
|
|
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 1e97d04b3..3a743430a 100644
|
|
--- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
|
|
+++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
|
|
@@ -1,6 +1,8 @@
|
|
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;
|
|
@@ -49,6 +51,23 @@ public class PlayerDeathEvent extends EntityDeathEvent {
|
|
public List<ItemStack> getItemsToKeep() {
|
|
return itemsToKeep;
|
|
}
|
|
+
|
|
+ private boolean doExpDrop;
|
|
+
|
|
+ /**
|
|
+ * @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
|
|
|
|
public PlayerDeathEvent(@NotNull final Player player, @NotNull final List<ItemStack> drops, final int droppedExp, @Nullable final String deathMessage) {
|
|
@@ -60,11 +79,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 String deathMessage) {
|
|
+ // Paper start
|
|
+ this(player, drops, droppedExp, newExp, newTotalExp, newLevel, deathMessage, player.getGameMode() != GameMode.SPECTATOR);
|
|
+ }
|
|
+ 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) {
|
|
+ // Paper end
|
|
super(player, drops, droppedExp);
|
|
this.newExp = newExp;
|
|
this.newTotalExp = newTotalExp;
|
|
this.newLevel = newLevel;
|
|
this.deathMessage = deathMessage;
|
|
+ this.doExpDrop = doExpDrop; // Paper
|
|
}
|
|
|
|
@NotNull
|
|
--
|
|
2.26.2
|
|
|