Added ability to give items names & lore through treasures.yml.

Adds #1419
This commit is contained in:
GJ
2013-09-15 21:09:32 -04:00
parent ae0a27991b
commit 64e1448782
2 changed files with 15 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.EntityType;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.material.Dye;
import org.bukkit.potion.Potion;
import org.bukkit.potion.PotionType;
@ -193,6 +194,18 @@ public class TreasureConfig extends ConfigLoader {
}
else if (material != null) {
item = new ItemStack(material, amount, (short) data);
if (config.contains(type + "." + treasureName + ".Custom_Name")) {
ItemMeta itemMeta = item.getItemMeta();
itemMeta.setDisplayName(config.getString(type + "." + treasureName + "Custom_Name"));
item.setItemMeta(itemMeta);
}
if (config.contains(type + "." + treasureName + ".Lore")) {
ItemMeta itemMeta = item.getItemMeta();
itemMeta.setLore(config.getStringList(type + "." + treasureName + "Custom_Name"));
item.setItemMeta(itemMeta);
}
}
if (noErrorsInConfig(reason)) {