Custom Flags
Custom flags allow developers to define unique behaviors and rules for claimed lands. Flags can trigger events, control land mechanics, and integrate with other plugin features. This section explains how to create, register, and configure a custom flag.
1. Creating a Custom Flag
Custom flags extend the Flag
class and override its methods. Here's an example:
Explanation:
onBlockBreak
: A sample event handler that interacts with the flag's state (hasEnabled
).getFlagName
: A unique identifier for the flag, required for registration.
2. Registering a Custom Flag
After defining the custom flag, it must be registered to integrate with the plugin. Here's how to do it:
Metadata Breakdown:
item
: The item used to represent the flag in the flag menu (e.g.,"PAPER"
).position
: The slot index in the flag menu where the flag appears.name
: The display name of the flag, supports color codes.lore
: A list of strings for the flag's description, also supports color codes.
Last updated