Skip to content

Commit

Permalink
Properly set item arrays for subcontainer
Browse files Browse the repository at this point in the history
Closes #8
  • Loading branch information
Jikoo committed Jun 12, 2016
1 parent 53eadcb commit 9edac80
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,12 @@ public SpecialEnderChest(OpenInv plugin, Player p, Boolean online) {
private void setItemArrays(InventorySubcontainer subcontainer, ItemStack[] items) {
try {
// Prepare to remove final modifier
Field modifiers;
modifiers = Field.class.getDeclaredField("modifiers");
Field modifiers = Field.class.getDeclaredField("modifiers");
modifiers.setAccessible(true);
// Access and replace main inventory array
Field field = InventorySubcontainer.class.getField("items");
modifiers.setInt(field, field.getModifiers() & ~Modifier.FINAL);
field.set(inventory, items);
field.set(subcontainer, items);
} catch (NoSuchFieldException e) {
e.printStackTrace();
} catch (SecurityException e) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: OpenInv
main: com.lishid.openinv.OpenInv
version: 2.4.7
version: 2.4.8
author: lishid
authors: [Jikoo]
description: >
Expand Down

0 comments on commit 9edac80

Please sign in to comment.