本文整理汇总了Java中org.bukkit.block.Biome.valueOf方法的典型用法代码示例。如果您正苦于以下问题:Java Biome.valueOf方法的具体用法?Java Biome.valueOf怎么用?Java Biome.valueOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.block.Biome
的用法示例。
在下文中一共展示了Biome.valueOf方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPlayerInteract
import org.bukkit.block.Biome; //导入方法依赖的package包/类
@EventHandler
public void onPlayerInteract(PlayerInteractEvent e) {
if (e.getAction() != Action.RIGHT_CLICK_BLOCK) {
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)!=null){
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");
}
}
perms.check(e.getPlayer());
}
}
}
}
示例2: blacklistBiome
import org.bukkit.block.Biome; //导入方法依赖的package包/类
public boolean blacklistBiome(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;
}
示例3: populateBiome
import org.bukkit.block.Biome; //导入方法依赖的package包/类
private void populateBiome(final World world, final int x, final int z) {
final Biome biome = Biome.valueOf(this.plotworld.PLOT_BIOME);
if (this.b) {
for (int i = 0; i < 16; i++) {
for (int j = 0; j < 16; j++) {
world.setBiome(x + i, z + j, biome);
}
}
}
}
示例4: setBiome
import org.bukkit.block.Biome; //导入方法依赖的package包/类
public static void setBiome(final String worldname, final int pos1_x, final int pos1_z, final int pos2_x, final int pos2_z, final String biome) {
final Biome b = Biome.valueOf(biome.toUpperCase());
final World world = getWorld(worldname);
for (int x = pos1_x; x <= pos2_x; x++) {
for (int z = pos1_z; z <= pos2_z; z++) {
final Block blk = world.getBlockAt(x, 0, z);
final Biome c = blk.getBiome();
if (c.equals(b)) {
x += 15;
continue;
}
blk.setBiome(b);
}
}
}
示例5: getBiomeFromString
import org.bukkit.block.Biome; //导入方法依赖的package包/类
@Override
public int getBiomeFromString(final String biomeStr) {
try {
final Biome biome = Biome.valueOf(biomeStr.toUpperCase());
if (biome == null) {
return -1;
}
return Arrays.asList(Biome.values()).indexOf(biome);
}
catch (IllegalArgumentException e) {
return -1;
}
}
示例6: isTheLocationSafe
import org.bukkit.block.Biome; //导入方法依赖的package包/类
/**
* Returns whether or not the location is safe or not.
* @param location The location to check
* @return False if unsafe, True if safe.
*/
private boolean isTheLocationSafe(final Location location) {
if(location == null) {
return false;
}
if(location.getY() == 0) {
return false;
}
//Get the block at the specified location
Block blockAtLocation = location.subtract(0, 2, 0).getBlock();
//Get the block at the surface.
Block surfaceBlock = blockAtLocation.getRelative(BlockFace.DOWN);
//Get the blacklisted list.
List<String> blacklisted = RandomCoords.getPlugin().blacklist.getStringList("Blacklisted");
if(RandomCoords.getPlugin().config.getString("ChunkLoader").equalsIgnoreCase("true")) {
boolean exit = false;
while (!exit) {
//The boolean thats used to cancel or continue the loop. If chunk loader is off, set as true. If chunk is generated set as trie.
exit = generateChunk(location);
}
}
//Parse over all the blocks in the blacklist.
for(String materialName : blacklisted) {
//Make sure the material exists.
if(Material.getMaterial(materialName) != null) {
//Get the blacklisted material
Material material = Material.getMaterial(materialName);
//Is the block blacklisted. If so return false.
if(surfaceBlock.getType().equals(material)) {
return false;
}
}
else if(Biome.valueOf(materialName) != null) {
if(surfaceBlock.getBiome().equals(Biome.valueOf(materialName))) {
return false;
}
} else {
//This is what happens when the block is not recognised.
Bukkit.getLogger().log(Level.WARNING, "The block " + materialName + " was not recognised as a Minecraft block.");
}
}
//If its not one of the blacklisted blocks, Continue and check for the regions.
return !kingdomsClaim.kingdomClaimNearby(location) && !redProtect.redProtectClaimNearby(location) &&
!fc.factionLandNearby(location) && !tc.townyClaimNearby(location) && !prc.areThereNearbyPlayers(location) &&
!gpc.griefPrevNearby(location) && wbc.WorldBorderCheck(location) && worldGuardEnabled(location) && !isOutsideBorder(location) &&
!residenceCheck.isChunkProtected(location);
}
示例7: getCondition
import org.bukkit.block.Biome; //导入方法依赖的package包/类
private Condition getCondition(String content) {
Condition condition;
String[] values = content.split("\\|");
String conId = values[0];
switch (conId) {
case "raining":
boolean raining = Boolean.parseBoolean(values[1]);
condition = new RainingCondition(raining);
break;
case "thundering":
boolean thundering = Boolean.parseBoolean(values[1]);
condition = new ThunderingCondition(thundering);
break;
case "time":
String time = values[1].toLowerCase();
condition = new TimeCondition(time);
break;
case "biome":
Biome biome = Biome.valueOf(values[1].toUpperCase());
condition = new BiomeCondition(biome);
break;
case "enchantment":
Enchantment ench = IdentityUtils.getEnchantment(values[1].toLowerCase());
int lv = Integer.parseInt(values[2]);
condition = new EnchantmentCondition(ench, lv);
break;
case "level":
int level = Integer.parseInt(values[1]);
condition = new LevelCondition(level);
break;
case "contest":
boolean ongoing = Boolean.parseBoolean(values[1]);
condition = new ContestCondition(ongoing);
break;
case "potioneffect":
PotionEffectType effectType = IdentityUtils.getPotionEffectType(values[1]);
int amplfier = Integer.parseInt(values[2]);
condition = new PotionEffectCondition(effectType, amplfier);
break;
case "height":
int minHeight = Integer.parseInt(values[1]);
int maxHeight = Integer.parseInt(values[2]);
condition = new HeightCondition(minHeight, maxHeight);
break;
case "mcmmo_skill":
String skillType = values[1];
level = Integer.parseInt(values[2]);
condition = new MCMMOSkillCondition(skillType, level);
break;
case "worldguard_region":
String regionId = values[1];
condition = new WGRegionCondtion(regionId);
break;
default:
return null;
}
return condition;
}
示例8: getMatch
import org.bukkit.block.Biome; //导入方法依赖的package包/类
@Override
public Biome getMatch(String in, CommandSender sender) {
return Biome.valueOf(Strings.getTechnicalName(in));
}
示例9: getBiome
import org.bukkit.block.Biome; //导入方法依赖的package包/类
@Override
public Biome getBiome(int x, int z) {
return Biome.valueOf(this.getChunk().getBiome(x, z).getBiomeType().name());
// TODO: Check if that works
}
示例10: getBiome
import org.bukkit.block.Biome; //导入方法依赖的package包/类
public Biome getBiome(int x, int z) {
return Biome.valueOf(getHandle().getBiome(x, z).getBiomeType().name());
// TODO: Check if that works
}
示例11: getBiome
import org.bukkit.block.Biome; //导入方法依赖的package包/类
@Override
public Biome getBiome() {
return Biome.valueOf(getCanaryWorld().getBiome(this.getHandle().getX(), this.getHandle().getZ()).getBiomeType()
.name());
// TODO: Check if that works
}
示例12: init
import org.bukkit.block.Biome; //导入方法依赖的package包/类
/**
* Initialize variables, and create plotworld object used in calculations
*/
public void init(PlotWorld plotworld) {
if (plotworld != null) {
this.plotworld = (HybridPlotWorld) plotworld;
}
this.plotsize = this.plotworld.PLOT_WIDTH;
this.pathsize = this.plotworld.ROAD_WIDTH;
this.roadblock = this.plotworld.ROAD_BLOCK.id;
this.wallfilling = this.plotworld.WALL_FILLING.id;
this.size = this.pathsize + this.plotsize;
this.wall = this.plotworld.WALL_BLOCK.id;
this.plotfloors = new short[this.plotworld.TOP_BLOCK.length];
for (int i = 0; i < this.plotworld.TOP_BLOCK.length; i++) {
this.plotfloors[i] = this.plotworld.TOP_BLOCK[i].id;
}
this.filling = new short[this.plotworld.MAIN_BLOCK.length];
for (int i = 0; i < this.plotworld.MAIN_BLOCK.length; i++) {
this.filling[i] = this.plotworld.MAIN_BLOCK[i].id;
}
if ((this.filling.length > 1) || (this.plotfloors.length > 1)) {
this.doState = true;
}
this.wallheight = this.plotworld.WALL_HEIGHT;
this.roadheight = this.plotworld.ROAD_HEIGHT;
this.plotheight = this.plotworld.PLOT_HEIGHT;
if (this.pathsize == 0) {
this.pathWidthLower = (short) -1;
this.pathWidthUpper = (short) (this.plotsize + 1);
}
else {
if ((this.pathsize % 2) == 0) {
this.pathWidthLower = (short) (Math.floor(this.pathsize / 2) - 1);
} else {
this.pathWidthLower = (short) (Math.floor(this.pathsize / 2));
}
this.pathWidthUpper = (short) (this.pathWidthLower + this.plotsize + 1);
}
this.biome = Biome.valueOf(this.plotworld.PLOT_BIOME);
try {
this.maxY = Bukkit.getWorld(plotworld.worldname).getMaxHeight();
} catch (final NullPointerException e) {}
if (this.maxY == 0) {
this.maxY = 256;
}
}