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
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!");
}
}
Using API Example
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
// 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);Similar projects
Plugin →Let Me Despawn
Improves performance by tweaking mob despawn rules. Say bye to pesky unintentional persistent mobs.
25MSueta
JourneyMap
Real-time map used for mapping in-game or your browser as you explore.
14.7MSueta
Emotecraft
Create your own emotes in Minecraft.
7.5MSueta
Simple Tpa
A simple tpa plugin which sends requests
5.4MSueta
Common Network
Forge and Fabric Unified Networking Solution
3.9MSueta
Set Home
A lightweight plugin for players to set their homes.
3.8MSueta