Package org.kingdoms.utils
Class PlayerUtils
java.lang.Object
org.kingdoms.utils.PlayerUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcachePlayer(org.bukkit.entity.Player player) static voiddamageArmor(org.bukkit.entity.LivingEntity entity, int armorDamage) static intfindEmptyHotbarSlot(org.bukkit.entity.Player player) static intgetAveragePing(org.bukkit.entity.Player player) static org.bukkit.OfflinePlayergetFirstPlayerThat(Predicate<org.bukkit.OfflinePlayer> predicate) static org.bukkit.inventory.ItemStackgetHotbarItem(org.bukkit.entity.Player player, int slot) static StringgetLocale(org.bukkit.entity.Player player) static doublegetMaxPlayerHealth(@NonNull org.bukkit.entity.LivingEntity entity) static @Nullable org.bukkit.OfflinePlayergetOfflinePlayer(@NonNull String name) static org.bukkit.OfflinePlayergetOfflinePlayerWarn(org.bukkit.entity.Player player, String name) static intgetPing(org.bukkit.entity.Player player) static @Nullable org.bukkit.entity.Playerstatic org.bukkit.entity.LivingEntitygetTargetedEntity(org.bukkit.entity.Player player, double minRange) static booleanhasFullHealth(@NonNull org.bukkit.entity.LivingEntity entity) Checks if the player has full healths.static voidinit()Init early so it doesn't start when the server is fully loaded.static booleaninvulnerableGameMode(@NonNull org.bukkit.entity.Player player) static booleanisEffectivelyInvisible(org.bukkit.entity.Player player) static voidsendBlockChange(@NonNull org.bukkit.entity.Player player, @NonNull org.bukkit.block.Block block) static voidsendBlockChange(@NonNull org.bukkit.entity.Player player, @NonNull org.bukkit.Location loc, @NonNull com.cryptomorin.xseries.XMaterial xMat) static StringvalidateOfflineName(org.bukkit.OfflinePlayer player)
-
Constructor Details
-
PlayerUtils
public PlayerUtils()
-
-
Method Details
-
init
public static void init()Init early so it doesn't start when the server is fully loaded. -
cachePlayer
public static void cachePlayer(org.bukkit.entity.Player player) -
getMaxPlayerHealth
public static double getMaxPlayerHealth(@NonNull org.bukkit.entity.LivingEntity entity) - Parameters:
entity- the entity to get the max health of.- Returns:
- entity's maximum health amount.
-
damageArmor
public static void damageArmor(org.bukkit.entity.LivingEntity entity, int armorDamage) -
sendBlockChange
public static void sendBlockChange(@NonNull org.bukkit.entity.Player player, @NonNull org.bukkit.Location loc, @NonNull com.cryptomorin.xseries.XMaterial xMat) -
sendBlockChange
public static void sendBlockChange(@NonNull org.bukkit.entity.Player player, @NonNull org.bukkit.block.Block block) -
invulnerableGameMode
public static boolean invulnerableGameMode(@NonNull org.bukkit.entity.Player player) -
findEmptyHotbarSlot
public static int findEmptyHotbarSlot(org.bukkit.entity.Player player) -
getHotbarItem
public static org.bukkit.inventory.ItemStack getHotbarItem(org.bukkit.entity.Player player, int slot) -
getAveragePing
public static int getAveragePing(org.bukkit.entity.Player player) -
getPing
public static int getPing(org.bukkit.entity.Player player) -
getFirstPlayerThat
public static org.bukkit.OfflinePlayer getFirstPlayerThat(Predicate<org.bukkit.OfflinePlayer> predicate) -
getLocale
-
getOfflinePlayer
-
getOfflinePlayerWarn
public static org.bukkit.OfflinePlayer getOfflinePlayerWarn(org.bukkit.entity.Player player, String name) -
getPlayer
-
hasFullHealth
public static boolean hasFullHealth(@NonNull org.bukkit.entity.LivingEntity entity) Checks if the player has full healths.- Parameters:
entity- the entity to check the health of.
-
isEffectivelyInvisible
public static boolean isEffectivelyInvisible(org.bukkit.entity.Player player) -
validateOfflineName
-
getTargetedEntity
public static org.bukkit.entity.LivingEntity getTargetedEntity(org.bukkit.entity.Player player, double minRange)
-