![]() ![]() This is where priorities become really important. A plugin can actually uncancel an event after another plugin cancelled it. So, we pass events to plugins even after they've been cancelled. If set to true, your method will not get the event if the event has been cancelledĮvery plugin gets a say in what happens, and every plugin must get a chance to know the outcome of an event. The annotation can take parameters to further define how the event handler behaves. Public class MyPlugin extends JavaPlugin implements Listener EventHandler Parameters In order for your plugin to handle an event call, you need to create a method for it: To keep this section simple, we're going to only work with PlayerLoginEvent. Due to unknown reasons there is no longer any links to official Javadocs as they have all been taken off line. player actions (player logged in, player clicked a block, player died, player respawned.), block events (block placed, block broken, block's neighbour changed.), entity events (a mob targeted you, a creeper exploded.), world-wide events (a world loaded or unloaded, a chunk loaded or unloaded), and many more. Bukkit defines many events, in multiple categories e.g. 5.1.3 Making your CustomEvent CancellableĮvents are how the CraftBukkit server tells your plugin that something has happened in the world.3.3 Registering Events in your Listener.3.2.1 Registering Events with Plugin as Listener.It does so by providing the CustomBlockData class which implements the PersistentDataHolder interface. If you are using this project in your paid plugins, or if you just want to buy me a coffee, I would be very happy over a small donationĬustomBlockData is a library for the Bukkit API that allows you to store ANY information inside blocks. If you need help in using CustomBlockData, feel free to join my Discord server and head to #programming-help: MorePersistentDataTypes: Adds a ton of new PersistentDataTypesĪrmorEquipEvent: A maintained verison of Arnuh's ArmorEquipEvent SpigotUpdateChecker: Powerful UpdateChecker for your plugins in one line of code! Once the block is broken, it will drop the stored item. It lets you left-click on a block to store your currently held ItemStack inside. Create blocks with custom behaviour when they're interacted withĬlick here for an example plugin.store the items that have been put inside Let CraftingTables, EnchantmentTables.by storing the associated Inventory inside the block Create new containers besides chests, furnaces, etc.Track whether blocks have been placed by players (and by who) or were naturally generated.Some ideas I had / discovered from other plugins: PersistentDataContainer customBlockData = new CustomBlockData (block, plugin ) For more information about how to use it, just look at the API docs for the PersistentDataContainer or look at this tutorial. Unlike NBT tags or other commonly used methods to store data in blocks, the information will not be lost on server restarts.You can store anything that can be stored inside a normal PersistantDataContainer (which means, basically, anything).When the chunk where the block is inside gets deleted, there will be no leftover information.It does not need any files or databases.This is disabled by default for backwards compatibility - just call CustomBlockData#registerListeners(Plugin) to enable it.You can make specific blocks protected from this, or listen to the cancellable CustomBlockDataEvent and its subclasses.It can automatically keep track of block changes and automatically delete block data when a block gets broken, move data when a block gets moved, etc.It does not need any files or databases by saving the information inside the chunk's PersistentDataContainer, and the information is persistent even after server restarts.ĬustomBlockData is compatible with all Bukkit versions from 1.16.3 onwards, including all forks. ![]() ![]() It does so by providing the CustomBlockData class which implements the PersistentDataContainer interface. I hope someone finds it helpful, have a nice day everyone!ĬustomBlockData is a library for the Bukkit API that allows you to store ANY information inside blocks. If you are only interested in how it works, check out the GitHub link below, the magical stuff is only a few lines long. Today I want to show you my new CustomBlockData resource. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |