mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 09:17:39 +00:00
There's no need to duplicate everything when copying the intersection masks, as the Set and array should be the same. (#680)
* There's no need to duplicate everything when copying the intersection masks, as the Set and array should be the same. * do the same for Union mask
This commit is contained in:
parent
fc606ff5ff
commit
b06d943f7c
@ -61,12 +61,6 @@ public class MaskIntersection extends AbstractMask {
|
||||
formArray();
|
||||
}
|
||||
|
||||
protected MaskIntersection(Set<Mask> masks, Mask[] masksArray, boolean defaultReturn) {
|
||||
this.masks = masks;
|
||||
this.masksArray = masksArray;
|
||||
this.defaultReturn = defaultReturn;
|
||||
}
|
||||
|
||||
public static Mask of(Mask... masks) {
|
||||
Set<Mask> set = new LinkedHashSet<>();
|
||||
for (Mask mask : masks) {
|
||||
@ -260,8 +254,7 @@ public class MaskIntersection extends AbstractMask {
|
||||
@Override
|
||||
public Mask copy(){
|
||||
Set<Mask> masks = this.masks.stream().map(Mask::copy).collect(Collectors.toSet());
|
||||
Mask[] maskArray = (Mask[]) Arrays.stream(this.masksArray).map(Mask::copy).toArray();
|
||||
return new MaskIntersection(masks, maskArray, this.defaultReturn);
|
||||
return new MaskIntersection(masks);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ package com.sk89q.worldedit.function.mask;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
@ -57,10 +56,6 @@ public class MaskUnion extends MaskIntersection {
|
||||
super(mask);
|
||||
}
|
||||
|
||||
private MaskUnion(Set<Mask> masks, Mask[] maskArray, boolean defaultReturn) {
|
||||
super(masks, maskArray, defaultReturn);
|
||||
}
|
||||
|
||||
public static Mask of(Mask... masks) {
|
||||
Set<Mask> set = new LinkedHashSet<>();
|
||||
for (Mask mask : masks) {
|
||||
@ -121,7 +116,6 @@ public class MaskUnion extends MaskIntersection {
|
||||
@Override
|
||||
public Mask copy() {
|
||||
Set<Mask> masksCopy = masks.stream().map(Mask::copy).collect(Collectors.toSet());
|
||||
Mask[] maskArray = (Mask[]) Arrays.stream(masksArray).map(Mask::copy).toArray();
|
||||
return new MaskUnion(masksCopy, maskArray, defaultReturn);
|
||||
return new MaskUnion(masksCopy);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user