Teleport Safety - MyWarp/MyWarp GitHub Wiki

While warps will (nearly) always point to a safe location when created, this may change later on. Because of that, MyWarp contains a safety check that will check the warp's location just before a players is teleported. If the warp's location is unsafe, MyWarp tries to find an alternate safe location or, if it does not find one, cancels the teleport.

Configuration

The teleport can be configured in the configuration file:

Configuration Node Effect
teleportSafety.enabled  Controls whether the safety check is enabled.
teleportSafety.searchRadius  The radius in blocks in which the safe location is searched.

Attention: Do not set the searchRadius to high - intensive usage might lag or (for really big numbers) even crash the server. The default value is normally fine.

Understanding the Algorithm

The algorithm loops through surrounding blocks from a starting point (the original and unsafe location of the warp) to find a safe location. It will stop only if it finds a safe location or it has checked all locations within the given boundaries. If the later happens, MyWarp will not teleport the user, but send them an error message.

The boundary can be imagined as a cube centered at the warp's location. The cube's side length is twice the searchRadius plus one (the block of the warp). When searching through those blocks, MyWarp starts with the blocks close to the centre (imagine the tiniest cube possible), than the blocks beneath them and so one.