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


Java Environment.NORMAL属性代码示例

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


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

示例1: getEnvironment

/**
 * Determines the environment of the given world based on its folder
 * structure.
 *
 * @param world the name of the world to determine the environment of
 * @return the environment of the given world
 * @since 0.3.0
 */
public static Environment getEnvironment(String world) {
	File worldFolder = new File(Bukkit.getWorldContainer(), world);
	if (worldFolder.exists()) {
		for (File f : worldFolder.listFiles()) {
			if (f.getName().equals("region")) {
				return Environment.NORMAL;
			}
			else if (f.getName().equals("DIM1")) {
				return Environment.THE_END;
			}
			else if (f.getName().equals("DIM-1")) {
				return Environment.NETHER;
			}
		}
	}
	return null;
}
 
开发者ID:myiume,项目名称:MyiuLib,代码行数:25,代码来源:MGUtil.java

示例2: getID

private int getID(Environment env)
{
    if (env == Environment.NETHER)
        return -1;
    else if (env == Environment.NORMAL)
        return 0;
    else if (env == Environment.THE_END)
        return 1;
    else
        return -1;
}
 
开发者ID:SamaGames,项目名称:SamaGamesAPI,代码行数:11,代码来源:SkyFactory.java

示例3: onCombust

/**
 * Triggers when something combusts in the world.
 * 
 * @param event
 *            The event being fired.
 * @author HomieDion
 * @since 1.1.0
 */
@EventHandler(ignoreCancelled = true)
public void onCombust(final EntityCombustEvent event) {
	// Ignore if this is caused by an event lower down the chain.
	if (event instanceof EntityCombustByEntityEvent || event instanceof EntityCombustByBlockEvent) {
		return;
	}

	// Variables
	final EntityType type = event.getEntityType();
	final World world = event.getEntity().getWorld();

	// Ignore world's without sunlight
	if (world.getEnvironment() != Environment.NORMAL) {
		return;
	}

	// Ignore disabled worlds
	if (settings.isDisabledWorld(world)) {
		return;
	}

	// Ignore someone without sunscreen
	if (!settings.hasSunscreen(type)) {
		return;
	}

	// Prevent the target from burning.
	event.setCancelled(true);
}
 
开发者ID:homiedion,项目名称:Sunscreen,代码行数:37,代码来源:CombustionListener.java

示例4: onBlockPlace

@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onBlockPlace(BlockPlaceEvent event)
{
    Block block = event.getBlock();
    World world = block.getWorld();
    
    if(world.getEnvironment() != Environment.NORMAL) return;
    
    if(!DiamondGuarantee.instance.worldSettingsManager.Get(world).generateDiamonds) return;
    
    //placed blocks don't provide or cost any points when broken
    block.setMetadata("DG_noValue", new FixedMetadataValue(DiamondGuarantee.instance, true));
}
 
开发者ID:BigScary,项目名称:DiamondGuarantee,代码行数:13,代码来源:DGEventHandler.java

示例5: createWorld

@Override
public World createWorld(WorldCreator creator) {
	World alreadyLoaded = this.getWorld(creator.name());
	if (alreadyLoaded != null) {
		return alreadyLoaded;
	}
	
	if (nukkit.isLevelGenerated(creator.name())) {
		nukkit.loadLevel(creator.name());
		World alreadyGenerated = this.getWorld(creator.name());
		return alreadyGenerated;
	}

	if (creator.environment() != Environment.NORMAL) {
		throw new IllegalArgumentException("No Nether or End support yet");
	}
	if (creator.generator() != null) {
		throw new IllegalArgumentException("Custom generators are not yet supported");
	}

	Map<String, Object> options = new HashMap<>();
	options.put("preset", creator.generatorSettings());
	if (!nukkit.generateLevel(creator.name(), creator.seed(), PokkitWorldType.toNukkit(creator.type()), options)) {
		throw new RuntimeException("Failed to create world " + creator.name());
	}
	World world = this.getWorld(creator.name());
	Pokkit.assertion(world != null, "World was still null");
	return world;
}
 
开发者ID:rutgerkok,项目名称:Pokkit,代码行数:29,代码来源:CraftServer.java

示例6: removeSurfaceFluids

public void removeSurfaceFluids(Claim exclusionClaim)
{
	//don't do this for administrative claims
	if(this.isAdminClaim()) return;
	
	//don't do it for very large claims
	if(this.getArea() > 10000) return;
	
	//only in creative mode worlds
	if(!GriefPrevention.instance.creativeRulesApply(this.lesserBoundaryCorner)) return;
	
	Location lesser = this.getLesserBoundaryCorner();
	Location greater = this.getGreaterBoundaryCorner();

	if(lesser.getWorld().getEnvironment() == Environment.NETHER) return;  //don't clean up lava in the nether
	
	int seaLevel = 0;  //clean up all fluids in the end
	
	//respect sea level in normal worlds
	if(lesser.getWorld().getEnvironment() == Environment.NORMAL) seaLevel = GriefPrevention.instance.getSeaLevel(lesser.getWorld());
	
	for(int x = lesser.getBlockX(); x <= greater.getBlockX(); x++)
	{
		for(int z = lesser.getBlockZ(); z <= greater.getBlockZ(); z++)
		{
			for(int y = seaLevel - 1; y <= lesser.getWorld().getMaxHeight(); y++)
			{
				//dodge the exclusion claim
				Block block = lesser.getWorld().getBlockAt(x, y, z);
				if(exclusionClaim != null && exclusionClaim.contains(block.getLocation(), true, false)) continue;
				
				if(block.getType() == Material.STATIONARY_LAVA || block.getType() == Material.LAVA)
				{
					block.setType(Material.AIR);
				}
			}
		}
	}		
}
 
开发者ID:john01dav,项目名称:GriefPreventionPlus,代码行数:39,代码来源:Claim.java

示例7: hasSurfaceFluids

boolean hasSurfaceFluids()
{
	Location lesser = this.getLesserBoundaryCorner();
	Location greater = this.getGreaterBoundaryCorner();

	//don't bother for very large claims, too expensive
	if(this.getArea() > 10000) return false;
	
	int seaLevel = 0;  //clean up all fluids in the end
	
	//respect sea level in normal worlds
	if(lesser.getWorld().getEnvironment() == Environment.NORMAL) seaLevel = GriefPrevention.instance.getSeaLevel(lesser.getWorld());
	
	for(int x = lesser.getBlockX(); x <= greater.getBlockX(); x++)
	{
		for(int z = lesser.getBlockZ(); z <= greater.getBlockZ(); z++)
		{
			for(int y = seaLevel - 1; y <= lesser.getWorld().getMaxHeight(); y++)
			{
				//dodge the exclusion claim
				Block block = lesser.getWorld().getBlockAt(x, y, z);
				
				if(block.getType() == Material.STATIONARY_LAVA || block.getType() == Material.LAVA)
				{
					return true;
				}
			}
		}
	}
	
	return false;
}
 
开发者ID:john01dav,项目名称:GriefPreventionPlus,代码行数:32,代码来源:Claim.java

示例8: getSkylightCount

/**
 * Retrieve the number of 2048 byte segments per chunklet. <p< This is
 * usually one for The Overworld, and zero for both The End and The Nether.
 * @return Number of skylight byte segments.
 */
protected int getSkylightCount()
{
	// There's no sun/moon in the end or in the nether, so Minecraft doesn't sent any skylight information
    // This optimization was added in 1.4.6. Note that ideally you should get this from the "f" (skylight) field.
    return world.getEnvironment() == Environment.NORMAL ? 1 : 0;
}
 
开发者ID:Ms-ran,项目名称:ItemPlus,代码行数:11,代码来源:ChunkPacketProcessor.java

示例9: blastProt

@EventHandler
public void blastProt(EntityExplodeEvent e) {
	if(e.getLocation().getWorld().getEnvironment() == Environment.NORMAL){
		if(Utility.isInsideSnowball(e.getLocation(), plugin, false))
			e.setCancelled(true); 		//impenetrable against tnt cannons
	}
}
 
开发者ID:CrystalCraftMC,项目名称:IceBall,代码行数:7,代码来源:IceBallLimitListener.java

示例10: noFallDeath

@EventHandler
public void noFallDeath(EntityDamageEvent e) {
	if(e.getEntity() instanceof Player) {
		Player p = (Player)e.getEntity();
		if(e.getCause().equals(DamageCause.FALL)) {
			Location loc = p.getLocation();
			if(loc.getWorld().getEnvironment() == Environment.NORMAL) {
				if(Utility.isInsideSnowball(loc, plugin, false))
					e.setCancelled(true);
			}
		}
	}
}
 
开发者ID:CrystalCraftMC,项目名称:IceBall,代码行数:13,代码来源:IceBallLimitListener.java

示例11: onBlockBreak

@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onBlockBreak(BlockBreakEvent event)
{
    Player player = event.getPlayer();
    if(player == null) return;
    
    if(!DiamondGuarantee.instance.worldSettingsManager.Get(player.getWorld()).generateDiamonds) return;
    
    Block block = event.getBlock();
    
    if(block.getWorld().getEnvironment() != Environment.NORMAL) return;
    
    long value = this.getBlockValue(block);
    if(value == 0) return;
    
    PlayerData data = PlayerData.FromPlayer(player);
    if(data.lastClickedFace == null) return;
    long newScore = data.adjustDiamondScore(value);
    
    if(newScore >= DiamondGuarantee.instance.worldSettingsManager.Get(player.getWorld()).diamondValue)
    {
        //verify in diamond zone
        int y = block.getY();
        if(y >DiamondGuarantee.instance.worldSettingsManager.Get(player.getWorld()).diamondZoneMaxY || y < DiamondGuarantee.instance.worldSettingsManager.Get(player.getWorld()).diamondZoneMinY) return;
        
        //find block on other side of broken block
        BlockFace direction; 
        switch(data.lastClickedFace)
        {
            case NORTH:direction = BlockFace.SOUTH; break;
            case SOUTH:direction = BlockFace.NORTH; break;
            case EAST:direction = BlockFace.WEST; break;
            case WEST:direction = BlockFace.EAST; break;
            case UP:direction = BlockFace.DOWN; break;
            default:direction = BlockFace.UP; break;
        }
        
        Block newBlock = block.getRelative(direction);
        Material newBlockType = newBlock.getType();
        
        //only stone stone will convert to diamond
        if(newBlockType != Material.STONE) return;
        
        //confirm block is entirely enclosed
        if(newBlock.getLightLevel() > 0) return;
        BlockFace [] adjacentFaces = new BlockFace [] {BlockFace.UP, BlockFace.DOWN, BlockFace.EAST, BlockFace.WEST, BlockFace.NORTH, BlockFace.SOUTH};
        for(BlockFace face : adjacentFaces)
        {
            Block nearbyBlock = newBlock.getRelative(face);
            if(nearbyBlock.getType().isTransparent()) return;
        }
        
        //convert to diamond ore
        newBlock.setType(Material.DIAMOND_ORE);
        
        if(DiamondGuarantee.instance.worldSettingsManager.Get(player.getWorld()).generateDiamondsLog)
        {
            String logEntry = "Generated diamond ore for " + player.getName() + " @ " + block.getWorld().getName() + "(" + block.getX() + ", " + block.getY() + ", " + block.getZ() + ").";
            DiamondGuarantee.AddLogEntry(logEntry);
        }
        
        //mark as generated ore which won't cost to break
        newBlock.setMetadata("DG_noValue", new FixedMetadataValue(DiamondGuarantee.instance, true));
        
        //deduct diamond points for generating a new ore as if it had been broken already
        data.adjustDiamondScore(-DiamondGuarantee.instance.worldSettingsManager.Get(player.getWorld()).diamondValue);
    }
}
 
开发者ID:BigScary,项目名称:DiamondGuarantee,代码行数:68,代码来源:DGEventHandler.java

示例12: run

@Override
public void run()
{
	//order is important!
	
	//remove sandstone which appears to be unnatural
	this.removeSandstone();
	
	//remove any blocks which are definitely player placed
	this.removePlayerBlocks();
	
	//reduce large outcroppings of stone, sandstone
	this.reduceStone();
	
	//reduce logs, except in jungle biomes
	this.reduceLogs();
	
	//remove natural blocks which are unnaturally hanging in the air
	this.removeHanging();
	
	//remove natural blocks which are unnaturally stacked high
	this.removeWallsAndTowers();
	
	//fill unnatural thin trenches and single-block potholes
	this.fillHolesAndTrenches();
	
	//fill water depressions and fix unnatural surface ripples
	this.fixWater();
	
	//remove water/lava above sea level
	this.removeDumpedFluids();
	
	//cover over any gaping holes in creative mode worlds
	if(this.creativeMode && this.environment == Environment.NORMAL)
	{
		this.fillBigHoles();
	}
	
	//cover surface stone and gravel with sand or grass, as the biome requires
	this.coverSurfaceStone();
	
	//remove any player-placed leaves
	this.removePlayerLeaves();
	
	//schedule main thread task to apply the result to the world
	RestoreNatureExecutionTask task = new RestoreNatureExecutionTask(this.snapshots, this.miny, this.lesserBoundaryCorner, this.greaterBoundaryCorner, this.player);
	GriefPrevention.instance.getServer().getScheduler().scheduleSyncDelayedTask(GriefPrevention.instance, task);
}
 
开发者ID:john01dav,项目名称:GriefPreventionPlus,代码行数:48,代码来源:RestoreNatureProcessingTask.java

示例13: onCommand

@Override
public boolean onCommand(CommandSender sender, Command arg1,
		String arg2, String[] args) {

	Object[] params = {"", 
					   String.valueOf(new Random().nextLong()), 
					   WorldType.NORMAL, 
					   Environment.NORMAL,
					   true};
	
	if(args.length > 0){
		if(args.length > params.length){
			sender.sendMessage(ChatColor.RED + "Too many arguments were provided!");
		} else {
			for(int index = (args.length - 1); index > -1; index--){
				Object obj = getParameters().get(index).getParameterValue(args[index]);
				if(obj != null){
					params[index] = obj;
				} else {
					sender.sendMessage(ChatColor.RED + "Invalid parameter supplied at index " + index);
					return false;
				}
			}
		
            if(!WorldManagerHelper.isWorldFolder(new File(Bukkit.getWorldContainer(), (String) params[0]))){
            	
                WorldCreator creator = new WorldCreator((String) params[0]);
                
                String seedStr = (String) params[1];
                long seed = seedStr.hashCode();
                try {
                	seed = Long.valueOf(seedStr);
                } catch (NumberFormatException e){}
             
                creator.seed(seed);
                creator.type((WorldType) params[2]);
                creator.environment((Environment) params[3]);
                creator.generateStructures((boolean) params[4]);

                sender.sendMessage("Generating world");
                creator.createWorld().save();
                //Bukkit.getLogger().info("Generator String: " + creator.generatorSettings());
                sender.sendMessage("Done generating world");
                return true;
            } else {
            	sender.sendMessage(ChatColor.RED + "That world already exists. You must delete the world before creating a new world with the same name!");
            }
		}
	} else {
		sender.sendMessage(ChatColor.RED + "You must provide at least a world name");
	}
       
       return false;
}
 
开发者ID:robotman3000,项目名称:Spigot-Plus,代码行数:54,代码来源:WorldCreateCommand.java

示例14: ProxyChunkGenerator

public ProxyChunkGenerator(final Environment environment) {
    this.blockPopulator = new ProxyBlockPopulator();
    this.environment = environment == null ? Environment.NORMAL : environment;
    this.nmsInitialized = false;
}
 
开发者ID:Ribesg,项目名称:Pure,代码行数:5,代码来源:ProxyChunkGenerator.java

示例15: isInsideSnowball

/**Checks whether a given coordinate is inside of the snowball area
 * @param Location, the location we're teleporting to
 * @param Snowball plugin
 * @param isClearTP, a boolean - true if we're checking the clearTP area
 * @param plugin
 * @return boolean, true if the coordinates are inside the area
 */
public static boolean isInsideSnowball(Location loc, IceBall plugin, boolean isClearTP) {
	if(loc.getWorld().getEnvironment() != Environment.NORMAL)
		return false;
	int x = (int)loc.getX();
	int y = (int)loc.getY();
	int z = (int)loc.getZ();
	int lowX, highX, lowY, highY, lowZ, highZ;
	if(plugin.iceballArea[0] < plugin.iceballArea[3]) {
		lowX = plugin.iceballArea[0];
		highX = plugin.iceballArea[3];
	}
	else {
		lowX = plugin.iceballArea[3];
		highX = plugin.iceballArea[0];
	}
	
	if(plugin.iceballArea[1] < plugin.iceballArea[4]) {
		lowY = plugin.iceballArea[1];
		highY = plugin.iceballArea[4];
	}
	else {
		lowY = plugin.iceballArea[4];
		highY = plugin.iceballArea[1];
	}
	
	if(plugin.iceballArea[2] < plugin.iceballArea[5]) {
		lowZ = plugin.iceballArea[2];
		highZ = plugin.iceballArea[5];
	}
	else {
		lowZ = plugin.iceballArea[5];
		highZ = plugin.iceballArea[2];
	}
	
	if(isClearTP) {
		int cl = plugin.clearLimit;
		if(x >= lowX+cl && x <= highX-cl &&
				y >= lowY+cl && y <= highY-cl &&
				z >= lowZ+cl && z <= highZ-cl) {
			return true;
		}
	}
	else {
		if(x >= lowX && x <= highX &&
				y >= lowY && y <= highY &&
				z >= lowZ && z <= highZ) {
			return true;
		}
	}
	return false;
}
 
开发者ID:CrystalCraftMC,项目名称:IceBall,代码行数:58,代码来源:Utility.java


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