Package ch.njol.skript.bukkitutil
Class PlayerUtils
java.lang.Object
ch.njol.skript.bukkitutil.PlayerUtils
Contains utility methods related to players
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanstatic intgetCumulativeXP(int level) Gets the cumulative experience needed to reach the given level, but no further.static intgetLevelXP(int level) Gets the experience points needed to reach the next level, starting at the given level.static Collection<? extends Player> Deprecated.static intgetTotalXP(int level, double progress) Gets the total experience points needed to reach the given level, including the given progress.static intgetTotalXP(Player player) Gets the total experience points of the given player.static voidsetTotalXP(Player player, int experience) Sets the total experience points of the given player.static voidupdateInventory(@Nullable Player player) Updates the clients inventory within a tick, usingPlayer.updateInventory().
-
Constructor Details
-
PlayerUtils
public PlayerUtils()
-
-
Method Details
-
updateInventory
Updates the clients inventory within a tick, usingPlayer.updateInventory(). Recommended over directly calling the update method, as multiple calls to this method within a short timespan will not send multiple updates to the client. -
getOnlinePlayers
Deprecated.useBukkit.getOnlinePlayers()instead -
canEat
-
getLevelXP
public static int getLevelXP(int level) Gets the experience points needed to reach the next level, starting at the given level. E.g. getLevelXP(30) returns the experience points needed to reach level 31 from level 30.- Parameters:
level- The starting level- Returns:
- The experience points needed to reach the next level
-
getCumulativeXP
public static int getCumulativeXP(int level) Gets the cumulative experience needed to reach the given level, but no further. E.g. getCumulativeXP(30) returns the experience points needed to reach level 30 from level 0.- Parameters:
level- The level to get the cumulative XP for- Returns:
- The experience points needed to reach the given level
-
getTotalXP
public static int getTotalXP(int level, double progress) Gets the total experience points needed to reach the given level, including the given progress. E.g. getTotalXP(30, 0.5) returns the experience points needed to reach level 30 from level 0, and have a half-full xp bar.- Parameters:
level- The level to get the total XP ofprogress- The progress towards the next level, between 0 and 1- Returns:
- The total experience points needed to reach the given level and progress
-
getTotalXP
Gets the total experience points of the given player.- Parameters:
player- The player to get the total XP of- Returns:
- The total experience points of the given player
-
setTotalXP
Sets the total experience points of the given player.- Parameters:
player- The player to set the total XP ofexperience- The total experience points to set
-
Bukkit.getOnlinePlayers()instead