Abstracted super pickaxe mode/tools and changed commands to /tree, /info, /none, /single, /area, and /recur.

This commit is contained in:
sk89q
2011-01-01 21:50:31 -08:00
parent 806081cc59
commit 1ed99f2337
16 changed files with 915 additions and 422 deletions

View File

@@ -21,6 +21,8 @@ package com.sk89q.worldedit;
import java.util.LinkedList;
import com.sk89q.worldedit.snapshots.Snapshot;
import com.sk89q.worldedit.superpickaxe.SinglePickaxe;
import com.sk89q.worldedit.superpickaxe.SuperPickaxeMode;
import com.sk89q.worldedit.bags.BlockBag;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.regions.CuboidRegion;
@@ -30,24 +32,8 @@ import com.sk89q.worldedit.regions.CuboidRegion;
* @author sk89q
*/
public class LocalSession {
/**
* List of super pick axe modes.
*/
public static enum SuperPickaxeMode {
SINGLE,
SAME_TYPE_RECURSIVE,
SAME_TYPE_AREA
};
/**
* List of tools.
*/
public static enum Tool {
NONE,
INFO,
TREE,
}
public static final int MAX_HISTORY_SIZE = 15;
private boolean placeAtPos1 = false;
private Vector pos1, pos2;
private Region region;
@@ -55,10 +41,9 @@ public class LocalSession {
private int historyPointer = 0;
private CuboidClipboard clipboard;
private boolean toolControl = true;
private boolean superPickAxe = false;
private SuperPickaxeMode superPickaxeMode = SuperPickaxeMode.SINGLE;
private Tool tool = Tool.NONE;
private int superPickaxeRange = 3;
private boolean superPickaxe = false;
private SuperPickaxeMode superPickaxeMode = new SinglePickaxe();
private SuperPickaxeMode tool;
private int maxBlocksChanged = -1;
private boolean useInventory;
private Snapshot snapshot;
@@ -291,25 +276,25 @@ public class LocalSession {
* @return status
*/
public boolean hasSuperPickAxe() {
return superPickAxe;
return superPickaxe;
}
/**
* Enable super pick axe.
*
* @param superPickAxe
* @param superPickaxe
*/
public void enableSuperPickAxe() {
superPickAxe = true;
superPickaxe = true;
}
/**
* Disable super pick axe.
*
* @param superPickAxe
* @param superPickaxe
*/
public void disableSuperPickAxe() {
superPickAxe = false;
superPickaxe = false;
}
/**
@@ -318,8 +303,8 @@ public class LocalSession {
* @return status
*/
public boolean toggleSuperPickAxe() {
superPickAxe = !superPickAxe;
return superPickAxe;
superPickaxe = !superPickaxe;
return superPickaxe;
}
/**
@@ -385,31 +370,17 @@ public class LocalSession {
this.superPickaxeMode = superPickaxeMode;
}
/**
* @return the superPickaxeRange
*/
public int getSuperPickaxeRange() {
return superPickaxeRange;
}
/**
* @param superPickaxeRange the superPickaxeRange to set
*/
public void setSuperPickaxeRange(int superPickaxeRange) {
this.superPickaxeRange = superPickaxeRange;
}
/**
* @return the tool
*/
public Tool getTool() {
public SuperPickaxeMode getTool() {
return tool;
}
/**
* @param tool the tool to set
*/
public void setTool(Tool tool) {
public void setTool(SuperPickaxeMode tool) {
this.tool = tool;
}