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>
|
* <br>
|
||||||
* 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>{@code
|
* <pre>{@code
|
||||||
* {@literal @EventHandler(ignoreCancelled = true)}
|
* private static final NamespacedKey SOULBOUND_KEY = new NamespacedKey("testplugin", "soulbound");
|
||||||
* public void onPlayerDeath(PlayerDeathEvent event) {
|
*
|
||||||
* for (Iterator<ItemStack> iterator = event.getDrops().iterator(); iterator.hasNext(); ) {
|
* @EventHandler(ignoreCancelled = true)
|
||||||
* ItemStack drop = iterator.next();
|
* public void onPlayerDeath(PlayerDeathEvent event) {
|
||||||
* List<String> lore = drop.getLore();
|
* for (Iterator<ItemStack> iterator = event.getDrops().iterator(); iterator.hasNext(); ) {
|
||||||
* if (lore != null && !lore.isEmpty()) {
|
* ItemStack drop = iterator.next();
|
||||||
* if (lore.get(0).contains("(SOULBOUND)")) {
|
* if (drop.getPersistentDataContainer().getOrDefault(SOULBOUND_KEY, PersistentDataType.BOOLEAN, false)) {
|
||||||
* iterator.remove();
|
* iterator.remove();
|
||||||
* event.getItemsToKeep().add(drop);
|
* event.getItemsToKeep().add(drop);
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
|
* }
|
||||||
* }</pre>
|
* }</pre>
|
||||||
* <p>
|
* <p>
|
||||||
* 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.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user