Implement InvertedMask & UnderOverlayMask as decorators

This commit is contained in:
aumgn
2012-03-21 11:34:45 +01:00
committed by zml2008
parent eb14efd2df
commit 30ed049918
4 changed files with 53 additions and 34 deletions

View File

@ -614,31 +614,13 @@ public class WorldEdit {
case '>':
case '<':
final LocalWorld world = player.getWorld();
final boolean over = firstChar == '>';
final String idString = component.substring(1);
final Set<Integer> ids = new HashSet<Integer>();
if (!(idString.equals("*") || idString.equals(""))) {
for (String sid : idString.split(",")) {
try {
final int pid = Integer.parseInt(sid);
if (!world.isValidBlockType(pid)) {
throw new UnknownItemException(sid);
}
ids.add(pid);
} catch (NumberFormatException e) {
final BlockType type = BlockType.lookup(sid);
final int id = type.getID();
if (!world.isValidBlockType(id)) {
throw new UnknownItemException(sid);
}
ids.add(id);
}
}
Mask submask;
if (component.length() > 1) {
submask = getBlockMaskComponent(player, session, masks, component.substring(1));
} else {
submask = new ExistingBlockMask();
}
return new UnderOverlayMask(ids, over);
return new UnderOverlayMask(submask, firstChar == '>');
case '$':
Set<BiomeType> biomes = new HashSet<BiomeType>();
@ -651,7 +633,7 @@ public class WorldEdit {
case '!':
if (component.length() > 1) {
return new InvertedBlockTypeMask(getBlockIDs(player, component.substring(1), true));
return new InvertedMask(getBlockMaskComponent(player, session, masks, component.substring(1)));
}
default: