gpt4 book ai didi

org.bukkit.WorldBorder类的使用及代码示例

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

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

WorldBorder介绍

暂无

代码示例

代码示例来源:origin: GlowstoneMC/Glowstone

world.getWorldBorder().setCenter(CommandUtils
      .getLocation(((Player) sender).getLocation(), args[1], "0", args[2]));
    world.getWorldBorder().setCenter(x, z);
  world.getWorldBorder().setSize(size, time);
if (sender instanceof Player) {
  sender.sendMessage(
    "World border is " + ((Player) sender).getWorld().getWorldBorder().getSize()
      + " blocks wide.");
} else {
  sender.sendMessage(
    "World border is " + Bukkit.getWorlds().get(0).getWorldBorder().getSize()
      + " blocks wide.");
  world.getWorldBorder().setSize(size + world.getWorldBorder().getSize(), time);
    world.getWorldBorder().setDamageBuffer(buffer);
    world.getWorldBorder().setDamageAmount(damage);
    world.getWorldBorder().setWarningTime(time);
    world.getWorldBorder().setWarningDistance(blocks);

代码示例来源: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: 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: EngineHub/CommandHelper

@Override
public double getSize() {
  return wb.getSize();
}

代码示例来源:origin: stackoverflow.com

World world = Bukkit.getWorld("world");

WorldBorder border = world.getWorldBorder();
border.setSize(400.0);
border.setCenter(0.0, 0.0);

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

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

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

@Override
public void setSize(double size) {
  wb.setSize(size);
}

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

@Override
public void setCenter(MCLocation location) {
  wb.setCenter((Location) location.getHandle());
}

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

@Override
public void setDamageAmount(double damage) {
  wb.setDamageAmount(damage);
}

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

@Override
public void setWarningDistance(int distance) {
  wb.setWarningDistance(distance);
}

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

@Override
public void setDamageBuffer(double blocks) {
  wb.setDamageBuffer(blocks);
}

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

@Override
public void setWarningTime(int seconds) {
  wb.setWarningTime(seconds);
}

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

@Override
public int getWarningDistance() {
  return wb.getWarningDistance();
}

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

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

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

sender.sendMessage(ChatColor.AQUA + " Is disguised: " + formatBoolean(controller.isDisguised(getEntity()), null, isPlayer && spellDisguiseRestricted ? true : null));
WorldBorder border = location.getWorld().getWorldBorder();
double borderSize = border.getSize();
  borderSize = borderSize / 2 - border.getWarningDistance();
  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));

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

int max = Math.min(plugin.getConfig().getInt("travel.max_distance"), (int) (w.getWorldBorder().getSize() / 2) - 17);
if (x > max || x < -max || z > max || z < -max) {
  TARDISMessage.send(player, "XZ_NOT_VALID");

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

@Override
public void setSize(double size, int seconds) {
  wb.setSize(size, seconds);
}

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

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());

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