mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 15:16:45 +01:00
Don't access tree until it has been created
This commit is contained in:
parent
dd4c5014fc
commit
93619b3988
@ -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