Package de.marcely.bedwars.api.levelshop
Class LevelShopAPI
java.lang.Object
de.marcely.bedwars.api.levelshop.LevelShopAPI
Base-API class for the LevelShop addon.
-
Method Summary
Modifier and TypeMethodDescriptionstatic LevelShopAPIget()Get the global instance of its API.intgetDroppingOrbsLvlAmount(DropType dropType) Get the amount of orbs (in levels) a given drop type will drop.Get the drop handler that is used for spawners to drop orbs.intgetPickupItemLvlAmount(DropType dropType) Get the amount of level a player will earn if it will pick up a dropped item.intgetTotalExp(int level) Calculates the total needed EXP needed to reach this level.voidplayLevelSound(Player player, Location loc, int newLevel) Plays orb and level sounds the same way vanilla does it.voidsetEarnedLevel(Player player, Location loc, int newLevel) Changes the player's level while playing vanilla's orb and level sounds.
-
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
Plays orb and level sounds the same way vanilla does it.- Parameters:
player- The player who reached the levelloc- The location where the orb was picked up fromnewLevel- The level that was reached
-
setEarnedLevel
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 levelloc- The location where the orb was picked up fromnewLevel- The level that was reached
-
getDroppingOrbsLvlAmount
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
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
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
Get the global instance of its API.- Returns:
- The global instance
-