Simplified setting icon creation

This commit is contained in:
Fabrizio La Rosa 2020-06-18 20:04:17 +02:00
parent 24f722d408
commit bb62bc5617

View File

@ -6,6 +6,7 @@ import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager; import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.island.Island; import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandRole; import com.songoda.skyblock.island.IslandRole;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -48,10 +49,10 @@ public abstract class BasicPermission {
|| role == IslandRole.Coop) || role == IslandRole.Coop)
roleName = "Default"; roleName = "Default";
String nameFinal = configLoad.getString("Menu.Settings." + roleName + ".Item.Setting." + name + ".Displayname"); String nameFinal = TextUtils.formatText(configLoad.getString("Menu.Settings." + roleName + ".Item.Setting." + name + ".Displayname", name));
im.setDisplayName(TextUtils.formatText(nameFinal == null ? name : nameFinal));
if(im != null){
im.setDisplayName(nameFinal);
for (String itemLoreList : configLoad for (String itemLoreList : configLoad
.getStringList("Menu.Settings." + roleName + ".Item.Setting.Status." .getStringList("Menu.Settings." + roleName + ".Item.Setting.Status."
+ (permissionEnabled ? "Enabled" : "Disabled") + ".Lore")) + (permissionEnabled ? "Enabled" : "Disabled") + ".Lore"))
@ -60,6 +61,7 @@ public abstract class BasicPermission {
im.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); im.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
im.setLore(itemLore); im.setLore(itemLore);
is.setItemMeta(im); is.setItemMeta(im);
}
return is; return is;
} }