Class Blacklist

java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<org.bukkit.World,Items>
fr.andross.banitem.database.Blacklist
All Implemented Interfaces:
Serializable, Cloneable, Map<org.bukkit.World,Items>

public final class Blacklist extends HashMap<org.bukkit.World,Items>
Map that contains the blacklisted items
Version:
3.3
Author:
Andross
See Also:
  • Constructor Details

    • Blacklist

      public Blacklist(@NotNull BanItem pl, @NotNull BanDatabase database, @NotNull org.bukkit.command.CommandSender sender, @Nullable org.bukkit.configuration.ConfigurationSection section)
      Constructor for a blacklist map
      Parameters:
      pl - the main instance
      database - the database instance
      sender - CommandSender to send the debug messages to
      section - ConfigurationSection which contains the blacklist node
  • Method Details

    • addNewBan

      public void addNewBan(@NotNull org.bukkit.World world, @NotNull BannedItem item, @NotNull Map<BanAction,BanActionData> map)
      This will add a new entry to the blacklist.
      Parameters:
      world - bukkit world (World)
      item - banned item (BannedItem)
      map - map containing BanAction and their respective BanActionData
    • getBanData

      @Nullable public BanActionData getBanData(@NotNull org.bukkit.World world, @NotNull BannedItem item, @NotNull BanAction action)
      Try to get the ban actions data for this item with this action.
      Parameters:
      world - bukkit world (World)
      item - banned item (BannedItem)
      action - the ban action (BanAction)
      Returns:
      the BanActionData object if the item is banned, or null if there is no banned action for this item with this action in this world
    • getBanActions

      @Nullable public Map<BanAction,BanActionData> getBanActions(@NotNull org.bukkit.World world, @NotNull BannedItem item)
      Trying to get the ban actions with their respective ban actions data for this item in the said world.
      Parameters:
      world - bukkit world (World)
      item - banned item (BannedItem)
      Returns:
      a map containing the ban action types and their respective ban actions, or null if this item is not banned in this world
    • isBlacklisted

      public boolean isBlacklisted(@NotNull org.bukkit.entity.Player player, @Nullable org.bukkit.Location location, @NotNull BannedItem item, boolean sendMessage, @NotNull BanAction action, @Nullable BanData... data)
      Check if the action with the item is blacklisted for the player.
      Parameters:
      player - player involved
      location - the effective location where the action occurs, using player location if null
      item - the banned item
      sendMessage - send a message to the player if banned
      action - action to check
      data - some ban data
      Returns:
      true if the item is blacklisted for the player world, otherwise false
    • isBlacklisted

      public boolean isBlacklisted(@NotNull org.bukkit.World world, @NotNull BannedItem item, @NotNull BanAction action, @Nullable BanData... data)
      This method is used to check if the item is banned, not involving a player This method is mainly used to check dispensers dispense and hoppers transfer
      Parameters:
      world - bukkit world
      item - the banned item
      action - ban action
      data - optional ban data
      Returns:
      true if the item is blacklisted for the player world, otherwise false
    • getTotal

      public int getTotal()
      Returns:
      the total amount of banned items in all worlds