#
Custom Elevator Settings
The ElevatorSettings API allows developers to define their own reusable settings that can be globally configured or customized per elevator. These settings are ideal for toggling features, adjusting variables, or adding meaningful controls that your plugin logic can interpret.
#
Getting Started
To begin creating a custom setting, use the builder method:
ElevatorSetting.builder("setting-key", defaultValue, ElevatorsDataType.TYPE)
setting-key
– A unique key for the setting. This must fit the pattern [a-z0-9/._-]+defaultValue
– The default value to use if none is configuredElevatorsDataType
– The type of data this setting holds (e.g., BOOLEAN, INTEGER)
You can also use
PersistentDataType<?,T>
if you prefer Bukkit’s native types.
#
Builder Methods
#
Handling Click Events
Use .onClick(context -> { ... })
to respond when the setting’s icon is clicked. You'll receive a ElevatorSettingClickContext
object.
#
ElevatorSettingClickContext
#
Example: Boolean Toggle Setting
ElevatorSetting.builder("test-setting", true, ElevatorsDataType.BOOLEAN)
.addAction("Left click", "Toggle")
.allowPerEleCustomization()
.addComment("This is an example comment. Heck yeah")
.onClick(context -> {
context.setValue(!context.getCurrentValue());
context.close();
})
.register(myPlugin, ChatColor.AQUA + "", "Test Setting", Material.ITEM_FRAME);
#
Notes
- Registered settings do not perform actions automatically — it's up to your plugin to read and respond to them as needed.
🧪 Want to contribute more settings? Feel free to fork the plugin and submit PRs via GitHub!