Skip to content

Commit

Permalink
Fix Inventory trait not setting view contents properly
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Apr 1, 2016
1 parent f0f09ea commit 2636172
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/net/citizensnpcs/api/trait/trait/Inventory.java
Expand Up @@ -52,6 +52,9 @@ public void inventoryCloseEvent(InventoryCloseEvent event) {
for (int i = 0; i < contents.length; i++) {
this.contents[i] = contents[i];
}
if (npc.getEntity() instanceof InventoryHolder) {
((InventoryHolder) npc.getEntity()).getInventory().setStorageContents(contents);
}
views.remove(event.getView());
}

Expand All @@ -73,6 +76,9 @@ public void onSpawn() {
}

public void openInventory(Player sender) {
for (int i = 0; i < view.getSize(); i++) {
view.setItem(i, contents[i]);
}
views.add(sender.openInventory(view));
}

Expand Down

0 comments on commit 2636172

Please sign in to comment.