Skip to content

Commit

Permalink
Save inventory less frequently
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Dec 14, 2022
1 parent bf4186e commit e249110
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -30,6 +30,7 @@
@TraitName("inventory")
public class Inventory extends Trait {
private ItemStack[] contents;
private int t;
private org.bukkit.inventory.Inventory view;
private final Set<InventoryView> views = new HashSet<InventoryView>();

Expand Down Expand Up @@ -136,7 +137,10 @@ private ItemStack[] parseContents(DataKey key) throws NPCLoadException {

@Override
public void run() {
saveContents(npc.getEntity());
if (t++ > 10) {
saveContents(npc.getEntity());
t = 0;
}
if (views.isEmpty())
return;
Iterator<InventoryView> itr = views.iterator();
Expand Down

0 comments on commit e249110

Please sign in to comment.