mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-10-04 17:47:41 +02:00
Cache the set made in ApplicableRegionSet.
This commit is contained in:
parent
1a781fc5b0
commit
bb1826bdb1
@ -57,6 +57,8 @@ public class ApplicableRegionSet implements Iterable<ProtectedRegion> {
|
||||
|
||||
private final List<ProtectedRegion> applicable;
|
||||
private final FlagValueCalculator flagValueCalculator;
|
||||
@Nullable
|
||||
private Set<ProtectedRegion> regionSet;
|
||||
|
||||
/**
|
||||
* Construct the object.
|
||||
@ -345,7 +347,11 @@ public int size() {
|
||||
* @return a set of regions
|
||||
*/
|
||||
public Set<ProtectedRegion> getRegions() {
|
||||
return new HashSet<ProtectedRegion>(applicable);
|
||||
if (regionSet != null) {
|
||||
return regionSet;
|
||||
}
|
||||
regionSet = Collections.unmodifiableSet(new HashSet<ProtectedRegion>(applicable));
|
||||
return regionSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user