Class PlayerUtil

java.lang.Object
com.kamikazejam.kamicommon.util.PlayerUtil

public class PlayerUtil extends Object
Utility class for helping with players You can give items (which drop near them if they are full), and clean their inventory (with or without armor)
  • Constructor Details

    • PlayerUtil

      public PlayerUtil()
  • Method Details

    • emptyInventory

      public static boolean emptyInventory(Player player)
      If the player's inventory is empty (Includes armor slots in the check)
      Parameters:
      player - The player to check
      Returns:
      If the inventory was empty
    • emptyInventory

      public static boolean emptyInventory(Player player, boolean checkArmor)
      If the player's inventory is empty
      Parameters:
      player - The player to check
      checkArmor - If the armor slots should be included in the check
      Returns:
      If the inventory was empty
    • giveItems

      public static void giveItems(Player player, ItemStack... itemStacks)
    • giveItem

      public static void giveItem(Player player, ItemStack itemStack)
    • stackItem

      @Nullable public static @Nullable ItemStack stackItem(Player player, ItemStack itemStack)
    • takeItems

      public static boolean takeItems(Player player, boolean enforceQuantities, ItemStack... itemStacks)
      Will try to take the items from the player's inventory
      Parameters:
      enforceQuantities - If we should fail if we cannot take all the items
      Returns:
      True IFF all items were taken
    • canTakeItems

      public static boolean canTakeItems(Player player, ItemStack... itemStacks)
    • isFullyValidPlayer

      public static boolean isFullyValidPlayer(@Nullable @Nullable Player player)
      Returns:
      true IFF (player != null AND player.isOnline() AND player.isValid())