HomeJavaModsMWorldBorderAPI [1.13+]
MWorldBorderAPI [1.13+]
The API library allows you to check the nearest wall to the border of the world, how far a given location is from the border, or an event when the player is within a certain distance from the border is to do something. This can be used to creating spawn and when player entering the world border will teleport the player to the map.

To start using my API download the jar file. Put it in the plugins folder. For developers, add the jar file to your plugin's library. Instructions for using the API below.

Loading API Example

Code (Java):
private void loadAPI ( ) {
    Plugin apiPlugin = Bukkit. getServer ( ). getPluginManager ( ). getPlugin ( "MWorldBorderAPI" ) ;
    if (apiPlugin != null ) {
        MWorldBorderAPIInstance instance = (MWorldBorderAPIInstance ) apiPlugin ;
        MWorldBorderAPI API = instance. getApi ( ) ;
        // use API! :)
    } else {
        apiPlugin. getLogger ( ). warning ( "Plugin MWorldBorderAPI is not loaded!" ) ;
    }
}
[​IMG]
Using API Example
Code (Java):
String direction = api. getNearestWall ( "world", player. getLocation ( ) ). toString ( ) ;
player. sendActionBar ( "Nearest border wall " + direction ) ;

WorldBorder worldBorder = api. getWorldBorder (player. getWorld ( ) ) ;
boolean isPlayerInBorder = api. isLocationIn (worldBorder, player. getLocation ( ) ) ;

// EXPERIMENTAL
new MWorldBorder ( "world" ). isPlayerNearWall ( "MODERR", 50 ) ;
Using API Task
Code (Java):
        // Enabling task
        WorldBorder wb = api. getWorldBorder ( "world" ) ;
        int taskId = api. borderDetectTask (wb, 5, new IBorderDetectCallback ( ) {
            // when canEnter condition fulfilled and condition distanceFromWall fulfilled
            @Override
            public void onEnter (Player player ) {
                Location exampleLocation = new Location (Bukkit. getWorld ( "world" ), 0, 0, 0 ) ;
                player. teleport (exampleLocation ) ;
            }
            // distance is less than "distanceFromWall"
            @Override
            public boolean canEnter (Player player, double distance ) {
                if (player. hasPermission ( "example.teleport" ) ) {
                    return true ;
                }
                return false ;
            }
        }, 20 ) ; // 20 ticks is 1s delay
 
        // Disabling task
        Bukkit. getScheduler ( ). cancelTask (taskId ) ;

Plugin details

Read from the plugin's own plugin.yml.

Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

MWorldBorderAPI [1.13+] is a free Minecraft Java mod. Compatible with Minecraft 1.13, 1.14, 1.15, 1.16 and newer. Downloaded 364 times (via Spigot). Download it and open it directly in the game.

Explore more