mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-02-25 15:11:20 +01:00
!Removed debug message, improved inv calculation with ornaments
This commit is contained in:
parent
fda2220c7c
commit
d9def4d4ea
@ -20,15 +20,13 @@ public class DefaultPlayerInventory implements PlayerInventory {
|
||||
for (ItemStack armor : player.getInventory().getArmorContents())
|
||||
list.add(new EquippedItem(armor, EquipmentSlot.ARMOR));
|
||||
|
||||
if(MMOItems.plugin.getLanguage().iterateWholeInventory)
|
||||
if (MMOItems.plugin.getLanguage().iterateWholeInventory)
|
||||
for (ItemStack item : player.getInventory().getContents()) {
|
||||
if(item != null && NBTItem.get(item).hasType())
|
||||
if(NBTItem.get(item).getType().getEquipmentType() == EquipmentSlot.ANY) {
|
||||
MMOItems.plugin.getLogger().info("Found: " + item.getType() + " with custom name: " + item.getItemMeta().getDisplayName());
|
||||
list.add(new EquippedItem(item, EquipmentSlot.ANY));
|
||||
}
|
||||
NBTItem nbtItem;
|
||||
if (item != null && (nbtItem = MMOItems.plugin.getNMS().getNBTItem(item)).hasType() && nbtItem.getType().getEquipmentType() == EquipmentSlot.ANY)
|
||||
list.add(new EquippedItem(nbtItem, EquipmentSlot.ANY));
|
||||
}
|
||||
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
@ -14,20 +14,25 @@ public interface PlayerInventory {
|
||||
public List<EquippedItem> getInventory(Player player);
|
||||
|
||||
public class EquippedItem {
|
||||
private final ItemStack item;
|
||||
private final NBTItem item;
|
||||
private final EquipmentSlot slot;
|
||||
|
||||
public EquippedItem(ItemStack item, EquipmentSlot slot) {
|
||||
this(MMOItems.plugin.getNMS().getNBTItem(item), slot);
|
||||
}
|
||||
|
||||
public EquippedItem(NBTItem item, EquipmentSlot slot) {
|
||||
this.item = item;
|
||||
this.slot = slot;
|
||||
}
|
||||
|
||||
public NBTItem newNBTItem() {
|
||||
return MMOItems.plugin.getNMS().getNBTItem(item);
|
||||
return item;
|
||||
}
|
||||
|
||||
public boolean matches(Type type) {
|
||||
return slot == EquipmentSlot.ANY || (type.getEquipmentType() == EquipmentSlot.BOTH_HANDS ? slot.isHand() : slot == EquipmentSlot.BOTH_HANDS ? type.getEquipmentType().isHand() : slot == type.getEquipmentType());
|
||||
return slot == EquipmentSlot.ANY
|
||||
|| (type.getEquipmentType() == EquipmentSlot.BOTH_HANDS ? slot.isHand() : slot == EquipmentSlot.BOTH_HANDS ? type.getEquipmentType().isHand() : slot == type.getEquipmentType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user