Package fr.andross.banitem.database
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>
Map that contains whitelistedworlds
- Version:
- 3.3
- Author:
- Andross
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,
V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Constructor Summary
ConstructorDescriptionWhitelist
(BanItem pl, BanDatabase database, org.bukkit.command.CommandSender sender, org.bukkit.configuration.ConfigurationSection section) Constructor for a whitelist map -
Method Summary
Modifier and TypeMethodDescriptionvoid
addNewException
(WhitelistedWorld ww, BannedItem item, Map<BanAction, BanActionData> actions) This will add a new exception (allowed item) into the WhitelistedWorld object.createNewWhitelistedWorld
(org.bukkit.World world, List<String> messages, List<BanAction> ignored) This method will create a new whitelisted world, and add/replace it into the mapgetOrCreateWhitelistedWorld
(org.bukkit.World world, List<String> messages, List<BanAction> ignored) This method try to get an already existing whitelisted world, else create and put one.int
getTotal()
boolean
isWhitelisted
(org.bukkit.entity.Player player, org.bukkit.Location location, BannedItem item, boolean sendMessage, BanAction action, BanData... data) Check if the item is whitelisted (allowed)boolean
isWhitelisted
(org.bukkit.World world, BannedItem item, BanAction action, 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 transferMethods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
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 instancedatabase
- the database instancesender
-CommandSender
who to send the debug messagessection
-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 worldmessages
- list of "not allowed" messagesignored
- 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 worldmessages
- list of "not allowed" messagesignored
- 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 withgetOrCreateWhitelistedWorld(World, List, List)
item
- the itemactions
- 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 involvedlocation
- the effective location where the action occursitem
- the banned itemsendMessage
- send a message to the player if not allowedaction
- the actiondata
- 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 worlditem
- the banned itemaction
- the actiondata
- 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
-