forked from Upstream/CommandPanels
Added potion type/stats auto grab for /cpg
This commit is contained in:
parent
74d9aa1d8a
commit
c10919da43
@ -448,6 +448,18 @@ public class ItemCreation {
|
|||||||
//not a banner
|
//not a banner
|
||||||
file.set("panels." + panelName + ".item." + i + ".banner", null);
|
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());
|
file.set("panels." + panelName + ".item." + i + ".stack", cont.getAmount());
|
||||||
if(!cont.getEnchantments().isEmpty()){
|
if(!cont.getEnchantments().isEmpty()){
|
||||||
List<String> enchantments = new ArrayList<>();
|
List<String> enchantments = new ArrayList<>();
|
||||||
|
Loading…
Reference in New Issue
Block a user