當前位置: 首頁>>代碼示例>>Java>>正文


Java WorldInitEvent類代碼示例

本文整理匯總了Java中org.bukkit.event.world.WorldInitEvent的典型用法代碼示例。如果您正苦於以下問題:Java WorldInitEvent類的具體用法?Java WorldInitEvent怎麽用?Java WorldInitEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


WorldInitEvent類屬於org.bukkit.event.world包,在下文中一共展示了WorldInitEvent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onWorldInit

import org.bukkit.event.world.WorldInitEvent; //導入依賴的package包/類
@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();
     }
     }*/
}
 
開發者ID:Samistine,項目名稱:BloodMoon,代碼行數:24,代碼來源:WorldInitListener.java

示例2: onWorldInit

import org.bukkit.event.world.WorldInitEvent; //導入依賴的package包/類
@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));
    }
}
 
開發者ID:IntellectualSites,項目名稱:PlotSquared,代碼行數:20,代碼來源:WorldEvents.java

示例3: onWorldInit

import org.bukkit.event.world.WorldInitEvent; //導入依賴的package包/類
@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.");
		}
	}
}
 
開發者ID:Curtis3321,項目名稱:Essentials,代碼行數:23,代碼來源:GMWorldListener.java

示例4: initialize

import org.bukkit.event.world.WorldInitEvent; //導入依賴的package包/類
@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, " ");
}
 
開發者ID:Jsawrus,項目名稱:Masters,代碼行數:19,代碼來源:worldHandler.java

示例5: onWorldLoad

import org.bukkit.event.world.WorldInitEvent; //導入依賴的package包/類
@EventHandler
public void onWorldLoad(WorldInitEvent evt) {
	if (noSpawnChunks) {
		World world = evt.getWorld();
		world.setKeepSpawnInMemory(false);
		AzureAPI.log("已為世界 " + world.getName() + " 設定不保留出生區塊.");
	}
}
 
開發者ID:GelandiAssociation,項目名稱:EscapeLag,代碼行數:9,代碼來源:NoSpawnChunks.java

示例6: WorldSeterLimitor

import org.bukkit.event.world.WorldInitEvent; //導入依賴的package包/類
@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() + " 設定了生物刷新速率~");
    }
}
 
開發者ID:GelandiAssociation,項目名稱:EscapeLag,代碼行數:12,代碼來源:WorldSpawnLimiter.java

示例7: onWorldInit

import org.bukkit.event.world.WorldInitEvent; //導入依賴的package包/類
@EventHandler(priority = EventPriority.LOWEST)
public void onWorldInit(WorldInitEvent event) {
    World world = event.getWorld();
    world.setAutoSave(false);
    world.setKeepSpawnInMemory(false);
    world.setSpawnFlags(false, false);
}
 
開發者ID:ShootGame,項目名稱:Arcade2,代碼行數:8,代碼來源:GeneralListeners.java

示例8: onWorldInit

import org.bukkit.event.world.WorldInitEvent; //導入依賴的package包/類
@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()));
    }
}
 
開發者ID:MCCarbon,項目名稱:Carbon-2,代碼行數:9,代碼來源:WorldGeneratorInjector.java

示例9: onWorldInit

import org.bukkit.event.world.WorldInitEvent; //導入依賴的package包/類
@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));
    }
}
 
開發者ID:Samistine,項目名稱:BloodMoon,代碼行數:9,代碼來源:DungeonListener.java

示例10: onWorldInit

import org.bukkit.event.world.WorldInitEvent; //導入依賴的package包/類
@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));
}
 
開發者ID:Eluinhost,項目名稱:UberHardcore,代碼行數:12,代碼來源:ZombieSeigeHandler.java

示例11: onWorldLoad

import org.bukkit.event.world.WorldInitEvent; //導入依賴的package包/類
@EventHandler
public static void onWorldLoad(WorldInitEvent event) {
    if (disableChunkLoad) {
        World world = event.getWorld();
        world.setKeepSpawnInMemory(false);
    }
}
 
開發者ID:boy0001,項目名稱:FastAsyncWorldedit,代碼行數:8,代碼來源:BukkitQueue_0.java

示例12: onWorldInit

import org.bukkit.event.world.WorldInitEvent; //導入依賴的package包/類
@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());
}
 
開發者ID:robotman3000,項目名稱:Spigot-Plus,代碼行數:10,代碼來源:WorldManager.java

示例13: onInit

import org.bukkit.event.world.WorldInitEvent; //導入依賴的package包/類
@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());
        }
    }
}
 
開發者ID:tastybento,項目名稱:beaconz,代碼行數:11,代碼來源:WorldListener.java

示例14: onWorldInit

import org.bukkit.event.world.WorldInitEvent; //導入依賴的package包/類
@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;
}
 
開發者ID:Mayomi,項目名稱:PlotSquared-Chinese,代碼行數:16,代碼來源:WorldEvents.java

示例15: onWorldInit

import org.bukkit.event.world.WorldInitEvent; //導入依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR)
public void onWorldInit(WorldInitEvent event)
{
	World world = event.getWorld();
	plugin.getDataHandler().loadWorld(world);
	plugin.getPermissionHandler().registerWorld(world);
}
 
開發者ID:dmulloy2,項目名稱:SwornPermissions,代碼行數:8,代碼來源:WorldListener.java


注:本文中的org.bukkit.event.world.WorldInitEvent類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。