API
TeleporterPro exposes a public API via the Bukkit Services Manager. Other plugins can access it without a hard dependency on TeleporterPro.
Getting the APIโ
RegisteredServiceProvider<TeleporterAPI> provider =
getServer().getServicesManager().getRegistration(TeleporterAPI.class);
if (provider != null) {
TeleporterAPI api = provider.getProvider();
// use the api
}
Or via the static convenience accessor (returns null if the plugin is not loaded):
TeleporterProAPI api = TeleporterProAPI.getInstance();
if (api != null) {
// use the api
}
Maven / Gradle Dependencyโ
Add TeleporterPro as a provided (compile-only) dependency so it is not bundled into your plugin jar:
<!-- pom.xml -->
<dependency>
<groupId>com.sigma</groupId>
<artifactId>TeleporterPro</artifactId>
<version>3.0.2</version>
<scope>provided</scope>
</dependency>
Add TeleporterPro to softdepend in your plugin.yml:
softdepend:
- TeleporterPro
Home Methodsโ
getHomes(UUID playerUUID)โ
Returns all homes for the given player as a Map<String, Location>.
Map<String, Location> homes = api.getHomes(player.getUniqueId());
homes.forEach((name, loc) -> player.sendMessage("Home: " + name));
getHome(UUID playerUUID, String homeName)โ
Returns an Optional<Location> for a named home.
api.getHome(player.getUniqueId(), "base").ifPresent(loc -> {
// loc is the saved location
});
setHome(UUID playerUUID, String homeName, Location location)โ
Sets a home programmatically. Returns false if the home name is invalid.
boolean success = api.setHome(player.getUniqueId(), "base", player.getLocation());
deleteHome(UUID playerUUID, String homeName)โ
Deletes a home. Returns true if the home existed and was deleted.
api.deleteHome(player.getUniqueId(), "base");
getMaxHomes(UUID playerUUID)โ
Returns the home limit for the given player, based on their current permissions and config tiers.
int max = api.getMaxHomes(player.getUniqueId());
teleportHome(Player player, String homeName)โ
Triggers the full home teleport flow: warmup โ economy check โ teleportAsync โ refund on failure.
This mirrors the exact logic in /home. Must be called on the player's entity thread.
player.getScheduler().run(plugin, task -> {
api.teleportHome(player, "home");
}, null);
Warp Methodsโ
getWarps()โ
Returns all server warps as a Map<String, Location>.
Map<String, Location> warps = api.getWarps();
getWarp(String warpName)โ
Returns an Optional<Location> for a named warp.
api.getWarp("spawn").ifPresent(loc -> {
// loc is the warp location
});
TPA State Methodsโ
isTpaDisabled(UUID playerUUID)โ
Returns true if the player is currently ignoring all TPA requests.
boolean disabled = api.isTpaDisabled(player.getUniqueId());
isGlobalAutoAccept(UUID playerUUID)โ
Returns true if the player has auto-accept enabled for /tpa.
isGlobalAutoAcceptHere(UUID playerUUID)โ
Returns true if the player has auto-accept enabled for /tpahere.
getPendingRequestCount(UUID playerUUID)โ
Returns the number of pending incoming TPA requests for the player.
int count = api.getPendingRequestCount(player.getUniqueId());