public final class BanItemAPI extends Object
IMPORTANT:
This api is loaded on next tick after server load, to allow other custom worlds plugins to load worlds. So this API is not available on server load, but will be on next available tick!
If you add/remove any action from a map (blacklist/whitelist), you have to reload the plugin listeners
so it can handle correctly the actions, using BanListener.load(CommandSender)
()}
Modifier and Type | Method and Description |
---|---|
void |
addMetaItem(String name,
org.bukkit.inventory.ItemStack item)
Add an ItemStack as a meta item and save it in metaitems.yml
Will replace existing value
|
boolean |
addToBlacklist(BannedItem item,
Map<BanAction,BanActionData> actions,
org.bukkit.World... worlds)
Add a new banned item to blacklist and save the config file used.
|
boolean |
addToBlacklist(Collection<? extends BannedItem> items,
Map<BanAction,BanActionData> actions,
org.bukkit.World... worlds)
Add the banned items to the blacklist and save the config file used
|
boolean |
addToWhitelist(WhitelistedWorld ww,
BannedItem item,
Map<BanAction,BanActionData> actions)
Add an item on the whitelist of a world and save in the used config
|
Blacklist |
getBlacklist() |
BannedItem |
getCustomItem(String metaName)
Get a BannedItem object for the meta item named metaName.
|
CustomItems |
getCustomItems() |
BanDatabase |
getDatabase()
Get the BanItem database, containing blacklist, whitelist, custom items and meta items.
|
static BanItemAPI |
getInstance()
Get a static instance of the api.
|
String |
getMetaItemName(BannedItem item)
Try to get the meta item name of the given item.
|
String |
getMetaItemName(org.bukkit.inventory.ItemStack item)
Try to get the meta item name of the given item.
|
Whitelist |
getWhitelist() |
boolean |
isBanned(org.bukkit.entity.Player player,
BannedItem item,
BanAction action,
BanData... data)
Check if the BannedItem object is banned, in both blacklist and whitelist.
|
boolean |
isBanned(org.bukkit.entity.Player player,
BannedItem item,
boolean sendMessage,
BanAction action,
BanData... data)
Check if the BannedItem object is banned, in both blacklist and whitelist.
|
boolean |
isBanned(org.bukkit.entity.Player player,
org.bukkit.inventory.ItemStack item,
BanAction action,
BanData... data)
Check if the ItemStack is banned, in both blacklist and whitelist.
|
boolean |
isBanned(org.bukkit.entity.Player player,
org.bukkit.inventory.ItemStack item,
boolean sendMessage,
BanAction action,
BanData... data)
Check if the ItemStack is banned, in both blacklist and whitelist.
|
boolean |
isBanned(org.bukkit.entity.Player player,
org.bukkit.Location loc,
BannedItem item,
BanAction action,
BanData... data)
Check if the BannedItem object is banned, in both blacklist and whitelist.
|
boolean |
isBanned(org.bukkit.entity.Player player,
org.bukkit.Location loc,
BannedItem item,
boolean sendMessage,
BanAction action,
BanData... data)
Check if the BannedItem object is banned, in both blacklist and whitelist.
|
boolean |
isBanned(org.bukkit.entity.Player player,
org.bukkit.Location loc,
org.bukkit.inventory.ItemStack item,
BanAction action,
BanData... data)
Check if the ItemStack is banned, in both blacklist and whitelist.
|
boolean |
isBanned(org.bukkit.entity.Player player,
org.bukkit.Location loc,
org.bukkit.inventory.ItemStack item,
boolean sendMessage,
BanAction action,
BanData... data)
Check if the ItemStack is banned, in both blacklist and whitelist.
|
boolean |
isBanned(org.bukkit.entity.Player player,
org.bukkit.Location loc,
org.bukkit.Material m,
BanAction action,
BanData... data)
Check if the material is banned, in both blacklist and whitelist.
|
boolean |
isBanned(org.bukkit.entity.Player player,
org.bukkit.Location loc,
org.bukkit.Material m,
boolean sendMessage,
BanAction action,
BanData... data)
Check if the material is banned, in both blacklist and whitelist.
|
boolean |
isBanned(org.bukkit.entity.Player player,
org.bukkit.Material m,
BanAction action,
BanData... data)
Check if the material is banned, in both blacklist and whitelist.
|
boolean |
isBanned(org.bukkit.entity.Player player,
org.bukkit.Material m,
boolean sendMessage,
BanAction action,
BanData... data)
Check if the material is banned, in both blacklist and whitelist.
|
boolean |
isBanned(org.bukkit.World world,
BannedItem item,
BanAction action,
BanData... data)
This method is used to check if the item is banned, in both blacklist and whitelist, not involving a player
This method is mainly used to check dispensers dispense and hoppers transfer
|
boolean |
isBanned(org.bukkit.World world,
org.bukkit.inventory.ItemStack item,
BanAction action,
BanData... data)
This method is used to check if the item is banned, in both blacklist and whitelist, not involving a player
This method is mainly used to check dispensers dispense and hoppers transfer
|
boolean |
isBanned(org.bukkit.World world,
org.bukkit.Material material,
BanAction action,
BanData... data)
This method is used to check if the item is banned, in both blacklist and whitelist, not involving a player
This method is mainly used to check dispensers dispense and hoppers transfer
|
boolean |
isBlacklisted(org.bukkit.entity.Player player,
org.bukkit.Location location,
BannedItem item,
boolean sendMessage,
BanAction action,
BanData... data)
Check if the item is blacklisted, sending a message or not to the player.
|
boolean |
isBlacklisted(org.bukkit.World world,
BannedItem item,
BanAction action,
BanData... data)
Check if the item is blacklisted, not involving a player
|
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), sending a message or not to the player.
|
boolean |
isWhitelisted(org.bukkit.World world,
BannedItem item,
BanAction action,
BanData... data)
Check if the item is whitelisted, not involving a player
|
void |
load(org.bukkit.command.CommandSender sender,
File configFile)
(re)Loading the plugin with this configuration file
|
boolean |
removeFromBlacklist(BannedItem item,
org.bukkit.World... worlds)
Remove the banned item from blacklisted worlds and save the config file used.
|
boolean |
removeFromBlacklist(Collection<? extends BannedItem> items,
org.bukkit.World... worlds) |
boolean |
removeFromWhitelist(WhitelistedWorld ww,
BannedItem item)
Remove the item from the whitelist and save in config.yml (comments in file may be removed)
|
void |
removeMetaItem(String name)
Remove the meta ItemStack named name
|
@NotNull public static BanItemAPI getInstance()
BanItem.getApi()
instead.@NotNull public BanDatabase getDatabase()
public void load(@NotNull org.bukkit.command.CommandSender sender, @Nullable File configFile)
sender
- command sender (send the message debug to)configFile
- the file configuration to load. If null, using (and reloading) the default configpublic boolean isBanned(@NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.Material m, @NotNull BanAction action, @Nullable BanData... data)
player
- the Player
involved into this actionm
- the Material
usedaction
- the BanAction
to checkdata
- optional action datas, leave it blank if not needed for the actionpublic boolean isBanned(@NotNull org.bukkit.entity.Player player, @Nullable org.bukkit.Location loc, @NotNull org.bukkit.Material m, @NotNull BanAction action, @Nullable BanData... data)
player
- the Player
involved into this actionloc
- the effective Location
of the actionm
- the Material
usedaction
- the BanAction
to checkdata
- optional action datas, leave it blank if not needed for the actionpublic boolean isBanned(@NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.Material m, boolean sendMessage, @NotNull BanAction action, @Nullable BanData... data)
player
- the Player
involved into this actionm
- the Material
usedsendMessage
- if the banned message should be send to the playeraction
- the BanAction
to checkdata
- optional action datas, leave it blank if not needed for the actionpublic boolean isBanned(@NotNull org.bukkit.entity.Player player, @Nullable org.bukkit.Location loc, @NotNull org.bukkit.Material m, boolean sendMessage, @NotNull BanAction action, @Nullable BanData... data)
player
- the Player
involved into this actionloc
- the effective Location
of the actionm
- the Material
usedsendMessage
- if the banned message should be send to the playeraction
- the BanAction
to checkdata
- optional action datas, leave it blank if not needed for the actionpublic boolean isBanned(@NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.inventory.ItemStack item, @NotNull BanAction action, @Nullable BanData... data)
player
- the Player
involved into this actionitem
- the ItemStack
usedaction
- the BanAction
to checkdata
- optional action datas, leave it blank if not needed for the actionpublic boolean isBanned(@NotNull org.bukkit.entity.Player player, @Nullable org.bukkit.Location loc, @NotNull org.bukkit.inventory.ItemStack item, @NotNull BanAction action, @Nullable BanData... data)
player
- the Player
involved into this actionloc
- the effective Location
of the actionitem
- the ItemStack
usedaction
- the BanAction
to checkdata
- optional action datas, leave it blank if not needed for the actionpublic boolean isBanned(@NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.inventory.ItemStack item, boolean sendMessage, @NotNull BanAction action, @Nullable BanData... data)
player
- the Player
involved into this actionitem
- the ItemStack
usedsendMessage
- if the banned message should be send to the playeraction
- the BanAction
to checkdata
- optional action datas, leave it blank if not needed for the actionpublic boolean isBanned(@NotNull org.bukkit.entity.Player player, @Nullable org.bukkit.Location loc, @NotNull org.bukkit.inventory.ItemStack item, boolean sendMessage, @NotNull BanAction action, @Nullable BanData... data)
player
- the Player
involved into this actionloc
- the effective Location
of the actionitem
- the ItemStack
usedsendMessage
- if the banned message should be send to the playeraction
- the BanAction
to checkdata
- optional action datas, leave it blank if not needed for the actionpublic boolean isBanned(@NotNull org.bukkit.entity.Player player, @NotNull BannedItem item, @NotNull BanAction action, @Nullable BanData... data)
player
- the Player
involved into this actionitem
- the BannedItem
objectaction
- the BanAction
to checkdata
- optional action datas, leave it blank if not needed for the actionpublic boolean isBanned(@NotNull org.bukkit.entity.Player player, @Nullable org.bukkit.Location loc, @NotNull BannedItem item, @NotNull BanAction action, @Nullable BanData... data)
player
- the Player
involved into this actionloc
- the effective Location
of the actionitem
- the BannedItem
objectaction
- the BanAction
to checkdata
- optional action datas, leave it blank if not needed for the actionpublic boolean isBanned(@NotNull org.bukkit.entity.Player player, @NotNull BannedItem item, boolean sendMessage, @NotNull BanAction action, @Nullable BanData... data)
player
- the Player
involved into this actionitem
- the BannedItem
objectsendMessage
- if the banned message should be send to the playeraction
- the BanAction
to checkdata
- optional action datas, leave it blank if not needed for the actionpublic boolean isBanned(@NotNull org.bukkit.entity.Player player, @Nullable org.bukkit.Location loc, @NotNull BannedItem item, boolean sendMessage, @NotNull BanAction action, @Nullable BanData... data)
player
- the Player
involved into this actionloc
- the effective Location
of the actionitem
- the BannedItem
objectsendMessage
- if the banned message should be send to the playeraction
- the BanAction
to checkdata
- optional action datas, leave it blank if not needed for the actionpublic boolean isBanned(@NotNull org.bukkit.World world, @NotNull org.bukkit.Material material, @NotNull BanAction action, @Nullable BanData... data)
world
- bukkit world (World
)material
- the involved materialaction
- the ban action to checkdata
- the ban action datas to checkpublic boolean isBanned(@NotNull org.bukkit.World world, @NotNull org.bukkit.inventory.ItemStack item, @NotNull BanAction action, @Nullable BanData... data)
world
- bukkit world (World
)item
- the involved ItemStackaction
- the ban action to checkdata
- the ban action datas to checkpublic boolean isBanned(@NotNull org.bukkit.World world, @NotNull BannedItem item, @NotNull BanAction action, @Nullable BanData... data)
world
- bukkit world (World
)item
- the involved itemaction
- the ban action to checkdata
- the ban action datas to checkpublic boolean isBlacklisted(@NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.Location location, @NotNull BannedItem item, boolean sendMessage, @NotNull BanAction action, @Nullable BanData... data)
player
- the Player
involved into this actionlocation
- the effective location where the action occursitem
- the BannedItem
involved into this actionsendMessage
- if the item is banned, send the ban message configuredaction
- the BanAction
action to checkdata
- additional ban dataspublic boolean isBlacklisted(@NotNull org.bukkit.World world, @NotNull BannedItem item, @NotNull BanAction action, @Nullable BanData... data)
world
- bukkit world (World
)item
- the involved itemaction
- the ban action to checkdata
- the ban action datas to checkpublic boolean isWhitelisted(@NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.Location location, @NotNull BannedItem item, boolean sendMessage, @NotNull BanAction action, @Nullable BanData... data)
player
- the Player
involved into this actionlocation
- the effective location where the action occursitem
- the BannedItem
involved into this actionsendMessage
- if the item is banned, send the ban message configuredaction
- the BanAction
action to checkdata
- optional ban dataspublic boolean isWhitelisted(@NotNull org.bukkit.World world, @NotNull BannedItem item, @NotNull BanAction action, @Nullable BanData... data)
world
- bukkit world (World
)item
- the involved itemaction
- the ban action to checkdata
- the ban action datas to check@NotNull public Blacklist getBlacklist()
public boolean addToBlacklist(@NotNull BannedItem item, @NotNull Map<BanAction,BanActionData> actions, @Nullable org.bukkit.World... worlds)
item
- the item to banactions
- a map containing actions and their respective dataworlds
- worlds where the ban apply. If null, including all worldspublic boolean addToBlacklist(@NotNull Collection<? extends BannedItem> items, @NotNull Map<BanAction,BanActionData> actions, @Nullable org.bukkit.World... worlds)
items
- the items to banactions
- a map containing actions and their respective dataworlds
- worlds where the ban apply. If null, including all worldspublic boolean removeFromBlacklist(@NotNull BannedItem item, @Nullable org.bukkit.World... worlds)
item
- the banned item to removeworlds
- worlds where the banned item can be present, all worlds if nullpublic boolean removeFromBlacklist(@NotNull Collection<? extends BannedItem> items, @Nullable org.bukkit.World... worlds)
@NotNull public Whitelist getWhitelist()
public boolean addToWhitelist(@NotNull WhitelistedWorld ww, @NotNull BannedItem item, @NotNull Map<BanAction,BanActionData> actions)
ww
- the whitelistedworld object, recoverable from Whitelist
item
- the item to addactions
- map of ban actions and their respective datapublic boolean removeFromWhitelist(@NotNull WhitelistedWorld ww, @NotNull BannedItem item)
ww
- the whitelisted worlditem
- the item@NotNull public CustomItems getCustomItems()
@Nullable public BannedItem getCustomItem(@NotNull String metaName)
metaName
- the name of the meta item@Nullable public String getMetaItemName(@NotNull org.bukkit.inventory.ItemStack item)
item
- the ItemStack@Nullable public String getMetaItemName(@NotNull BannedItem item)
item
- the itempublic void addMetaItem(@NotNull String name, @NotNull org.bukkit.inventory.ItemStack item)
Will replace existing value
name
- the name of the custom ItemStackitem
- the custom ItemStackpublic void removeMetaItem(@NotNull String name)
name
- the name of the custom ItemStackCopyright © 2021. All rights reserved.