diff --git a/Changelog.txt b/Changelog.txt index 7107194ae..738af1499 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -23,6 +23,8 @@ Version 1.4.07-dev + Added new McMMOPlayerDeathPenaltyEvent, fired when a player dies and would lose levels + Added new McMMOPlayerLevelChangeEvent, fired when a players level changes + Added new McMMOPlayerLevelDownEvent, fired when a player loses levels + + Added ability to give custom names to items in treasures.yml - use the key "Custom_Name" to set, expects a string. + + Added ability to give lore to items in treasures.yml - use the key "Lore" to set, expects a list of strings. = Fixed bug which allowed players to bypass fishing's exploit prevention = Fixed bug where FakeEntityDamageByEntityEvent wasn't being fired = Fixed bug with "Skull Splitter" not finding the locale string diff --git a/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java b/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java index a1f918262..1d9e641f8 100644 --- a/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java +++ b/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java @@ -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)) {