mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-29 16:46:45 +01:00
Don't access tree until it has been created
This commit is contained in:
parent
1c6075df2b
commit
38a7c771be
@ -62,6 +62,9 @@ public class ScatteredPlotWorld extends PlotWorld {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override @Nullable public PlotArea getArea(@NotNull final Location location) {
|
@Override @Nullable public PlotArea getArea(@NotNull final Location location) {
|
||||||
|
if (this.areas.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
synchronized (this.treeLock) {
|
synchronized (this.treeLock) {
|
||||||
final Observable<Entry<PlotArea, Geometry>> area =
|
final Observable<Entry<PlotArea, Geometry>> area =
|
||||||
areaTree.search(Geometries.point(location.getX(), location.getZ()));
|
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) {
|
@Override @NotNull public Collection<PlotArea> getAreasInRegion(@NotNull final CuboidRegion region) {
|
||||||
|
if (this.areas.isEmpty()) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
synchronized (this.treeLock) {
|
synchronized (this.treeLock) {
|
||||||
final List<PlotArea> areas = new LinkedList<>();
|
final List<PlotArea> areas = new LinkedList<>();
|
||||||
this.areaTree.search(RegionUtil.toRectangle(region)).toBlocking().forEach(entry -> areas.add(entry.value()));
|
this.areaTree.search(RegionUtil.toRectangle(region)).toBlocking().forEach(entry -> areas.add(entry.value()));
|
||||||
|
Loading…
Reference in New Issue
Block a user