Java Code Examples for org.bukkit.block.Biome#valueOf()

The following examples show how to use org.bukkit.block.Biome#valueOf() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Island.java    From askyblock with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Copy constructor
 * @param island - island to copy
 */
public Island(Island island) {
    this.plugin = island.plugin;
    this.biome = island.biome == null ? null : Biome.valueOf(island.biome.name());
    this.center = island.center != null ? island.center.clone() : null;
    this.createdDate = Long.valueOf(island.createdDate);
    island.igs.forEach((k,v) -> this.igs.put(k, v));
    this.islandDistance = Integer.valueOf(island.islandDistance);
    this.isSpawn = Boolean.valueOf(island.isSpawn);
    this.locked = Boolean.valueOf(island.locked);
    this.levelHandicap = Integer.valueOf(island.levelHandicap);
    this.minProtectedX = Integer.valueOf(island.minProtectedX);
    this.minProtectedZ = Integer.valueOf(island.minProtectedZ);
    this.minX = Integer.valueOf(island.minX);
    this.minZ = Integer.valueOf(island.minZ);
    this.owner = island.owner == null ? null : UUID.fromString(island.owner.toString());
    this.password = island.password;
    this.protectionRange = Integer.valueOf(island.protectionRange);
    this.purgeProtected = Boolean.valueOf(island.purgeProtected);
    this.spawnPoint = island.spawnPoint == null ? null : island.spawnPoint.clone();
    this.tileEntityCount.addAll(island.tileEntityCount);
    this.updatedDate = Long.valueOf(island.updatedDate);
    this.votes = Integer.valueOf(island.votes);
    this.world = island.world == null ? null : Bukkit.getWorld(island.world.getUID());
    this.y = Integer.valueOf(island.y);
}
 
Example 2
Source File: Checks.java    From WildernessTp with MIT License 5 votes vote down vote up
public boolean inNether(Location loc, Player target) {
    if (loc.getWorld().getBiome(loc.getBlockX(), loc.getBlockZ()) == Biome.valueOf(nether) || target.getWorld().getName().equals("DIM-1")) {
        inNether = true;
    } else {
        inNether = false;
    }
    return inNether;
}
 
Example 3
Source File: Checks.java    From WildernessTp with MIT License 5 votes vote down vote up
public boolean isBlacklistedBiome(Location loc) {
    List<String> biomes = wild.getConfig().getStringList("Blacklisted_Biomes");
    if (biomes.size() == 0) {
        return false;
    } else {
        for (String biome : biomes) {
            biome = biome.toUpperCase();
            if (loc.getBlock().getBiome() == Biome.valueOf(biome)) {
                return true;
            }
        }
    }
    return false;
}
 
Example 4
Source File: NMS_1_16_R1.java    From 1.13-Command-API with Apache License 2.0 4 votes vote down vote up
@Override
public Biome getBiome(CommandContext cmdCtx, String key) {
	MinecraftKey minecraftKey = (MinecraftKey) cmdCtx.getArgument(key, MinecraftKey.class);
	return Biome.valueOf(minecraftKey.getKey().toUpperCase());
}
 
Example 5
Source File: BiomeMapUtil.java    From Skript with GNU General Public License v3.0 4 votes vote down vote up
To19Mapping(String name) {
	this.handle = Biome.valueOf(name);
}
 
Example 6
Source File: SignClick.java    From WildernessTp with MIT License 4 votes vote down vote up
@EventHandler
public void onPlayerInteract(PlayerInteractEvent e) {
    /*if (wild.usageMode != UsageMode.SIGN_ONLY && wild.usageMode != UsageMode.BOTH) {
        e.getPlayer().sendMessage(wild.getConfig().getString("UsageDisabled"));
        return;
    }*/

    if (e.getAction() != Action.RIGHT_CLICK_BLOCK) {
        return;
    }

    if (e.getClickedBlock() == null) {
        return;
    }

    if (e.getClickedBlock().getState() instanceof Sign) {
        CheckPerms perms = new CheckPerms(wild);
        Sign sign = (Sign) e.getClickedBlock().getState();
        if (sign.getLine(1).equalsIgnoreCase("[§1Wild§0]") && sign.getLine(0).equalsIgnoreCase("§4====================")) {
            if (!Wild.cancel.contains(e.getPlayer().getUniqueId())) {
                if(!sign.getLine(3).equals("")){
                    try{
                        for(World world : Bukkit.getWorlds()){
                            if(world.getName().toLowerCase().equals(sign.getLine(3).toLowerCase())){
                                perms.check(e.getPlayer(),world.getName());
                                return;
                            }
                        }
                        Biome biome = Biome.valueOf(sign.getLine(3).toUpperCase());
                        wild.biome.put(e.getPlayer().getUniqueId(),biome);
                    }catch(IllegalArgumentException ex){
                        Location loc = e.getClickedBlock().getLocation();
                        Bukkit.getLogger().severe("Biome wild sign at " +loc.getWorld().getName()+","+loc.getBlockX()
                                +","+loc.getBlockY()+ "," + loc.getBlockZ() +" has a biome or a world that is incorrect please fix");
                    }
                }else
                    perms.check(e.getPlayer(),e.getPlayer().getWorld().getName());
            }
        }
    }
}