當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。