Ejemplo n.º 1
0
  @Command(
      aliases = {"/paste"},
      usage = "",
      flags = "ao",
      desc = "Вставляет содержимое буфера обмена",
      help =
          "Вставить содержимое буфера обмена.\n"
              + "Флаги:\n"
              + "  -a пропускает блоки воздуха\n"
              + "  -o вставляет на позициях, которые были скопированы/вырезаны",
      min = 0,
      max = 0)
  @CommandPermissions("worldedit.clipboard.paste")
  @Logging(PLACEMENT)
  public void paste(
      CommandContext args, LocalSession session, LocalPlayer player, EditSession editSession)
      throws WorldEditException {

    boolean atOrigin = args.hasFlag('o');
    boolean pasteNoAir = args.hasFlag('a');

    if (atOrigin) {
      Vector pos = session.getClipboard().getOrigin();
      session.getClipboard().place(editSession, pos, pasteNoAir);
      session.getClipboard().pasteEntities(pos);
      player.findFreePosition();
      player.print("Вставлено. Для отмены напишите //undo");
    } else {
      Vector pos = session.getPlacementPosition(player);
      session.getClipboard().paste(editSession, pos, pasteNoAir, true);
      player.findFreePosition();
      player.print("Вставлено. Для отмены напишите //undo");
    }
  }
Ejemplo n.º 2
0
  @Command(
      aliases = {"/faces", "/outline"},
      usage = "<block>",
      desc = "Build the walls, ceiling, and floor of a selection",
      min = 1,
      max = 1)
  @CommandPermissions("worldedit.region.faces")
  @Logging(REGION)
  public static void faces(
      CommandContext args,
      WorldEdit we,
      LocalSession session,
      LocalPlayer player,
      EditSession editSession)
      throws WorldEditException {

    Pattern pattern = we.getBlockPattern(player, args.getString(0));
    int affected;
    if (pattern instanceof SingleBlockPattern) {
      affected =
          editSession.makeCuboidFaces(
              session.getSelection(player.getWorld()), ((SingleBlockPattern) pattern).getBlock());
    } else {
      affected = editSession.makeCuboidFaces(session.getSelection(player.getWorld()), pattern);
    }

    player.print(affected + " block(s) have been changed.");
  }
Ejemplo n.º 3
0
  @Command(
      aliases = {"forestgen"},
      usage = "[size] [type] [density]",
      desc = "Generate a forest",
      min = 0,
      max = 3)
  @CommandPermissions({"worldedit.generation.forest"})
  @Logging(POSITION)
  public static void forestGen(
      CommandContext args,
      WorldEdit we,
      LocalSession session,
      LocalPlayer player,
      EditSession editSession)
      throws WorldEditException {

    int size = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : 10;
    TreeGenerator.TreeType type =
        args.argsLength() > 1
            ? type = TreeGenerator.lookup(args.getString(1))
            : TreeGenerator.TreeType.TREE;
    double density = args.argsLength() > 2 ? args.getDouble(2) / 100 : 0.05;

    if (type == null) {
      player.printError("Tree type '" + args.getString(1) + "' is unknown.");
      return;
    } else {
    }

    int affected =
        editSession.makeForest(player.getPosition(), size, density, new TreeGenerator(type));
    player.print(affected + " trees created.");
  }
Ejemplo n.º 4
0
  @Command(
      aliases = {"/smooth"},
      usage = "[iterations]",
      flags = "n",
      desc = "Smooth the elevation in the selection",
      min = 0,
      max = 1)
  @CommandPermissions("worldedit.region.smooth")
  @Logging(REGION)
  public static void smooth(
      CommandContext args,
      WorldEdit we,
      LocalSession session,
      LocalPlayer player,
      EditSession editSession)
      throws WorldEditException {

    int iterations = 1;
    if (args.argsLength() > 0) {
      iterations = args.getInteger(0);
    }

    HeightMap heightMap =
        new HeightMap(editSession, session.getSelection(player.getWorld()), args.hasFlag('n'));
    HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0));
    int affected = heightMap.applyFilter(filter, iterations);
    player.print("Terrain's height map smoothed. " + affected + " block(s) changed.");
  }
Ejemplo n.º 5
0
  @Command(
      aliases = {"/overlay"},
      usage = "<block>",
      desc = "Set a block on top of blocks in the region",
      min = 1,
      max = 1)
  @CommandPermissions("worldedit.region.overlay")
  @Logging(REGION)
  public static void overlay(
      CommandContext args,
      WorldEdit we,
      LocalSession session,
      LocalPlayer player,
      EditSession editSession)
      throws WorldEditException {

    Pattern pat = we.getBlockPattern(player, args.getString(0));

    Region region = session.getSelection(player.getWorld());
    int affected = 0;
    if (pat instanceof SingleBlockPattern) {
      affected = editSession.overlayCuboidBlocks(region, ((SingleBlockPattern) pat).getBlock());
    } else {
      affected = editSession.overlayCuboidBlocks(region, pat);
    }
    player.print(affected + " block(s) have been overlayed.");
  }
Ejemplo n.º 6
0
  @Command(
      aliases = {"/hpyramid"},
      usage = "<block> <range>",
      desc = "Generate a hollow pyramid",
      min = 2,
      max = 2)
  @CommandPermissions({"worldedit.generation.pyramid"})
  @Logging(PLACEMENT)
  public static void hpyramid(
      CommandContext args,
      WorldEdit we,
      LocalSession session,
      LocalPlayer player,
      EditSession editSession)
      throws WorldEditException {

    Pattern block = we.getBlockPattern(player, args.getString(0));
    int size = Math.max(1, args.getInteger(1));
    Vector pos = session.getPlacementPosition(player);

    int affected = editSession.makePyramid(pos, block, size, false);

    player.findFreePosition();
    player.print(affected + " block(s) have been created.");
  }
Ejemplo n.º 7
0
  @Command(
      aliases = {"/copy"},
      flags = "e",
      desc = "Копирует выделенную территорию в буфер обмена",
      help =
          "Копирует выделенную территорию в буфер обмен\n"
              + "Флаги:\n"
              + "  -e определяет, будут ли объекты копироваться в буфер обмена\n"
              + "ПРЕДУПРЕЖДЕНИЕ: Вставленные объекты не могут быть отменены!",
      min = 0,
      max = 0)
  @CommandPermissions("worldedit.clipboard.copy")
  public void copy(
      CommandContext args, LocalSession session, LocalPlayer player, EditSession editSession)
      throws WorldEditException {

    Region region = session.getSelection(player.getWorld());
    Vector min = region.getMinimumPoint();
    Vector max = region.getMaximumPoint();
    Vector pos = session.getPlacementPosition(player);

    CuboidClipboard clipboard =
        new CuboidClipboard(max.subtract(min).add(new Vector(1, 1, 1)), min, min.subtract(pos));
    clipboard.copy(editSession);
    if (args.hasFlag('e')) {
      for (LocalEntity entity : player.getWorld().getEntities(region)) {
        clipboard.storeEntity(entity);
      }
    }
    session.setClipboard(clipboard);

    player.print("Блок(и) скопирован(ы).");
  }
Ejemplo n.º 8
0
  @Command(
      aliases = {"/hsphere"},
      usage = "<block> <radius> [raised?] ",
      desc = "Generate a hollow sphere",
      min = 2,
      max = 3)
  @CommandPermissions({"worldedit.generation.sphere"})
  @Logging(PLACEMENT)
  public static void hsphere(
      CommandContext args,
      WorldEdit we,
      LocalSession session,
      LocalPlayer player,
      EditSession editSession)
      throws WorldEditException {

    Pattern block = we.getBlockPattern(player, args.getString(0));
    double radius = Math.max(1, args.getDouble(1));
    boolean raised =
        args.argsLength() > 2
            ? (args.getString(2).equalsIgnoreCase("true")
                || args.getString(2).equalsIgnoreCase("yes"))
            : false;

    Vector pos = session.getPlacementPosition(player);
    if (raised) {
      pos = pos.add(0, radius, 0);
    }

    int affected = editSession.makeSphere(pos, block, radius, false);
    player.findFreePosition();
    player.print(affected + " block(s) have been created.");
  }
Ejemplo n.º 9
0
 @Command(
     aliases = {"descend"},
     usage = "[# of floors]",
     desc = "Go down a floor",
     min = 0,
     max = 1)
 @CommandPermissions({"worldedit.navigation.descend"})
 public static void descend(
     CommandContext args,
     WorldEdit we,
     LocalSession session,
     LocalPlayer player,
     EditSession editSession)
     throws WorldEditException {
   int levelsToDescend = 0;
   if (args.argsLength() == 0) {
     levelsToDescend = 1;
   } else {
     levelsToDescend = args.getInteger(0);
   }
   int descentLevels = 1;
   while (player.descendLevel() && levelsToDescend != descentLevels) {
     ++descentLevels;
   }
   if (descentLevels == 0) {
     player.printError("No free spot above you found.");
   } else {
     player.print(
         (descentLevels != 1)
             ? "Descended " + Integer.toString(descentLevels) + " levels."
             : "Descended a level.");
   }
 }
Ejemplo n.º 10
0
  @Command(
      aliases = {"/redo", "redo"},
      usage = "[times] [player]",
      desc = "Redoes the last action (from history)",
      min = 0,
      max = 2)
  @CommandPermissions("worldedit.history.redo")
  public void redo(
      CommandContext args, LocalSession session, LocalPlayer player, EditSession editSession)
      throws WorldEditException {

    int times = Math.max(1, args.getInteger(0, 1));

    for (int i = 0; i < times; ++i) {
      EditSession redone;
      if (args.argsLength() < 2) {
        redone = session.redo(session.getBlockBag(player));
      } else {
        player.checkPermission("worldedit.history.redo.other");
        LocalSession sess = we.getSession(args.getString(1));
        if (sess == null) {
          player.printError("Unable to find session for " + args.getString(1));
          break;
        }
        redone = sess.redo(session.getBlockBag(player));
      }
      if (redone != null) {
        player.print("Redo successful.");
        we.flushBlockBag(player, redone);
      } else {
        player.printError("Nothing left to redo.");
      }
    }
  }
Ejemplo n.º 11
0
  @Command(
      aliases = {"/set"},
      usage = "<block>",
      desc = "Set all the blocks inside the selection to a block",
      min = 1,
      max = 1)
  @CommandPermissions("worldedit.region.set")
  @Logging(REGION)
  public static void set(
      CommandContext args,
      WorldEdit we,
      LocalSession session,
      LocalPlayer player,
      EditSession editSession)
      throws WorldEditException {

    Pattern pattern = we.getBlockPattern(player, args.getString(0));

    int affected;

    if (pattern instanceof SingleBlockPattern) {
      affected =
          editSession.setBlocks(
              session.getSelection(player.getWorld()), ((SingleBlockPattern) pattern).getBlock());
    } else {
      affected = editSession.setBlocks(session.getSelection(player.getWorld()), pattern);
    }

    player.print(affected + " block(s) have been changed.");
  }
Ejemplo n.º 12
0
  public boolean actPrimary(
      ServerInterface server,
      LocalConfiguration config,
      LocalPlayer player,
      LocalSession session,
      WorldVector clicked) {

    EditSession editSession = session.createEditSession(player);

    try {
      boolean successful = false;

      for (int i = 0; i < 10; i++) {
        if (gen.generate(editSession, clicked.add(0, 1, 0))) {
          successful = true;
          break;
        }
      }

      if (!successful) {
        player.printError("A tree can't go there.");
      }
    } catch (MaxChangedBlocksException e) {
      player.printError("Max. blocks changed reached.");
    } finally {
      session.remember(editSession);
    }

    return true;
  }
Ejemplo n.º 13
0
  @Command(
      aliases = {"/cut"},
      usage = "[leave-id]",
      desc = "Вырезает выделенную территорию в буфер обмена",
      help =
          "Вырезает выделенную территорию в буфер обмена\n"
              + "Флаги:\n"
              + "  -e controls определяет, будут ли объекты копироваться в буфер обмена\n"
              + "ПРЕДУПРЕЖДЕНИЕ: Вырезанные и вставленные объекты не могут быть отменены!",
      flags = "e",
      min = 0,
      max = 1)
  @CommandPermissions("worldedit.clipboard.cut")
  @Logging(REGION)
  public void cut(
      CommandContext args, LocalSession session, LocalPlayer player, EditSession editSession)
      throws WorldEditException {

    BaseBlock block = new BaseBlock(BlockID.AIR);
    LocalWorld world = player.getWorld();

    if (args.argsLength() > 0) {
      block = we.getBlock(player, args.getString(0));
    }

    Region region = session.getSelection(world);
    Vector min = region.getMinimumPoint();
    Vector max = region.getMaximumPoint();
    Vector pos = session.getPlacementPosition(player);

    CuboidClipboard clipboard =
        new CuboidClipboard(max.subtract(min).add(new Vector(1, 1, 1)), min, min.subtract(pos));
    clipboard.copy(editSession);
    if (args.hasFlag('e')) {
      LocalEntity[] entities = world.getEntities(region);
      for (LocalEntity entity : entities) {
        clipboard.storeEntity(entity);
      }
      world.killEntities(entities);
    }
    session.setClipboard(clipboard);

    int affected = editSession.setBlocks(session.getSelection(world), block);
    player.print(
        affected
            + " "
            + StringUtil.plural(affected, "блок вырезан", "блока вырезано", "блоков вырезано")
            + ".");
  }
Ejemplo n.º 14
0
  @Command(
      aliases = {"/move"},
      usage = "[count] [direction] [leave-id]",
      flags = "s",
      desc = "Move the contents of the selection",
      min = 0,
      max = 3)
  @CommandPermissions("worldedit.region.move")
  @Logging(ORIENTATION_REGION)
  public static void move(
      CommandContext args,
      WorldEdit we,
      LocalSession session,
      LocalPlayer player,
      EditSession editSession)
      throws WorldEditException {

    int count = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : 1;
    Vector dir =
        we.getDirection(player, args.argsLength() > 1 ? args.getString(1).toLowerCase() : "me");
    BaseBlock replace;

    // Replacement block argument
    if (args.argsLength() > 2) {
      replace = we.getBlock(player, args.getString(2));
    } else {
      replace = new BaseBlock(BlockID.AIR);
    }

    int affected =
        editSession.moveCuboidRegion(
            session.getSelection(player.getWorld()), dir, count, true, replace);

    if (args.hasFlag('s')) {
      try {
        Region region = session.getSelection(player.getWorld());
        region.expand(dir.multiply(count));
        region.contract(dir.multiply(count));

        session.getRegionSelector().learnChanges();
        session.getRegionSelector().explainRegionAdjust(player, session);
      } catch (RegionOperationException e) {
        player.printError(e.getMessage());
      }
    }

    player.print(affected + " blocks moved.");
  }
Ejemplo n.º 15
0
    /**
     * Detect the mechanic at a placed sign.
     *
     * @throws ProcessedMechanismException
     */
    @Override
    public Teleporter detect(BlockWorldVector pt, LocalPlayer player, Sign sign)
        throws InvalidMechanismException, ProcessedMechanismException {

      if (!sign.getLine(1).equalsIgnoreCase("[Teleport]")) return null;

      if (!player.hasPermission("craftbook.mech.teleporter")) {
        throw new InsufficientPermissionsException();
      }

      player.print("mech.teleport.create");
      sign.setLine(1, "[Teleport]");

      String[] pos = sign.getLine(2).split(":");
      if (!(pos.length > 2)) return null;

      throw new ProcessedMechanismException();
    }
Ejemplo n.º 16
0
  @Command(
      aliases = {"unstuck"},
      usage = "",
      desc = "Escape from being stuck inside a block",
      min = 0,
      max = 0)
  @CommandPermissions({"worldedit.navigation.unstuck"})
  public static void unstuck(
      CommandContext args,
      WorldEdit we,
      LocalSession session,
      LocalPlayer player,
      EditSession editSession)
      throws WorldEditException {

    player.print("There you go!");
    player.findFreePosition();
  }
Ejemplo n.º 17
0
  @Override
  public void onRightClick(PlayerInteractEvent event) {

    if (!plugin.getLocalConfiguration().teleporterSettings.enable) return;

    if (!BukkitUtil.toWorldVector(event.getClickedBlock())
        .equals(BukkitUtil.toWorldVector(trigger))) return; // wth? our manager is insane. ikr.

    LocalPlayer localPlayer = plugin.wrap(event.getPlayer());

    if (!localPlayer.hasPermission("craftbook.mech.teleporter.use")) {
      localPlayer.printError("mech.use-permission");
      return;
    }

    makeItSo(event.getPlayer());

    event.setCancelled(true);
  }
Ejemplo n.º 18
0
  @Command(
      aliases = {"/naturalize"},
      usage = "",
      desc = "3 layers of dirt on top then rock below",
      min = 0,
      max = 0)
  @CommandPermissions("worldedit.region.naturalize")
  @Logging(REGION)
  public static void naturalize(
      CommandContext args,
      WorldEdit we,
      LocalSession session,
      LocalPlayer player,
      EditSession editSession)
      throws WorldEditException {

    Region region = session.getSelection(player.getWorld());
    int affected = editSession.naturalizeCuboidBlocks(region);
    player.print(affected + " block(s) have been naturalized.");
  }
Ejemplo n.º 19
0
  @Command(
      aliases = {"/stack"},
      usage = "[count] [direction]",
      flags = "sa",
      desc = "Repeat the contents of the selection",
      min = 0,
      max = 2)
  @CommandPermissions("worldedit.region.stack")
  @Logging(ORIENTATION_REGION)
  public static void stack(
      CommandContext args,
      WorldEdit we,
      LocalSession session,
      LocalPlayer player,
      EditSession editSession)
      throws WorldEditException {

    int count = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : 1;
    Vector dir =
        we.getDiagonalDirection(
            player, args.argsLength() > 1 ? args.getString(1).toLowerCase() : "me");

    int affected =
        editSession.stackCuboidRegion(
            session.getSelection(player.getWorld()), dir, count, !args.hasFlag('a'));

    if (args.hasFlag('s')) {
      try {
        Region region = session.getSelection(player.getWorld());
        region.expand(dir.multiply(count));
        region.contract(dir.multiply(count));

        session.getRegionSelector().learnChanges();
        session.getRegionSelector().explainRegionAdjust(player, session);
      } catch (RegionOperationException e) {
        player.printError(e.getMessage());
      }
    }

    player.print(affected + " blocks changed. Undo with //undo");
  }
Ejemplo n.º 20
0
  @Command(
      aliases = {"/rotate"},
      usage = "<angle-in-degrees>",
      desc = "Поворот содержимого буфера обмена",
      min = 1,
      max = 1)
  @CommandPermissions("worldedit.clipboard.rotate")
  public void rotate(
      CommandContext args, LocalSession session, LocalPlayer player, EditSession editSession)
      throws WorldEditException {

    int angle = args.getInteger(0);

    if (angle % 90 == 0) {
      CuboidClipboard clipboard = session.getClipboard();
      clipboard.rotate2D(angle);
      player.print("Содержимое буфера обмена повернуто на " + angle + " градусов.");
    } else {
      player.printError("Углы должны делиться на 90 градусов.");
    }
  }
Ejemplo n.º 21
0
  @Command(
      aliases = {"thru"},
      usage = "",
      desc = "Passthrough walls",
      min = 0,
      max = 0)
  @CommandPermissions({"worldedit.navigation.thru"})
  public static void thru(
      CommandContext args,
      WorldEdit we,
      LocalSession session,
      LocalPlayer player,
      EditSession editSession)
      throws WorldEditException {

    if (player.passThroughForwardWall(6)) {
      player.print("Whoosh!");
    } else {
      player.printError("No free spot ahead of you found.");
    }
  }
Ejemplo n.º 22
0
  @Command(
      aliases = {"pumpkins"},
      usage = "[size]",
      desc = "Generate pumpkin patches",
      min = 0,
      max = 1)
  @CommandPermissions({"worldedit.generation.pumpkins"})
  @Logging(POSITION)
  public static void pumpkins(
      CommandContext args,
      WorldEdit we,
      LocalSession session,
      LocalPlayer player,
      EditSession editSession)
      throws WorldEditException {

    int size = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : 10;

    int affected = editSession.makePumpkinPatches(player.getPosition(), size);
    player.print(affected + " pumpkin patches created.");
  }
Ejemplo n.º 23
0
 @Command(
     aliases = {"/save"},
     usage = "<filename>",
     desc = "Сохраняет буфер обмена в схематический файл.",
     min = 0,
     max = 1)
 @Deprecated
 @CommandPermissions("worldedit.clipboard.save")
 public void save(
     CommandContext args, LocalSession session, LocalPlayer player, EditSession editSession)
     throws WorldEditException {
   player.printError("Эта команда больше не используется. Пишите //schematic save.");
 }
Ejemplo n.º 24
0
  @Command(
      aliases = {"/replace"},
      usage = "[from-block] <to-block>",
      desc = "Replace all blocks in the selection with another",
      flags = "f",
      min = 1,
      max = 2)
  @CommandPermissions("worldedit.region.replace")
  @Logging(REGION)
  public static void replace(
      CommandContext args,
      WorldEdit we,
      LocalSession session,
      LocalPlayer player,
      EditSession editSession)
      throws WorldEditException {

    Set<BaseBlock> from;
    Pattern to;
    if (args.argsLength() == 1) {
      from = null;
      to = we.getBlockPattern(player, args.getString(0));
    } else {
      from = we.getBlocks(player, args.getString(0), true, !args.hasFlag('f'));
      to = we.getBlockPattern(player, args.getString(1));
    }

    int affected = 0;
    if (to instanceof SingleBlockPattern) {
      affected =
          editSession.replaceBlocks(
              session.getSelection(player.getWorld()), from, ((SingleBlockPattern) to).getBlock());
    } else {
      affected = editSession.replaceBlocks(session.getSelection(player.getWorld()), from, to);
    }

    player.print(affected + " block(s) have been replaced.");
  }
Ejemplo n.º 25
0
  @Command(
      aliases = {"/clearhistory", "clearhistory"},
      usage = "",
      desc = "Clear your history",
      min = 0,
      max = 0)
  @CommandPermissions("worldedit.history.clear")
  public void clearHistory(
      CommandContext args, LocalSession session, LocalPlayer player, EditSession editSession)
      throws WorldEditException {

    session.clearHistory();
    player.print("History cleared.");
  }
Ejemplo n.º 26
0
  @Command(
      aliases = {"jumpto"},
      usage = "",
      desc = "Teleport to a location",
      min = 0,
      max = 0)
  @CommandPermissions({"worldedit.navigation.jumpto"})
  public static void jumpTo(
      CommandContext args,
      WorldEdit we,
      LocalSession session,
      LocalPlayer player,
      EditSession editSession)
      throws WorldEditException {

    WorldVector pos = player.getSolidBlockTrace(300);
    if (pos != null) {
      player.findFreePosition(pos);
      player.print("Poof!");
    } else {
      player.printError("No block in sight!");
    }
  }
Ejemplo n.º 27
0
  @Command(
      aliases = {"clearclipboard"},
      usage = "",
      desc = "Очищает Ваш буфер обмена",
      min = 0,
      max = 0)
  @CommandPermissions("worldedit.clipboard.clear")
  public void clearClipboard(
      CommandContext args, LocalSession session, LocalPlayer player, EditSession editSession)
      throws WorldEditException {

    session.setClipboard(null);
    player.print("Буфер обмена очищен.");
  }
Ejemplo n.º 28
0
  @Command(
      aliases = {"/regen"},
      usage = "",
      desc = "Regenerates the contents of the selection",
      min = 0,
      max = 0)
  @CommandPermissions("worldedit.regen")
  @Logging(REGION)
  public static void regenerateChunk(
      CommandContext args,
      WorldEdit we,
      LocalSession session,
      LocalPlayer player,
      EditSession editSession)
      throws WorldEditException {

    Region region = session.getSelection(player.getWorld());
    Mask mask = session.getMask();
    session.setMask(null);
    player.getWorld().regenerate(region, editSession);
    session.setMask(mask);
    player.print("Region regenerated.");
  }
Ejemplo n.º 29
0
  @Command(
      aliases = {"up"},
      usage = "<block>",
      desc = "Go upwards some distance",
      min = 1,
      max = 1)
  @CommandPermissions({"worldedit.navigation.up"})
  @Logging(POSITION)
  public static void up(
      CommandContext args,
      WorldEdit we,
      LocalSession session,
      LocalPlayer player,
      EditSession editSession)
      throws WorldEditException {

    int distance = args.getInteger(0);

    if (player.ascendUpwards(distance)) {
      player.print("Whoosh!");
    } else {
      player.printError("You would hit something above you.");
    }
  }
Ejemplo n.º 30
0
  @Command(
      aliases = {"ceil"},
      usage = "[clearance]",
      desc = "Go to the celing",
      min = 0,
      max = 1)
  @CommandPermissions({"worldedit.navigation.ceiling"})
  @Logging(POSITION)
  public static void ceiling(
      CommandContext args,
      WorldEdit we,
      LocalSession session,
      LocalPlayer player,
      EditSession editSession)
      throws WorldEditException {

    int clearence = args.argsLength() > 0 ? Math.max(0, args.getInteger(0)) : 0;

    if (player.ascendToCeiling(clearence)) {
      player.print("Whoosh!");
    } else {
      player.printError("No free spot above you found.");
    }
  }