Class HuntAPI

java.lang.Object
com.Moshu.TreasureHunt.Core.API.HuntAPI

public class HuntAPI extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static List<Hunt>
    Hunts here are guaranteed to be active
    static List<String>
    Hunt IDs from here are guaranteed to be active
    static List<Hunt>
    Treasures here are guaranteed to be active
    static Hunt
    getNearestHunt(org.bukkit.Location loc)
    Gets the nearest hunt at a location
    static Treasure
    getTreasure(org.bukkit.Location loc)
    Gets the treasure at a location
    static @NotNull ArrayList<TreasureData>
    About TreasureData TreasureData holds all the info from the treasure file It represents only the info of the treasure, not the actual treasure itself You can get info about TreasureKey, ItemRewards, CommandRewards, TreasureDebuff and TreasureKeepers from there If you need info about the treasure itself, you can get it from the Treasure class which is instantiated by starting a Hunt.
    static boolean
    Checks if a hunt is active with a specific identifier
    static boolean
    isHuntActive(org.bukkit.Location loc)
    Checks if a treasure is active at a location
    static boolean
    isNearTreasure(org.bukkit.entity.Player p)
    Checks if a player is near a treasure
    static boolean
    isTreasure(org.bukkit.Location loc)
    Checks if a location is a treasure
    static boolean
    isTreasureKey(org.bukkit.inventory.ItemStack itemStack)
    Checks if an item is a treasure key
    static Hunt
    startTreasureHunt(@NotNull org.bukkit.Location location, @NotNull String treasureIdentifier)
    Starts a treasure hunt at a specific location.
    startTreasureHuntAtRandomLocation(@NotNull String treasureIdentifier)
    Async method that starts a treasure hunt at a random location.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • HuntAPI

      public HuntAPI()
  • Method Details

    • getTreasureData

      @NotNull public static @NotNull ArrayList<TreasureData> getTreasureData()
      About TreasureData TreasureData holds all the info from the treasure file It represents only the info of the treasure, not the actual treasure itself You can get info about TreasureKey, ItemRewards, CommandRewards, TreasureDebuff and TreasureKeepers from there If you need info about the treasure itself, you can get it from the Treasure class which is instantiated by starting a Hunt.
      Returns:
      ArrayList of all the TreasureData (the data of all the treasure.yml files)
    • startTreasureHuntAtRandomLocation

      @Nullable public static CompletableFuture<Hunt> startTreasureHuntAtRandomLocation(@NotNull @NotNull String treasureIdentifier)
      Async method that starts a treasure hunt at a random location. Needs a valid treasure identifier or it will return null.
      Parameters:
      treasureIdentifier -
      Returns:
      a future that completes when the hunt has started (a location has been found for the treasure).
      Throws:
      TreasureAlreadyRunningException - if a treasure with the same identifier is already running. The location where the treasure will spawn depends on your treasure.yml and config.yml settings. The location is restricted within world boundaries, and cannot spawn in regions or unsafe places.
    • startTreasureHunt

      public static Hunt startTreasureHunt(@NotNull @NotNull org.bukkit.Location location, @NotNull @NotNull String treasureIdentifier)
      Starts a treasure hunt at a specific location.
      Parameters:
      location - the location where the treasure will spawn -- attention: this location still needs to be safe enough (inside world boundaries, not in regions, not on unsafe places) or the hunt will fail and won't start.
      treasureIdentifier - the treasure identifier (needs a valid identifier)
      Returns:
      a Hunt instance that already started
    • getActiveHunts

      public static List<Hunt> getActiveHunts()
      Hunts here are guaranteed to be active
      Returns:
      a list of all the hunts active
    • getActiveHuntsIdentifiers

      public static List<String> getActiveHuntsIdentifiers()
      Hunt IDs from here are guaranteed to be active
      Returns:
      a list of all the hunts' identifiers active
    • getActiveTreasures

      public static List<Hunt> getActiveTreasures()
      Treasures here are guaranteed to be active
      Returns:
      a list of all the treasures active
    • isHuntActive

      public static boolean isHuntActive(org.bukkit.Location loc)
      Checks if a treasure is active at a location
      Parameters:
      loc - the location to check
      Returns:
      true if a treasure is active at the location, false otherwise
    • getNearestHunt

      public static Hunt getNearestHunt(org.bukkit.Location loc)
      Gets the nearest hunt at a location
      Parameters:
      loc - the location to check
      Returns:
      the nearest hunt at the location, null if no hunt is active at the location
    • isTreasure

      public static boolean isTreasure(org.bukkit.Location loc)
      Checks if a location is a treasure
      Parameters:
      loc - the location to check
      Returns:
      true if the location is a treasure, false otherwise
    • getTreasure

      public static Treasure getTreasure(org.bukkit.Location loc)
      Gets the treasure at a location
      Parameters:
      loc - the location to check
      Returns:
      the treasure at the location, null if no treasure is at the location
    • isNearTreasure

      public static boolean isNearTreasure(org.bukkit.entity.Player p)
      Checks if a player is near a treasure
      Parameters:
      p - the player to check
      Returns:
      true if the player is near a treasure, false otherwise
    • isTreasureKey

      public static boolean isTreasureKey(org.bukkit.inventory.ItemStack itemStack)
      Checks if an item is a treasure key
      Parameters:
      itemStack - the item to check
      Returns:
      true if the item is a treasure key, false otherwise
    • isHuntActive

      public static boolean isHuntActive(String id)
      Checks if a hunt is active with a specific identifier
      Parameters:
      id - the identifier to check
      Returns:
      true if the hunt is active with the identifier, false otherwise