/** * Adds a position to be used a source. * * @return */ @Override public void addSourcePosition(WorldVector arg0) { // int ox = pos.getBlockX(); // int oy = pos.getBlockY(); // int oz = pos.getBlockZ(); for (int x = -3; x <= 3; x++) { for (int y = -3; y <= 3; y++) { for (int z = -3; z <= 3; z++) { Vector cur = arg0.add(x, y, z); addSingleSourcePosition(new WorldVector(arg0.getWorld(), cur)); } } } }
public boolean actPrimary( ServerInterface server, LocalConfiguration config, LocalPlayer player, LocalSession session, WorldVector clicked) { BlockBag bag = session.getBlockBag(player); LocalWorld world = clicked.getWorld(); EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1, bag, player); try { editSession.setBlock(clicked, targetBlock); } catch (MaxChangedBlocksException e) { } finally { if (bag != null) { bag.flushChanges(); } session.remember(editSession); } return true; }
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; }
/** * Adds a position to be used a source. * * @return */ @Override public void addSingleSourcePosition(WorldVector arg0) { int x = arg0.getBlockX(); int y = arg0.getBlockY(); int z = arg0.getBlockZ(); if (BukkitUtil.toWorld(arg0.getWorld()).getBlockAt(BukkitUtil.toLocation(arg0)).getTypeId() == BlockType.CHEST.getID()) { BlockState complexBlock = BukkitUtil.toWorld(arg0.getWorld()).getBlockAt(x, y, z).getState(); if (complexBlock instanceof Chest) { Chest chest = (Chest) complexBlock; if (!chests.contains(chest)) { chests.add((Chest) complexBlock); } } } }
@Override public boolean act( ServerInterface server, LocalConfiguration config, LocalPlayer player, LocalSession session, WorldVector clicked) { LocalWorld world = clicked.getWorld(); EditSession editSession = new EditSession(server, world, session.getBlockChangeLimit()); try { editSession.makePineTree(clicked.add(0, 1, 0)); } catch (MaxChangedBlocksException e) { player.printError("Max blocks change limit reached."); } finally { session.remember(editSession); } return true; }
public boolean actSecondary( ServerInterface server, LocalConfiguration config, LocalPlayer player, LocalSession session, WorldVector clicked) { LocalWorld world = clicked.getWorld(); EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1, player); targetBlock = (editSession).getBlock(clicked); BlockType type = BlockType.fromID(targetBlock.getType()); if (type != null) { player.print("Replacer tool switched to: " + type.getName()); } return true; }
public static World toWorld(WorldVector pt) { return ((SpoutWorld) pt.getWorld()).getWorld(); }
public static Point toPoint(WorldVector pt) { return new Point(toWorld(pt), (float) pt.getX(), (float) pt.getY(), (float) pt.getZ()); }