Uh oh!
There was an error while loading. Please reload this page.
Adding EssentialsWarpEvent - #1921
Conversation
There was a problem hiding this comment.
Great! Some Plugins could really use this for an api!
Edit: I have compiled it for use. If you're too lazy, look here: https://github.com/loper12/BanbeucmasEssPatch
mdcfe
left a comment
There was a problem hiding this comment.
This mostly looks good, but I haven't been able to test it so I can't approve this yet.
| public void warp(IUser teleportee, String warp, Trade chargeFor, TeleportCause cause) throws Exception { | ||
| EssentialsWarpEvent event = new EssentialsWarpEvent(teleportee, warp); | ||
| Bukkit.getServer().getPluginManager().callEvent(event); | ||
| if(event.isCancelled()){ |
There was a problem hiding this comment.
Testing with Remote Debugging and also Checkpoints, the event was called. I haven't test the listeners tho
| private IUser user; | ||
| private String warp; | ||
| private boolean cancelled = false; | ||
There was a problem hiding this comment.
Should I add Trade also?
There was a problem hiding this comment.
Ok wait for me a moment
mdcfe
commented
Mar 24, 2018
We could also add a method Also, prefixing the event with |
Banbeucmas
commented
Mar 24, 2018
Like that? |
| return trade; | ||
| } | ||
| public void setWarp(String warp){ |
There was a problem hiding this comment.
Spacing here too: public void setWarp(String warp) {
| UserWarpEvent event = new UserWarpEvent(teleportee, warp, chargeFor); | ||
| Bukkit.getServer().getPluginManager().callEvent(event); | ||
| if(event.isCancelled()){ |
There was a problem hiding this comment.
This should still be spaced out: if (event.isCancelled()) {
There was a problem hiding this comment.
Ok I will do it tonight
| return warp; | ||
| } | ||
| public Trade getTrade() { |
There was a problem hiding this comment.
Should help. I am not that familiar with Javadocs tho
There was a problem hiding this comment.
I don't know if I were to left documentation there, providing that all of other Events doesn't have any documentation except the heading of the class.
mdcfe
commented
Oct 28, 2018
This has been merged into the 1.13 branch and is now part of experimental builds. |
Banbeucmas
commented
Oct 29, 2018
Thanks for the merge. |
* Adding EssentialsWarpEvent for checking if player is wrapping * Spacing * Adding Trade parameter * Refactoring * Adding #setWarp() to the Event * Spacing * Documenting the purpose of the Event * Javadoc?
* Adding EssentialsWarpEvent for checking if player is wrapping * Spacing * Adding Trade parameter * Refactoring * Adding #setWarp() to the Event * Spacing * Documenting the purpose of the Event * Javadoc?
Tho you can still use PlayerTeleportEvent for this, I think it is better to have an event especially for EssentialsWarp for checking warps tho.
This should help a lot on dependency which are trying to hook into the plugin.