Added greater coverage for CUI for region adjustments.

This commit is contained in:
sk89q
2011-03-12 02:27:43 -08:00
parent 9151f8b6bf
commit 94ab610da7
7 changed files with 129 additions and 81 deletions

View File

@ -82,6 +82,17 @@ public class CuboidRegionSelector implements RegionSelector, CUIPointBasedRegion
session.dispatchCUIEvent(player,
new SelectionPointEvent(1, pos, getArea()));
}
public void explainRegionAdjust(LocalPlayer player, LocalSession session) {
if (pos1 != null) {
session.dispatchCUIEvent(player,
new SelectionPointEvent(0, pos1, getArea()));
}
if (pos2 != null) {
session.dispatchCUIEvent(player,
new SelectionPointEvent(1, pos2, getArea()));
}
}
public BlockVector getPrimaryPosition() throws IncompleteRegionException {
if (pos1 == null) {

View File

@ -77,6 +77,9 @@ public class Polygonal2DRegionSelector implements RegionSelector {
player.print("Added point #" + region.size() + " at " + pos + ".");
}
public void explainRegionAdjust(LocalPlayer player, LocalSession session) {
}
public BlockVector getPrimaryPosition() throws IncompleteRegionException {
if (pos1 == null) {
throw new IncompleteRegionException();

View File

@ -68,6 +68,15 @@ public interface RegionSelector {
public void explainSecondarySelection(LocalPlayer player,
LocalSession session, Vector pos);
/**
* The the player information about the region's changes. This may resend
* all the defining region information if needed.
*
* @param player
* @param session
*/
public void explainRegionAdjust(LocalPlayer player, LocalSession session);
/**
* Get the primary position.
*