Skip to content

Commit

Permalink
インベントリのアイテムを更新するメソッド追加
Browse files Browse the repository at this point in the history
  • Loading branch information
Arisa9006 committed Nov 17, 2024
1 parent 4c481e6 commit 63db272
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>dev.felnull</groupId>
<artifactId>BetterStorage</artifactId>
<version>1.0.3</version>
<version>1.0.4-SNAPSHOT</version>
<packaging>jar</packaging>

<name>BetterStorage</name>
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/dev/felnull/Data/InventoryData.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,16 @@ public InventoryData(String[] userTag, String displayName, int rows, Set<String>
this.requirePermission = requirePermission;
this.itemStackSlot = itemStackSlot;
}

public void saveInventory(Inventory inventory) {
itemStackSlot.clear();
for (int i = 0; i < inventory.getSize(); i++) {
ItemStack item = inventory.getItem(i);

// 空でないスロットのみをマップに追加
if (item != null) {
itemStackSlot.put(i, item);
}
}
}
}

0 comments on commit 63db272

Please sign in to comment.