Added a new region-based mask type and the ability to combine masks.

This commit is contained in:
sk89q
2011-06-04 11:57:40 -07:00
parent 504b4a613f
commit e1da7c41ad
3 changed files with 48 additions and 6 deletions

View File

@ -403,13 +403,13 @@ public class WorldEdit {
* blocks to include when replacing.
*
* @param player
* @param session
* @param maskString
* @return
* @throws UnknownItemException
* @throws DisallowedItemException
* @throws WorldEditException
*/
public Mask getBlockMask(LocalPlayer player, String maskString)
throws UnknownItemException, DisallowedItemException {
public Mask getBlockMask(LocalPlayer player, LocalSession session,
String maskString) throws WorldEditException {
Mask mask = null;
for (String component : maskString.split(" ")) {
@ -418,6 +418,10 @@ public class WorldEdit {
if (component.charAt(0) == '#') {
if (component.equalsIgnoreCase("#existing")) {
current = new ExistingBlockMask();
} else if (component.equalsIgnoreCase("#selection")
|| component.equalsIgnoreCase("#region")
|| component.equalsIgnoreCase("#sel")) {
current = new RegionMask(session.getSelection(player.getWorld()));
} else {
throw new UnknownItemException(component);
}