Class PlayerWarpsAPI

java.lang.Object
com.olziedev.playerwarps.api.PlayerWarpsAPI

public abstract class PlayerWarpsAPI extends Object
The main class for accessing and using the API.
  • Constructor Details

    • PlayerWarpsAPI

      public PlayerWarpsAPI()
  • Method Details

    • getInstance

      public static PlayerWarpsAPI getInstance()
      Retrieve the instance of the API.
      Returns:
      The instance of the API.
    • getInstance

      public static void getInstance(Consumer<PlayerWarpsAPI> api)
      Waits for the instance of the API when it is ready.
      Parameters:
      api - Callback with the instance of the API.
    • getPlayerWarp

      public abstract Warp getPlayerWarp(String warpName, CommandSender sender)
      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

      public abstract Warp getSponsorWarp(String id, CommandSender sender)
      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

      public abstract WLocation createWarpLocation(Location location, String server)
      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

      public abstract WLocation createWarpLocation(Location location)
      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 use createWarpLocation(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 use createWarpLocation(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

      public abstract List<Warp> getPlayerWarps(boolean showLocked)
      Parameters:
      showLocked - Add locked warps to the list.
      Returns:
      List of the warps on the server.
    • getPlayerWarps

      public abstract List<Warp> getPlayerWarps(boolean showLocked, CommandSender sender)
      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

      public 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.
      Parameters:
      id - An existing warp that needs to be updated.
      Returns:
      The new updated cache version of the warp object.
    • updateWarpPlayer

      public 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.
      Parameters:
      uuid - The player's UUID to update.
      Returns:
      The new updated cache version of the player object.
    • getWarpCategory

      public abstract WCategory getWarpCategory(String category)
      Parameters:
      category - The category name.
      Returns:
      The requested category object.
    • getWarpCategories

      public abstract List<WCategory> getWarpCategories()
      Returns:
      List of the currently loaded warp categories.
    • getWarpPlayer

      public abstract WPlayer getWarpPlayer(UUID uuid)
      Parameters:
      uuid - The uuid of a player to get.
      Returns:
      The requested warp player object.
    • getWarpPlayers

      public abstract List<WPlayer> getWarpPlayers()
      Returns:
      List of the currently loaded warp players.
    • getExpansionRegistry

      public abstract ExpansionRegistry getExpansionRegistry()
      Returns:
      The expansion registry to manage the plugin expansions.
    • getCommandRegistry

      public abstract CommandRegistry getCommandRegistry()
      Returns:
      The command registry to manage the plugin sub-commands.
    • sendMessage

      public abstract void sendMessage(CommandSender sender, String message)
      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

      public abstract ItemStack createConfigItem(ConfigurationSection section, boolean containsTag)
      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

      public abstract WarpSortType getWarpSortType()
      Returns:
      The default warp sort type from the configuration.
    • getConsoleName

      public abstract String getConsoleName()
      Returns:
      The default console name from the configuration.
    • getConsoleUUID

      public abstract UUID getConsoleUUID()
      Returns:
      The default console uuid from the configuration.