mirror of
https://github.com/Phoenix616/RandomTeleport.git
synced 2024-11-21 18:15:58 +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
|
||||
public Location getCenter(World world) {
|
||||
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
|
||||
public double getBorderRadius(World world) {
|
||||
BorderData borderData = chunkyBorder.getBorders().get(world.getName());
|
||||
return borderData.getRadiusX();
|
||||
return borderData != null ? borderData.getRadiusX() : -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInsideBorder(Location location) {
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user