From 2ba1c15b6923a0873a2b866e5671671c4bb08ef7 Mon Sep 17 00:00:00 2001 From: Roch Blonndiaux Date: Wed, 2 Nov 2022 15:32:58 +0100 Subject: [PATCH] Maximum level bug fixed --- .../listener/reforging/RFGKeepUpgrades.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/MMOItems-Dist/src/main/java/net/Indyuce/mmoitems/listener/reforging/RFGKeepUpgrades.java b/MMOItems-Dist/src/main/java/net/Indyuce/mmoitems/listener/reforging/RFGKeepUpgrades.java index 8cc6cc60..a3e67c13 100644 --- a/MMOItems-Dist/src/main/java/net/Indyuce/mmoitems/listener/reforging/RFGKeepUpgrades.java +++ b/MMOItems-Dist/src/main/java/net/Indyuce/mmoitems/listener/reforging/RFGKeepUpgrades.java @@ -16,13 +16,14 @@ public class RFGKeepUpgrades implements Listener { @EventHandler public void onReforge(MMOItemReforgeEvent event) { - if (!event.getOptions().shouldKeepUpgrades()) { return; } - //RFG// MMOItems.log("§8Reforge §4EFG§7 Keeping Upgrades"); + final UpgradeData upgrade = ((UpgradeData) event.getOldMMOItem().getData(ItemStats.UPGRADE)); + final UpgradeData newOne = ((UpgradeData) event.getNewMMOItem().getData(ItemStats.UPGRADE)); - UpgradeData upgrade = ((UpgradeData) event.getOldMMOItem().getData(ItemStats.UPGRADE)); - UpgradeData newOne = ((UpgradeData) event.getNewMMOItem().getData(ItemStats.UPGRADE)); - - if (upgrade == null || newOne == null) { return; } + if (!event.getOptions().shouldKeepUpgrades() + || upgrade == null + || newOne == null + || newOne.getMaxUpgrades() <= 0) + return; //UPGRD//MMOItems.log(" \u00a7e* \u00a77Existing Upgrade Detected");