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


Java Environment.NETHER属性代码示例

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


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

示例1: removeDumpedFluids

private void removeDumpedFluids()
{
	//remove any surface water or lava above sea level, presumed to be placed by players
	//sometimes, this is naturally generated.  but replacing it is very easy with a bucket, so overall this is a good plan
	if(this.environment == Environment.NETHER) return;
	for(int x = 1; x < snapshots.length - 1; x++)
	{
		for(int z = 1; z < snapshots[0][0].length - 1; z++)
		{
			for(int y = this.seaLevel - 1; y < snapshots[0].length - 1; y++)
			{
				BlockSnapshot block = snapshots[x][y][z];
				if(block.typeId == Material.STATIONARY_WATER.getId() || block.typeId == Material.STATIONARY_LAVA.getId() ||
				   block.typeId == Material.WATER.getId() || block.typeId == Material.LAVA.getId())
				{
					block.typeId = Material.AIR.getId();
				}
			}
		}
	}
}
 
开发者ID:john01dav,项目名称:GriefPreventionPlus,代码行数:21,代码来源:RestoreNatureProcessingTask.java

示例2: 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

示例3: onPlayerInteract

/**
 * Permits water to be placed in the Nether if in a greenhouse and in an acceptable biome 
 * @param event
 */
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled=true)
public void onPlayerInteract(PlayerInteractEvent event){        
    Player player = event.getPlayer();
    World world = player.getWorld();
    // Check we are in the right world
    if (!Settings.worldName.contains(world.getName())) {
        return;
    }
    if (event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
        // Find out which greenhouse the player is in
        if(event.getClickedBlock().getWorld().getEnvironment() == Environment.NETHER 
                && event.getItem() != null && event.getItem().getType() == Material.WATER_BUCKET) {
            Greenhouse g = plugin.players.getInGreenhouse(player);
            if (g != null && !g.getBiome().equals(Biome.HELL) && !g.getBiome().equals(Biome.DESERT)
                    && !g.getBiome().equals(Biome.DESERT_HILLS)) {
                event.setCancelled(true);
                event.getClickedBlock().getRelative(event.getBlockFace()).setType(Material.WATER);
            }
        }
    }
}
 
开发者ID:tastybento,项目名称:greenhouses,代码行数:25,代码来源:GreenhouseEvents.java

示例4: onIceBreak

/**
 * Makes water in the Nether if ice is broken and in a greenhouse
 * @param event
 */
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled=true)
public void onIceBreak(BlockBreakEvent event){        
    Player player = event.getPlayer();
    World world = player.getWorld();
    // Check we are in the right world
    if (!Settings.worldName.contains(world.getName())) {
        return;
    }
    // Find out which greenhouse the player is in
    if(event.getBlock().getWorld().getEnvironment() == Environment.NETHER 
            && event.getBlock().getType() == Material.ICE) {
        Greenhouse g = plugin.players.getInGreenhouse(player);
        if (g != null && !g.getBiome().equals(Biome.HELL) && !g.getBiome().equals(Biome.DESERT)
                && !g.getBiome().equals(Biome.DESERT_HILLS)) {
            event.setCancelled(true);
            event.getBlock().setType(Material.WATER);
        }
    }
}
 
开发者ID:tastybento,项目名称:greenhouses,代码行数:23,代码来源:GreenhouseEvents.java

示例5: AdditionalSubWorld

public AdditionalSubWorld(final NWorld instance, final AdditionalWorld parentWorld, final NLocation spawnLocation, final String requiredPermission, final boolean enabled, final boolean hidden, final Environment type) {
    super(instance);
    this.parentWorld = parentWorld;
    String worldName = parentWorld.getWorldName();
    if (type == Environment.NETHER) {
        worldName += "_nether";
        this.setType(WorldType.ADDITIONAL_SUB_NETHER);
        parentWorld.setNetherWorld(this);
    } else if (type == Environment.THE_END) {
        worldName += "_the_end";
        this.setType(WorldType.ADDITIONAL_SUB_END);
        parentWorld.setEndWorld(this);
    } else {
        throw new IllegalArgumentException("Invalid sub-world type: " + type);
    }
    this.setWorldName(worldName);
    this.setSpawnLocation(spawnLocation);
    this.setRequiredPermission(requiredPermission);
    this.setEnabled(enabled);
    this.setHidden(hidden);
    if (!this.plugin.getWorlds().containsKey(worldName)) {
        this.plugin.getWorlds().put(worldName, this);
    }
}
 
开发者ID:Ribesg,项目名称:NPlugins,代码行数:24,代码来源:AdditionalSubWorld.java

示例6: getRandomLocation

/**
 * Gets a random location near the specified location in a range of range
 *
 */
public static Location getRandomLocation(Location location, int minRange, int maxRange) {
    World world = location.getWorld();
    int blockX = location.getBlockX();
    int blockZ = location.getBlockZ();

    int distance;
    distance = minRange + random.nextInt(maxRange - minRange);
    blockX = (random.nextBoolean()) ? blockX + (distance) : blockX - (distance);

    distance = minRange + random.nextInt(maxRange - minRange);
    blockZ = (random.nextBoolean()) ? blockZ + (distance) : blockZ - (distance);

    int blockY = (Config.getInstance().getRespawnFromSky()) ? world.getMaxHeight() : world.getHighestBlockYAt(blockX, blockZ);

    if (world.getEnvironment() == Environment.NETHER) {
        for (int i = 0; i < world.getMaxHeight(); i++) {
            if (world.getBlockAt(blockX, i, blockZ).getType() == Material.AIR) {
                blockY = i;
                break;
            }
        }
    }

    return new Location(world, blockX, blockY, blockZ);
}
 
开发者ID:TfT-02,项目名称:Ghosts,代码行数:29,代码来源:Misc.java

示例7: addBlocksToPalette

private static void addBlocksToPalette(ChunkMapManager manager, Environment environment) {
    if(!manager.inputHasNonAirBlock()) {
        return;
    }

    int[] list = environment == Environment.NETHER
            ? OrebfuscatorConfig.NetherPaletteBlocks
            : OrebfuscatorConfig.NormalPaletteBlocks;

    for(int id : list) {
        int blockData = ChunkMapManager.getBlockDataFromId(id);
        manager.addToOutputPalette(blockData);
    }
}
 
开发者ID:SamaGames,项目名称:AntiCheat,代码行数:14,代码来源:Calculations.java

示例8: 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

示例9: overrideGenerator

public void overrideGenerator() {
    String worldName = this.world.getName();
    this.originalGenerator = this.nmsWorld.getChunkProviderServer().chunkGenerator;
    String originalGenName = this.originalGenerator.getClass().getSimpleName();
    boolean genFeatures = this.nmsWorld.getWorldData().shouldGenerateMapFeatures();
    long worldSeed = this.nmsWorld.getSeed();
    Environment environment = this.world.getEnvironment();

    if (environment != Environment.NETHER) {
        this.messages.unknownEnvironment(worldName, environment.toString());
        return;
    }

    if (originalGenName.equals("TallNether_ChunkProviderHell")) {
        this.messages.alreadyEnabled(worldName);
        return;
    }

    try {
        Field cp = net.minecraft.server.v1_9_R1.ChunkProviderServer.class.getDeclaredField("chunkGenerator");
        cp.setAccessible(true);

        if (!originalGenName.equals("NetherChunkGenerator") && !originalGenName.equals("TimedChunkGenerator")) {
            this.messages.unknownGenerator(worldName, originalGenName);
            return;
        }

        TallNether_ChunkProviderHell generator = new TallNether_ChunkProviderHell(this.nmsWorld, genFeatures,
                worldSeed, this.worldConfig, this.plugin);
        setFinal(cp, generator);
    } catch (Exception e) {
        e.printStackTrace();
    }

    this.messages.enabledSuccessfully(worldName);
}
 
开发者ID:OtakuMegane,项目名称:TallNether,代码行数:36,代码来源:LoadHell.java

示例10: overrideGenerator

public void overrideGenerator() {
    String worldName = this.world.getName();
    this.originalGenerator = this.nmsWorld.getChunkProviderServer().chunkGenerator;
    String originalGenName = this.originalGenerator.getClass().getSimpleName();
    boolean genFeatures = this.nmsWorld.getWorldData().shouldGenerateMapFeatures();
    long worldSeed = this.nmsWorld.getSeed();
    Environment environment = this.world.getEnvironment();

    if (environment != Environment.NETHER) {
        this.messages.unknownEnvironment(worldName, environment.toString());
        return;
    }

    if (originalGenName.equals("TallNether_ChunkProviderHell")) {
        this.messages.alreadyEnabled(worldName);
        return;
    }

    try {
        Field cp = net.minecraft.server.v1_9_R2.ChunkProviderServer.class.getDeclaredField("chunkGenerator");
        cp.setAccessible(true);

        if (!originalGenName.equals("NetherChunkGenerator") && !originalGenName.equals("TimedChunkGenerator")) {
            this.messages.unknownGenerator(worldName, originalGenName);
            return;
        }

        TallNether_ChunkProviderHell generator = new TallNether_ChunkProviderHell(this.nmsWorld, genFeatures,
                worldSeed, this.worldConfig, this.plugin);
        setFinal(cp, generator);
    } catch (Exception e) {
        e.printStackTrace();
    }

    this.messages.enabledSuccessfully(worldName);
}
 
开发者ID:OtakuMegane,项目名称:TallNether,代码行数:36,代码来源:LoadHell.java

示例11: overrideGenerator

public void overrideGenerator() {
    String worldName = this.world.getName();
    this.originalGenerator = this.nmsWorld.getChunkProviderServer().chunkGenerator;
    String originalGenName = this.originalGenerator.getClass().getSimpleName();
    boolean genFeatures = this.nmsWorld.getWorldData().shouldGenerateMapFeatures();
    long worldSeed = this.nmsWorld.getSeed();
    Environment environment = this.world.getEnvironment();

    if (environment != Environment.NETHER) {
        this.messages.unknownEnvironment(worldName, environment.toString());
        return;
    }

    if (originalGenName.equals("TallNether_ChunkProviderHell")) {
        this.messages.alreadyEnabled(worldName);
        return;
    }

    try {
        Field cp = net.minecraft.server.v1_10_R1.ChunkProviderServer.class.getDeclaredField("chunkGenerator");
        cp.setAccessible(true);

        if (!originalGenName.equals("NetherChunkGenerator") && !originalGenName.equals("TimedChunkGenerator")) {
            this.messages.unknownGenerator(worldName, originalGenName);
            return;
        }

        TallNether_ChunkProviderHell generator = new TallNether_ChunkProviderHell(this.nmsWorld, genFeatures,
                worldSeed, this.worldConfig, this.plugin);
        setFinal(cp, generator);
    } catch (Exception e) {
        e.printStackTrace();
    }

    this.messages.enabledSuccessfully(worldName);
}
 
开发者ID:OtakuMegane,项目名称:TallNether,代码行数:36,代码来源:LoadHell.java

示例12: overrideGenerator

public void overrideGenerator() {
    String worldName = this.world.getName();
    this.originalGenerator = this.nmsWorld.getChunkProviderServer().chunkGenerator;
    String originalGenName = this.originalGenerator.getClass().getSimpleName();
    boolean genFeatures = this.nmsWorld.getWorldData().shouldGenerateMapFeatures();
    long worldSeed = this.nmsWorld.getSeed();
    Environment environment = this.world.getEnvironment();

    if (environment != Environment.NETHER) {
        this.messages.unknownEnvironment(worldName, environment.toString());
        return;
    }

    if (originalGenName.equals("TallNether_ChunkProviderHell")) {
        this.messages.alreadyEnabled(worldName);
        return;
    }

    try {
        Field cp = net.minecraft.server.v1_12_R1.ChunkProviderServer.class.getDeclaredField("chunkGenerator");
        cp.setAccessible(true);

        if (!originalGenName.equals("NetherChunkGenerator") && !originalGenName.equals("TimedChunkGenerator")) {
            this.messages.unknownGenerator(worldName, originalGenName);
            return;
        }

        TallNether_ChunkProviderHell generator = new TallNether_ChunkProviderHell(this.nmsWorld, genFeatures,
                worldSeed, this.worldConfig, this.plugin);
        setFinal(cp, generator);
    } catch (Exception e) {
        e.printStackTrace();
    }

    this.messages.enabledSuccessfully(worldName);
}
 
开发者ID:OtakuMegane,项目名称:TallNether,代码行数:36,代码来源:LoadHell.java

示例13: overrideGenerator

public void overrideGenerator() {
    String worldName = this.world.getName();
    this.originalGenerator = this.nmsWorld.getChunkProviderServer().chunkGenerator;
    String originalGenName = this.originalGenerator.getClass().getSimpleName();
    boolean genFeatures = this.nmsWorld.getWorldData().shouldGenerateMapFeatures();
    long worldSeed = this.nmsWorld.getSeed();
    Environment environment = this.world.getEnvironment();

    if (environment != Environment.NETHER) {
        this.messages.unknownEnvironment(worldName, environment.toString());
        return;
    }

    if (originalGenName.equals("TallNether_ChunkProviderHell")) {
        this.messages.alreadyEnabled(worldName);
        return;
    }

    try {
        Field cp = net.minecraft.server.v1_11_R1.ChunkProviderServer.class.getDeclaredField("chunkGenerator");
        cp.setAccessible(true);

        if (!originalGenName.equals("NetherChunkGenerator") && !originalGenName.equals("TimedChunkGenerator")) {
            this.messages.unknownGenerator(worldName, originalGenName);
            return;
        }

        TallNether_ChunkProviderHell generator = new TallNether_ChunkProviderHell(this.nmsWorld, genFeatures,
                worldSeed, this.worldConfig, this.plugin);
        setFinal(cp, generator);
    } catch (Exception e) {
        e.printStackTrace();
    }

    this.messages.enabledSuccessfully(worldName);
}
 
开发者ID:OtakuMegane,项目名称:TallNether,代码行数:36,代码来源:LoadHell.java

示例14: overrideGenerator

public void overrideGenerator() {
    String worldName = this.world.getName();
    this.originalGenerator = this.nmsWorld.chunkProviderServer.chunkProvider;
    String originalGenName = this.originalGenerator.getClass().getSimpleName();
    boolean genFeatures = this.nmsWorld.getWorldData().shouldGenerateMapFeatures();
    long worldSeed = this.nmsWorld.getSeed();
    Environment environment = this.world.getEnvironment();

    if (environment != Environment.NETHER) {
        this.messages.unknownEnvironment(worldName, environment.toString());
        return;
    }

    if (originalGenName.equals("TallNether_ChunkProviderHell")) {
        this.messages.alreadyEnabled(worldName);
        return;
    }

    if (!originalGenName.equals("NetherChunkGenerator") && !originalGenName.equals("TimedChunkGenerator")) {
        this.messages.unknownGenerator(worldName, originalGenName);
        return;
    }

    this.nmsWorld.chunkProviderServer.chunkProvider = new TallNether_ChunkProviderHell(this.nmsWorld, genFeatures,
            worldSeed, this.worldConfig, this.plugin);
    this.messages.enabledSuccessfully(worldName);
}
 
开发者ID:OtakuMegane,项目名称:TallNether,代码行数:27,代码来源:LoadHell.java

示例15: 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


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