mirror of
https://github.com/Phoenix616/RandomTeleport.git
synced 2024-11-22 02:25:38 +01:00
Fix possible NPEs when no ChunkyBorder border is set in a world (Fixes #56)
This commit is contained in:
parent
34fc5c3439
commit
8bebacc7ba
@ -25,19 +25,19 @@ public class ChunkyBorderHook implements WorldborderHook {
|
|||||||
@Override
|
@Override
|
||||||
public Location getCenter(World world) {
|
public Location getCenter(World world) {
|
||||||
BorderData borderData = chunkyBorder.getBorders().get(world.getName());
|
BorderData borderData = chunkyBorder.getBorders().get(world.getName());
|
||||||
return new Location(world, borderData.getCenterX(),0D,borderData.getCenterZ());
|
return borderData != null ? new Location(world, borderData.getCenterX(),0D,borderData.getCenterZ()) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getBorderRadius(World world) {
|
public double getBorderRadius(World world) {
|
||||||
BorderData borderData = chunkyBorder.getBorders().get(world.getName());
|
BorderData borderData = chunkyBorder.getBorders().get(world.getName());
|
||||||
return borderData.getRadiusX();
|
return borderData != null ? borderData.getRadiusX() : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isInsideBorder(Location location) {
|
public boolean isInsideBorder(Location location) {
|
||||||
BorderData borderData = chunkyBorder.getBorders().get(location.getWorld().getName());
|
BorderData borderData = chunkyBorder.getBorders().get(location.getWorld().getName());
|
||||||
return borderData.getBorder().isBounding(location.getBlockX(),location.getBlockZ());
|
return borderData == null || borderData.getBorder().isBounding(location.getBlockX(),location.getBlockZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user