mirror of
https://github.com/Brettflan/WorldBorder.git
synced 2025-01-23 16:01:23 +01:00
Added a function to the main plugin class for other plugins to hook into, which will get the BorderData for a specified world. The other plugin can then access all available functions such as checking an X/Z position to see if it's inside the border, or getting a corrected (and safe) position inside the border.
This commit is contained in:
parent
2fb1b9dd7a
commit
ce7a14c36b
@ -123,6 +123,10 @@ public class BorderData
|
||||
return false; // Apparently outside, then
|
||||
}
|
||||
}
|
||||
public boolean insideBorder(double xLoc, double zLoc)
|
||||
{
|
||||
return insideBorder(xLoc, zLoc, Config.ShapeRound());
|
||||
}
|
||||
|
||||
public Location correctedPosition(Location loc, boolean round)
|
||||
{
|
||||
@ -164,6 +168,10 @@ public class BorderData
|
||||
|
||||
return new Location(loc.getWorld(), Math.floor(xLoc) + 0.5, yLoc, Math.floor(zLoc) + 0.5, loc.getYaw(), loc.getPitch());
|
||||
}
|
||||
public Location correctedPosition(Location loc)
|
||||
{
|
||||
return correctedPosition(loc, Config.ShapeRound());
|
||||
}
|
||||
|
||||
//these material IDs are acceptable for places to teleport player; breathable blocks and water
|
||||
private static LinkedHashSet<Integer> acceptableBlocks = new LinkedHashSet<Integer>(Arrays.asList(
|
||||
|
@ -41,4 +41,10 @@ public class WorldBorder extends JavaPlugin
|
||||
System.out.println( desc.getName() + " version " + desc.getVersion() + " shutting down" );
|
||||
Config.StopBorderTimer();
|
||||
}
|
||||
|
||||
// for other plugins to hook into
|
||||
public BorderData GetWorldBorder(String worldName)
|
||||
{
|
||||
return Config.Border(worldName);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user