forked from Upstream/CommandPanels
3.17.5.0
This commit is contained in:
parent
b3c3c5c0f2
commit
3033f42c9a
@ -1,4 +1,4 @@
|
|||||||
version: 3.17.4.3
|
version: 3.17.5.0
|
||||||
main: me.rockyhawk.commandpanels.CommandPanels
|
main: me.rockyhawk.commandpanels.CommandPanels
|
||||||
name: CommandPanels
|
name: CommandPanels
|
||||||
author: RockyHawk
|
author: RockyHawk
|
||||||
|
@ -84,6 +84,13 @@ public class Panel{
|
|||||||
|
|
||||||
//NBT will equal to panelName:slot and the slot will be -1 if item is not stationery
|
//NBT will equal to panelName:slot and the slot will be -1 if item is not stationery
|
||||||
public ItemStack getHotbarItem(Player p){
|
public ItemStack getHotbarItem(Player p){
|
||||||
|
if (this.getConfig().contains("open-with-item.pre-load-commands")) {
|
||||||
|
try {
|
||||||
|
plugin.commandTags.runCommands(this,PanelPosition.Top,p, this.getConfig().getStringList("open-with-item.pre-load-commands"));
|
||||||
|
}catch(Exception s){
|
||||||
|
plugin.debug(s,p);
|
||||||
|
}
|
||||||
|
}
|
||||||
ItemStack s = plugin.itemCreate.makeItemFromConfig(this,PanelPosition.Top,getHotbarSection(p), p, true, true, false);
|
ItemStack s = plugin.itemCreate.makeItemFromConfig(this,PanelPosition.Top,getHotbarSection(p), p, true, true, false);
|
||||||
int slot = -1;
|
int slot = -1;
|
||||||
if(getHotbarSection(p).isSet("stationary")){
|
if(getHotbarSection(p).isSet("stationary")){
|
||||||
|
@ -246,13 +246,23 @@ public class ItemCreation {
|
|||||||
if (itemSection.contains("enchanted")) {
|
if (itemSection.contains("enchanted")) {
|
||||||
try {
|
try {
|
||||||
ItemMeta EnchantMeta;
|
ItemMeta EnchantMeta;
|
||||||
if (Objects.requireNonNull(itemSection.getString("enchanted")).trim().equalsIgnoreCase("true")) {
|
if(itemSection.isList("enchanted")){
|
||||||
|
//if there is a list of enchantments to add
|
||||||
|
EnchantMeta = s.getItemMeta();
|
||||||
|
assert EnchantMeta != null;
|
||||||
|
for(String enchantment : itemSection.getStringList("enchanted")){
|
||||||
|
EnchantMeta.addEnchant(Objects.requireNonNull(Enchantment.getByKey(NamespacedKey.minecraft(enchantment.split("\\s")[0].toLowerCase()))), Integer.parseInt(enchantment.split("\\s")[1]), true);
|
||||||
|
}
|
||||||
|
s.setItemMeta(EnchantMeta);
|
||||||
|
}else if (Objects.requireNonNull(itemSection.getString("enchanted")).trim().equalsIgnoreCase("true")) {
|
||||||
|
//if used if enchanted is set to true
|
||||||
EnchantMeta = s.getItemMeta();
|
EnchantMeta = s.getItemMeta();
|
||||||
assert EnchantMeta != null;
|
assert EnchantMeta != null;
|
||||||
EnchantMeta.addEnchant(Enchantment.KNOCKBACK, 1, false);
|
EnchantMeta.addEnchant(Enchantment.KNOCKBACK, 1, false);
|
||||||
EnchantMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
EnchantMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||||
s.setItemMeta(EnchantMeta);
|
s.setItemMeta(EnchantMeta);
|
||||||
} else if (!Objects.requireNonNull(itemSection.getString("enchanted")).trim().equalsIgnoreCase("false")) {
|
} else if (!Objects.requireNonNull(itemSection.getString("enchanted")).trim().equalsIgnoreCase("false")) {
|
||||||
|
//if used to ensure enchanted does not equal false but equals something else
|
||||||
EnchantMeta = s.getItemMeta();
|
EnchantMeta = s.getItemMeta();
|
||||||
assert EnchantMeta != null;
|
assert EnchantMeta != null;
|
||||||
EnchantMeta.addEnchant(Objects.requireNonNull(Enchantment.getByKey(NamespacedKey.minecraft(Objects.requireNonNull(itemSection.getString("enchanted")).split("\\s")[0].toLowerCase()))), Integer.parseInt(Objects.requireNonNull(itemSection.getString("enchanted")).split("\\s")[1]), true);
|
EnchantMeta.addEnchant(Objects.requireNonNull(Enchantment.getByKey(NamespacedKey.minecraft(Objects.requireNonNull(itemSection.getString("enchanted")).split("\\s")[0].toLowerCase()))), Integer.parseInt(Objects.requireNonNull(itemSection.getString("enchanted")).split("\\s")[1]), true);
|
||||||
|
Loading…
Reference in New Issue
Block a user