Class HoneypotBlockManager

java.lang.Object
org.reprogle.honeypot.storagemanager.HoneypotBlockManager

public class HoneypotBlockManager extends Object
A class for managing Honeypot blocks. Adds functions for creating, removing, verifying, getting the action, listing all blocks, and even clearing out the DB.
See Also:
  • Constructor Details

    • HoneypotBlockManager

      public HoneypotBlockManager()
  • Method Details

    • getInstance

      public static HoneypotBlockManager getInstance()
      Returns the singleton instance of this class
      Returns:
      The HoneypotBlockManager instance
    • createBlock

      public void createBlock(org.bukkit.block.Block block, String action)
      Create a honeypot Block by creating a HoneypotBlock object and storing it to DB.
      Parameters:
      block - The Honeypot Block we're creating
      action - The action of the Honeypot
    • deleteBlock

      public void deleteBlock(org.bukkit.block.Block block)
      Compare the coordinates of the received Block to the DB. If it exists, delete it and break to avoid a Java error
      Parameters:
      block - The Honeypot Block we're deleting
    • isHoneypotBlock

      public boolean isHoneypotBlock(org.bukkit.block.Block block)
      Check if the coordinates of the Honeypot already exist within the list
      Parameters:
      block - The Block we're checking
      Returns:
      true or false
    • getHoneypotBlock

      public HoneypotBlockObject getHoneypotBlock(org.bukkit.block.Block block)
      Convert a block to its HoneypotBlockObject, if it exists in the database
      Parameters:
      block - The block to convert to a HoneypotBlockObject
      Returns:
      HoneypotBlockObject if it exists, null if it doesn't
      See Also:
    • getAction

      public String getAction(org.bukkit.block.Block block)
      Return the action for the honeypot Block (Meant for ban, kick, etc.) If a string is returned that is not a default action, it's custom.
      Parameters:
      block - The Block we're checking
      Returns:
      The Honeypot's action as a string
    • deleteAllHoneypotBlocks

      public void deleteAllHoneypotBlocks()
      Delete all Honeypots in the entire DB. Do not use unless you know what you're doing
    • getAllHoneypots

      public List<HoneypotBlockObject> getAllHoneypots()
      Get all HoneypotBlockObject in the DB
      Returns:
      An array list of all HoneypotBlockObjects