当前位置: 首页>>代码示例>>Java>>正文


Java World.getLoadedChunks方法代码示例

本文整理汇总了Java中org.bukkit.World.getLoadedChunks方法的典型用法代码示例。如果您正苦于以下问题:Java World.getLoadedChunks方法的具体用法?Java World.getLoadedChunks怎么用?Java World.getLoadedChunks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.World的用法示例。


在下文中一共展示了World.getLoadedChunks方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: disableAI

import org.bukkit.World; //导入方法依赖的package包/类
public void disableAI() {
    for (World world : getServer().getWorlds()) {
        if (config.ignored_world.contains(world.getName())) {
            continue;
        }
        if (world.getLivingEntities().size() >= this.config.world_entity) {
            if (!disableAIWorlds.contains(world.getName())) {
                disableAIWorlds.add(world.getName());
                getLogger().info("disable entity ai in " + world.getName());
            }
            for (Chunk chunk : world.getLoadedChunks()) {
                int entityCount = getLivingEntityCount(chunk);
                if (entityCount >= this.config.chunk_entity) {
                    for (Entity entity : chunk.getEntities()) {
                        if (entity instanceof LivingEntity) {
                            setFromMobSpawner((LivingEntity) entity, true);
                        }
                    }
                }
            }
        }
    }
}
 
开发者ID:NyaaCat,项目名称:Yasui,代码行数:24,代码来源:Main.java

示例2: enableAI

import org.bukkit.World; //导入方法依赖的package包/类
public void enableAI() {
    for (World world : getServer().getWorlds()) {
        if (!disableAIWorlds.contains(world.getName())) {
            continue;
        } else {
            disableAIWorlds.remove(world.getName());
        }
        getLogger().info("enable entity ai in " + world.getName());
        for (Chunk chunk : world.getLoadedChunks()) {
            for (Entity entity : chunk.getEntities()) {
                if (entity instanceof LivingEntity) {
                    setFromMobSpawner((LivingEntity) entity, false);
                }
            }
        }
    }
}
 
开发者ID:NyaaCat,项目名称:Yasui,代码行数:18,代码来源:Main.java

示例3: preloadExistingChunks

import org.bukkit.World; //导入方法依赖的package包/类
public void preloadExistingChunks() {
	for (World world : CropControl.getPlugin().getServer().getWorlds()) {
		for (Chunk loadedChunk : world.getLoadedChunks()) {
			dataAccessObject.getChunk(loadedChunk);
		}
	}
}
 
开发者ID:DevotedMC,项目名称:CropControl,代码行数:8,代码来源:CropControlDatabaseHandler.java

示例4: WorldInfo

import org.bukkit.World; //导入方法依赖的package包/类
public WorldInfo(World world) {
	this.worldName = world.getName();
	this.totalOnline = world.getPlayers().size();
	for (Entity entity : world.getEntities()) {
		this.totalEntity++;
		if (entity instanceof Animals) {
			this.totalAnimals++;
		} else if (entity instanceof Monster) {
			this.totalMonsters++;
		} else if (entity instanceof Item) {
			this.totalDropItem++;
		}
	}
	for (Chunk loadedChunk : world.getLoadedChunks()) {
		this.totalChunk++;
		for (BlockState tiles : loadedChunk.getTileEntities()) {
			this.totalTiles++;
			if (tiles instanceof Hopper) {
				this.totalHopper++;
			} else if (tiles instanceof Chest) {
				this.totalChest++;
			} else if (tiles instanceof Dispenser) {
				this.totalDispenser++;
			} else if (tiles instanceof Dropper) {
				this.totalDropper++;
			} else if (tiles instanceof BrewingStand) {
				this.totalBrewingStand++;
			}
		}

	}
}
 
开发者ID:jiongjionger,项目名称:NeverLag,代码行数:33,代码来源:WorldInfo.java

示例5: onCommand

import org.bukkit.World; //导入方法依赖的package包/类
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{
	if(args.length == 1)
	{
		switch(args[0].toLowerCase())
		{
			case "on":
				Survival.snowGenOption = true;
				break;
			case "off":
				Survival.snowGenOption = false;
				break;
			default:
				return false;
		}
		if(sender instanceof Player)
		{
			sender.sendMessage(ChatColor.AQUA + "[SurvivalPlus] " + ChatColor.YELLOW + "Snow Generation is " + args[0].toLowerCase());
			sender.getServer().getConsoleSender().sendMessage("[SurvivalPlus] " + ChatColor.YELLOW + "Snow Generation is " + args[0].toLowerCase());
		}
		else if(sender instanceof ConsoleCommandSender)
		{
			sender.sendMessage("[SurvivalPlus] " + ChatColor.YELLOW + "Snow Generation is " + args[0].toLowerCase());
		}
		return true;
	}
	else if(args.length == 0)
	{
		if(Bukkit.getServer().getOnlinePlayers().size() <= 1)
		{
			if(sender instanceof Player)
			{
				sender.sendMessage(ChatColor.AQUA + "[SurvivalPlus] " + ChatColor.RED + "WARNING!" + ChatColor.YELLOW + " Snow Generation is running for generated chunks!");
				sender.getServer().getConsoleSender().sendMessage("[SurvivalPlus] " + ChatColor.RED + "WARNING!" + ChatColor.YELLOW + " Snow Generation is running for generated chunks!");
			}
			else if(sender instanceof ConsoleCommandSender)
			{
				sender.sendMessage("[SurvivalPlus] " + ChatColor.RED + "WARNING!" + ChatColor.YELLOW + " Snow Generation is running for generated chunks!");
			}
			
			SnowGeneration snowGen = new SnowGeneration();
			
			for(final World world : Bukkit.getServer().getWorlds())
			{
				for(final Chunk chunk : world.getLoadedChunks())
				{
					snowGen.checkChunk(chunk);
				}
			}
			
			if(sender instanceof Player)
			{
				sender.sendMessage(ChatColor.AQUA + "[SurvivalPlus] " + ChatColor.GREEN + "Snow Generation is completed.");
				sender.getServer().getConsoleSender().sendMessage("[SurvivalPlus] " + ChatColor.GREEN + "Snow Generation is completed.");
			}
			else if(sender instanceof ConsoleCommandSender)
			{
				sender.sendMessage("[SurvivalPlus] " + ChatColor.GREEN + "Snow Generation is completed.");
			}
			
			return true;
		}
		else
		{
			if(sender instanceof Player)
			{
				sender.sendMessage(ChatColor.AQUA + "[SurvivalPlus] " + ChatColor.RED + "WARNING!" + ChatColor.YELLOW + " Snow Generation will run through all generated chunks, lag spikes may occur!");
				sender.sendMessage(ChatColor.AQUA + "[SurvivalPlus] " + ChatColor.YELLOW + "Run this command while nobody is in the server.");
			}
			else if(sender instanceof ConsoleCommandSender)
			{
				sender.sendMessage("[SurvivalPlus] " + ChatColor.RED + "WARNING!" + ChatColor.YELLOW + " Snow Generation will run through all generated chunks, lag spikes may occur!");
				sender.sendMessage("[SurvivalPlus] " + ChatColor.YELLOW + "Run this command while nobody is in the server.");
			}
			
			return false;
		}
	}
	return false;
}
 
开发者ID:FattyMieo,项目名称:SurvivalPlus,代码行数:81,代码来源:SnowGen.java

示例6: getChunks

import org.bukkit.World; //导入方法依赖的package包/类
@Override
protected int getChunks(World world) {
    return world.getLoadedChunks().length;
}
 
开发者ID:games647,项目名称:Minefana,代码行数:5,代码来源:BukkitWorldCollector.java


注:本文中的org.bukkit.World.getLoadedChunks方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。