Search in sources :

Example 1 with AdjacentMask

use of com.fastasyncworldedit.core.function.mask.AdjacentMask in project FastAsyncWorldEdit by IntellectualSites.

the class AdjacentMaskParser method parseFromInput.

@Override
protected Mask parseFromInput(@Nonnull String[] arguments, ParserContext context) throws InputParseException {
    if (arguments.length == 0) {
        return null;
    }
    Mask subMask = worldEdit.getMaskFactory().parseFromInput(arguments[0], context);
    int min = arguments.length > 1 ? Integer.parseInt(arguments[1]) : -1;
    int max = arguments.length > 2 ? Integer.parseInt(arguments[2]) : -1;
    if (min == -1 && max == -1) {
        min = 1;
        max = 8;
    } else if (max == -1) {
        max = min;
    }
    if (max >= 8 && min == 1) {
        return new AdjacentAnyMask(subMask, context.getMinY(), context.getMaxY());
    }
    return new AdjacentMask(subMask, min, max);
}
Also used : AdjacentMask(com.fastasyncworldedit.core.function.mask.AdjacentMask) Mask(com.sk89q.worldedit.function.mask.Mask) AdjacentAnyMask(com.fastasyncworldedit.core.function.mask.AdjacentAnyMask) AdjacentMask(com.fastasyncworldedit.core.function.mask.AdjacentMask) AdjacentAnyMask(com.fastasyncworldedit.core.function.mask.AdjacentAnyMask)

Aggregations

AdjacentAnyMask (com.fastasyncworldedit.core.function.mask.AdjacentAnyMask)1 AdjacentMask (com.fastasyncworldedit.core.function.mask.AdjacentMask)1 Mask (com.sk89q.worldedit.function.mask.Mask)1