gpt4 book ai didi

org.bukkit.WorldBorder.getCenter()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-22 18:37:05 28 4
gpt4 key购买 nike

本文整理了Java中org.bukkit.WorldBorder.getCenter()方法的一些代码示例,展示了WorldBorder.getCenter()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WorldBorder.getCenter()方法的具体详情如下:
包路径:org.bukkit.WorldBorder
类名称:WorldBorder
方法名:getCenter

WorldBorder.getCenter介绍

暂无

代码示例

代码示例来源:origin: EngineHub/CommandHelper

@Override
public MCLocation getCenter() {
  return new BukkitMCLocation(wb.getCenter());
}

代码示例来源:origin: ProSavage/SavageFactions

/**
 * Checks if the chunk represented by this FLocation is outside the world border
 *
 * @param buffer the number of chunks from the border that will be treated as "outside"
 * @return whether this location is outside of the border
 */
public boolean isOutsideWorldBorder(int buffer) {
  if (!worldBorderSupport) {
    return false;
  }
  WorldBorder border = getWorld().getWorldBorder();
  Chunk chunk = border.getCenter().getChunk();
  int lim = FLocation.chunkToRegion((int) border.getSize()) - buffer;
  int diffX = chunk.getX() - x;
  int diffZ = chunk.getZ() - z;
  return diffX > lim || diffZ > lim || -diffX > lim - 1 || -diffZ > lim - 1;
}

代码示例来源:origin: eccentricdevotion/TARDIS

Location centre = wb.getCenter();
if (size < 30000000) {
  minX = centre.getBlockX() - size;

代码示例来源:origin: FunnyGuilds/FunnyGuilds

WorldBorder border = player.getWorld().getWorldBorder();
double borderSize = border.getSize() / 2;
double borderX = border.getCenter().getX() + borderSize;
double borderZ = border.getCenter().getZ() + borderSize;
double distanceX = Math.abs(borderX) - Math.abs(player.getLocation().getX());
double distanceZ = Math.abs(borderZ) - Math.abs(player.getLocation().getZ());

代码示例来源:origin: elBukkit/MagicPlugin

@Override
public boolean canCast(Location location) {
  if (bypassAll) return true;
  if (!hasCastPermission(mage.getCommandSender())) return false;
  Entity entity = mage.getEntity();
  if (disguiseRestricted && entity != null && entity instanceof Player && controller.isDisguised(entity)) return false;
  if (glideRestricted && entity != null && entity instanceof LivingEntity && ((LivingEntity)entity).isGliding()) return false;
  if (glideExclusive && entity != null && entity instanceof LivingEntity && !((LivingEntity)entity).isGliding()) return false;
  if (location == null) return true;
  Boolean regionPermission = bypassRegionPermission ? null : controller.getRegionCastPermission(mage.getPlayer(), this, location);
  if (regionPermission != null && !ignoreRegionOverrides && regionPermission == true) return true;
  Boolean personalPermission = bypassRegionPermission ? null : controller.getPersonalCastPermission(mage.getPlayer(), this, location);
  if (personalPermission != null && !ignoreRegionOverrides && 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.clone().subtract(border.getCenter());
    if (offset.getX() < -borderSize || offset.getX() > borderSize || offset.getZ() < -borderSize || offset.getZ() > borderSize) return false;
  }
  return !pvpRestricted || bypassPvpRestriction || mage.isPVPAllowed(location);
}

代码示例来源:origin: elBukkit/MagicPlugin

Location offset = location.subtract(border.getCenter());
boolean isOutsideBorder = (offset.getX() < -borderSize || offset.getX() > borderSize || offset.getZ() < -borderSize || offset.getZ() > borderSize);
sender.sendMessage(ChatColor.AQUA + " Is in world border (" + ChatColor.GRAY + borderSize + ChatColor.AQUA + "): " + formatBoolean(!isOutsideBorder, true, false));

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com