Package fr.andross.banitem
Class BanUtils
java.lang.Object
fr.andross.banitem.BanUtils
An utility class for the plugin
- Version:
- 3.4
- Author:
- Andross
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Send a message if an update is available This must be executed asyncvoid
checkPlayerArmors
(org.bukkit.entity.Player p) Used to check a player armor inventoryvoid
checkPlayerIllegalStacks
(org.bukkit.entity.Player p) Used to check if a player has an illegal stacked itemvoid
deleteItemFromInventoryView
(org.bukkit.entity.Player player) Method to check and delete banned item from the player opened inventoriesgetBanActionsForItem
(List<org.bukkit.World> worlds, org.bukkit.configuration.ConfigurationSection itemSection, String key, Debug d) Get ban actions data for a sectiongetBanActionsFromItemSection
(List<org.bukkit.World> worlds, org.bukkit.configuration.ConfigurationSection section, Debug d) Get a map of actions and actions data from a sectionGet the sub commands aliasesgetCooldownString
(long time) Get a friendly string of remaining timeGet the IllegalStackScanner handlerThis map contains the players who activated the log in game with /banitem log Players which log mode is activated will receive the logs messages for the banned items, if set in configGet the messages cooldown mapGet the WearScanner handlervoid
giveItemBack
(org.bukkit.entity.Player p, org.bukkit.inventory.ItemStack item) Method to give an item back to the player, drop it if the inventory is fullboolean
hasPermission
(org.bukkit.entity.Player player, String itemName, BanAction action, BanData... data) Method to check if the player has the bypass permission for either the item (material name) or custom namevoid
sendMessage
(org.bukkit.command.CommandSender sender, String message) Sending a prefixed and colored (if player) message to sendervoid
sendMessage
(org.bukkit.entity.Player player, BanAction action, List<String> messages) This method is used to send a ban message to player, if exists.void
sendMessage
(org.bukkit.entity.Player player, String itemName, BanAction action, BanActionData data) This method is used to send a ban message to player, if exists.
-
Method Details
-
getBanActionsFromItemSection
@NotNull public Map<BanAction,BanActionData> getBanActionsFromItemSection(@NotNull List<org.bukkit.World> worlds, @Nullable org.bukkit.configuration.ConfigurationSection section, @NotNull Debug d) Get a map of actions and actions data from a section- Parameters:
worlds
- list of worldssection
- sectiond
- debug- Returns:
- a map containing the ban actions and their respective data from the ConfigurationSection
-
getBanActionsForItem
@NotNull public BanActionData getBanActionsForItem(@NotNull List<org.bukkit.World> worlds, @NotNull org.bukkit.configuration.ConfigurationSection itemSection, @NotNull String key, @NotNull Debug d) Get ban actions data for a section- Parameters:
worlds
- list of worlds, used for regionsitemSection
- the action sectionkey
- the current data keyd
- debug- Returns:
- actions data from the section of the specific action
-
deleteItemFromInventoryView
public void deleteItemFromInventoryView(@NotNull org.bukkit.entity.Player player) Method to check and delete banned item from the player opened inventories- Parameters:
player
- any player
-
sendMessage
public void sendMessage(@NotNull org.bukkit.entity.Player player, @NotNull String itemName, @NotNull BanAction action, @Nullable BanActionData data) This method is used to send a ban message to player, if exists. Mainly used for blacklist- Parameters:
player
- player involved in the actionitemName
- the item name involvedaction
- the ban action (used for log)data
- the ban data (containing the messages)
-
sendMessage
public void sendMessage(@NotNull org.bukkit.entity.Player player, @NotNull BanAction action, @NotNull List<String> messages) This method is used to send a ban message to player, if exists. Mainly used for whitelist- Parameters:
player
- send the message toaction
- the ban action (used for log)messages
- list of messages
-
hasPermission
public boolean hasPermission(@NotNull org.bukkit.entity.Player player, @NotNull String itemName, @NotNull BanAction action, @Nullable BanData... data) Method to check if the player has the bypass permission for either the item (material name) or custom name- Parameters:
player
- player to checkitemName
- name of the itemaction
- action namedata
- additional data to check- Returns:
- true if the player has the permission to bypass the ban, otherwise false
-
getCooldownString
Get a friendly string of remaining time- Parameters:
time
- time in millis- Returns:
- a friendly string of remaining time
-
checkPlayerArmors
public void checkPlayerArmors(org.bukkit.entity.Player p) Used to check a player armor inventory- Parameters:
p
- player
-
checkPlayerIllegalStacks
public void checkPlayerIllegalStacks(@NotNull org.bukkit.entity.Player p) Used to check if a player has an illegal stacked item- Parameters:
p
- player
-
giveItemBack
public void giveItemBack(@NotNull org.bukkit.entity.Player p, @NotNull org.bukkit.inventory.ItemStack item) Method to give an item back to the player, drop it if the inventory is full- Parameters:
p
- the playeritem
- the item
-
sendMessage
Sending a prefixed and colored (if player) message to sender- Parameters:
sender
- sendermessage
- message
-
checkForUpdate
public void checkForUpdate()Send a message if an update is available This must be executed async -
getWearScanner
Get the WearScanner handler- Returns:
- the wear scanner handler
-
getIllegalStackScanner
Get the IllegalStackScanner handler- Returns:
- the illegal stack scanner handler
-
getCommandsAliases
Get the sub commands aliases- Returns:
- the sub commands aliases
-
getMessagesCooldown
Get the messages cooldown map- Returns:
- map containing the cooldowns for messages
-
getLogging
This map contains the players who activated the log in game with /banitem log Players which log mode is activated will receive the logs messages for the banned items, if set in config- Returns:
- set of players uuid
-