Class HoneypotBlockManager
java.lang.Object
org.reprogle.honeypot.storagemanager.HoneypotBlockManager
A class for managing Honeypot blocks.
Adds functions for creating, removing, verifying, getting the action, listing
all blocks, and even clearing out the DB.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateBlock(org.bukkit.block.Block block, String action) Create a honeypotBlockby creating a HoneypotBlock object and storing it to DB.voidDelete all Honeypots in the entire DB.voiddeleteBlock(org.bukkit.block.Block block) Compare the coordinates of the receivedBlockto the DB.getAction(org.bukkit.block.Block block) Return the action for the honeypotBlock(Meant for ban, kick, etc.) If a string is returned that is not a default action, it's custom.Get allHoneypotBlockObjectin the DBgetHoneypotBlock(org.bukkit.block.Block block) Convert a block to itsHoneypotBlockObject, if it exists in the databasestatic HoneypotBlockManagerReturns the singleton instance of this classbooleanisHoneypotBlock(org.bukkit.block.Block block) Check if the coordinates of the Honeypot already exist within the list
-
Constructor Details
-
HoneypotBlockManager
public HoneypotBlockManager()
-
-
Method Details
-
getInstance
Returns the singleton instance of this class- Returns:
- The
HoneypotBlockManagerinstance
-
createBlock
Create a honeypotBlockby creating a HoneypotBlock object and storing it to DB.- Parameters:
block- The Honeypot Block we're creatingaction- The action of the Honeypot
-
deleteBlock
public void deleteBlock(org.bukkit.block.Block block) Compare the coordinates of the receivedBlockto the DB. If it exists, delete it and break to avoid a Java error- Parameters:
block- The HoneypotBlockwe'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- TheBlockwe're checking- Returns:
- true or false
-
getHoneypotBlock
Convert a block to itsHoneypotBlockObject, 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
Return the action for the honeypotBlock(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
Get allHoneypotBlockObjectin the DB- Returns:
- An array list of all HoneypotBlockObjects
-