Package fr.andross.banitem.database
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>
Map that contains the blacklisted items
- 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
ConstructorDescriptionBlacklist
(BanItem pl, BanDatabase database, org.bukkit.command.CommandSender sender, org.bukkit.configuration.ConfigurationSection section) Constructor for a blacklist map -
Method Summary
Modifier and TypeMethodDescriptionvoid
addNewBan
(org.bukkit.World world, BannedItem item, Map<BanAction, BanActionData> map) This will add a new entry to the blacklist.getBanActions
(org.bukkit.World world, BannedItem item) Trying to get the ban actions with their respective ban actions data for this item in the said world.getBanData
(org.bukkit.World world, BannedItem item, BanAction action) Try to get the ban actions data for this item with this action.int
getTotal()
boolean
isBlacklisted
(org.bukkit.entity.Player player, org.bukkit.Location location, BannedItem item, boolean sendMessage, BanAction action, BanData... data) Check if the action with the item is blacklisted for the player.boolean
isBlacklisted
(org.bukkit.World world, BannedItem item, BanAction action, 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 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
-
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 instancedatabase
- the database instancesender
-CommandSender
to send the debug messages tosection
-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 containingBanAction
and their respectiveBanActionData
-
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 involvedlocation
- the effective location where the action occurs, using player location if nullitem
- the banned itemsendMessage
- send a message to the player if bannedaction
- action to checkdata
- 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 worlditem
- the banned itemaction
- ban actiondata
- 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
-