本文整理汇总了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);
}
}
}
}
}
}
}
示例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);
}
}
}
}
}
示例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);
}
}
}
示例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++;
}
}
}
}
示例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;
}
示例6: getChunks
import org.bukkit.World; //导入方法依赖的package包/类
@Override
protected int getChunks(World world) {
return world.getLoadedChunks().length;
}