From c10919da4395d9ad6fda3e39b44c4c7ebef3bea7 Mon Sep 17 00:00:00 2001 From: TinyTank800 Date: Fri, 12 Jan 2024 15:16:07 -0800 Subject: [PATCH] Added potion type/stats auto grab for /cpg --- .../commandpanels/classresources/ItemCreation.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/me/rockyhawk/commandpanels/classresources/ItemCreation.java b/src/me/rockyhawk/commandpanels/classresources/ItemCreation.java index 28757b5..252b68e 100644 --- a/src/me/rockyhawk/commandpanels/classresources/ItemCreation.java +++ b/src/me/rockyhawk/commandpanels/classresources/ItemCreation.java @@ -448,6 +448,18 @@ public class ItemCreation { //not a banner file.set("panels." + panelName + ".item." + i + ".banner", null); } + try { + PotionMeta potionMeta = (PotionMeta) cont.getItemMeta(); + assert potionMeta != null; + PotionData potionData = potionMeta.getBasePotionData(); + PotionType potionType = potionData.getType(); // Gets the potion type as a string rather than bukkit type + boolean level = potionData.isUpgraded(); // Check if the potion is level II + boolean extended = potionData.isExtended(); // Check if the potion is extended + file.set("panels." + panelName + ".item." + i + ".potion", potionType + " " + extended + " " + level); + }catch(Exception ignore){ + //not a banner + file.set("panels." + panelName + ".item." + i + ".potion", null); + } file.set("panels." + panelName + ".item." + i + ".stack", cont.getAmount()); if(!cont.getEnchantments().isEmpty()){ List enchantments = new ArrayList<>();