From 9331153551c33d719c35bb533f84e9ef6b254766 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 3 Aug 2018 19:57:09 +1000 Subject: SPIGOT-4217: Account for ShowIcon to allow custom tipped arrows to merge --- src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java index 43b9d96b..81e1a40c 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java @@ -31,6 +31,7 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta { static final ItemMetaKey AMBIENT = new ItemMetaKey("Ambient", "ambient"); static final ItemMetaKey DURATION = new ItemMetaKey("Duration", "duration"); static final ItemMetaKey SHOW_PARTICLES = new ItemMetaKey("ShowParticles", "has-particles"); + static final ItemMetaKey SHOW_ICON = new ItemMetaKey("ShowIcon", "has-icon"); static final ItemMetaKey POTION_EFFECTS = new ItemMetaKey("CustomPotionEffects", "custom-effects"); static final ItemMetaKey POTION_COLOR = new ItemMetaKey("CustomPotionColor", "custom-color"); static final ItemMetaKey ID = new ItemMetaKey("Id", "potion-id"); @@ -80,7 +81,8 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta { int duration = effect.getInt(DURATION.NBT); boolean ambient = effect.getBoolean(AMBIENT.NBT); boolean particles = effect.getBoolean(SHOW_PARTICLES.NBT); - customEffects.add(new PotionEffect(type, duration, amp, ambient, particles)); + boolean icon = tag.hasKeyOfType(SHOW_ICON.NBT, CraftMagicNumbers.NBT.TAG_BYTE) ? effect.getBoolean(SHOW_ICON.NBT) : particles; + customEffects.add(new PotionEffect(type, duration, amp, ambient, particles, icon)); } } } @@ -128,6 +130,7 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta { effectData.setInt(DURATION.NBT, effect.getDuration()); effectData.setBoolean(AMBIENT.NBT, effect.isAmbient()); effectData.setBoolean(SHOW_PARTICLES.NBT, effect.hasParticles()); + effectData.setBoolean(SHOW_ICON.NBT, effect.hasIcon()); effectList.add(effectData); } } -- cgit v1.2.3