Skip to content

Commit

Permalink
Inventory views should have a proper size
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Mar 31, 2016
1 parent 5472f8d commit 17d51a4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/java/net/citizensnpcs/api/trait/trait/Inventory.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,13 @@ public void load(DataKey key) throws NPCLoadException {
@Override
public void onSpawn() {
setContents(contents);
view = Bukkit.createInventory(
npc.getEntity() instanceof InventoryHolder ? ((InventoryHolder) npc.getEntity()) : null,
contents.length);
view = Bukkit
.createInventory(
npc.getEntity() instanceof InventoryHolder ? ((InventoryHolder) npc.getEntity()) : null,
npc.getEntity() instanceof Player ? 36
: npc.getEntity() instanceof InventoryHolder
? ((InventoryHolder) npc.getEntity()).getInventory().getSize()
: contents.length);
}

private ItemStack[] parseContents(DataKey key) throws NPCLoadException {
Expand Down

0 comments on commit 17d51a4

Please sign in to comment.