Further Information

This page simply contains some further miscellaneous info which doesn't really fit in other categories.


Each world which you want to have a border will need to have one defined separately. You can of course use the appropriate commands to define borders for worlds which you aren't currently in or even worlds which don't exist yet. It will inform you if the world doesn't exist, but will store the border info and will use it if/when a world by that name is ever loaded.

Whenever any configuration is changed by a command, whether it be adding or modifying a border or changing the border message, the configuration file is automatically saved. Since all configuration data is modifiable via the in-game command interface, you should never have to actually even know how to open this plugin's config.yml file.

The default border shape is round/elliptic. A round/elliptic border makes for a nicer world map, but takes a few more calculations. Even so, the round/elliptic border is only a miniscule amount less efficient; it is based mostly on rBorder's excellently crafted algorithm for determining if a player is inside the border. You can also choose to have a square/rectangular border, which is very slightly more lightweight, and some might prefer the shape anyway.

The border checking routine is done as a repeating task for higher performance, rather than being run with every player movement event like other border-providing plugins. It defaults to running every 4 ticks (200ms), but can be configured to run more or less often than that using the delay command. For reference, 20 ticks = 1000ms = 1 second.

If a player moves outside the border, they are informed of it and teleported a few blocks back inside the border (3 blocks by default). The target location inside the border will be offset vertically if needed to the closest free spot where a player can stand (though it accepts placement in water). The target location will also be offset to the center of the block so the player won't be stuck in the edge of anything. If the player is using a vehicle, the vehicle will move back with them inside the border. In the rare case (such as some places in a Nether world) that no suitable vertical open space exists at the target X and Z coordinates, the player will be teleported back to the spawn location of the current world. If you're using square/rectangular borders, the move back inside the border will normally only be along one direction (X or Z). If you're using round/elliptic borders, the move back inside the border will instead be aimed in a direct line towards the border's center location; thus, it will quite often move the player back at an angle.


Special thanks to Reil for his excellent lightweight round border detection code, which I use mostly unchanged from rBorder's source with permission.


API / Integration

Below is some example code for getting the Border data for a specific world:

import com.wimbli.WorldBorder.BorderData;
import com.wimbli.WorldBorder.Config;

//...

// example code with example world name
String worldName = "world";
BorderData border = Config.Border(worldName);
// if border isn't set for world, it returns null; need to check for that
if (border != null)
{
    // can use border.getX() and border.getZ() to get the center position,
    // border.getRadiusX() and border.getRadiusZ() to get the radius values,
    // border.insideBorder(...) for checking if a location is inside the border,
    // along with everything else that's available through BorderData
}