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 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; }