protected void saveChunks(boolean flag) throws ExceptionWorldConflict { // CraftBukkit - added throws if (!this.M) { // CraftBukkit start - fire WorldSaveEvent // WorldServer[] aworldserver = this.worldServer; int i = this.worlds.size(); for (int j = 0; j < i; ++j) { WorldServer worldserver = this.worlds.get(j); if (worldserver != null) { if (!flag) { MinecraftServer.i.info("Saving chunks for level \'" + worldserver.getWorldData().getName() + "\'/" + worldserver.worldProvider.getName()); } worldserver.save(true, (IProgressUpdate) null); worldserver.saveLevel(); WorldSaveEvent event = new WorldSaveEvent(worldserver.getWorld()); this.server.getPluginManager().callEvent(event); // CraftBukkit end } } } }
protected void saveChunks(boolean flag) throws ExceptionWorldConflict { // CraftBukkit - added throws if (!this.P) { // CraftBukkit start for (int j = 0; j < this.worlds.size(); ++j) { WorldServer worldserver = this.worlds.get(j); if (worldserver != null) { if (!flag) { this.getLogger().info("Saving chunks for level \'" + worldserver.getWorldData().getName() + "\'/" + worldserver.worldProvider.getName()); } worldserver.save(true, (IProgressUpdate) null); worldserver.saveLevel(); WorldSaveEvent event = new WorldSaveEvent(worldserver.getWorld()); this.server.getPluginManager().callEvent(event); } } // CraftBukkit end } }
protected void saveChunks(boolean flag) throws ExceptionWorldConflict { // CraftBukkit - added throws if (!this.N) { // CraftBukkit start for (int j = 0; j < this.worlds.size(); ++j) { WorldServer worldserver = this.worlds.get(j); if (worldserver != null) { if (!flag) { this.getLogger().info("Saving chunks for level \'" + worldserver.getWorldData().getName() + "\'/" + worldserver.worldProvider.getName()); } worldserver.save(true, (IProgressUpdate) null); worldserver.saveLevel(); WorldSaveEvent event = new WorldSaveEvent(worldserver.getWorld()); this.server.getPluginManager().callEvent(event); } } // CraftBukkit end } }
@Override public boolean unloadWorld(World world, boolean save) { if (world == null) { return false; } net.minecraft.world.WorldServer handle = ((CraftWorld) world).getHandle(); if (!(console.worlds.contains(handle))) { return false; } if (handle.playerEntities.size() > 0) { return false; } WorldUnloadEvent e = new WorldUnloadEvent(handle.getWorld()); pluginManager.callEvent(e); if (e.isCancelled()) { return false; } if (save) { try { handle.saveAllChunks(true, null); handle.flush(); WorldSaveEvent event = new WorldSaveEvent(handle.getWorld()); getPluginManager().callEvent(event); } catch (net.minecraft.world.MinecraftException ex) { getLogger().log(Level.SEVERE, null, ex); FMLLog.log(org.apache.logging.log4j.Level.ERROR, ex, "Failed to save world " + handle.getWorld().getName() + " while unloading it."); } } MinecraftForge.EVENT_BUS.post(new WorldEvent.Unload(handle)); // Cauldron - fire unload event before removing world worlds.remove(world.getName().toLowerCase()); DimensionManager.setWorld(handle.provider.dimensionId, null); // Cauldron - remove world from DimensionManager return true; }
@EventHandler public void onWorldSave(WorldSaveEvent e) { // only save once for all worlds if (e.getWorld().equals(Bukkit.getWorlds().get(0))) { saveDuctsAsync(false); } }
@EventHandler public void onWorldSave(WorldSaveEvent event) { if (!event.getWorld().equals(Bukkit.getWorlds().get(0))) { return; } BackpackManager.saveBackpacks(); for (Player player : Bukkit.getServer().getOnlinePlayers()) { InventoryManager.savePlayerInventory(player); } }
@Override public boolean unloadWorld(World world, boolean save) { if (world == null) { return false; } net.minecraft.world.WorldServer handle = ((CraftWorld) world).getHandle(); if (!(console.worlds.contains(handle))) { return false; } if (handle.playerEntities.size() > 0) { return false; } WorldUnloadEvent e = new WorldUnloadEvent(handle.getWorld()); pluginManager.callEvent(e); if (e.isCancelled()) { return false; } if (save) { try { handle.saveAllChunks(true, null); handle.flush(); WorldSaveEvent event = new WorldSaveEvent(handle.getWorld()); getPluginManager().callEvent(event); } catch (net.minecraft.world.MinecraftException ex) { getLogger().log(Level.SEVERE, null, ex); FMLLog.log(org.apache.logging.log4j.Level.ERROR, ex, "Failed to save world " + handle.getWorld().getName() + " while unloading it."); } } MinecraftForge.EVENT_BUS.post(new WorldEvent.Unload(handle)); // Cauldron - fire unload event before removing world worlds.remove(world.getName().toLowerCase(java.util.Locale.ROOT)); DimensionManager.setWorld(handle.provider.dimensionId, null); // Cauldron - remove world from DimensionManager return true; }
@EventHandler public void onWorldSave(WorldSaveEvent event) { WorldData world = this.module.getWorldManager().getWorld(event.getWorld().getName()); for(Player player : event.getWorld().getPlayers()) { world.getData(player.getName()).save(player); } }
@EventHandler public void onWorldSave(WorldSaveEvent event) { long now = new Date().getTime(); if (now - stamp > 60000) { stamp = now; new BukkitRunnable() { @Override public void run() { config.save(); Logger.log("Saved player data."); } }.runTask((NodeBBIntegrationBukkit)plugin); } }
@EventHandler public void onWorldSave(WorldSaveEvent event) { long now = new Date().getTime(); if (now - stamp > 60000) { stamp = now; new BukkitRunnable() { @Override public void run() { plugin.getPluginConfig().save(); plugin.log("Saved player data."); } }.runTask(plugin); } }
protected void saveAllWorlds(boolean p_71267_1_) throws MinecraftException // CraftBukkit - added throws { if (!this.worldIsBeingDeleted) { // CraftBukkit start for (int j = 0; j < this.worlds.size(); ++j) { WorldServer worldserver = this.worlds.get(j); if (worldserver != null) { if (!p_71267_1_) { logger.info("Saving chunks for level \'" + worldserver.getWorldInfo().getWorldName() + "\'/" + worldserver.provider.getDimensionName()); } worldserver.saveAllChunks(true, (IProgressUpdate) null); worldserver.flush(); WorldSaveEvent event = new WorldSaveEvent(worldserver.getWorld()); this.server.getPluginManager().callEvent(event); // Cauldron start - save world configs if (worldserver.cauldronConfig != null) { worldserver.cauldronConfig.save(); } if (worldserver.tileentityConfig != null) { worldserver.tileentityConfig.save(); } // Cauldron end } } // CraftBukkit end } }
@EventHandler public void autoSave(WorldSaveEvent event) { if ("world".equals(event.getWorld().getName())) { Bukkit.broadcastMessage(ChatColor.DARK_RED + "Tregmine is saving, You may experience some slowness."); } }
@EventHandler (priority = EventPriority.NORMAL) public void load(final WorldSaveEvent evt) { for (Player pl : Bukkit.getServer().getOnlinePlayers()) { if (pl.hasPermission("masters.debug")) { pl.sendMessage(ChatColor.RED + "World " + evt.getWorld().getName() + " has been saved."); } } }
@EventHandler public void onWorldLoaded(final WorldSaveEvent event) { if (event.getWorld().getEnvironment() == World.Environment.NORMAL) this.onLoaded(event.getWorld()); }
@EventHandler public void onWorldSave(WorldSaveEvent worldSaveEvent) { checkSafety(worldSaveEvent); }
@Override public boolean unloadWorld(World world, boolean save) { if (world == null) { return false; } WorldServer handle = ((CraftWorld) world).getHandle(); if (!(console.worlds.contains(handle))) { return false; } if (!(handle.dimension > 1)) { return false; } if (handle.players.size() > 0) { return false; } WorldUnloadEvent e = new WorldUnloadEvent(handle.getWorld()); pluginManager.callEvent(e); if (e.isCancelled()) { return false; } if (save) { try { handle.save(true, null); handle.saveLevel(); WorldSaveEvent event = new WorldSaveEvent(handle.getWorld()); getPluginManager().callEvent(event); } catch (ExceptionWorldConflict ex) { getLogger().log(Level.SEVERE, null, ex); } } worlds.remove(world.getName().toLowerCase()); console.worlds.remove(console.worlds.indexOf(handle)); return true; }
public void disable() { WorldInitEvent.getHandlerList().unregister(this); WorldUnloadEvent.getHandlerList().unregister(this); WorldLoadEvent.getHandlerList().unregister(this); WorldSaveEvent.getHandlerList().unregister(this); }
@EventHandler(priority = EventPriority.NORMAL) public void onWorldSave(WorldSaveEvent ev) { plugin.getDebug().normal("#### " + ev.getWorld().getName() + " was saved."); }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onWorldSaveEvent(WorldSaveEvent event) { if(event.getWorld().getName().equals("world")) Villagers.SaveVillagers(); }
public boolean unloadWorld(World world, boolean save) { if (world == null) { return false; } WorldServer handle = ((CraftWorld) world).getHandle(); if (!(console.worlds.contains(handle))) { return false; } if (!(handle.dimension > 1)) { return false; } if (handle.players.size() > 0) { return false; } WorldUnloadEvent e = new WorldUnloadEvent(handle.getWorld()); pluginManager.callEvent(e); if (e.isCancelled()) { return false; } if (save) { try { handle.save(true, null); handle.saveLevel(); WorldSaveEvent event = new WorldSaveEvent(handle.getWorld()); getPluginManager().callEvent(event); } catch (ExceptionWorldConflict ex) { getLogger().log(Level.SEVERE, null, ex); } } worlds.remove(world.getName().toLowerCase()); console.worlds.remove(console.worlds.indexOf(handle)); return true; }
public boolean unloadWorld(World world, boolean save) { if (world == null) { return false; } net.minecraft.world.WorldServer handle = ((CraftWorld) world).getHandle(); if (!(console.worlds.contains(handle))) { return false; } if (!(handle.dimension > 1)) { return false; } if (handle.field_73010_i.size() > 0) { return false; } WorldUnloadEvent e = new WorldUnloadEvent(handle.getWorld()); pluginManager.callEvent(e); if (e.isCancelled()) { return false; } if (save) { try { handle.func_73044_a(true, (net.minecraft.util.IProgressUpdate) null); handle.func_73041_k(); WorldSaveEvent event = new WorldSaveEvent(handle.getWorld()); getPluginManager().callEvent(event); } catch (net.minecraft.world.MinecraftException ex) { getLogger().log(Level.SEVERE, null, ex); } } worlds.remove(world.getName().toLowerCase()); console.worlds.remove(console.worlds.indexOf(handle)); return true; }