mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-21 11:45:19 +01:00
Page:
Events
Pages
API Documentation
API Flag
Backups
BlockBucket
Bypass Permissions
Changelog
ChestShop Compatibility
Chunk processor
Commands and Permissions
Commands
Events
FAWE
Fix plot borders
Getting an instance of PlotSquared
Home
Installation
Merging all plots
Migrating from an older major release
Permission Packs
Placeholders
Plot Component Presets
Plot Components
Plot Membership Tiers
Plot analysis
Plot flags
Plot web interface
PlotSquared web API
PlotSquared.use_THIS.yml
Printing the furthest plot
Resetting plot biomes
Schematic Generation
Schematic on Claim
Scripting
Set a plotworld as default world
Setting all signs
Single Plot Area
UUID conversion
Updating from 1.12 to 1.13
Usage
Usage: Schematic export
Vanilla Tags
Why should you switch to PlotSquared?
World reduction
WorldEdit processing
commands.yml
settings.yml
style.yml
worlds.yml
1
Events
NotMyFault edited this page 2021-04-27 17:51:35 +02:00
Table of Contents
PlotSquared uses the Guava EventBus to register listeners and dispatch events.
Event List
Events can be found at https://github.com/IntellectualSites/PlotSquared/tree/v5/Core/src/main/java/com/plotsquared/core/events
Registering a Listener
Registering a listener is super easy. Add the @Subscribe
annotation to any methods that are listening to events, register the class with the EventBus through PlotAPI#registerListener(Class)
and you're done!
public class P2Listener {
public void P2Listener(PlotAPI api) {
api.registerListener(this)
}
@Subscribe
public void onPlayerEnterPlot(PlayerEnterPlotEvent e) {
//do stuff
}
}
An alternative to the above would be to register the listener elsewhere, for example:
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
PlotAPI plotApi = new PlotAPI();
api.registerListener(new P2Listener());
}
}
public class P2Listener {
@Subscribe
public void onPlayerEnterPlot(PlayerEnterPlotEvent e) {
//do stuff
}
}
Home
Installation
API documentation
Further installation
- Road schematics
- settings.yml
- commands.yml
- worlds.yml
- style.yml
- UUID conversion
- Set a plot world as default world
- ChestShop Compatibility