mirror of
https://github.com/Phoenix616/RandomTeleport.git
synced 2024-11-25 12:06:15 +01:00
Merge pull request #42 from MWHunter/master
Fix WorldBorder checking for non-circle borders
This commit is contained in:
commit
6b632d7023
@ -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