本文整理汇总了Java中com.wimbli.WorldBorder.BorderData类的典型用法代码示例。如果您正苦于以下问题:Java BorderData类的具体用法?Java BorderData怎么用?Java BorderData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BorderData类属于com.wimbli.WorldBorder包,在下文中一共展示了BorderData类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: WorldBorderCheck
import com.wimbli.WorldBorder.BorderData; //导入依赖的package包/类
/**
* Checks if the location is outside of the WorldBorder world border. (Plugin)
* @param l The location to check.
* @return True or false, Is the location outside of the border.
*/
public boolean WorldBorderCheck(final Location l) {
if (!(Bukkit.getServer().getPluginManager().getPlugin("WorldBorder") == null)) {
if (RandomCoords.getPlugin().config.getString("WorldBorder").equalsIgnoreCase("true")) {
final BorderData border = Config.Border(l.getWorld().getName());
return border == null || border.insideBorder(l);
} else {
return true;
}
} else {
return true;
}
}
开发者ID:jolbol1,项目名称:RandomCoordinatesV2,代码行数:22,代码来源:WorldBorderChecker.java
示例2: isInsideBorder
import com.wimbli.WorldBorder.BorderData; //导入依赖的package包/类
private boolean isInsideBorder(LivingSpawnEvent event)
{
World world = event.getEntity().worldObj;
BorderData border = Config.Border( Worlds.getWorldName(world) );
return border == null
|| border.insideBorder( event.getEntity().posX, event.getEntity().posZ, Config.getShapeRound() );
}
开发者ID:abused,项目名称:World-Border,代码行数:9,代码来源:MobSpawnListener.java
示例3: isInsideBorder
import com.wimbli.WorldBorder.BorderData; //导入依赖的package包/类
private boolean isInsideBorder(World world, int x, int z)
{
BorderData border = Config.Border(Worlds.getWorldName(world));
return border == null
|| border.insideBorder( x, z, Config.getShapeRound() );
}
开发者ID:abused,项目名称:World-Border,代码行数:8,代码来源:BlockPlaceListener.java
示例4: execute
import com.wimbli.WorldBorder.BorderData; //导入依赖的package包/类
@Override
public void execute(ICommandSender sender, EntityPlayerMP player, List<String> params, String worldName)
{
if (player == null && params.size() == 1)
{
sendErrorAndHelp(sender, "When running this command from console, you must specify a world.");
return;
}
boolean wrap = false;
// world and wrap on/off specified
if (params.size() == 2)
{
worldName = params.get(0);
wrap = strAsBool(params.get(1));
}
// no world specified, just wrap on/off
else
{
worldName = Worlds.getWorldName(player.worldObj);
wrap = strAsBool(params.get(0));
}
BorderData border = Config.Border(worldName);
if (border == null)
{
sendErrorAndHelp(sender, "This world (\"" + worldName + "\") does not have a border set.");
return;
}
border.setWrapping(wrap);
Config.setBorder(worldName, border, false);
Util.chat(sender, "Border for world \"" + worldName + "\" is now set to " + (wrap ? "" : "not ") + "wrap around.");
}
开发者ID:abused,项目名称:World-Border,代码行数:37,代码来源:CmdWrap.java
示例5: isInsideBorder
import com.wimbli.WorldBorder.BorderData; //导入依赖的package包/类
private boolean isInsideBorder(LivingSpawnEvent event)
{
World world = event.entity.worldObj;
BorderData border = Config.Border( Worlds.getWorldName(world) );
return border == null
|| border.insideBorder( event.entity.posX, event.entity.posZ, Config.getShapeRound() );
}
开发者ID:RoyCurtis,项目名称:WorldBorder-Forge,代码行数:9,代码来源:MobSpawnListener.java
示例6: isLocationInsideBorder
import com.wimbli.WorldBorder.BorderData; //导入依赖的package包/类
@Override
public boolean isLocationInsideBorder(Location location) {
if (isWorldBorderEnabled()) {
WorldBorder wb = WorldBorder.plugin;
BorderData bd = wb.getWorldBorder(location.getWorld().getName());
return bd.insideBorder(location);
}
return true;
}
开发者ID:DevotedMC,项目名称:ExilePearl,代码行数:10,代码来源:ExilePearlCore.java
示例7: execute
import com.wimbli.WorldBorder.BorderData; //导入依赖的package包/类
@Override
public void execute(ICommandSender sender, EntityPlayerMP player, List<String> params, String worldName)
{
if (worldName == null)
worldName = Worlds.getWorldName(player.worldObj);
BorderData border = Config.Border(worldName);
if (border == null)
{
sendErrorAndHelp(sender, "This world (\"" + worldName + "\") must first have a border set normally.");
return;
}
double x = border.getX();
double z = border.getZ();
int radiusX;
int radiusZ;
try
{
if ( params.get(0).startsWith("+") )
{
// Add to the current radius
radiusX = border.getRadiusX();
radiusX += Integer.parseInt(params.get(0).substring(1));
}
else if ( params.get(0).startsWith("-") )
{
// Subtract from the current radius
radiusX = border.getRadiusX();
radiusX -= Integer.parseInt(params.get(0).substring(1));
}
else
radiusX = Integer.parseInt(params.get(0));
if (params.size() == 2)
{
if ( params.get(1).startsWith("+") )
{
// Add to the current radius
radiusZ = border.getRadiusZ();
radiusZ += Integer.parseInt(params.get(1).substring(1));
}
else if ( params.get(1).startsWith("-") )
{
// Subtract from the current radius
radiusZ = border.getRadiusZ();
radiusZ -= Integer.parseInt(params.get(1).substring(1));
}
else
radiusZ = Integer.parseInt(params.get(1));
}
else
radiusZ = radiusX;
}
catch(NumberFormatException ex)
{
sendErrorAndHelp(sender, "The radius value(s) must be integers.");
return;
}
double minimum = Config.getKnockBack();
if (radiusX < minimum || radiusZ < minimum)
{
sendErrorAndHelp(sender, "The resulting radius must be more than the knockback.");
return;
}
Config.setBorder(worldName, radiusX, radiusZ, x, z);
if (player != null)
Util.chat(sender, "Radius has been set. " + Config.BorderDescription(worldName));
}
开发者ID:abused,项目名称:World-Border,代码行数:74,代码来源:CmdRadius.java
示例8: execute
import com.wimbli.WorldBorder.BorderData; //导入依赖的package包/类
@Override
public void execute(ICommandSender sender, EntityPlayerMP player, List<String> params, String worldName)
{
// handle "clear all" command separately
if (params.size() == 1 && params.get(0).equalsIgnoreCase("all"))
{
if (worldName != null)
{
sendErrorAndHelp(sender, "You should not specify a world with \"clear all\".");
return;
}
Config.removeAllBorders();
if (player != null)
Util.chat(sender, "All borders have been cleared for all worlds.");
return;
}
if (worldName == null)
{
if (player == null)
{
sendErrorAndHelp(sender, "You must specify a world name from console if not using \"clear all\".");
return;
}
worldName = Worlds.getWorldName(player.worldObj);
}
BorderData border = Config.Border(worldName);
if (border == null)
{
sendErrorAndHelp(sender, "This world (\"" + worldName + "\") does not have a border set.");
return;
}
Config.removeBorder(worldName);
if (player != null)
Util.chat(sender, "Border cleared for world \"" + worldName + "\".");
}
开发者ID:abused,项目名称:World-Border,代码行数:42,代码来源:CmdClear.java
示例9: execute
import com.wimbli.WorldBorder.BorderData; //导入依赖的package包/类
@Override
public void execute(ICommandSender sender, EntityPlayerMP player, List<String> params, String worldName)
{
if (player == null && params.size() == 1)
{
sendErrorAndHelp(sender, "When running this command from console, you must specify a world.");
return;
}
String shapeName;
// world and shape specified
if (params.size() == 2)
{
worldName = params.get(0);
shapeName = params.get(1).toLowerCase();
}
// no world specified, just shape
else
{
worldName = Worlds.getWorldName(player.worldObj);
shapeName = params.get(0).toLowerCase();
}
BorderData border = Config.Border(worldName);
if (border == null)
{
sendErrorAndHelp(sender, "This world (\"" + worldName + "\") does not have a border set.");
return;
}
Boolean shape = null;
if (shapeName.equals("rectangular") || shapeName.equals("square"))
shape = false;
else if (shapeName.equals("elliptic") || shapeName.equals("round"))
shape = true;
border.setShape(shape);
Config.setBorder(worldName, border, false);
Util.chat(sender, "Border shape for world \"" + worldName + "\" is now set to \"" + Config.getShapeName(shape) + "\".");
}
开发者ID:abused,项目名称:World-Border,代码行数:43,代码来源:CmdWshape.java
示例10: teleportCheck
import com.wimbli.WorldBorder.BorderData; //导入依赖的package包/类
/**
* Checks if block is valid to teleport to (no lava, fire, water, ...)
* @param player The player we should check
* @param world The world the coordinate is in
* @param x Coordinate of the block as int
* @param z Coordinate of the block as int
* @param biomeList THe list of biomes at that point
* @param forceBlocks true if should only check if the player wont die,
* false for block restrictions check
* @param forceRegions true if should not check if location is in region,
* false for region restriction
* @return true if the block is a valid teleport block
*/
private boolean teleportCheck(Player player, World world, int x, int z, List<Biome> biomeList, boolean forceBlocks, boolean forceRegions) {
if(worldborder) {
WorldBorder wbPlugin = (WorldBorder) getServer().getPluginManager().getPlugin("WorldBorder");
BorderData border = wbPlugin.getWorldBorder(world.getName());
if(border != null && !border.insideBorder(x, z)) {
return false;
}
}
org.bukkit.WorldBorder wb = world.getWorldBorder();
double wbMaxX = wb.getCenter().getX() + wb.getSize() / 2;
double wbMinX = wb.getCenter().getX() - wb.getSize() / 2;
double wbMaxZ = wb.getCenter().getZ() + wb.getSize() / 2;
double wbMinZ = wb.getCenter().getZ() - wb.getSize() / 2;
if(x > wbMaxX || x < wbMinX) {
return false;
}
if(z > wbMaxZ || z < wbMinZ) {
return false;
}
int y = world.getHighestBlockYAt(x, z);
Block highest = world.getBlockAt(x, y - 1, z);
getLogger().log(debugLevel, "Checked teleport location for player '" + player.getName() + "' X: " + x + " Y: " + (y - 1) + " Z: " + z + " is " + highest.getType() + " + " + world.getBlockAt(x, y + 1, z).getType() + ", Biome: " + highest.getBiome().toString());
if(biomeList.size() > 0 && !biomeList.contains(highest.getBiome())) {
return false;
}
if(!forceBlocks) {
switch (world.getEnvironment()) {
case NETHER:
return false;
case THE_END:
if(highest.getType() == Material.AIR || highest.getType() == Material.WATER || highest.getType() == Material.STATIONARY_WATER || highest.getType() == Material.STATIONARY_LAVA || highest.getType() == Material.WEB || highest.getType() == Material.LAVA || highest.getType() == Material.CACTUS || highest.getType() == Material.ENDER_PORTAL || highest.getType() == Material.PORTAL)
return false;
case NORMAL:
default:
if(highest.getType() != Material.SAND && highest.getType() != Material.GRAVEL && highest.getType() != Material.DIRT && highest.getType() != Material.GRASS)
return false;
}
} else {
if(highest.getType() == Material.AIR || highest.getType() == Material.WATER || highest.getType() == Material.STATIONARY_WATER || highest.getType() == Material.STATIONARY_LAVA || highest.getType() == Material.WEB || highest.getType() == Material.LAVA || highest.getType() == Material.CACTUS || highest.getType() == Material.ENDER_PORTAL || highest.getType() == Material.PORTAL)
return false;
}
return checkforRegion(player, highest.getLocation(), forceRegions);
}
开发者ID:Phoenix616,项目名称:RandomTeleport,代码行数:64,代码来源:RandomTeleport.java
注:本文中的com.wimbli.WorldBorder.BorderData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论