Class IllegalStackScanner

java.lang.Object
fr.andross.banitem.utils.scanners.illegalstack.IllegalStackScanner

public final class IllegalStackScanner extends Object
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 Details

    • IllegalStackScanner

      public IllegalStackScanner(@NotNull @NotNull BanItem plugin, @NotNull @NotNull BanUtils utils)
      Prepare the illegal stack scanner.
      Parameters:
      plugin - the ban item plugin instance
      utils - 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 executor
      config - 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 world
      material - the item material type
      illegalStackItemConfig - 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,IllegalStackItemConfig>> getItems()
      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

      @Nullable public @Nullable IllegalStackBlockType 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

      public void setDefaultBlockType(@Nullable @Nullable IllegalStackBlockType defaultBlockType)
      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