Added greater coverage for CUI for region adjustments.

Dieser Commit ist enthalten in:
sk89q 2011-03-12 02:27:43 -08:00
Ursprung 9151f8b6bf
Commit 94ab610da7
7 geänderte Dateien mit 129 neuen und 81 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

@ -530,21 +530,34 @@ public class LocalSession {
}
if (selector != null) {
player.dispatchCUIEvent(
new SelectionShapeEvent(selector.getTypeId()));
dispatchCUISelection(player);
}
}
/**
* Send the selection information.
*
* @param player
*/
public void dispatchCUISelection(LocalPlayer player) {
if (!hasCUISupport) {
return;
}
player.dispatchCUIEvent(
new SelectionShapeEvent(selector.getTypeId()));
if (selector instanceof CUIPointBasedRegion) {
Vector[] points = ((CUIPointBasedRegion) selector).getCUIPoints();
int size = selector.getArea();
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++;
int i = 0;
for (Vector pt : points) {
if (pt != null) {
player.dispatchCUIEvent(
new SelectionPointEvent(i, pt, size));
}
i++;
}
}
}

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -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) {

Datei anzeigen

@ -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();

Datei anzeigen

@ -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.
*