PlotSquared
PlotSquared copied to clipboard
Add Events for Plot Move + Plot Swap
Overview
Fixes #3692
Description
Adds a cancellable PlotMoveEvent and informational PostPlotMoveEvent. (+ Swap) ~~Found no fitting case for handling the FORCE result, therefor marked that as not supported (just supporting DENY and ACCEPT).~~
Submitter Checklist
- [x] Make sure you are opening from a topic branch (/feature/fix/docs/ branch (right side)) and not your main branch.
- [x] Ensure that the pull request title represents the desired changelog entry.
- [x] New public fields and methods are annotated with
@since TODO. - [x] I read and followed the contribution guidelines.
Validated the functionality of this change using a simple addon plugin:
public class TestAddonPlugin extends JavaPlugin {
@Override
public void onEnable() {
new PlotAPI().registerListener(new Object() {
@Subscribe
public void onPlotMove(PlotMoveEvent event) {
event.setEventResult(Result.DENY);
System.out.println("cancelled");
}
@Subscribe
public void onPostPlotMove(PostPlotMoveEvent event) {
System.out.println("Plot was moved");
}
});
}
}
The FORCE result may be used to move the plot to occupied places as well? Opinions about that @IntellectualSites/plotsquared-team?
The destination of the move should be able to be changed in the event. Also, the FORCE result needs to be implemented (the event call needs to be moved further up)
I'd also say that a PlotSwapEvent should be added as the two commands are very similar
Please take a moment and address the merge conflicts of your pull request. Thanks!