Added ability to customize the separator item in the Disband GUI.

This commit is contained in:
DroppingAnvil 2020-02-16 22:59:02 -06:00 committed by droppinganvil
parent f34ebc73fa
commit 13399c53c5
2 changed files with 23 additions and 2 deletions

View File

@ -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<String> separatorLore = config.getStringList("f-disband-gui.separation-item.Lore");
if (separatorMeta.getLore() != null) separatorMeta.getLore().clear();
if (separatorLore != null) {
List<String> 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) -> {

View File

@ -751,6 +751,11 @@ f-disband-gui:
Lore:
- ' '
- '&7Click to cancel faction disband.'
separation-item:
Type: BLACK_WOOL
Name: ' '
Lore:
############################################################