Class BoosterManager

java.lang.Object
nl.minetopiasdb.api.boosters.BoosterManager

public class BoosterManager extends Object
Class responsible for managing boosters
  • Constructor Details

    • BoosterManager

      public BoosterManager()
  • Method Details

    • getInstance

      public static BoosterManager getInstance()
      Get the instance of BoosterManager
      Returns:
      instance of booster manager
    • getBoosters

      public List<Boost> getBoosters(UUID uuid, BoostType type)
      Get a list of all boosts a player has
      Parameters:
      uuid - UUID of player
      type - boost type
      Returns:
      list of boosts
    • addBoost

      public void addBoost(UUID uuid, BoostType type, int percentage)
      Add a boost to provided player
      Parameters:
      uuid - uuid of player
      type - boost type
      percentage - percentage of the boost
    • addBoost

      public void addBoost(UUID uuid, BoostType type, int percentage, int amount)
      Add multiple boosts to provided player
      Parameters:
      uuid - uuid of player
      type - boost type
      percentage - percentage of the boost
      amount - amount of boosters that need to be added
    • removeBoost

      public void removeBoost(int rowId)
      Remove the boost with provided id
      Parameters:
      rowId - id of booster
    • removeBoost

      public boolean removeBoost(UUID uuid, BoostType type, int percentage)
      Remove a booster with provided UUID and percentage
      Parameters:
      uuid - uuid of player
      type - boost type
      percentage - percentage of boost
      Returns:
      true if a boost was found and deleted
    • clearBoosts

      public void clearBoosts(UUID uuid, BoostType type)
      Remove all boosts that a player has
      Parameters:
      uuid - uuid of player
      type - boost type
    • getLastActivatedBoost

      public ActiveBoost getLastActivatedBoost(BoostType type)
      Get the last activated booster
      Parameters:
      type - boost type
      Returns:
      active boost object
    • getActiveBoosts

      public List<ActiveBoost> getActiveBoosts()
      Get a list of currently active boosters
      Returns:
      list of active boosts
    • getActiveBoosts

      public List<ActiveBoost> getActiveBoosts(BoostType type)
      Get a list of currently active boosters of a specific type
      Parameters:
      type - boost type
      Returns:
      list of active boosts
    • startBoost

      public ActiveBoost startBoost(UUID uuid, BoostType type, int percentage)
      Start a booster
      Parameters:
      uuid - uuid of booster activator
      type - boost type
      percentage - boost percentage
      Returns:
      active boost object for the just activated boost object
    • pullActiveBoosts

      public void pullActiveBoosts()
      Pull the currently active boosters to the database. Used on server startup and when a booster gets activated in a different MT server (and communicates that through the messagechannels)
    • deleteExpiredBoosts

      public void deleteExpiredBoosts()
      Delete expired boosters
    • getBar

      public BoostBar getBar(BoostType type)
      Get the boost bar for the specified boosttype
      Parameters:
      type - boost type
      Returns:
      boost bar
    • getTotalBoost

      public int getTotalBoost(BoostType type)
      Get the total percentage of active boosts
      Parameters:
      type - boost type
      Returns:
      total boost percentage of active boosts