From 6a16d53d8e2e89c833f823fe99f8f8bebc10156a Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Mon, 14 Mar 2016 19:28:07 +0100 Subject: [PATCH] Fix upgraded and extended. --- .../massivecore/adapter/ItemStackAdapterInner19.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/com/massivecraft/massivecore/adapter/ItemStackAdapterInner19.java b/src/com/massivecraft/massivecore/adapter/ItemStackAdapterInner19.java index f0bf0a79..68aed19c 100644 --- a/src/com/massivecraft/massivecore/adapter/ItemStackAdapterInner19.java +++ b/src/com/massivecraft/massivecore/adapter/ItemStackAdapterInner19.java @@ -128,12 +128,14 @@ public class ItemStackAdapterInner19 extends ItemStackAdapterInner18 boolean extended = potion.hasExtendedDuration(); boolean upgraded = (potion.getLevel() >= 2); - // Try to avoid slow exceptions. - // The same checks are done in the PotionData constructor. + // This section serves two purposes: + // 1. Avoid slow exceptions over for invalid damage values. + // 2. Lenient upgrade to Minecraft 1.9. Keep what we can. + // If a potion was both upgraded and extended we keep the upgraded and remove the extended. if (type == null) return null; if (extended && ! type.isExtendable()) return null; if (upgraded && ! type.isUpgradeable()) return null; - if (upgraded && extended) return null; + if (upgraded && extended) extended = false; return new PotionData(type, extended, upgraded); }