Class Whitelist

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

public class Whitelist extends HashMap<org.bukkit.World,WhitelistedWorld>
Map that contains whitelistedworlds
Version:
3.3
Author:
Andross
See Also:
  • Constructor Details

    • Whitelist

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

    • createNewWhitelistedWorld

      @NotNull public WhitelistedWorld createNewWhitelistedWorld(@NotNull org.bukkit.World world, @Nullable List<String> messages, @Nullable List<BanAction> ignored)
      This method will create a new whitelisted world, and add/replace it into the map
      Parameters:
      world - the bukkit world
      messages - list of "not allowed" messages
      ignored - list of ignored actions
      Returns:
      the new whitelistedworld object
    • getOrCreateWhitelistedWorld

      public WhitelistedWorld getOrCreateWhitelistedWorld(@NotNull org.bukkit.World world, @Nullable List<String> messages, @Nullable List<BanAction> ignored)
      This method try to get an already existing whitelisted world, else create and put one.
      Parameters:
      world - the bukkit world
      messages - list of "not allowed" messages
      ignored - list of ignored actions
      Returns:
      an existing whitelistedworld object, otherwise a new one
    • addNewException

      public void addNewException(@NotNull WhitelistedWorld ww, @NotNull BannedItem item, @NotNull Map<BanAction,BanActionData> actions)
      This will add a new exception (allowed item) into the WhitelistedWorld object.
      Parameters:
      ww - whitelistedworld, can be get with getOrCreateWhitelistedWorld(World, List, List)
      item - the item
      actions - actions with their respective datas
    • isWhitelisted

      public boolean isWhitelisted(@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 item is whitelisted (allowed)
      Parameters:
      player - player involved
      location - the effective location where the action occurs
      item - the banned item
      sendMessage - send a message to the player if not allowed
      action - the action
      data - optional ban data
      Returns:
      true if the item is whitelisted (allowed), otherwise false
    • isWhitelisted

      public boolean isWhitelisted(@NotNull org.bukkit.World world, @NotNull BannedItem item, @NotNull BanAction action, @Nullable BanData... data)
      This method is used to check if the item is whitelisted, 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 - the action
      data - optional ban data
      Returns:
      true if the item is whitelisted (allowed), otherwise false
    • getTotal

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