Class IllegalStackScanner
java.lang.Object
fr.andross.banitem.utils.scanners.illegalstack.IllegalStackScanner
Async scanner to check if players has illegal stacks into their inventories.
If an illegal stack is detected, a next sync task will be run to handle it.
- Version:
- 3.4
- Author:
- Andross
-
Constructor Summary
ConstructorsConstructorDescriptionIllegalStackScanner
(@NotNull BanItem plugin, @NotNull BanUtils utils) Prepare the illegal stack scanner. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addIllegalStackItem
(org.bukkit.World world, org.bukkit.Material material, IllegalStackItemConfig illegalStackItemConfig) Add an illegal stack item configuration in memory to be checked.@Nullable IllegalStackBlockType
Get the default block type for items.@NotNull Map
<org.bukkit.World, Map<org.bukkit.Material, IllegalStackItemConfig>> getItems()
Get the map of illegal stacks configuration loaded from config.int
Get the scanner Bukkit Task id, -1 if not running.boolean
Check if the scanner is running.boolean
Check if the scanner should be enabled (in config).boolean
Check if the vanilla max stack size is enabled.void
Load the configuration file and enable (if configured) the illegal stack scanner.void
setDefaultBlockType
(@Nullable IllegalStackBlockType defaultBlockType) Set the default block type for items.void
setEnabled
(boolean enabled) Enable or disable the scanner.void
setEnabledInConfig
(boolean enabledInConfig) Set the variable.void
setVanillaMaxStackSize
(boolean vanillaMaxStackSize) Set the vanilla max stack size state.
-
Constructor Details
-
IllegalStackScanner
Prepare the illegal stack scanner.- Parameters:
plugin
- the ban item plugin instanceutils
- the ban item utility class
-
-
Method Details
-
load
public void load(@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull BanConfig config) Load the configuration file and enable (if configured) the illegal stack scanner.- Parameters:
sender
- the executorconfig
- the configuration file
-
addIllegalStackItem
public void addIllegalStackItem(org.bukkit.World world, org.bukkit.Material material, IllegalStackItemConfig illegalStackItemConfig) Add an illegal stack item configuration in memory to be checked.- Parameters:
world
- the related worldmaterial
- the item material typeillegalStackItemConfig
- the configuration
-
isEnabled
public boolean isEnabled()Check if the scanner is running.- Returns:
- true if the scanner is running, otherwise false
-
setEnabled
public void setEnabled(boolean enabled) Enable or disable the scanner.- Parameters:
enabled
- the enabled state
-
isEnabledInConfig
public boolean isEnabledInConfig()Check if the scanner should be enabled (in config).- Returns:
- if the scanner should be enabled (in config)
-
setEnabledInConfig
public void setEnabledInConfig(boolean enabledInConfig) Set the variable. This does not edit the config file.- Parameters:
enabledInConfig
- set the variable
-
getTaskId
public int getTaskId()Get the scanner Bukkit Task id, -1 if not running.- Returns:
- the scanner Bukkit Task id, -1 if not running
-
getItems
@NotNull public @NotNull Map<org.bukkit.World,Map<org.bukkit.Material, getItems()IllegalStackItemConfig>> Get the map of illegal stacks configuration loaded from config.- Returns:
- the map of illegal stacks configuration loaded from config
-
isVanillaMaxStackSize
public boolean isVanillaMaxStackSize()Check if the vanilla max stack size is enabled.- Returns:
- true if the vanilla max stack size is enabled, otherwise false
-
setVanillaMaxStackSize
public void setVanillaMaxStackSize(boolean vanillaMaxStackSize) Set the vanilla max stack size state. This does not edit the config file.- Parameters:
vanillaMaxStackSize
- the vanilla max stack size state
-
getDefaultBlockType
Get the default block type for items. This can be null if an invalid block type is set from config.- Returns:
- the default block type for items
-
setDefaultBlockType
Set the default block type for items. Setting the parameter to null is not recommended because it will keep the task running but will not block anything.- Parameters:
defaultBlockType
- the default block type wanted
-