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

@ -11,9 +11,6 @@ commands:
delchunks: delchunks:
description: Delete chunks that your selection includes description: Delete chunks that your selection includes
usage: /<command> usage: /<command>
clearclipboard:
description: Clear your clipboard
usage: /<command>
/load: /load:
description: Load a schematic into your clipboard description: Load a schematic into your clipboard
usage: /<command> <filename> usage: /<command> <filename>
@ -35,6 +32,12 @@ commands:
/paste: /paste:
description: Paste the clipboard's contents description: Paste the clipboard's contents
usage: /<command> [-ao] usage: /<command> [-ao]
clearclipboard:
description: Clear your clipboard
usage: /<command>
/limit:
description: Modify block change limit
usage: /<command> <limit>
we: we:
description: WorldEdit commands description: WorldEdit commands
usage: /<command> usage: /<command>
@ -46,9 +49,6 @@ commands:
description: Search for an item description: Search for an item
usage: /<command> [-bi] <query> usage: /<command> [-bi] <query>
aliases: ['/l', 'search'] aliases: ['/l', 'search']
/limit:
description: Modify block change limit
usage: /<command> <limit>
/hcyl: /hcyl:
description: Generate a hollow cylinder description: Generate a hollow cylinder
usage: /<command> <block> <radius> [height] usage: /<command> <block> <radius> [height]
@ -67,17 +67,17 @@ commands:
pumpkins: pumpkins:
description: Generate pumpkin patches description: Generate pumpkin patches
usage: /<command> [size] usage: /<command> [size]
clearhistory:
description: Clear your history
usage: /<command>
/redo:
description: Redoes the last action (from history)
usage: /<command> [times]
aliases: ['redo']
/undo: /undo:
description: Undoes the last action description: Undoes the last action
usage: /<command> [times] usage: /<command> [times]
aliases: ['undo'] aliases: ['undo']
/redo:
description: Redoes the last action (from history)
usage: /<command> [times]
aliases: ['redo']
clearhistory:
description: Clear your history
usage: /<command>
unstuck: unstuck:
description: Escape from being stuck inside a block description: Escape from being stuck inside a block
usage: /<command> usage: /<command>
@ -87,18 +87,27 @@ commands:
descend: descend:
description: Go down a floor description: Go down a floor
usage: /<command> usage: /<command>
ceil:
description: Go to the celing
usage: /<command> [clearance]
thru: thru:
description: Passthrough walls description: Passthrough walls
usage: /<command> usage: /<command>
jumpto: jumpto:
description: Teleport to a location description: Teleport to a location
usage: /<command> usage: /<command>
ceil:
description: Go to the celing
usage: /<command> [clearance]
up: up:
description: Go upwards some distance description: Go upwards some distance
usage: /<command> <block> usage: /<command> <block>
/replace:
description: Replace all blocks in the selection with another
usage: /<command> [from-block] <to-block>
/stack:
description: Repeat the contents of the selection
usage: /<command> [-a] [count] [direction]
/set:
description: Set all the blocks inside the selection to a block
usage: /<command> <block>
/overlay: /overlay:
description: Set a block on top of blocks in the region description: Set a block on top of blocks in the region
usage: /<command> <block> usage: /<command> <block>
@ -112,24 +121,24 @@ commands:
/smooth: /smooth:
description: Smooth the elevation in the selection description: Smooth the elevation in the selection
usage: /<command> [iterations] usage: /<command> [iterations]
/replace:
description: Replace all blocks in the selection with another
usage: /<command> [from-block] <to-block>
/stack:
description: Repeat the contents of the selection
usage: /<command> [-a] [count] [direction]
/set:
description: Set all the blocks inside the selection to a block
usage: /<command> <block>
/move: /move:
description: Move the contents of the selection description: Move the contents of the selection
usage: /<command> [count] [direction] [leave-id] usage: /<command> [count] [direction] [leave-id]
.s:
description: Execute last CraftScript
usage: /<command> [args...]
cs: cs:
description: Execute a CraftScript description: Execute a CraftScript
usage: /<command> <filename> [args...] usage: /<command> <filename> [args...]
.s:
description: Execute last CraftScript
usage: /<command> [args...]
/count:
description: Counts the number of a certain type of block
usage: /<command> <block>
/size:
description: Get information about the selection
usage: /<command>
/shift:
description: Shift the selection area
usage: /<command> <amount> [direction]
/chunk: /chunk:
description: Set the selection to your current chunk description: Set the selection to your current chunk
usage: /<command> usage: /<command>
@ -151,34 +160,25 @@ commands:
toggleeditwand: toggleeditwand:
description: Toggle functionality of the edit wand description: Toggle functionality of the edit wand
usage: /<command> usage: /<command>
/expand:
description: Expand the selection area
usage: /<command> <amount> [reverse-amount] <direction>
/contract: /contract:
description: Contract the selection area description: Contract the selection area
usage: /<command> <amount> [reverse-amount] [direction] usage: /<command> <amount> [reverse-amount] [direction]
/outset: /outset:
description: Outset the selection area description: Outset the selection area
usage: /<command> [-hv] <amount> usage: /<command> [-hv] <amount>
/inset:
description: Inset the selection area
usage: /<command> [-hv] <amount>
/distr: /distr:
description: Get the distribution of blocks in the selection description: Get the distribution of blocks in the selection
usage: /<command> [-c] usage: /<command> [-c]
/count:
description: Counts the number of a certain type of block
usage: /<command> <block>
/size:
description: Get information about the selection
usage: /<command>
/shift:
description: Shift the selection area
usage: /<command> <amount> [direction]
/expand:
description: Expand the selection area
usage: /<command> <amount> [reverse-amount] <direction>
/sel: /sel:
description: Choose a region selector description: Choose a region selector
usage: /<command> [type] usage: /<command> [type]
aliases: [','] aliases: [',']
/inset:
description: Inset the selection area
usage: /<command> [-hv] <amount>
snapshot: snapshot:
description: Snapshot commands description: Snapshot commands
usage: /<command> usage: /<command>
@ -187,6 +187,12 @@ commands:
description: Restore the selection from a snapshot description: Restore the selection from a snapshot
usage: /<command> [snapshot] usage: /<command> [snapshot]
aliases: ['/restore'] aliases: ['/restore']
size:
description: Set the brush size
usage: /<command> [pattern]
mask:
description: Set the brush mask
usage: /<command> [mask]
/: /:
description: Toggle the super pickaxe pickaxe function description: Toggle the super pickaxe pickaxe function
usage: /<command> usage: /<command>
@ -202,15 +208,15 @@ commands:
description: Set the brush material description: Set the brush material
usage: /<command> [pattern] usage: /<command> [pattern]
aliases: ['material', 'fill'] aliases: ['material', 'fill']
size: info:
description: Set the brush size description: Block information tool
usage: /<command> [pattern] usage: /<command>
mask:
description: Set the brush mask
usage: /<command> [mask]
none: none:
description: Turn off all superpickaxe alternate modes description: Turn off all superpickaxe alternate modes
usage: /<command> usage: /<command>
tree:
description: Tree generator tool
usage: /<command> [type]
repl: repl:
description: Block replacer tool description: Block replacer tool
usage: /<command> <block> usage: /<command> <block>
@ -221,15 +227,19 @@ commands:
description: Brush tool description: Brush tool
usage: /<command> usage: /<command>
aliases: ['br'] aliases: ['br']
info: remove:
description: Block information tool description: Remove all entities of a type
usage: /<command> usage: /<command> <type> <radius>
tree: aliases: ['rem', 'rement']
description: Tree generator tool /fill:
usage: /<command> [type] description: Fill a hole
usage: /<command> <block> <radius> [depth]
/fillr: /fillr:
description: Fill a hole recursively description: Fill a hole recursively
usage: /<command> <block> <radius> [depth] usage: /<command> <block> <radius> [depth]
/drain:
description: Drain a pool
usage: /<command> <radius>
fixlava: fixlava:
description: Fix lava to be stationary description: Fix lava to be stationary
usage: /<command> <radius> usage: /<command> <radius>
@ -261,13 +271,3 @@ commands:
butcher: butcher:
description: Kill all or nearby mobs description: Kill all or nearby mobs
usage: /<command> [radius] usage: /<command> [radius]
remove:
description: Remove all entities of a type
usage: /<command> <type> <radius>
aliases: ['rem', 'rement']
/fill:
description: Fill a hole
usage: /<command> <block> <radius> [depth]
/drain:
description: Drain a pool
usage: /<command> <radius>

View File

@ -530,6 +530,20 @@ public class LocalSession {
} }
if (selector != null) { if (selector != null) {
dispatchCUISelection(player);
}
}
/**
* Send the selection information.
*
* @param player
*/
public void dispatchCUISelection(LocalPlayer player) {
if (!hasCUISupport) {
return;
}
player.dispatchCUIEvent( player.dispatchCUIEvent(
new SelectionShapeEvent(selector.getTypeId())); new SelectionShapeEvent(selector.getTypeId()));
@ -547,7 +561,6 @@ public class LocalSession {
} }
} }
} }
}
/** /**
* Sets the status of CUI support. * Sets the status of CUI support.

View File

@ -122,15 +122,15 @@ public class BukkitPlayer extends LocalPlayer {
String[] params = event.getParameters(); String[] params = event.getParameters();
if (params.length > 0) { if (params.length > 0) {
printRaw("\u00A75\u00A76\u00A74\u00A75" + event.getTypeId() player.sendRawMessage("\u00A75\u00A76\u00A74\u00A75" + event.getTypeId()
+ "|" + StringUtil.joinString(params, "|")); + "|" + StringUtil.joinString(params, "|"));
} else { } else {
printRaw("\u00A75\u00A76\u00A74\u00A75" + event.getTypeId()); player.sendRawMessage("\u00A75\u00A76\u00A74\u00A75" + event.getTypeId());
} }
} }
@Override @Override
public void dispatchCUIHandshake() { public void dispatchCUIHandshake() {
printRaw("\u00A75\u00A76\u00A74\u00A75"); player.sendRawMessage("\u00A75\u00A76\u00A74\u00A75");
} }
} }

View File

@ -161,6 +161,8 @@ public class SelectionCommands {
selector.selectSecondary(max); selector.selectSecondary(max);
session.setRegionSelector(player.getWorld(), selector); session.setRegionSelector(player.getWorld(), selector);
session.dispatchCUISelection(player);
player.print("Chunk selected: " player.print("Chunk selected: "
+ min2D.getBlockX() + ", " + min2D.getBlockZ()); + min2D.getBlockX() + ", " + min2D.getBlockZ());
} }
@ -268,6 +270,8 @@ public class SelectionCommands {
session.getRegionSelector().learnChanges(); session.getRegionSelector().learnChanges();
int newSize = region.getArea(); int newSize = region.getArea();
session.getRegionSelector().explainRegionAdjust(player, session);
player.print("Region expanded " + (newSize - oldSize) + " blocks."); player.print("Region expanded " + (newSize - oldSize) + " blocks.");
} }
@ -315,6 +319,8 @@ public class SelectionCommands {
session.getRegionSelector().learnChanges(); session.getRegionSelector().learnChanges();
int newSize = region.getArea(); int newSize = region.getArea();
session.getRegionSelector().explainRegionAdjust(player, session);
player.print("Region contracted " + (oldSize - newSize) + " blocks."); player.print("Region contracted " + (oldSize - newSize) + " blocks.");
} catch (RegionOperationException e) { } catch (RegionOperationException e) {
player.printError(e.getMessage()); player.printError(e.getMessage());
@ -348,6 +354,8 @@ public class SelectionCommands {
region.contract(dir.multiply(change)); region.contract(dir.multiply(change));
session.getRegionSelector().learnChanges(); session.getRegionSelector().learnChanges();
session.getRegionSelector().explainRegionAdjust(player, session);
player.print("Region shifted."); player.print("Region shifted.");
} catch (RegionOperationException e) { } catch (RegionOperationException e) {
player.printError(e.getMessage()); player.printError(e.getMessage());
@ -385,6 +393,8 @@ public class SelectionCommands {
session.getRegionSelector().learnChanges(); session.getRegionSelector().learnChanges();
session.getRegionSelector().explainRegionAdjust(player, session);
player.print("Region outset."); player.print("Region outset.");
} catch (RegionOperationException e) { } catch (RegionOperationException e) {
player.printError(e.getMessage()); player.printError(e.getMessage());
@ -421,6 +431,8 @@ public class SelectionCommands {
session.getRegionSelector().learnChanges(); session.getRegionSelector().learnChanges();
session.getRegionSelector().explainRegionAdjust(player, session);
player.print("Region inset."); player.print("Region inset.");
} }

View File

@ -83,6 +83,17 @@ public class CuboidRegionSelector implements RegionSelector, CUIPointBasedRegion
new SelectionPointEvent(1, pos, getArea())); 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 { public BlockVector getPrimaryPosition() throws IncompleteRegionException {
if (pos1 == null) { if (pos1 == null) {
throw new IncompleteRegionException(); throw new IncompleteRegionException();

View File

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

View File

@ -68,6 +68,15 @@ public interface RegionSelector {
public void explainSecondarySelection(LocalPlayer player, public void explainSecondarySelection(LocalPlayer player,
LocalSession session, Vector pos); 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. * Get the primary position.
* *