mirror of
https://github.com/PaperMC/Paper.git
synced 2025-05-19 05:30:23 -07:00
[ci skip] Don't promote checking enchantment by legacy lore (#12421)
This commit is contained in:
parent
f517267c0c
commit
4511edb849
@ -264,19 +264,18 @@ public class PlayerDeathEvent extends EntityDeathEvent {
|
||||
* <br>
|
||||
* You <b>MUST</b> remove the item from the .getDrops() collection too or it will duplicate!
|
||||
* <pre>{@code
|
||||
* {@literal @EventHandler(ignoreCancelled = true)}
|
||||
* public void onPlayerDeath(PlayerDeathEvent event) {
|
||||
* for (Iterator<ItemStack> iterator = event.getDrops().iterator(); iterator.hasNext(); ) {
|
||||
* ItemStack drop = iterator.next();
|
||||
* List<String> lore = drop.getLore();
|
||||
* if (lore != null && !lore.isEmpty()) {
|
||||
* if (lore.get(0).contains("(SOULBOUND)")) {
|
||||
* iterator.remove();
|
||||
* event.getItemsToKeep().add(drop);
|
||||
* }
|
||||
* }
|
||||
* private static final NamespacedKey SOULBOUND_KEY = new NamespacedKey("testplugin", "soulbound");
|
||||
*
|
||||
* @EventHandler(ignoreCancelled = true)
|
||||
* public void onPlayerDeath(PlayerDeathEvent event) {
|
||||
* for (Iterator<ItemStack> iterator = event.getDrops().iterator(); iterator.hasNext(); ) {
|
||||
* ItemStack drop = iterator.next();
|
||||
* if (drop.getPersistentDataContainer().getOrDefault(SOULBOUND_KEY, PersistentDataType.BOOLEAN, false)) {
|
||||
* iterator.remove();
|
||||
* event.getItemsToKeep().add(drop);
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* }</pre>
|
||||
* <p>
|
||||
* Adding an item to this list that the player did not previously have will give them the item on death.
|
||||
|
Loading…
x
Reference in New Issue
Block a user