From 13399c53c507c8b83529d2654a137275a71f56c2 Mon Sep 17 00:00:00 2001 From: DroppingAnvil Date: Sun, 16 Feb 2020 22:59:02 -0600 Subject: [PATCH] Added ability to customize the separator item in the Disband GUI. --- .../zcore/fdisband/FDisbandFrame.java | 20 +++++++++++++++++-- src/main/resources/config.yml | 5 +++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/zcore/fdisband/FDisbandFrame.java b/src/main/java/com/massivecraft/factions/zcore/fdisband/FDisbandFrame.java index b6003170..f2831366 100644 --- a/src/main/java/com/massivecraft/factions/zcore/fdisband/FDisbandFrame.java +++ b/src/main/java/com/massivecraft/factions/zcore/fdisband/FDisbandFrame.java @@ -7,7 +7,9 @@ import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.Faction; import com.massivecraft.factions.FactionsPlugin; import com.massivecraft.factions.util.XMaterial; +import org.bukkit.ChatColor; import org.bukkit.configuration.ConfigurationSection; +import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.metadata.FixedMetadataValue; @@ -43,8 +45,22 @@ public class FDisbandFrame { fPlayer.getPlayer().performCommand("f disband"); })); } - - GUIItems.set(4, new GuiItem(XMaterial.BLACK_WOOL.parseItem(), (e) -> e.setCancelled(true))); + //Separator + FileConfiguration config = FactionsPlugin.getInstance().getConfig(); + ItemStack separatorItem = XMaterial.matchXMaterial(config.getString("f-disband-gui.separation-item.Type")).get().parseItem(); + ItemMeta separatorMeta = separatorItem.getItemMeta(); + separatorMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getString("f-disband-gui.separation-item.Name"))); + List separatorLore = config.getStringList("f-disband-gui.separation-item.Lore"); + if (separatorMeta.getLore() != null) separatorMeta.getLore().clear(); + if (separatorLore != null) { + List lore = new ArrayList<>(); + for (String loreEntry : config.getStringList("f-disband-gui.separation-item.Lore")) { + lore.add(ChatColor.translateAlternateColorCodes('&', loreEntry)); + } + separatorMeta.setLore(lore); + } + GUIItems.set(4, new GuiItem(separatorItem, (e) -> e.setCancelled(true))); + //End Separator for (i = 5; i < 10; ++i) { GUIItems.add(new GuiItem(deny, (e) -> { diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index b1081def..7f873ee7 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -751,6 +751,11 @@ f-disband-gui: Lore: - ' ' - '&7Click to cancel faction disband.' + separation-item: + Type: BLACK_WOOL + Name: ' ' + Lore: + ############################################################