Class Whitelist

java.lang.Object
java.util.AbstractMap<org.bukkit.World,WhitelistedWorld>
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 whitelisted worlds.
Version:
3.3
Author:
Andross
See Also:
  • Constructor Details

    • Whitelist

      public Whitelist(@NotNull @NotNull BanItem plugin, @NotNull @NotNull BanDatabase database, @NotNull @NotNull org.bukkit.command.CommandSender sender, @Nullable @Nullable org.bukkit.configuration.ConfigurationSection section)
      Constructor for a whitelist map.
      Parameters:
      plugin - 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 @NotNull WhitelistedWorld createNewWhitelistedWorld(@NotNull @NotNull org.bukkit.World world, @Nullable @Nullable List<String> messages, @Nullable @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 whitelisted world object
    • getOrCreateWhitelistedWorld

      public WhitelistedWorld getOrCreateWhitelistedWorld(@NotNull @NotNull org.bukkit.World world, @Nullable @Nullable List<String> messages, @Nullable @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 whitelisted world object, otherwise a new one
    • addNewException

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

      public boolean isWhitelisted(@NotNull @NotNull org.bukkit.entity.Player player, @Nullable @Nullable org.bukkit.Location location, @NotNull @NotNull BannedItem item, boolean sendMessage, @NotNull @NotNull BanAction action, @Nullable @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 @NotNull org.bukkit.World world, @NotNull @NotNull BannedItem item, @NotNull @NotNull BanAction action, @Nullable @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
    • getTotalWhitelistedItems

      public int getTotalWhitelistedItems()
      The total amount of items allowed, in all worlds.
      Returns:
      The total amount of items allowed, in all worlds