mirror of
https://github.com/Phoenix616/RandomTeleport.git
synced 2024-11-22 10:36:00 +01:00
Use worldborder API instead of an incorrect calculation
This commit is contained in:
parent
53fece8dac
commit
35a010c41e
@ -42,14 +42,5 @@ public interface WorldborderHook extends PluginHook {
|
|||||||
* @param location The location to check
|
* @param location The location to check
|
||||||
* @return True if it is inside (or there is no border), false if not
|
* @return True if it is inside (or there is no border), false if not
|
||||||
*/
|
*/
|
||||||
default boolean isInsideBorder(Location location) {
|
boolean isInsideBorder(Location location);
|
||||||
Location center = getCenter(location.getWorld());
|
|
||||||
if (center != null) {
|
|
||||||
double radius = getBorderRadius(location.getWorld());
|
|
||||||
if (radius > 0) {
|
|
||||||
return center.distanceSquared(location) <= radius * radius;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,12 @@ public class WorldBorderHook implements WorldborderHook {
|
|||||||
return data == null ? -1 : Math.min(data.getRadiusX(), data.getRadiusZ());
|
return data == null ? -1 : Math.min(data.getRadiusX(), data.getRadiusZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isInsideBorder(Location location) {
|
||||||
|
BorderData data = plugin.getWorldBorder(location.getWorld().getName());
|
||||||
|
return data.insideBorder(location);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Plugin getPlugin() {
|
public Plugin getPlugin() {
|
||||||
return plugin;
|
return plugin;
|
||||||
|
Loading…
Reference in New Issue
Block a user