3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00
Dieser Commit ist enthalten in:
Aikar 2019-03-28 23:58:09 -04:00
Ursprung a73444b0e1
Commit 4a0da388da
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 401ADFC9891FAAFE

Datei anzeigen

@ -1,4 +1,4 @@
From f3ebc45b923294990f9db2b1514d34d7c9a4840f Mon Sep 17 00:00:00 2001 From ef529fe9d2cdb0ba907c3c953e1f09b18492b244 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Mon, 11 Mar 2013 20:04:34 -0400 Date: Mon, 11 Mar 2013 20:04:34 -0400
Subject: [PATCH] PlayerDeathEvent#getItemsToKeep Subject: [PATCH] PlayerDeathEvent#getItemsToKeep
@ -8,7 +8,7 @@ Exposes a mutable array on items a player should keep on death
Example Usage: https://gist.github.com/aikar/5bb202de6057a051a950ce1f29feb0b4 Example Usage: https://gist.github.com/aikar/5bb202de6057a051a950ce1f29feb0b4
diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
index 5b0ef1eb..af6070d1 100644 index 5b0ef1eb..c96815a4 100644
--- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java --- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
+++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java +++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
@@ -18,6 +18,40 @@ public class PlayerDeathEvent extends EntityDeathEvent { @@ -18,6 +18,40 @@ public class PlayerDeathEvent extends EntityDeathEvent {
@ -22,8 +22,8 @@ index 5b0ef1eb..af6070d1 100644
+ * A mutable collection to add items that the player should retain in their inventory on death (Similar to KeepInventory game rule) + * A mutable collection to add items that the player should retain in their inventory on death (Similar to KeepInventory game rule)
+ * + *
+ * You <b>MUST</b> remove the item from the .getDrops() collection too or it will duplicate! + * You <b>MUST</b> remove the item from the .getDrops() collection too or it will duplicate!
+ * <pre> + * <pre>{@code
+ * \@EventHandler(ignoreCancelled = true) + * @literal @EventHandler(ignoreCancelled = true)
+ * public void onPlayerDeath(PlayerDeathEvent event) { + * public void onPlayerDeath(PlayerDeathEvent event) {
+ * for (Iterator<ItemStack> iterator = event.getDrops().iterator(); iterator.hasNext(); ) { + * for (Iterator<ItemStack> iterator = event.getDrops().iterator(); iterator.hasNext(); ) {
+ * ItemStack drop = iterator.next(); + * ItemStack drop = iterator.next();
@ -36,7 +36,7 @@ index 5b0ef1eb..af6070d1 100644
+ * } + * }
+ * } + * }
+ * } + * }
+ * </pre> + * }</pre>
+ * + *
+ * Adding an item to this list that the player did not previously have will give them the item on death. + * Adding an item to this list that the player did not previously have will give them the item on death.
+ * An example case could be a "Note" that "You died at X/Y/Z coordinates" + * An example case could be a "Note" that "You died at X/Y/Z coordinates"