Overview | EssentialsC | WarpApi
net.godlycow.org.essc.api

Interface WarpApi

public interface WarpApi

API interface for interacting with EssentialsC's warp system. Manages named teleport locations with permissions, economy costs, categories, and usage tracking. All data is persisted to SQLite.

Retrieve an instance via EssentialsCAPI.getWarpApi().

WarpApi warp = APIProvider.getAPI().getWarpApi();

warp.getWarp("spawn").ifPresent(w -> {
    player.teleport(w.location());
});

The WarpEntry record lives in the net.godlycow.org.essc.api.warp sub-package.

Method Summary

boolean isSystemEnabled()
Returns whether the warp system is globally enabled.
Optional<WarpEntry> getWarp(String name)
Returns the warp with the given name, if it exists.
boolean warpExists(String name)
Returns whether a warp with the given name exists.
List<WarpEntry> getAllWarps()
Returns all warps including hidden ones.
List<WarpEntry> getVisibleWarps()
Returns all non-hidden warps sorted alphabetically.
List<WarpEntry> getWarpsByCategory(String category)
Returns warps in the specified category.
Set<String> getCategories()
Returns all unique category names.
CompletableFuture<Boolean> createWarp(String name, Location location)
Creates a new warp at the given location (async).
CompletableFuture<Boolean> deleteWarp(String name)
Deletes the warp with the given name (async).
CompletableFuture<Boolean> updateWarp(WarpEntry warp)
Updates an existing warp's properties (async).
long getRemainingCooldown(UUID uuid)
Returns the remaining cooldown in seconds for the player.
CompletableFuture<Integer> getWarpUsage(UUID uuid, String warpName)
Returns the number of times the player has used the specified warp (async).
void reload()
Reloads all warps from the database.
Method Detail
public boolean isSystemEnabled()

Returns whether the warp system is globally enabled.

Returns:
booleantrue if warps are enabled in config
public Optional<WarpEntry> getWarp(String name)

Returns the warp with the given name, if it exists.

Parameters:
namethe warp name; must not be null
Returns:
Optional<WarpEntry>an Optional containing the warp, or empty if not found
public boolean warpExists(String name)

Returns whether a warp with the given name exists.

Parameters:
namethe warp name to check; must not be null
Returns:
booleantrue if the warp exists
public List<WarpEntry> getAllWarps()

Returns all warps including hidden ones.

Returns:
List<WarpEntry>an unmodifiable list of all warps; never null
public List<WarpEntry> getVisibleWarps()

Returns all non-hidden warps sorted alphabetically.

Returns:
List<WarpEntry>an unmodifiable list of visible warps; never null
public List<WarpEntry> getWarpsByCategory(String category)

Returns warps in the specified category.

Parameters:
categorythe category name; must not be null
Returns:
List<WarpEntry>an unmodifiable list of warps in the category; never null
public Set<String> getCategories()

Returns all unique category names.

Returns:
Set<String>an unmodifiable set of category names; never null
public CompletableFuture<Boolean> createWarp(String name, Location location)

Creates a new warp at the given location.

Warning: Do not block the main thread waiting on this future.
Parameters:
namethe unique warp name; must not be null
locationthe location to set; must not be null
Returns:
CompletableFuture<Boolean>a future resolving to true if created
public CompletableFuture<Boolean> deleteWarp(String name)

Deletes the warp with the given name.

Warning: Do not block the main thread waiting on this future.
Parameters:
namethe warp name to delete; must not be null
Returns:
CompletableFuture<Boolean>a future resolving to true if deleted
public CompletableFuture<Boolean> updateWarp(WarpEntry warp)

Updates an existing warp's properties.

Warning: Do not block the main thread waiting on this future.
Parameters:
warpthe warp entry with updated values; must not be null
Returns:
CompletableFuture<Boolean>a future resolving to true if updated
public long getRemainingCooldown(UUID uuid)

Returns the remaining cooldown in seconds for the player.

Parameters:
uuidthe player's UUID; must not be null
Returns:
longremaining cooldown in seconds, or 0 if none
public CompletableFuture<Integer> getWarpUsage(UUID uuid, String warpName)

Returns the number of times the player has used the specified warp.

Warning: Do not block the main thread waiting on this future.
Parameters:
uuidthe player's UUID; must not be null
warpNamethe warp name; must not be null
Returns:
CompletableFuture<Integer>a future resolving to the usage count
public void reload()

Reloads all warps from the database. Clears caches and re-reads from SQLite.

Warning: Must be called on the main thread.