本文整理汇总了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();
}
}
}
}
}
示例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;
}
示例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);
}
}
}
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
}
}
}