[untested] dynamic lore

upgrading and unidentifying an
item with durability should now
automatically update the lore
This commit is contained in:
ASangarin 2020-10-11 17:13:44 +02:00
parent 7a06588e83
commit 9510e69184
2 changed files with 4 additions and 2 deletions

View File

@ -26,6 +26,7 @@ import net.Indyuce.mmoitems.api.interaction.util.DurabilityItem;
import net.Indyuce.mmoitems.api.item.mmoitem.LiveMMOItem;
import net.Indyuce.mmoitems.api.item.mmoitem.MMOItem;
import net.Indyuce.mmoitems.api.item.mmoitem.VolatileMMOItem;
import net.Indyuce.mmoitems.api.item.util.DynamicLore;
import net.Indyuce.mmoitems.api.item.util.identify.IdentifiedItem;
import net.Indyuce.mmoitems.api.util.message.Message;
import net.Indyuce.mmoitems.comp.flags.FlagPlugin.CustomFlag;
@ -160,7 +161,7 @@ public class Consumable extends UseItem {
}
Message.UPGRADE_SUCCESS.format(ChatColor.YELLOW, "#item#", MMOUtils.getDisplayName(event.getCurrentItem())).send(player);
event.getCurrentItem().setItemMeta(result.toItem().getItemMeta());
event.getCurrentItem().setItemMeta(new DynamicLore(result).build().getItemMeta());
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 2);
return true;
}

View File

@ -20,6 +20,7 @@ import net.Indyuce.mmoitems.api.Type;
import net.Indyuce.mmoitems.api.item.mmoitem.MMOItem;
import net.Indyuce.mmoitems.api.item.mmoitem.VolatileMMOItem;
import net.Indyuce.mmoitems.api.item.util.ConfigItem;
import net.Indyuce.mmoitems.api.item.util.DynamicLore;
import net.Indyuce.mmoitems.stat.data.DoubleData;
import net.Indyuce.mmoitems.stat.type.ItemStat;
import net.mmogroup.mmolib.MMOLib;
@ -106,7 +107,7 @@ public class UnidentifiedItem extends ConfigItem {
*/
item.getItem().setAmount(1);
ItemStack unidentified = MMOLib.plugin.getVersion().getWrapper().copyTexture(item)
.addTag(new ItemTag("MMOITEMS_UNIDENTIFIED_ITEM", serialize(item.getItem()))).toItem();
.addTag(new ItemTag("MMOITEMS_UNIDENTIFIED_ITEM", serialize(new DynamicLore(item).build()))).toItem();
unidentified.setAmount(amount);
ItemMeta meta = unidentified.getItemMeta();
meta.addItemFlags(ItemFlag.values());