mirror of
https://github.com/TotalFreedomMC/TF-PlotSquared.git
synced 2024-12-23 00:15:06 +00:00
Don't access tree until it has been created
This commit is contained in:
parent
1c6075df2b
commit
38a7c771be
1 changed files with 6 additions and 0 deletions
|
@ -62,6 +62,9 @@ public class ScatteredPlotWorld extends PlotWorld {
|
|||
}
|
||||
|
||||
@Override @Nullable public PlotArea getArea(@NotNull final Location location) {
|
||||
if (this.areas.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
synchronized (this.treeLock) {
|
||||
final Observable<Entry<PlotArea, Geometry>> area =
|
||||
areaTree.search(Geometries.point(location.getX(), location.getZ()));
|
||||
|
@ -87,6 +90,9 @@ public class ScatteredPlotWorld extends PlotWorld {
|
|||
}
|
||||
|
||||
@Override @NotNull public Collection<PlotArea> getAreasInRegion(@NotNull final CuboidRegion region) {
|
||||
if (this.areas.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
synchronized (this.treeLock) {
|
||||
final List<PlotArea> areas = new LinkedList<>();
|
||||
this.areaTree.search(RegionUtil.toRectangle(region)).toBlocking().forEach(entry -> areas.add(entry.value()));
|
||||
|
|
Loading…
Reference in a new issue