Add logging to world unload

This commit is contained in:
libraryaddict 2020-11-29 07:12:06 +13:00
parent 789d1b15c7
commit eb9eeca691

View File

@ -255,11 +255,13 @@ public class DisguiseListener implements Listener {
} }
@EventHandler @EventHandler
public void onChunkUnload(WorldUnloadEvent event) { public void onWorldUnload(WorldUnloadEvent event) {
if (!DisguiseConfig.isSaveEntityDisguises()) { if (!DisguiseConfig.isSaveEntityDisguises()) {
return; return;
} }
int disguisesSaved = 0;
for (Entity entity : event.getWorld().getEntities()) { for (Entity entity : event.getWorld().getEntities()) {
if (entity instanceof Player) { if (entity instanceof Player) {
continue; continue;
@ -271,8 +273,13 @@ public class DisguiseListener implements Listener {
continue; continue;
} }
disguisesSaved++;
DisguiseUtilities.saveDisguises(entity.getUniqueId(), disguises); DisguiseUtilities.saveDisguises(entity.getUniqueId(), disguises);
} }
if (disguisesSaved > 0) {
DisguiseUtilities.getLogger().info("World unloaded, saved " + disguisesSaved + " disguises");
}
} }
@EventHandler @EventHandler