Warp Addon

Here you can view details on how to create a warp addon using the Expansions API.

In Player Warps you can create a warp addon that will essentially decide if a player can set a warp in a specific location or create a warp on a certain event.

Registering

You can go here to learn on how to register an expansion.

Examples

Here is an example of a warp addon class, this will let you be able to decide if a player can set a warp at that specific location or not. You may also add events and what no as well in this as well.

import com.olziedev.playerwarps.api.expansion.WAddon;
import org.bukkit.entity.Player;

public class ExampleWarpExpansion extends WAddon {

    @Override
    public boolean isEnabled() {
        return true;
    }

    @Override
    public String getName() {
        return "Example Expansion";
    }

    @Override
    public void onLoad() {

    }

    @Override
    public Runnable isAuthorized(Player player) {
        if (player.getLocation().getY() < 5) {
            return () -> player.sendMessage("You are not authorized to use this command!");
        }
        return null;
    }
}

When using the isAuthorized method, you can return null if you want them to be able to set a warp at that location.

If you do not want them to set a warp, you can return a runnable interface and whatever is in that code will be executed. If you're wondering why its a runnable, its so then the plugin will not execute every single addons' runnable at once when setting a warp.

Last updated