@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) public void onWorldInit(WorldInitEvent event) { World world = event.getWorld(); plugin.createConfig(world); /*if (plugin.isFeatureEnabled(world.getName(), Feature.SPAWN_CONTROL)){ WorldServer worldServer = ((CraftWorld) world).getHandle(); try{ IChunkLoader chunkLoader = ReflectionUtils.getFieldValue(net.minecraft.server.v1_8_R1.ChunkProviderServer.class, "chunkLoader", IChunkLoader.class, worldServer.chunkProviderServer); ChunkProviderServer newProvider = new ChunkProviderServer(this.plugin, worldServer, chunkLoader, worldServer.chunkProviderServer.chunkProvider); newProvider.chunks = worldServer.chunkProviderServer.chunks; newProvider.forceChunkLoad = worldServer.chunkProviderServer.forceChunkLoad; worldServer.chunkProviderServer = newProvider; }catch (NoSuchFieldException e){ e.printStackTrace(); } }*/ }
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onWorldInit(WorldInitEvent event) { World world = event.getWorld(); String name = world.getName(); PlotAreaManager manager = PS.get().getPlotAreaManager(); if (manager instanceof SinglePlotAreaManager) { SinglePlotAreaManager single = (SinglePlotAreaManager) manager; if (single.isWorld(name)) { world.setKeepSpawnInMemory(false); return; } } ChunkGenerator gen = world.getGenerator(); if (gen instanceof GeneratorWrapper) { PS.get().loadWorld(name, (GeneratorWrapper<?>) gen); } else { PS.get().loadWorld(name, new BukkitPlotGenerator(name, gen)); } }
@EventHandler(priority = EventPriority.LOWEST) public void onWorldInit(WorldInitEvent event) { String worldName = event.getWorld().getName(); if (GroupManager.isLoaded() && !plugin.getWorldsHolder().isInList(worldName)) { GroupManager.logger.info("New world detected..."); GroupManager.logger.info("Creating data for: " + worldName); plugin.getWorldsHolder().setupWorldFolder(worldName); plugin.getWorldsHolder().loadWorld(worldName); if (plugin.getWorldsHolder().isInList(worldName)) { GroupManager.logger.info("Don't forget to configure/mirror this world in config.yml."); } else { GroupManager.logger.severe("Failed to configure this world."); } } }
@EventHandler (priority = EventPriority.NORMAL) public void initialize(final WorldInitEvent evt) { StringBuilder players = new StringBuilder(); for (Player pls : evt.getWorld().getPlayers()) { players.append(pls); } for (Player pl : Bukkit.getServer().getOnlinePlayers()) { if (pl.hasPermission("masters.debug")) { pl.sendMessage(ChatColor.RED + "World " + evt.getWorld().getName() + " has been loaded by " + players + "."); } } //set string to null players.setLength(0); players.replace(0, 0, " "); }
@EventHandler public void onWorldLoad(WorldInitEvent evt) { if (noSpawnChunks) { World world = evt.getWorld(); world.setKeepSpawnInMemory(false); AzureAPI.log("已为世界 " + world.getName() + " 设定不保留出生区块."); } }
@EventHandler public void WorldSeterLimitor(WorldInitEvent event) { World world = event.getWorld(); FileConfiguration config = EscapeLag.configOptimize.getValue(); if (config.getBoolean("WorldSpawnLimitor." + world.getName() + ".enable")) { world.setMonsterSpawnLimit(config.getInt("WorldSpawnLimitor." + world.getName() + ".PerChunkMonsters")); world.setAnimalSpawnLimit(config.getInt("WorldSpawnLimitor." + world.getName() + ".PerChunkAnimals")); world.setAmbientSpawnLimit(config.getInt("WorldSpawnLimitor." + world.getName() + ".PerChunkAmbient")); EscapeLag.MainThis.getLogger().info("已为世界 " + world.getName() + " 设定了生物刷新速率~"); } }
@EventHandler(priority = EventPriority.LOWEST) public void onWorldInit(WorldInitEvent event) { World world = event.getWorld(); world.setAutoSave(false); world.setKeepSpawnInMemory(false); world.setSpawnFlags(false, false); }
@EventHandler public void onWorldInit(WorldInitEvent event) { WorldServer nmsworld = ((CraftWorld) event.getWorld()).getHandle(); IChunkProvider genprovider = nmsworld.chunkProviderServer.chunkProvider; if (genprovider instanceof SkyLandsChunkGenerator) { ReflectionUtils.setFieldValue(NormalChunkGenerator.class, "provider", genprovider, new NewChunkProviderTheEnd(nmsworld, nmsworld.getSeed())); } }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onWorldInit(WorldInitEvent event) { World world = event.getWorld(); if (plugin.isEnabled(world) && plugin.isFeatureEnabled(world, Feature.DUNGEONS)) { world.getPopulators().add(new DungeonGenerator(plugin)); } }
@EventHandler public void onWorldInit(WorldInitEvent event) throws NoSuchFieldException, IllegalAccessException { WorldServer world = ((CraftWorld) event.getWorld()).getHandle(); if (seigeHandlerField == null) { seigeHandlerField = WorldServer.class.getDeclaredField("siegeManager"); seigeHandlerField.setAccessible(true); } seigeHandlerField.set(world, new CustomZombieSeige(world)); }
@EventHandler public static void onWorldLoad(WorldInitEvent event) { if (disableChunkLoad) { World world = event.getWorld(); world.setKeepSpawnInMemory(false); } }
@EventHandler public void onWorldInit(WorldInitEvent evt) { if(safeSpawnMode){ Location spawn = WorldManagerHelper.getSafestSpawnPoint(evt.getWorld()); evt.getWorld().setSpawnLocation(spawn.getBlockX(), spawn.getBlockY(), spawn.getBlockZ()); logInfo("Safe Spawn: Updated spawn location " + spawn); } WorldManagerHelper.saveWorldConfig(evt.getWorld()); }
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true) public void onInit(WorldInitEvent event) { //Bukkit.getLogger().info("On World Init called"); if (event.getWorld().equals(getBeaconzWorld())) { if (!getBeaconzWorld().getPopulators().contains(getBlockPopulator())) { event.getWorld().getPopulators().add(getBlockPopulator()); } } }
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public static void onWorldInit(final WorldInitEvent event) { final World world = event.getWorld(); String name = getName(world); final ChunkGenerator gen = world.getGenerator(); if (gen instanceof PlotGenerator) { // PlotSquared.loadWorld(name, (PlotGenerator) gen); } else { if (PlotSquared.config.contains("worlds." + name)) { PlotSquared.loadWorld(name, null); } } lastWorld = null; }
@EventHandler(priority = EventPriority.MONITOR) public void onWorldInit(WorldInitEvent event) { World world = event.getWorld(); plugin.getDataHandler().loadWorld(world); plugin.getPermissionHandler().registerWorld(world); }
@EventHandler public void onWorldInit(final WorldInitEvent event) { for (final String worldName : TreePlugin.this.getConfig() .getStringList("worlds")) { if (worldName.equals(event.getWorld().getName())) { TreePlugin.this.getLogger() .info("Attaching giant tree populator to world \"" + event.getWorld().getName() + "\""); event.getWorld().getPopulators() .add(new TreePopulator(TreePlugin.this)); return; } } }
/** * Monitor WorldInit events. * * @param event The event to watch */ @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onWorldInit(WorldInitEvent event) { World world = event.getWorld(); if (!new File(world.getWorldFolder(), "mcmmo_data").exists() || plugin == null) { return; } plugin.getLogger().info("Converting block storage for " + world.getName() + " to a new format."); new BlockStoreConversionMain(world).run(); }
@EventHandler public void onWorldInit(WorldInitEvent event) { World world = event.getWorld(); for (MagicWorld notifyWorld : magicWorlds.values()) { notifyWorld.onWorldInit(plugin, world); } MagicWorld magicWorld = magicWorlds.get(world.getName()); if (magicWorld == null) return; logger.info("Initializing world " + world.getName()); magicWorld.installPopulators(world); }
@EventHandler(priority = EventPriority.MONITOR) public void onWorldInit(WorldInitEvent event) { World world = event.getWorld(); if (plugin.isAllWorlds() || plugin.getWorlds().contains(world.getName().toLowerCase())) world.setKeepSpawnInMemory(plugin.isKeepSpawnInMemory()); }
@EventHandler public void onWorldInit (WorldInitEvent event) { for (BlockPopulator pop : event.getWorld().getPopulators()) { if (pop instanceof OrePopulator) return; } if (event.getWorld().getEnvironment() == World.Environment.NORMAL) { event.getWorld().getPopulators().add(new OrePopulator(_plugin)); } }
@Override public World createWorld(WorldCreator creator) { Validate.notNull(creator, "Creator may not be null"); String name = creator.name(); ChunkGenerator generator = creator.generator(); File folder = new File(getWorldContainer(), name); World world = getWorld(name); net.minecraft.world.WorldType type = net.minecraft.world.WorldType.parseWorldType(creator.type().getName()); boolean generateStructures = creator.generateStructures(); if ((folder.exists()) && (!folder.isDirectory())) { throw new IllegalArgumentException("File exists with the name '" + name + "' and isn't a folder"); } if (world != null) { return world; } boolean hardcore = false; WorldSettings worldSettings = new WorldSettings(creator.seed(), net.minecraft.world.WorldSettings.GameType.getByID(getDefaultGameMode().getValue()), generateStructures, hardcore, type); net.minecraft.world.WorldServer worldserver = DimensionManager.initDimension(creator, worldSettings); pluginManager.callEvent(new WorldInitEvent(worldserver.getWorld())); net.minecraftforge.cauldron.CauldronHooks.craftWorldLoading = true; System.out.print("Preparing start region for level " + (console.worlds.size() - 1) + " (Dimension: " + worldserver.provider.dimensionId + ", Seed: " + worldserver.getSeed() + ")"); // Cauldron - log dimension if (worldserver.getWorld().getKeepSpawnInMemory()) { short short1 = 196; long i = System.currentTimeMillis(); for (int j = -short1; j <= short1; j += 16) { for (int k = -short1; k <= short1; k += 16) { long l = System.currentTimeMillis(); if (l < i) { i = l; } if (l > i + 1000L) { int i1 = (short1 * 2 + 1) * (short1 * 2 + 1); int j1 = (j + short1) * (short1 * 2 + 1) + k + 1; System.out.println("Preparing spawn area for " + worldserver.getWorld().getName() + ", " + (j1 * 100 / i1) + "%"); i = l; } net.minecraft.util.ChunkCoordinates chunkcoordinates = worldserver.getSpawnPoint(); worldserver.theChunkProviderServer.loadChunk(chunkcoordinates.posX + j >> 4, chunkcoordinates.posZ + k >> 4); } } } pluginManager.callEvent(new WorldLoadEvent(worldserver.getWorld())); net.minecraftforge.cauldron.CauldronHooks.craftWorldLoading = false; return worldserver.getWorld(); }
@EventHandler public void onWorldInit(WorldInitEvent event) { event.getWorld().setKeepSpawnInMemory(false); }
@EventHandler public void onWorldInit(final WorldInitEvent event) { if (event.getWorld().getEnvironment() == World.Environment.NORMAL) this.init(event.getWorld()); }
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onWorldLoad(WorldInitEvent e) { e.getWorld().setKeepSpawnInMemory(cm.isKeepSpawnChunkInMemory); }
@EventHandler(priority = EventPriority.NORMAL) public void onWorldInit(WorldInitEvent event) { prepareWorld(event.getWorld()); }
@EventHandler(priority = EventPriority.HIGH) public void onWorldInit(final WorldInitEvent event) { loadWorld(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 onWorldInit(WorldInitEvent ev) { plugin.getDebug().normal("#### " + ev.getWorld().getName() + " was saved."); }