Honeypot Help

Storage Providers

Technical Information

Storage Providers are a brand-new feature in Honeypot 3.4.0 that allows developers to create different methods of storing Honeypot blocks should the built-in methods not be enough for their specific use case.

Honeypot has two native storage methods: PDC and SQLite. SQLite is always used for storing player and player history information. However, Block data, the location and action of a Honeypot, is queried much more frequently. It is necessary to have different methods of storage allows server managers to pick what is best for them

The SQLite DB has been architected to use an R*-Tree data structure, a variant of an R-Tree data structure but with better query performance. PDC uses custom formatted key and value strings and stores all keys within the world container. In testing, these methods allowed Honeypot to search a 2,000,0003 block area within milliseconds.

Because Honeypot can achieve such extreme query times without nearly any overhead, it's recommended that you stick with the native Honeypot storage methods unless you know you absolutely need something else.

Using Storage Providers

To use a storage provider, you must first create the provider by extending StorageProvider from the Honeypot API. You must also annotate the class with @HoneypotStore. The annotation requires a name property, which is case-insensitive and must be unique. The below class is just a logging class for testing a store. You are responsible for the actual storage logic

package me.terrorbyte.test; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.block.Block; import org.jetbrains.annotations.Nullable; import [[[org.reprogle.honeypot.common.storageproviders.HoneypotBlockObject|https://javadoc.jitpack.io/com/github/TerrorByteTW/Honeypot/honeypot-api/3.4.0/javadoc/org/reprogle/honeypot/common/storageproviders/HoneypotBlockObject.html]]]; import [[[org.reprogle.honeypot.common.storageproviders.HoneypotStore|https://javadoc.jitpack.io/com/github/TerrorByteTW/Honeypot/honeypot-api/3.4.0/javadoc/org/reprogle/honeypot/common/storageproviders/HoneypotStore.html]]]; import [[[org.reprogle.honeypot.common.storageproviders.StorageProvider|https://javadoc.jitpack.io/com/github/TerrorByteTW/Honeypot/honeypot-api/3.4.0/javadoc/org/reprogle/honeypot/common/storageproviders/StorageProvider.html]]]; import java.util.List; import java.util.logging.Logger; @HoneypotStore(name = "DemoHoneypotStore") public class DemoHoneypotStore extends [[[StorageProvider|https://javadoc.jitpack.io/com/github/TerrorByteTW/Honeypot/honeypot-api/3.4.0/javadoc/org/reprogle/honeypot/common/storageproviders/StorageProvider.html]]] { @Override public void createHoneypotBlock(Block block, String s) { Logger.getLogger("minecraft").info("Create honeypot block was called!"); } @Override public void removeHoneypotBlock(Block block) { Logger.getLogger("minecraft").info("Remove honeypot block was called!"); } @Override public boolean isHoneypotBlock(Block block) { Logger.getLogger("minecraft").info("Is Honeypot block was called!"); return false; } @Override public HoneypotBlockObject getHoneypotBlock(Block block) { Logger.getLogger("minecraft").info("Get honeypot block was called!"); return null; } @Override public String getAction(Block block) { Logger.getLogger("minecraft").info("Get action was called!"); return ""; } @Override public void deleteAllHoneypotBlocks(@Nullable World world) { Logger.getLogger("minecraft").info("Delete all honeypot blocks was called!"); } @Override public List<HoneypotBlockObject> getAllHoneypots(@Nullable World world) Logger.getLogger("minecraft").info("Get all honeypot blocks was called!"); return List.of(); } @Override public List<HoneypotBlockObject> getNearbyHoneypots(Location location, int i) { Logger.getLogger("minecraft").info("Get nearby honeypot blocks was called!"); return List.of(); } }

Once the storage provider is complete, you must register it in your onLoad() method.

package me.terrorbyte.test; import org.bukkit.plugin.java.JavaPlugin; import [[[org.reprogle.honeypot.Registry|https://javadoc.jitpack.io/com/github/TerrorByteTW/Honeypot/honeypot-api/3.4.0/javadoc/org/reprogle/honeypot/Registry.html]]]; public class Test extends JavaPlugin { // This is how you would register storage providers @Override public void onLoad() { [[[Registry|https://javadoc.jitpack.io/com/github/TerrorByteTW/Honeypot/honeypot-api/3.4.0/javadoc/org/reprogle/honeypot/Registry.html]]].[[[getStorageManagerRegistry()|https://javadoc.jitpack.io/com/github/TerrorByteTW/Honeypot/honeypot-api/3.4.0/javadoc/org/reprogle/honeypot/Registry.html#getStorageManagerRegistry()]]].[[[register|https://javadoc.jitpack.io/com/github/TerrorByteTW/Honeypot/honeypot-api/3.4.0/javadoc/org/reprogle/honeypot/HoneypotStoreRegistry.html#register(org.reprogle.honeypot.common.storageproviders.StorageProvider)]]](new DemoHoneypotStore()); } @Override public void onEnable() { this.getLogger().info("Enabling!"); } @Override public void onDisable(){ this.getLogger().info("Disabling!"); } }

Honeypot will allow registrations of storage providers only on load, so you cannot reload Honeypot using /reload or a plugin like PlugManX. In order to use the behavior provider that was added, see Configuring Honeypot. You must update the name of the storage method to what you set in the @HoneypotStore annotation, and you must enable the third party storage manager flag.

Last modified: 02 November 2024