Some random bukkitutil/worldutil improvements

This commit is contained in:
Alexander Söderberg
2020-07-17 22:58:10 +02:00
committed by Alexander Söderberg
parent 932052772c
commit d077fafd29
15 changed files with 511 additions and 495 deletions

View File

@@ -171,7 +171,7 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
if (X > bx && X < tx && Z > bz && Z < tz) {
count(count, entity);
} else {
Plot other = area.getPlot(BukkitUtil.getLocation(location));
Plot other = area.getPlot(BukkitUtil.adapt(location));
if (plot.equals(other)) {
count(count, entity);
}
@@ -186,7 +186,7 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
Entity[] entities1 = chunk.getEntities();
for (Entity entity : entities1) {
if (X == bx || X == tx || Z == bz || Z == tz) {
Plot other = area.getPlot(BukkitUtil.getLocation(entity));
Plot other = area.getPlot(BukkitUtil.adapt(entity.getLocation()));
if (plot.equals(other)) {
count(count, entity);
}
@@ -411,7 +411,15 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
@Override public void clearAllEntities(Location pos1, Location pos2) {
String world = pos1.getWorldName();
List<Entity> entities = BukkitUtil.getEntities(world);
final World bukkitWorld = BukkitUtil.getWorld(world);
final List<Entity> entities;
if (bukkitWorld != null) {
entities = new ArrayList<>(bukkitWorld.getEntities());
} else {
entities = new ArrayList<>();
}
int bx = pos1.getX();
int bz = pos1.getZ();
int tx = pos2.getX();