Class BanUtils

java.lang.Object
fr.andross.banitem.BanUtils

public final class BanUtils extends Object
An utility class for the plugin
Version:
3.4
Author:
Andross
  • Method Details

    • getBanActionsFromItemSection

      @NotNull public Map<BanAction,BanActionData> getBanActionsFromItemSection(@NotNull List<org.bukkit.World> worlds, @Nullable org.bukkit.configuration.ConfigurationSection section, @NotNull Debug d)
      Get a map of actions and actions data from a section
      Parameters:
      worlds - list of worlds
      section - section
      d - debug
      Returns:
      a map containing the ban actions and their respective data from the ConfigurationSection
    • getBanActionsForItem

      @NotNull public BanActionData getBanActionsForItem(@NotNull List<org.bukkit.World> worlds, @NotNull org.bukkit.configuration.ConfigurationSection itemSection, @NotNull String key, @NotNull Debug d)
      Get ban actions data for a section
      Parameters:
      worlds - list of worlds, used for regions
      itemSection - the action section
      key - the current data key
      d - debug
      Returns:
      actions data from the section of the specific action
    • deleteItemFromInventoryView

      public void deleteItemFromInventoryView(@NotNull org.bukkit.entity.Player player)
      Method to check and delete banned item from the player opened inventories
      Parameters:
      player - any player
    • sendMessage

      public void sendMessage(@NotNull org.bukkit.entity.Player player, @NotNull String itemName, @NotNull BanAction action, @Nullable BanActionData data)
      This method is used to send a ban message to player, if exists. Mainly used for blacklist
      Parameters:
      player - player involved in the action
      itemName - the item name involved
      action - the ban action (used for log)
      data - the ban data (containing the messages)
    • sendMessage

      public void sendMessage(@NotNull org.bukkit.entity.Player player, @NotNull BanAction action, @NotNull List<String> messages)
      This method is used to send a ban message to player, if exists. Mainly used for whitelist
      Parameters:
      player - send the message to
      action - the ban action (used for log)
      messages - list of messages
    • hasPermission

      public boolean hasPermission(@NotNull org.bukkit.entity.Player player, @NotNull String itemName, @NotNull BanAction action, @Nullable BanData... data)
      Method to check if the player has the bypass permission for either the item (material name) or custom name
      Parameters:
      player - player to check
      itemName - name of the item
      action - action name
      data - additional data to check
      Returns:
      true if the player has the permission to bypass the ban, otherwise false
    • getCooldownString

      @NotNull public String getCooldownString(long time)
      Get a friendly string of remaining time
      Parameters:
      time - time in millis
      Returns:
      a friendly string of remaining time
    • checkPlayerArmors

      public void checkPlayerArmors(org.bukkit.entity.Player p)
      Used to check a player armor inventory
      Parameters:
      p - player
    • checkPlayerIllegalStacks

      public void checkPlayerIllegalStacks(@NotNull org.bukkit.entity.Player p)
      Used to check if a player has an illegal stacked item
      Parameters:
      p - player
    • giveItemBack

      public void giveItemBack(@NotNull org.bukkit.entity.Player p, @NotNull org.bukkit.inventory.ItemStack item)
      Method to give an item back to the player, drop it if the inventory is full
      Parameters:
      p - the player
      item - the item
    • sendMessage

      public void sendMessage(@NotNull org.bukkit.command.CommandSender sender, @Nullable String message)
      Sending a prefixed and colored (if player) message to sender
      Parameters:
      sender - sender
      message - message
    • checkForUpdate

      public void checkForUpdate()
      Send a message if an update is available This must be executed async
    • getWearScanner

      @NotNull public WearScanner getWearScanner()
      Get the WearScanner handler
      Returns:
      the wear scanner handler
    • getIllegalStackScanner

      @NotNull public IllegalStackScanner getIllegalStackScanner()
      Get the IllegalStackScanner handler
      Returns:
      the illegal stack scanner handler
    • getCommandsAliases

      @NotNull public Map<String,String> getCommandsAliases()
      Get the sub commands aliases
      Returns:
      the sub commands aliases
    • getMessagesCooldown

      @NotNull public Map<UUID,Long> getMessagesCooldown()
      Get the messages cooldown map
      Returns:
      map containing the cooldowns for messages
    • getLogging

      @NotNull public Set<UUID> getLogging()
      This map contains the players who activated the log in game with /banitem log Players which log mode is activated will receive the logs messages for the banned items, if set in config
      Returns:
      set of players uuid