Package com.olziedev.playerwarps.api
Class PlayerWarpsAPI
java.lang.Object
com.olziedev.playerwarps.api.PlayerWarpsAPI
The main class for accessing and using the API.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract ItemStack
createConfigItem
(ConfigurationSection section, boolean containsTag) Use the plugin create item method for all type item creation support.abstract void
createPlayerWarp
(String name, WLocation location, WPlayer owner, WarpType type, CommandSender creator, Consumer<Warp> callback) Creates a player warp with the requested name.abstract void
createSafePlayerWarp
(String name, WLocation location, WPlayer owner, WarpType type, Player player, Consumer<Warp> callback) Creates a player warp with the requested name.abstract WLocation
createWarpLocation
(Location location) Creates a new location object from the Bukkit location object.abstract WLocation
createWarpLocation
(Location location, String server) Creates a new location object from the Bukkit location object.abstract CommandRegistry
abstract String
abstract UUID
abstract ExpansionRegistry
static PlayerWarpsAPI
Retrieve the instance of the API.static void
Waits for the instance of the API when it is ready.abstract Warp
getPlayerWarp
(String warpName, CommandSender sender) Retrieve the requested warp object.getPlayerWarps
(boolean showLocked) getPlayerWarps
(boolean showLocked, CommandSender sender) abstract Warp
getSponsorWarp
(String id, CommandSender sender) Retrieve the warp that is sponsoring the specified sponsor slot.abstract WCategory
getWarpCategory
(String category) abstract WPlayer
getWarpPlayer
(UUID uuid) abstract WarpSortType
abstract void
sendMessage
(CommandSender sender, String message) Use the plugin send message method for all type of syntax support.abstract Warp
updateWarp
(long id) Updates the current warp with its new data, if the warp doesn't exist then a new warp object will be created and added to the cache automatically.abstract WPlayer
updateWarpPlayer
(UUID uuid) Updates the current player with its new data, if the player isn't in cache then it won't do anything and return null.
-
Constructor Details
-
PlayerWarpsAPI
public PlayerWarpsAPI()
-
-
Method Details
-
getInstance
Retrieve the instance of the API.- Returns:
- The instance of the API.
-
getInstance
Waits for the instance of the API when it is ready.- Parameters:
api
- Callback with the instance of the API.
-
getPlayerWarp
Retrieve the requested warp object.- Parameters:
warpName
- The name of the warp to get.sender
- The command sender, this is to check if they can see specific warps or not.- Returns:
- The requested warp object.
-
getSponsorWarp
Retrieve the warp that is sponsoring the specified sponsor slot.- Parameters:
id
- The ID of that sponsor.sender
- The command sender, this is to check if they can see specific warps or not.- Returns:
- The warp that is sponsoring the specified sponsor slot.
-
createWarpLocation
Creates a new location object from the Bukkit location object.- Parameters:
location
- The location to be used to create a warp location.server
- The server the warp is on.- Returns:
- The warp location.
-
createWarpLocation
Creates a new location object from the Bukkit location object.- Parameters:
location
- The location to be used to create a warp location.- Returns:
- The warp location.
-
createPlayerWarp
public abstract void createPlayerWarp(String name, WLocation location, WPlayer owner, WarpType type, CommandSender creator, Consumer<Warp> callback) Creates a player warp with the requested name.- Parameters:
name
- The name of the warp.location
- The location of the warp, can usecreateWarpLocation(Location)
to create the location.owner
- The owner of the warp, set null to be a server warp.type
- The type of the warp being created.creator
- The creator who created the warp.callback
- Callback of the created warp instance.
-
createSafePlayerWarp
public abstract void createSafePlayerWarp(String name, WLocation location, WPlayer owner, WarpType type, Player player, Consumer<Warp> callback) Creates a player warp with the requested name. (using the checks the set command uses).- Parameters:
name
- The name of the warp.location
- The location of the warp, can usecreateWarpLocation(Location)
to create the location.owner
- The owner of the warp, set null to be a server warp.type
- The type of the warp being created.player
- The creator who created the warp.callback
- Callback of the created warp instance.
-
getPlayerWarps
- Parameters:
showLocked
- Add locked warps to the list.- Returns:
- List of the warps on the server.
-
getPlayerWarps
- Parameters:
showLocked
- Add locked warps to the list.sender
- The command sender, this is to check if they can see specific warps or not.- Returns:
- List of the warps on the server.
-
updateWarp
Updates the current warp with its new data, if the warp doesn't exist then a new warp object will be created and added to the cache automatically.- Parameters:
id
- An existing warp that needs to be updated.- Returns:
- The new updated cache version of the warp object.
-
updateWarpPlayer
Updates the current player with its new data, if the player isn't in cache then it won't do anything and return null.- Parameters:
uuid
- The player's UUID to update.- Returns:
- The new updated cache version of the player object.
-
getWarpCategory
- Parameters:
category
- The category name.- Returns:
- The requested category object.
-
getWarpCategories
- Returns:
- List of the currently loaded warp categories.
-
getWarpPlayer
- Parameters:
uuid
- The uuid of a player to get.- Returns:
- The requested warp player object.
-
getWarpPlayers
- Returns:
- List of the currently loaded warp players.
-
getExpansionRegistry
- Returns:
- The expansion registry to manage the plugin expansions.
-
getCommandRegistry
- Returns:
- The command registry to manage the plugin sub-commands.
-
sendMessage
Use the plugin send message method for all type of syntax support.- Parameters:
sender
- The entity who will receive the message.message
- The message.
-
createConfigItem
Use the plugin create item method for all type item creation support.- Parameters:
section
- The configuration section to get the item from.containsTag
- If the item contains a tag.- Returns:
- The item from the configuration section.
-
getWarpSortType
- Returns:
- The default warp sort type from the configuration.
-
getConsoleName
- Returns:
- The default console name from the configuration.
-
getConsoleUUID
- Returns:
- The default console uuid from the configuration.
-