mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-01-03 06:37:47 +01:00
item browser always regenerates the item
This commit is contained in:
parent
838c0fed23
commit
270389cf8f
@ -248,10 +248,7 @@ public class ItemBrowser extends PluginInventory {
|
||||
|
||||
} else {
|
||||
if (event.getAction() == InventoryAction.PICKUP_ALL) {
|
||||
// this refreshes the item if it's unstackable
|
||||
ItemStack generatedItem = (NBTItem.get(item).getBoolean("UNSTACKABLE")) ? MMOItems.plugin.getItem(type, id, playerData)
|
||||
: removeLastLoreLines(NBTItem.get(item));
|
||||
getPlayer().getInventory().addItem(generatedItem);
|
||||
getPlayer().getInventory().addItem(MMOItems.plugin.getItem(type, id, playerData));
|
||||
getPlayer().playSound(getPlayer().getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 2);
|
||||
}
|
||||
|
||||
@ -259,10 +256,4 @@ public class ItemBrowser extends PluginInventory {
|
||||
new ItemEdition(getPlayer(), MMOItems.plugin.getTemplates().getTemplate(type, id)).open();
|
||||
}
|
||||
}
|
||||
|
||||
private ItemStack removeLastLoreLines(NBTItem item) {
|
||||
List<Component> lore = item.getLoreComponents();
|
||||
item.setLoreComponents(lore.subList(0, lore.size() - 3));
|
||||
return item.toItem();
|
||||
}
|
||||
}
|
||||
|
@ -95,6 +95,10 @@ public class DurabilityListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is for all the items which have 0 max durability
|
||||
* i.E which are not breakable hence the {@link Material#getMaxDurability()} call
|
||||
*/
|
||||
private void handleVanillaDamage(ItemStack stack, Player player, EquipmentSlot slot, int damage) {
|
||||
DurabilityItem item = new DurabilityItem(player, stack);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user