Пример #1
0
 private static void showIntersections(Player player, Area area) {
   if (!RegionsPlugin.getCfg().selectionShowIntersections) return;
   List<Location> cubeLoc = new ArrayList<Location>();
   for (Region region : Regions.getManager().getIntersections(area).values())
     cubeLoc.addAll(getCubePoints(region.getMin(), region.getMax()));
   for (Location l : cubeLoc) playEffect(new DustParticle(l, BlockColor.BLUE_BLOCK_COLOR), player);
 }
Пример #2
0
  private static void showSelection(Player player) {
    if (player == null) return;
    if (!player.isOnline()) return;
    List<Location> sel = Regions.getSelector().getPoints(player);
    if (sel == null || sel.isEmpty()) return;
    List<Location> cubeLoc = new ArrayList<Location>();
    if (sel.size() == 2) {
      Area area = new Area(sel.get(0), sel.get(1));
      cubeLoc = getCubePoints(area.getMin(), area.getMax());
      showIntersections(player, area);
    } else cubeLoc.add(sel.get(0));

    for (Location l : cubeLoc)
      playEffect(new RedstoneParticle(centerLoc(l), cubeLoc.size() == 1 ? 5 : 1), player);
  }
Пример #3
0
 @Override
 public void setBlockBox(String playerName, Block block, Location l1, Location l2) {
   Area area = new Area(l1, l2);
   List<Block> blocks = new LinkedList<Block>();
   Clipboard undo = Clipboard.createUndoClipBoard(playerName);
   for (int x = area.getX1(); x <= area.getX2(); x++)
     for (int z = area.getZ1(); z <= area.getZ2(); z++)
       for (int y = area.getY1(); y <= area.getY2(); y++) {
         if (x != l1.getFloorX()
             && x != l2.getFloorX()
             && z != l1.getFloorZ()
             && z != l2.getFloorZ()
             && y != l1.getFloorY()
             && y != l2.getFloorY()) continue;
         Position position = new Position(x, y, z, area.getLevel());
         if (undo != null) undo.add(position.getLevel().getBlock(position));
         setBlock(playerName, Block.get(block.getId(), block.getDamage(), position));
       }
   if (undo != null) Regions.getUndoManager().add(undo);
 }
Пример #4
0
 @Override
 public void setBlockWall(String playerName, Block block, Location l1, Location l2) {
   Area area = new Area(l1, l2);
   Clipboard undo = Clipboard.createUndoClipBoard(playerName);
   for (int y = area.getY1(); y <= area.getY2(); y++) {
     for (int x = area.getX1(); x <= area.getX2(); x++) {
       Position p1 = new Position(x, y, area.getZ1(), area.getLevel());
       Position p2 = new Position(x, y, area.getZ1(), area.getLevel());
       if (undo != null) undo.add(p1.getLevel().getBlock(p1), p1.getLevel().getBlock(p2));
       setBlock(playerName, Block.get(block.getId(), block.getDamage(), p1));
       setBlock(playerName, Block.get(block.getId(), block.getDamage(), p2));
     }
     for (int z = area.getZ1(); z <= area.getZ2(); z++) {
       Position p1 = new Position(area.getX1(), area.getY1(), z, area.getLevel());
       Position p2 = new Position(area.getX2(), area.getY2(), z, area.getLevel());
       if (undo != null) undo.add(p1.getLevel().getBlock(p1), p1.getLevel().getBlock(p2));
       setBlock(playerName, Block.get(block.getId(), block.getDamage(), p1));
       setBlock(playerName, Block.get(block.getId(), block.getDamage(), p2));
     }
   }
   if (undo != null) Regions.getUndoManager().add(undo);
 }