当前位置: 首页>>代码示例>>Java>>正文


Java WorldBorder.getSize方法代码示例

本文整理汇总了Java中org.bukkit.WorldBorder.getSize方法的典型用法代码示例。如果您正苦于以下问题:Java WorldBorder.getSize方法的具体用法?Java WorldBorder.getSize怎么用?Java WorldBorder.getSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.WorldBorder的用法示例。


在下文中一共展示了WorldBorder.getSize方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isInsideBorder

import org.bukkit.WorldBorder; //导入方法依赖的package包/类
/**
 * Checks if the given location is inside the world border of his world.
 *
 * @param location The location.
 *
 * @return The result of the check.
 */
public static boolean isInsideBorder(Location location)
{
    World world = location.getWorld();
    WorldBorder border = world.getWorldBorder();

    Double borderRadius = border.getSize() / 2;

    Double xMin = border.getCenter().getX() - borderRadius;
    Double xMax = border.getCenter().getX() + borderRadius;
    Double zMin = border.getCenter().getZ() - borderRadius;
    Double zMax = border.getCenter().getZ() + borderRadius;

    Double x = location.getX();
    Double z = location.getZ();

    return (x > xMin && x < xMax) && (z > zMin && z < zMax);
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:25,代码来源:SafePortalsUtils.java

示例2: canCast

import org.bukkit.WorldBorder; //导入方法依赖的package包/类
public boolean canCast(Location location) {
    if (location == null) return true;
    if (!hasCastPermission(mage.getCommandSender())) return false;
    Entity entity = mage.getEntity();
    if (disguiseRestricted && entity != null && entity instanceof Player && controller.isDisguised(entity)) return false;
    Boolean regionPermission = controller.getRegionCastPermission(mage.getPlayer(), this, location);
    if (regionPermission != null && regionPermission == true) return true;
    Boolean personalPermission = controller.getPersonalCastPermission(mage.getPlayer(), this, location);
    if (personalPermission != null && personalPermission == true) return true;
    if (regionPermission != null && regionPermission == false) return false;
    if (requiresBuildPermission() && !hasBuildPermission(location.getBlock())) return false;
    if (requiresBreakPermission() && !hasBreakPermission(location.getBlock())) return false;
    if (worldBorderRestricted)
    {
        WorldBorder border = location.getWorld().getWorldBorder();
        double borderSize = border.getSize() / 2 - border.getWarningDistance();
        Location offset = location.subtract(border.getCenter());
        if (offset.getX() < -borderSize || offset.getX() > borderSize || offset.getZ() < -borderSize || offset.getZ() > borderSize) return false;
    }
    return !pvpRestricted || bypassPvpRestriction || mage.isPVPAllowed(location);
}
 
开发者ID:elBukkit,项目名称:MagicLib,代码行数:22,代码来源:BaseSpell.java

示例3: run

import org.bukkit.WorldBorder; //导入方法依赖的package包/类
@Override
public void run() {
    plugin.getServer().getOnlinePlayers().forEach(p ->
        Lang.sendMessage(p, "messages.game.shrinking")
    );
    times--;
    WorldBorder wb = battles.getWorld().getWorldBorder();
    double newSize = wb.getSize() - amount;
    if(newSize > 0) {
        wb.setSize(newSize, shrinkTime);
    }

    if(times <= 0) cancel();
}
 
开发者ID:DragonetMC,项目名称:PlayerStevesBattleGrounds,代码行数:15,代码来源:ShrinkBorderTask.java

示例4: isInsideBorder

import org.bukkit.WorldBorder; //导入方法依赖的package包/类
public static boolean isInsideBorder(Location location) {
    WorldBorder border = location.getWorld().getWorldBorder();
    Location center = border.getCenter();
    double radius = border.getSize() / 2d;
    return Math.abs(location.getX() - center.getX()) < radius &&
           Math.abs(location.getZ() - center.getZ()) < radius;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:8,代码来源:WorldBorderUtils.java

示例5: clampToBorder

import org.bukkit.WorldBorder; //导入方法依赖的package包/类
public static boolean clampToBorder(Location location) {
    WorldBorder border = location.getWorld().getWorldBorder();
    Location center = border.getCenter();
    double radius = border.getSize() / 2d;
    double xMin = center.getX() - radius;
    double xMax = center.getX() + radius;
    double zMin = center.getZ() - radius;
    double zMax = center.getZ() + radius;

    boolean moved = false;

    if(location.getX() < xMin) {
        location.setX(xMin);
        moved = true;
    }

    if(location.getX() > xMax) {
        location.setX(xMax);
        moved = true;
    }

    if(location.getZ() < zMin) {
        location.setZ(zMin);
        moved = true;
    }

    if(location.getZ() > zMax) {
        location.setZ(zMax);
        moved = true;
    }

    return moved;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:34,代码来源:WorldBorderUtils.java

示例6: getProperty

import org.bukkit.WorldBorder; //导入方法依赖的package包/类
public static Number getProperty(WorldBorder border, BorderProperty borderProperty) {
    switch (borderProperty) {
        case DIAMETER: return border.getSize();
        case DAMAGE_AMOUNT: return border.getDamageAmount();
        case DAMAGE_BUFFER: return border.getDamageBuffer();
        case WARNING_DISTANCE: return border.getWarningDistance();
        case WARNING_TIME: return border.getWarningTime();
    }
    throw new IllegalArgumentException("Illegal BorderProperty: " + borderProperty);
}
 
开发者ID:MundoSK,项目名称:MundoSK,代码行数:11,代码来源:ExprPropertyOfBorder.java

示例7: handleWorldBorder

import org.bukkit.WorldBorder; //导入方法依赖的package包/类
@Nonnull
private static String handleWorldBorder(WorldBorder border) {
    return "[size=" + border.getSize() + " " +
            "center=" + border.getCenter().getBlockX() + "," + border.getCenter().getBlockY() + "," + border.getCenter().getBlockZ() + " " +
            "dmgAmt=" + border.getDamageAmount() + "]";
}
 
开发者ID:zachbr,项目名称:Debuggery,代码行数:7,代码来源:OutputFormatter.java


注:本文中的org.bukkit.WorldBorder.getSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。