From 5ac8c5adf75a75b50bf55be66933ed4040ee85c8 Mon Sep 17 00:00:00 2001 From: sk89q Date: Fri, 11 Mar 2011 22:43:02 -0800 Subject: [PATCH] Added basic support for CUI. --- src/com/sk89q/worldedit/LocalPlayer.java | 15 ++++ src/com/sk89q/worldedit/LocalSession.java | 76 ++++++++++++++++--- src/com/sk89q/worldedit/WorldEdit.java | 4 +- .../sk89q/worldedit/bukkit/BukkitPlayer.java | 19 +++++ .../WorldEditCriticalPlayerListener.java | 57 ++++++++++++++ .../worldedit/bukkit/WorldEditPlugin.java | 2 + .../worldedit/commands/SelectionCommands.java | 8 +- .../worldedit/commands/WorldEditCommands.java | 14 ++++ src/com/sk89q/worldedit/cui/CUIEvent.java | 25 ++++++ .../worldedit/cui/CUIPointBasedRegion.java | 26 +++++++ .../worldedit/cui/SelectionPointEvent.java | 52 +++++++++++++ .../worldedit/cui/SelectionShapeEvent.java | 40 ++++++++++ .../regions/CuboidRegionSelector.java | 33 +++++++- .../regions/Polygonal2DRegionSelector.java | 15 +++- .../worldedit/regions/RegionSelector.java | 23 +++++- 15 files changed, 386 insertions(+), 23 deletions(-) create mode 100644 src/com/sk89q/worldedit/bukkit/WorldEditCriticalPlayerListener.java create mode 100644 src/com/sk89q/worldedit/cui/CUIEvent.java create mode 100644 src/com/sk89q/worldedit/cui/CUIPointBasedRegion.java create mode 100644 src/com/sk89q/worldedit/cui/SelectionPointEvent.java create mode 100644 src/com/sk89q/worldedit/cui/SelectionShapeEvent.java diff --git a/src/com/sk89q/worldedit/LocalPlayer.java b/src/com/sk89q/worldedit/LocalPlayer.java index f603f61da..81bd56cd2 100644 --- a/src/com/sk89q/worldedit/LocalPlayer.java +++ b/src/com/sk89q/worldedit/LocalPlayer.java @@ -22,6 +22,7 @@ package com.sk89q.worldedit; import java.io.File; import com.sk89q.worldedit.bags.BlockBag; import com.sk89q.worldedit.blocks.BlockType; +import com.sk89q.worldedit.cui.CUIEvent; import com.sk89q.worldedit.util.TargetBlock; /** @@ -574,6 +575,20 @@ public abstract class LocalPlayer { public boolean canDestroyBedrock() { return hasPermission("worldedit.override.bedrock"); } + + /** + * Send a CUI event. + * + * @param event + */ + public void dispatchCUIEvent(CUIEvent event) { + } + + /** + * Send the CUI handshake. + */ + public void dispatchCUIHandshake() { + } /** * Returns true if equal. diff --git a/src/com/sk89q/worldedit/LocalSession.java b/src/com/sk89q/worldedit/LocalSession.java index c3821317b..8f75db0ee 100644 --- a/src/com/sk89q/worldedit/LocalSession.java +++ b/src/com/sk89q/worldedit/LocalSession.java @@ -28,6 +28,10 @@ import com.sk89q.worldedit.tools.SinglePickaxe; import com.sk89q.worldedit.tools.BlockTool; import com.sk89q.worldedit.tools.Tool; import com.sk89q.worldedit.bags.BlockBag; +import com.sk89q.worldedit.cui.CUIPointBasedRegion; +import com.sk89q.worldedit.cui.CUIEvent; +import com.sk89q.worldedit.cui.SelectionPointEvent; +import com.sk89q.worldedit.cui.SelectionShapeEvent; import com.sk89q.worldedit.regions.CuboidRegionSelector; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.RegionSelector; @@ -53,7 +57,7 @@ public class LocalSession { private LocalConfiguration config; private LocalWorld selectionWorld; - private RegionSelector regionSelector = new CuboidRegionSelector(); + private RegionSelector selector = new CuboidRegionSelector(); private boolean placeAtPos1 = false; private LinkedList history = new LinkedList(); private int historyPointer = 0; @@ -69,6 +73,7 @@ public class LocalSession { private String lastScript; private CompassMode compassMode = CompassMode.JUMPTO; private boolean beenToldVersion = false; + private boolean hasCUISupport = false; /** * Construct the object. @@ -159,9 +164,9 @@ public class LocalSession { selectionWorld = world; } else if (!selectionWorld.equals(world)) { selectionWorld = world; - regionSelector.clear(); + selector.clear(); } - return regionSelector; + return selector; } /** @@ -171,7 +176,7 @@ public class LocalSession { * @return position */ public RegionSelector getRegionSelector() { - return regionSelector; + return selector; } /** @@ -182,7 +187,7 @@ public class LocalSession { */ public void setRegionSelector(LocalWorld world, RegionSelector selector) { selectionWorld = world; - regionSelector = selector; + this.selector = selector; } /** @@ -192,7 +197,7 @@ public class LocalSession { */ @Deprecated public boolean isRegionDefined() { - return regionSelector.isDefined(); + return selector.isDefined(); } /** @@ -205,7 +210,7 @@ public class LocalSession { if (selectionWorld == null || !selectionWorld.equals(world)) { return false; } - return regionSelector.isDefined(); + return selector.isDefined(); } /** @@ -216,7 +221,7 @@ public class LocalSession { */ @Deprecated public Region getRegion() throws IncompleteRegionException { - return regionSelector.getRegion(); + return selector.getRegion(); } /** @@ -233,7 +238,7 @@ public class LocalSession { if (selectionWorld == null || !selectionWorld.equals(world)) { throw new IncompleteRegionException(); } - return regionSelector.getRegion(); + return selector.getRegion(); } /** @@ -340,7 +345,7 @@ public class LocalSession { return player.getBlockIn(); } - return regionSelector.getPrimaryPosition(); + return selector.getPrimaryPosition(); } /** @@ -519,4 +524,55 @@ public class LocalSession { } } } + + /** + * Dispatch a CUI event but only if the player has CUI support. + * + * @param player + * @param event + */ + public void dispatchCUIEvent(LocalPlayer player, CUIEvent event) { + if (hasCUISupport) { + player.dispatchCUIEvent(event); + } + } + + /** + * Dispatch the initial setup CUI messages. + * + * @param player + */ + public void dispatchCUISetup(LocalPlayer player) { + if (!hasCUISupport) { + return; + } + + if (selector != null) { + player.dispatchCUIEvent( + new SelectionShapeEvent(selector.getTypeId())); + + if (selector instanceof CUIPointBasedRegion) { + Vector[] points = ((CUIPointBasedRegion) selector).getCUIPoints(); + int size = selector.getArea(); + + int i = 0; + for (Vector pt : points) { + if (pt != null) { + player.dispatchCUIEvent( + new SelectionPointEvent(i, pt, size)); + } + i++; + } + } + } + } + + /** + * Sets the status of CUI support. + * + * @param support + */ + public void setCUISupport(boolean support) { + hasCUISupport = true; + } } diff --git a/src/com/sk89q/worldedit/WorldEdit.java b/src/com/sk89q/worldedit/WorldEdit.java index f35a780dc..5049487ec 100644 --- a/src/com/sk89q/worldedit/WorldEdit.java +++ b/src/com/sk89q/worldedit/WorldEdit.java @@ -820,7 +820,7 @@ public class WorldEdit { && player.hasPermission("worldedit.selection.pos")) { RegionSelector selector = session.getRegionSelector(player.getWorld()); if (selector.selectSecondary(clicked)) { - selector.explainSecondarySelection(player, clicked); + selector.explainSecondarySelection(player, session, clicked); } return true; @@ -857,7 +857,7 @@ public class WorldEdit { RegionSelector selector = session.getRegionSelector(player.getWorld()); if (selector.selectPrimary(clicked)) { - selector.explainPrimarySelection(player, clicked); + selector.explainPrimarySelection(player, session, clicked); } return true; diff --git a/src/com/sk89q/worldedit/bukkit/BukkitPlayer.java b/src/com/sk89q/worldedit/bukkit/BukkitPlayer.java index 81f4e7019..5734eeedb 100644 --- a/src/com/sk89q/worldedit/bukkit/BukkitPlayer.java +++ b/src/com/sk89q/worldedit/bukkit/BukkitPlayer.java @@ -22,8 +22,10 @@ package com.sk89q.worldedit.bukkit; import org.bukkit.*; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import com.sk89q.util.StringUtil; import com.sk89q.worldedit.*; import com.sk89q.worldedit.bags.BlockBag; +import com.sk89q.worldedit.cui.CUIEvent; public class BukkitPlayer extends LocalPlayer { private Player player; @@ -114,4 +116,21 @@ public class BukkitPlayer extends LocalPlayer { public LocalWorld getWorld() { return new BukkitWorld(player.getWorld()); } + + @Override + public void dispatchCUIEvent(CUIEvent event) { + String[] params = event.getParameters(); + + if (params.length > 0) { + printRaw("\u00A75\u00A76\u00A74\u00A75" + event.getTypeId() + + "|" + StringUtil.joinString(params, "|")); + } else { + printRaw("\u00A75\u00A76\u00A74\u00A75" + event.getTypeId()); + } + } + + @Override + public void dispatchCUIHandshake() { + printRaw("\u00A75\u00A76\u00A74\u00A75"); + } } diff --git a/src/com/sk89q/worldedit/bukkit/WorldEditCriticalPlayerListener.java b/src/com/sk89q/worldedit/bukkit/WorldEditCriticalPlayerListener.java new file mode 100644 index 000000000..29f1dcf6a --- /dev/null +++ b/src/com/sk89q/worldedit/bukkit/WorldEditCriticalPlayerListener.java @@ -0,0 +1,57 @@ +// $Id$ +/* + * WorldEdit + * Copyright (C) 2010 sk89q + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . +*/ + +package com.sk89q.worldedit.bukkit; + +import org.bukkit.entity.Player; +import org.bukkit.event.player.PlayerEvent; +import org.bukkit.event.player.PlayerListener; + +/** + * Handles all events thrown in relation to a Player + */ +public class WorldEditCriticalPlayerListener extends PlayerListener { + /** + * Plugin. + */ + private WorldEditPlugin plugin; + + /** + * Construct the object; + * + * @param plugin + */ + public WorldEditCriticalPlayerListener(WorldEditPlugin plugin) { + this.plugin = plugin; + } + + /** + * Called when a player joins a server + * + * @param event Relevant event details + */ + @Override + public void onPlayerJoin(PlayerEvent event) { + wrapPlayer(event.getPlayer()).dispatchCUIHandshake(); + } + + private BukkitPlayer wrapPlayer(Player player) { + return new BukkitPlayer(plugin, plugin.server, player); + } +} diff --git a/src/com/sk89q/worldedit/bukkit/WorldEditPlugin.java b/src/com/sk89q/worldedit/bukkit/WorldEditPlugin.java index e8f80bbb2..a8bcd44cd 100644 --- a/src/com/sk89q/worldedit/bukkit/WorldEditPlugin.java +++ b/src/com/sk89q/worldedit/bukkit/WorldEditPlugin.java @@ -123,6 +123,7 @@ public class WorldEditPlugin extends JavaPlugin { */ protected void registerEvents() { PlayerListener playerListener = new WorldEditPlayerListener(this); + PlayerListener criticalPlayerListener = new WorldEditCriticalPlayerListener(this); BlockListener blockListener = new WorldEditBlockListener(this); registerEvent(Event.Type.PLAYER_QUIT, playerListener); @@ -131,6 +132,7 @@ public class WorldEditPlugin extends JavaPlugin { registerEvent(Event.Type.PLAYER_COMMAND_PREPROCESS, playerListener); registerEvent(Event.Type.BLOCK_DAMAGED, blockListener); registerEvent(Event.Type.BLOCK_RIGHTCLICKED, blockListener); + registerEvent(Event.Type.PLAYER_JOIN, criticalPlayerListener, Priority.Lowest); // The permissions resolver has some hooks of its own (new PermissionsResolverServerListener(perms)).register(this); diff --git a/src/com/sk89q/worldedit/commands/SelectionCommands.java b/src/com/sk89q/worldedit/commands/SelectionCommands.java index 07df859eb..77fb14318 100644 --- a/src/com/sk89q/worldedit/commands/SelectionCommands.java +++ b/src/com/sk89q/worldedit/commands/SelectionCommands.java @@ -58,7 +58,7 @@ public class SelectionCommands { } session.getRegionSelector(player.getWorld()) - .explainPrimarySelection(player, player.getBlockIn()); + .explainPrimarySelection(player, session, player.getBlockIn()); } @Command( @@ -81,7 +81,7 @@ public class SelectionCommands { session.getRegionSelector(player.getWorld()) - .explainSecondarySelection(player, player.getBlockIn()); + .explainSecondarySelection(player, session, player.getBlockIn()); } @Command( @@ -106,7 +106,7 @@ public class SelectionCommands { } session.getRegionSelector(player.getWorld()) - .explainPrimarySelection(player, pos); + .explainPrimarySelection(player, session, pos); } else { player.printError("No block in sight!"); } @@ -134,7 +134,7 @@ public class SelectionCommands { } session.getRegionSelector(player.getWorld()) - .explainSecondarySelection(player, pos); + .explainSecondarySelection(player, session, pos); } else { player.printError("No block in sight!"); } diff --git a/src/com/sk89q/worldedit/commands/WorldEditCommands.java b/src/com/sk89q/worldedit/commands/WorldEditCommands.java index a81b62cfe..28b506f31 100644 --- a/src/com/sk89q/worldedit/commands/WorldEditCommands.java +++ b/src/com/sk89q/worldedit/commands/WorldEditCommands.java @@ -59,4 +59,18 @@ public class WorldEditCommands { we.getServer().reload(); player.print("Configuration reloaded!"); } + + @Command( + aliases = {"cui"}, + usage = "", + desc = "Complete CUI handshake", + min = 0, + max = 0 + ) + public static void cui(CommandContext args, WorldEdit we, + LocalSession session, LocalPlayer player, EditSession editSession) + throws WorldEditException { + session.setCUISupport(true); + session.dispatchCUISetup(player); + } } diff --git a/src/com/sk89q/worldedit/cui/CUIEvent.java b/src/com/sk89q/worldedit/cui/CUIEvent.java new file mode 100644 index 000000000..a98393570 --- /dev/null +++ b/src/com/sk89q/worldedit/cui/CUIEvent.java @@ -0,0 +1,25 @@ +// $Id$ +/* + * WorldEdit + * Copyright (C) 2010, 2011 sk89q + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . +*/ + +package com.sk89q.worldedit.cui; + +public interface CUIEvent { + public String getTypeId(); + public String[] getParameters(); +} diff --git a/src/com/sk89q/worldedit/cui/CUIPointBasedRegion.java b/src/com/sk89q/worldedit/cui/CUIPointBasedRegion.java new file mode 100644 index 000000000..c96c7f240 --- /dev/null +++ b/src/com/sk89q/worldedit/cui/CUIPointBasedRegion.java @@ -0,0 +1,26 @@ +// $Id$ +/* + * WorldEdit + * Copyright (C) 2010, 2011 sk89q + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . +*/ + +package com.sk89q.worldedit.cui; + +import com.sk89q.worldedit.Vector; + +public interface CUIPointBasedRegion { + public Vector[] getCUIPoints(); +} diff --git a/src/com/sk89q/worldedit/cui/SelectionPointEvent.java b/src/com/sk89q/worldedit/cui/SelectionPointEvent.java new file mode 100644 index 000000000..f09c4a239 --- /dev/null +++ b/src/com/sk89q/worldedit/cui/SelectionPointEvent.java @@ -0,0 +1,52 @@ +// $Id$ +/* + * WorldEdit + * Copyright (C) 2010, 2011 sk89q + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . +*/ + +package com.sk89q.worldedit.cui; + +import com.sk89q.worldedit.Vector; + +public class SelectionPointEvent implements CUIEvent { + + protected int id; + protected Vector pos; + protected int area; + + public SelectionPointEvent(int id, Vector pos, int area) { + this.id = id; + this.pos = pos; + this.area = area; + } + + @Override + public String getTypeId() { + return "p"; + } + + @Override + public String[] getParameters() { + return new String[] { + String.valueOf(id), + String.valueOf(pos.getBlockX()), + String.valueOf(pos.getBlockY()), + String.valueOf(pos.getBlockZ()), + String.valueOf(area) + }; + } + +} diff --git a/src/com/sk89q/worldedit/cui/SelectionShapeEvent.java b/src/com/sk89q/worldedit/cui/SelectionShapeEvent.java new file mode 100644 index 000000000..815fb4a22 --- /dev/null +++ b/src/com/sk89q/worldedit/cui/SelectionShapeEvent.java @@ -0,0 +1,40 @@ +// $Id$ +/* + * WorldEdit + * Copyright (C) 2010, 2011 sk89q + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . +*/ + +package com.sk89q.worldedit.cui; + +public class SelectionShapeEvent implements CUIEvent { + + protected String shapeName; + + public SelectionShapeEvent(String shapeName) { + this.shapeName = shapeName; + } + + @Override + public String getTypeId() { + return "s"; + } + + @Override + public String[] getParameters() { + return new String[] { shapeName }; + } + +} diff --git a/src/com/sk89q/worldedit/regions/CuboidRegionSelector.java b/src/com/sk89q/worldedit/regions/CuboidRegionSelector.java index eddf8f91a..04c06da82 100644 --- a/src/com/sk89q/worldedit/regions/CuboidRegionSelector.java +++ b/src/com/sk89q/worldedit/regions/CuboidRegionSelector.java @@ -24,14 +24,17 @@ import java.util.List; import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.LocalPlayer; +import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.cui.CUIPointBasedRegion; +import com.sk89q.worldedit.cui.SelectionPointEvent; /** * Selector for cuboids. * * @author sk89q */ -public class CuboidRegionSelector implements RegionSelector { +public class CuboidRegionSelector implements RegionSelector, CUIPointBasedRegion { protected BlockVector pos1; protected BlockVector pos2; protected CuboidRegion region = new CuboidRegion(new Vector(), new Vector()); @@ -54,22 +57,30 @@ public class CuboidRegionSelector implements RegionSelector { return true; } - public void explainPrimarySelection(LocalPlayer player, Vector pos) { + public void explainPrimarySelection(LocalPlayer player, + LocalSession session, Vector pos) { if (pos1 != null && pos2 != null) { player.print("First position set to " + pos1 + " (" + region.getArea() + ")."); } else { player.print("First position set to " + pos1 + "."); } + + session.dispatchCUIEvent(player, + new SelectionPointEvent(0, pos, getArea())); } - public void explainSecondarySelection(LocalPlayer player, Vector pos) { + public void explainSecondarySelection(LocalPlayer player, + LocalSession session, Vector pos) { if (pos1 != null && pos2 != null) { player.print("Second position set to " + pos2 + " (" + region.getArea() + ")."); } else { player.print("Second position set to " + pos2 + "."); } + + session.dispatchCUIEvent(player, + new SelectionPointEvent(1, pos, getArea())); } public BlockVector getPrimaryPosition() throws IncompleteRegionException { @@ -119,4 +130,20 @@ public class CuboidRegionSelector implements RegionSelector { return lines; } + + public String getTypeId() { + return "cuboid"; + } + + public Vector[] getCUIPoints() { + return new Vector[] { pos1, pos2 }; + } + + public int getArea() { + if (pos1 != null && pos2 != null) { + return region.getArea(); + } + + return -1; + } } diff --git a/src/com/sk89q/worldedit/regions/Polygonal2DRegionSelector.java b/src/com/sk89q/worldedit/regions/Polygonal2DRegionSelector.java index be0236dc9..09d87d374 100644 --- a/src/com/sk89q/worldedit/regions/Polygonal2DRegionSelector.java +++ b/src/com/sk89q/worldedit/regions/Polygonal2DRegionSelector.java @@ -25,6 +25,7 @@ import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.BlockVector2D; import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.LocalPlayer; +import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.Vector; /** @@ -66,11 +67,13 @@ public class Polygonal2DRegionSelector implements RegionSelector { return true; } - public void explainPrimarySelection(LocalPlayer player, Vector pos) { + public void explainPrimarySelection(LocalPlayer player, + LocalSession session, Vector pos) { player.print("Starting a new polygon at " + pos + "."); } - public void explainSecondarySelection(LocalPlayer player, Vector pos) { + public void explainSecondarySelection(LocalPlayer player, + LocalSession session, Vector pos) { player.print("Added point #" + region.size() + " at " + pos + "."); } @@ -111,4 +114,12 @@ public class Polygonal2DRegionSelector implements RegionSelector { return lines; } + public String getTypeId() { + return "polygon2d"; + } + + public int getArea() { + return region.getArea(); + } + } diff --git a/src/com/sk89q/worldedit/regions/RegionSelector.java b/src/com/sk89q/worldedit/regions/RegionSelector.java index ee052803c..944b63208 100644 --- a/src/com/sk89q/worldedit/regions/RegionSelector.java +++ b/src/com/sk89q/worldedit/regions/RegionSelector.java @@ -23,6 +23,7 @@ import java.util.List; import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.LocalPlayer; +import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.Vector; /** @@ -51,17 +52,21 @@ public interface RegionSelector { * Tell the player information about his/her primary selection. * * @param player + * @param session * @param pos */ - public void explainPrimarySelection(LocalPlayer player, Vector pos); + public void explainPrimarySelection(LocalPlayer player, + LocalSession session, Vector pos); /** * Tell the player information about his/her secondary selection. * * @param player + * @param session * @param pos */ - public void explainSecondarySelection(LocalPlayer player, Vector pos); + public void explainSecondarySelection(LocalPlayer player, + LocalSession session, Vector pos); /** * Get the primary position. @@ -86,6 +91,13 @@ public interface RegionSelector { */ public boolean isDefined(); + /** + * Get the number of blocks inside the region. + * + * @return number of blocks or -1 if undefined + */ + public int getArea(); + /** * Update the selector with changes to the region. */ @@ -103,6 +115,13 @@ public interface RegionSelector { */ public String getTypeName(); + /** + * Get a lowecase space-less ID. + * + * @return + */ + public String getTypeId(); + /** * Get lines of information about the selection. *