@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) private void onWorldUnload(WorldUnloadEvent event) { String worldName = event.getWorld().getName(); for (Region region : _instances.keySet()) { if (region.isDefined() && worldName.equals(region.getWorldName())) { // remove world from locations, helps garbage collector //noinspection ConstantConditions region.getP1().setWorld(null); //noinspection ConstantConditions region.getP2().setWorld(null); } } }
/** * Creates an EndWorldHandler if the loaded world is an End world * * @param event a World Unload Event */ @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) public void onWorldUnload(final WorldUnloadEvent event) { if (event.getWorld().getEnvironment() == Environment.THE_END) { this.plugin.getLogger().info("Handling " + event.getWorld().getName() + " unload"); final EndWorldHandler handler = this.plugin.getHandler(StringUtil.toLowerCamelCase(event.getWorld().getName())); if (handler != null) { try { handler.unload(false); } catch (final InvalidConfigurationException e) { this.plugin.getLogger().severe("An error occured, stacktrace follows:"); e.printStackTrace(); } } } }
@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(priority = EventPriority.LOWEST, ignoreCancelled = true) public static void onUnloadWorld(WorldUnloadEvent e) { if (stablesizes.containsKey(e.getWorld())) { stablesizes.remove(e.getWorld()); stabletimes.remove(e.getWorld()); origsizes.remove(e.getWorld()); } }
@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled = true) public void onWorldUnload(WorldUnloadEvent e) { if (e.getWorld() == this.world) { world = null; location = null; } }
@HookHandler(priority = Priority.CRITICAL) public void onWorldUnload(final UnloadWorldHook hook) { server.getPluginManager().callEvent(new WorldUnloadEvent(new CanaryWorld(hook.getWorld())) { @Override public void setCancelled(boolean cancelled) { super.setCancelled(cancelled); //UnloadWorldHook isn't a CancelableHook :( } }); }
@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(); } catch (ExceptionWorldConflict ex) { getLogger().log(Level.SEVERE, null, ex); } } worlds.remove(world.getName().toLowerCase()); console.worlds.remove(console.worlds.indexOf(handle)); return true; }
@EventHandler(priority = EventPriority.NORMAL) public void onWorldUnload(WorldUnloadEvent e) { World w = e.getWorld(); try { RedProtect.get().rm.unload(w); RedProtect.get().logger.warning("World unloaded: " + w.getName()); } catch (Exception ex) { RedProtect.get().logger.severe("RedProtect problem on unload world:"); ex.printStackTrace(); } }
@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 onWorldUnload(WorldUnloadEvent event) { World world = event.getWorld(); if (announcementTasks.containsKey(world.getName())) { plugin.getLogger().info("Cancelling Announcement Task for " + world.getName()); announcementTasks.get(world.getName()).cancel(); } }
@EventHandler public void onWorldUnload(WorldUnloadEvent event) { if (BridgePlugin.getInstance().debugMode) { System.out.println("[BRIDGE WORLD LISTENER] Unloading: " + event.getWorld().getName()); Thread.dumpStack(); } }
private void onWorldUnload(WorldUnloadEvent event) { List<IArena> arenas = PVStarAPI.getArenaManager().getArenas(); for (IArena arena : arenas) { if (arena.getRegion().isDefined()) { World world = arena.getRegion().getWorld(); if (event.getWorld().equals(world)) { arena.getSettings().setTransientEnabled(false); } } } }
@EventHandler (priority = EventPriority.NORMAL) public void unload(final WorldUnloadEvent evt) { for (Player pl : Bukkit.getServer().getOnlinePlayers()) { if (pl.hasPermission("masters.debug")) { pl.sendMessage(ChatColor.RED + "World " + evt.getWorld().getName() + " has been unloaded."); } } }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onWorldUnload(final WorldUnloadEvent event) { for(Tracker tracker : this.manager.getTrackers()) { tracker.clear(event.getWorld()); } }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onWorldUnload(WorldUnloadEvent event) { for(Entity entity : event.getWorld().getEntities()) { map.remove(entity); } }
@EventHandler(priority = EventPriority.LOWEST) public void onWorldChange(WorldUnloadEvent event) { leakDetector.expectRelease(event.getWorld(), DEADLINE, true); }
@EventHandler(priority = EventPriority.MONITOR) public void onUnload(WorldUnloadEvent event) { armorStands.remove(event.getWorld()); }
@EventHandler(ignoreCancelled = true) public void onWorldUnload(WorldUnloadEvent event) { plugin.signDB.updateAttachedBlocks(); }
@EventHandler public void onWorldUnload(WorldUnloadEvent worldUnloadEvent) { checkSafety(worldUnloadEvent); }
@EventHandler public void on(WorldUnloadEvent e) { installWorld(e.getWorld()); }
@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; }
@EventHandler public void onWorldUnload(WorldUnloadEvent event){ WorldManagerHelper.saveWorldConfig(event.getWorld()); }
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 onWorldUnload(WorldUnloadEvent ev) { plugin.getDebug().normal("#### " + ev.getWorld().getName() + " was unloaded."); }
@EventHandler public void onWorldUnload(WorldUnloadEvent event) { this.removeWorld(event.getWorld()); }
@EventHandler public void onWorldUnload(WorldUnloadEvent ev) { removeFlyingBlocks(ev.getWorld()); }
@EventHandler public void onWorldUnLoad(WorldUnloadEvent event) { LocationManager.getManager().worldUnloaded(event.getWorld()); }
@EventHandler(priority = EventPriority.MONITOR) public void onWorldUnload(WorldUnloadEvent e) { plugin.worlds.remove(e.getWorld().getName()); }
@EventHandler public void onWorldUnload(WorldUnloadEvent event) { World world = event.getWorld(); manager.unloadWorld(world); }
@EventHandler public void worldUnloadEvent(WorldUnloadEvent e) { clearWorldCache = true; }