Class LevelShopAPI

java.lang.Object
de.marcely.bedwars.api.levelshop.LevelShopAPI

public class LevelShopAPI extends Object
Base-API class for the LevelShop addon.
  • Method Details

    • getTotalExp

      public int getTotalExp(int level)
      Calculates the total needed EXP needed to reach this level.
      Parameters:
      level - The level to be reached
      Returns:
      The amount of total EXP needed
    • playLevelSound

      public void playLevelSound(Player player, Location loc, int newLevel)
      Plays orb and level sounds the same way vanilla does it.
      Parameters:
      player - The player who reached the level
      loc - The location where the orb was picked up from
      newLevel - The level that was reached
    • setEarnedLevel

      public void setEarnedLevel(Player player, Location loc, int newLevel)
      Changes the player's level while playing vanilla's orb and level sounds.

      Use this over Player.setLevel(int) since Bukkit's API expects you to also set multiple attributes, which can cause desyncs (poor API). This method keeps care of that.

      Orb and level sounds are only played if the player's level actually increases.

      Parameters:
      player - The player who reached the level
      loc - The location where the orb was picked up from
      newLevel - The level that was reached
    • getDroppingOrbsLvlAmount

      public int getDroppingOrbsLvlAmount(DropType dropType)
      Get the amount of orbs (in levels) a given drop type will drop.

      The value depends on the server's configuration.

      Parameters:
      dropType - The drop type to check
      Returns:
      The amount of levels it will drop or 0 if it doesn't drop any
    • getPickupItemLvlAmount

      public int getPickupItemLvlAmount(DropType dropType)
      Get the amount of level a player will earn if it will pick up a dropped item.
      Parameters:
      dropType - The drop type to check that drops items
      Returns:
      The amount of level the player will earn or 0 if he doesn't earn any
    • getOrbsDropHandler

      public CustomDropTypeHandler getOrbsDropHandler()
      Get the drop handler that is used for spawners to drop orbs.
      Returns:
      The global instance used to replace a spawner's dropping functionality
      See Also:
    • get

      public static LevelShopAPI get()
      Get the global instance of its API.
      Returns:
      The global instance