mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-24 00:15:16 +01:00
Fixed certain items not being able to use custom texture values
This commit is contained in:
parent
515092a884
commit
b6b3ce8c76
@ -46,7 +46,7 @@ public class ClassSelect extends EditableInventory {
|
|||||||
private final List<String> lore;
|
private final List<String> lore;
|
||||||
|
|
||||||
public ClassItem(ConfigurationSection config) {
|
public ClassItem(ConfigurationSection config) {
|
||||||
super(Material.BARRIER, config);
|
super(new ItemStack(Material.BARRIER), config);
|
||||||
|
|
||||||
this.name = config.getString("name");
|
this.name = config.getString("name");
|
||||||
this.lore = config.getStringList("lore");
|
this.lore = config.getStringList("lore");
|
||||||
|
@ -134,7 +134,7 @@ public class QuestViewer extends EditableInventory {
|
|||||||
/*
|
/*
|
||||||
* generate item
|
* generate item
|
||||||
*/
|
*/
|
||||||
ItemStack item = new ItemStack(getMaterial());
|
ItemStack item = new ItemStack(getStack());
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
meta.setDisplayName(holders.apply(inv.getPlayer(), getName()));
|
meta.setDisplayName(holders.apply(inv.getPlayer(), getName()));
|
||||||
meta.addItemFlags(ItemFlag.values());
|
meta.addItemFlags(ItemFlag.values());
|
||||||
|
@ -170,7 +170,7 @@ public class SkillList extends EditableInventory {
|
|||||||
for (int j = 0; j < lore.size(); j++)
|
for (int j = 0; j < lore.size(); j++)
|
||||||
lore.set(j, ChatColor.GRAY + ChatColor.translateAlternateColorCodes('&', lore.get(j)));
|
lore.set(j, ChatColor.GRAY + ChatColor.translateAlternateColorCodes('&', lore.get(j)));
|
||||||
|
|
||||||
ItemStack item = new ItemStack(getMaterial());
|
ItemStack item = new ItemStack(getStack());
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', getName().replace("{skill}", skill.getSkill().getName()).replace("{roman}", MMOCoreUtils.intToRoman(skillLevel)).replace("{level}", "" + skillLevel)));
|
meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', getName().replace("{skill}", skill.getSkill().getName()).replace("{roman}", MMOCoreUtils.intToRoman(skillLevel)).replace("{level}", "" + skillLevel)));
|
||||||
meta.addItemFlags(ItemFlag.values());
|
meta.addItemFlags(ItemFlag.values());
|
||||||
@ -195,7 +195,7 @@ public class SkillList extends EditableInventory {
|
|||||||
private final int selectedSkillSlot;
|
private final int selectedSkillSlot;
|
||||||
|
|
||||||
public SkillItem(ConfigurationSection config) {
|
public SkillItem(ConfigurationSection config) {
|
||||||
super(Material.BARRIER, config);
|
super(new ItemStack(Material.BARRIER), config);
|
||||||
|
|
||||||
selectedSkillSlot = config.getInt("selected-slot");
|
selectedSkillSlot = config.getInt("selected-slot");
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ import java.util.UUID;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.inventory.ItemFlag;
|
import org.bukkit.inventory.ItemFlag;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -18,32 +17,35 @@ import com.mojang.authlib.GameProfile;
|
|||||||
import com.mojang.authlib.properties.Property;
|
import com.mojang.authlib.properties.Property;
|
||||||
|
|
||||||
import net.Indyuce.mmocore.MMOCore;
|
import net.Indyuce.mmocore.MMOCore;
|
||||||
|
import net.Indyuce.mmocore.MMOCoreUtils;
|
||||||
import net.Indyuce.mmocore.gui.api.GeneratedInventory;
|
import net.Indyuce.mmocore.gui.api.GeneratedInventory;
|
||||||
import net.Indyuce.mmocore.gui.api.PluginInventory;
|
import net.Indyuce.mmocore.gui.api.PluginInventory;
|
||||||
|
|
||||||
public abstract class InventoryPlaceholderItem extends InventoryItem {
|
public abstract class InventoryPlaceholderItem extends InventoryItem {
|
||||||
private final Material material;
|
private final ItemStack stack;
|
||||||
private final String name, texture;
|
private final String name, texture;
|
||||||
private final List<String> lore;
|
private final List<String> lore;
|
||||||
|
private final int modelData;
|
||||||
private final boolean placeholders, hideFlags;
|
private final boolean placeholders, hideFlags;
|
||||||
|
|
||||||
public InventoryPlaceholderItem(ConfigurationSection config) {
|
public InventoryPlaceholderItem(ConfigurationSection config) {
|
||||||
this(Material.valueOf(config.getString("item")), config);
|
this(MMOCoreUtils.readIcon(config.getString("item")), config);
|
||||||
}
|
}
|
||||||
|
|
||||||
public InventoryPlaceholderItem(Material material, ConfigurationSection config) {
|
public InventoryPlaceholderItem(ItemStack stack, ConfigurationSection config) {
|
||||||
super(config);
|
super(config);
|
||||||
|
|
||||||
this.material = material;
|
this.stack = stack;
|
||||||
this.name = config.getString("name");
|
this.name = config.getString("name");
|
||||||
this.lore = config.getStringList("lore");
|
this.lore = config.getStringList("lore");
|
||||||
this.hideFlags = config.getBoolean("hide-flags");
|
this.hideFlags = config.getBoolean("hide-flags");
|
||||||
this.texture = config.getString("texture");
|
this.texture = config.getString("texture");
|
||||||
this.placeholders = config.getBoolean("placeholders");
|
this.placeholders = config.getBoolean("placeholders");
|
||||||
|
this.modelData = config.getInt("custom-model-data");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Material getMaterial() {
|
public ItemStack getStack() {
|
||||||
return material;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hideFlags() {
|
public boolean hideFlags() {
|
||||||
@ -66,6 +68,10 @@ public abstract class InventoryPlaceholderItem extends InventoryItem {
|
|||||||
return lore;
|
return lore;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getModelData() {
|
||||||
|
return modelData;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean supportPlaceholders() {
|
public boolean supportPlaceholders() {
|
||||||
return placeholders;
|
return placeholders;
|
||||||
}
|
}
|
||||||
@ -85,7 +91,7 @@ public abstract class InventoryPlaceholderItem extends InventoryItem {
|
|||||||
public ItemStack display(GeneratedInventory inv, int n) {
|
public ItemStack display(GeneratedInventory inv, int n) {
|
||||||
|
|
||||||
Placeholders placeholders = getPlaceholders(inv, n);
|
Placeholders placeholders = getPlaceholders(inv, n);
|
||||||
ItemStack item = new ItemStack(getMaterial());
|
ItemStack item = getStack();
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
|
|
||||||
if (texture != null && meta instanceof SkullMeta)
|
if (texture != null && meta instanceof SkullMeta)
|
||||||
@ -103,6 +109,9 @@ public abstract class InventoryPlaceholderItem extends InventoryItem {
|
|||||||
meta.setLore(lore);
|
meta.setLore(lore);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (MMOCore.plugin.version.isStrictlyHigher(1, 13))
|
||||||
|
meta.setCustomModelData(getModelData());
|
||||||
|
|
||||||
item.setItemMeta(meta);
|
item.setItemMeta(meta);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package net.Indyuce.mmocore.gui.api.item;
|
package net.Indyuce.mmocore.gui.api.item;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import net.Indyuce.mmocore.gui.api.PluginInventory;
|
import net.Indyuce.mmocore.gui.api.PluginInventory;
|
||||||
|
|
||||||
@ -10,8 +10,8 @@ public class NoPlaceholderItem extends InventoryPlaceholderItem {
|
|||||||
super(config);
|
super(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NoPlaceholderItem(Material material, ConfigurationSection config) {
|
public NoPlaceholderItem(ItemStack stack, ConfigurationSection config) {
|
||||||
super(material, config);
|
super(stack, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user