Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -566,4 +566,14 @@ public IslandBlockCount getIsland(Island island) {
return islandCountMap.computeIfAbsent(island.getUniqueId(),
k -> new IslandBlockCount(k, island.getGameMode()));
}

/**
* Notify that the island's data has changed so it gets batched for a save.
* Called from {@link EntityLimitListener} when entity counts are incremented
* or decremented — block changes go through {@link #process} which already
* calls this internally.
*/
public void markChanged(String islandId) {
updateSaveMap(islandId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ private void trackSpawn(Entity entity) {
IslandBlockCount ibc = addon.getBlockLimitListener().getIsland(island);
ibc.incrementEntity(envOf(w), entity.getType());
entityIslandMap.put(entity.getUniqueId(), island.getUniqueId());
addon.getBlockLimitListener().markChanged(island.getUniqueId());
});
}

Expand Down Expand Up @@ -326,6 +327,7 @@ public void onEntityRemove(EntityRemoveEvent e) {
IslandBlockCount ibc = addon.getBlockLimitListener().getIsland(islandId);
if (ibc != null) {
ibc.decrementEntity(envOf(w), entity.getType());
addon.getBlockLimitListener().markChanged(islandId);
}
return;
}
Expand All @@ -336,6 +338,7 @@ public void onEntityRemove(EntityRemoveEvent e) {
IslandBlockCount ibc = addon.getBlockLimitListener().getIsland(island.getUniqueId());
if (ibc != null) {
ibc.decrementEntity(envOf(w), entity.getType());
addon.getBlockLimitListener().markChanged(island.getUniqueId());
}
});
}
Expand Down Expand Up @@ -367,6 +370,7 @@ public void onEntityPortal(EntityPortalEvent e) {
IslandBlockCount ibc = addon.getBlockLimitListener().getIsland(island.getUniqueId());
if (ibc != null) {
ibc.decrementEntity(fromEnv, entity.getType());
addon.getBlockLimitListener().markChanged(island.getUniqueId());
}
});
}
Expand All @@ -378,6 +382,7 @@ public void onEntityPortal(EntityPortalEvent e) {
IslandBlockCount ibc = addon.getBlockLimitListener().getIsland(island);
ibc.incrementEntity(toEnv, entity.getType());
entityIslandMap.put(entity.getUniqueId(), island.getUniqueId());
addon.getBlockLimitListener().markChanged(island.getUniqueId());
});
}
}
Expand Down
Loading