forked from Upstream/mmocore
fixed default gui configs
This commit is contained in:
parent
7353cba619
commit
dc351ed10f
@ -15,6 +15,7 @@ import net.Indyuce.mmocore.manager.SoundManager;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -71,7 +72,7 @@ public class ClassConfirmation extends EditableInventory {
|
||||
private final InventoryItem unlocked, locked;
|
||||
|
||||
public YesItem(ConfigurationSection config) {
|
||||
super(config);
|
||||
super(Material.BARRIER, config);
|
||||
|
||||
Validate.isTrue(config.contains("unlocked"), "Could not load 'unlocked' config");
|
||||
Validate.isTrue(config.contains("locked"), "Could not load 'locked' config");
|
||||
|
@ -14,6 +14,7 @@ import net.Indyuce.mmocore.gui.api.item.InventoryItem;
|
||||
import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem;
|
||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||
import net.Indyuce.mmocore.manager.SoundManager;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -42,7 +43,7 @@ public class SubclassSelect extends EditableInventory {
|
||||
private final List<String> lore;
|
||||
|
||||
public ClassItem(ConfigurationSection config) {
|
||||
super(config);
|
||||
super(Material.BARRIER, config);
|
||||
|
||||
this.name = config.getString("name");
|
||||
this.lore = config.getStringList("lore");
|
||||
@ -60,7 +61,6 @@ public class SubclassSelect extends EditableInventory {
|
||||
|
||||
PlayerClass profess = inv.subclasses.get(n).getProfess();
|
||||
|
||||
|
||||
ItemStack item = profess.getIcon();
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(MythicLib.plugin.parseColors(name).replace("{name}", profess.getName()));
|
||||
|
@ -97,7 +97,7 @@ public class WaypointViewer extends EditableInventory {
|
||||
private final WaypointDisplayItem availWaypoint;
|
||||
|
||||
public WaypointItem(ConfigurationSection config) {
|
||||
super(config);
|
||||
super(Material.BARRIER, config);
|
||||
|
||||
Validate.notNull(config.getConfigurationSection("no-waypoint"), "Could not load 'no-waypoint' config");
|
||||
Validate.notNull(config.getConfigurationSection("locked"), "Could not load 'locked' config");
|
||||
|
@ -47,9 +47,10 @@ public abstract class EditableInventory {
|
||||
try {
|
||||
ConfigurationSection section = config.getConfigurationSection("items." + key);
|
||||
Validate.notNull(section, "Could not load config");
|
||||
items.add(loadInventoryItem(section));
|
||||
InventoryItem loaded = loadInventoryItem(section);
|
||||
items.add(loaded);
|
||||
} catch (IllegalArgumentException exception) {
|
||||
MMOCore.log(Level.WARNING, "[Inventories] Could not load item '" + key + "' from inventory '" + getId() + "': " + exception.getMessage());
|
||||
MMOCore.log(Level.WARNING, "Could not load item '" + key + "' from inventory '" + getId() + "': " + exception.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import net.Indyuce.mmocore.gui.api.item.Placeholders;
|
||||
import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
@ -86,7 +87,7 @@ public class EditableGuildView extends EditableInventory {
|
||||
private final MemberDisplayItem member;
|
||||
|
||||
public MemberItem(ConfigurationSection config) {
|
||||
super(config);
|
||||
super(Material.BARRIER, config);
|
||||
|
||||
Validate.notNull(config.contains("empty"), "Could not load empty config");
|
||||
Validate.notNull(config.contains("member"), "Could not load member config");
|
||||
@ -107,7 +108,7 @@ public class EditableGuildView extends EditableInventory {
|
||||
}
|
||||
}
|
||||
|
||||
public class ConditionalItem extends SimplePlaceholderItem {
|
||||
public class ConditionalItem extends SimplePlaceholderItem<GuildViewInventory> {
|
||||
private final String function;
|
||||
|
||||
public ConditionalItem(String func, ConfigurationSection config) {
|
||||
@ -116,8 +117,7 @@ public class EditableGuildView extends EditableInventory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack display(GeneratedInventory invpar, int n) {
|
||||
GuildViewInventory inv = (GuildViewInventory) invpar;
|
||||
public ItemStack display(GuildViewInventory inv, int n) {
|
||||
|
||||
if (function.equals("next"))
|
||||
if (inv.getPage() == (inv.getPlayerData().getGuild().getMembers().count() + 20)
|
||||
|
@ -14,6 +14,7 @@ import net.Indyuce.mmocore.gui.api.item.Placeholders;
|
||||
import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
@ -86,7 +87,7 @@ public class EditablePartyView extends EditableInventory {
|
||||
private final MemberDisplayItem member;
|
||||
|
||||
public MemberItem(ConfigurationSection config) {
|
||||
super(config);
|
||||
super(Material.BARRIER, config);
|
||||
|
||||
Validate.notNull(config.contains("empty"), "Could not load empty config");
|
||||
Validate.notNull(config.contains("member"), "Could not load member config");
|
||||
|
@ -48,7 +48,7 @@ public class InventoryManager {
|
||||
try {
|
||||
inv.reload(new ConfigFile("/gui", inv.getId()).getConfig());
|
||||
} catch (IllegalArgumentException exception) {
|
||||
MMOCore.log(Level.WARNING, "[Inventories] Could not load inventory " + inv.getId() + ": " + exception.getMessage());
|
||||
MMOCore.log(Level.WARNING, "Could not load inventory " + inv.getId() + ": " + exception.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user