Skip to content

Conversation

@Banbeucmas
Copy link
Contributor

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.

Copy link

@Dolphin2Point1 Dolphin2Point1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

@mdcfe mdcfe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be spaced out.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I add Trade also?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could do, I suppose.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok wait for me a moment

@mdcfe
Copy link
Member

mdcfe commented Mar 24, 2018

We could also add a method EssentialsWarpEvent#setWarp which changes the warp destination, then retrieve the warp destination from the event in Teleport#warp.

Also, prefixing the event with Essentials isn't consistent with other Essentials events - I'd suggest renaming it to UserWarpEvent, but open to any other suggestions.

@mdcfe mdcfe added the type: enhancement Features and feature requests. label Mar 24, 2018
@Banbeucmas
Copy link
Contributor Author

We could also add a method EssentialsWarpEvent#setWarp which changes the warp destination, then retrieve the warp destination from the event in Teleport#warp.

Like that?
I tested and pretty sure it worked flawlessly without errors

return trade;
}

public void setWarp(String warp){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spacing here too: public void setWarp(String warp) {

UserWarpEvent event = new UserWarpEvent(teleportee, warp, chargeFor);
Bukkit.getServer().getPluginManager().callEvent(event);

if(event.isCancelled()){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should still be spaced out: if (event.isCancelled()) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I will do it tonight

return warp;
}

public Trade getTrade() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps some javadocs would help?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should help. I am not that familiar with Javadocs tho

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Banbeucmas
Copy link
Contributor Author

Banbeucmas commented Mar 26, 2018

@md678685 @drtshock Done, can you guys check for what is left?
If it is ok then I think we can merge it by now.

@mdcfe mdcfe added this to the 2.16.0 milestone Mar 30, 2018
@mdcfe mdcfe changed the base branch from 2.x to 1.13 October 28, 2018 18:53
@mdcfe mdcfe merged commit 280d121 into EssentialsX:1.13 Oct 28, 2018
@mdcfe
Copy link
Member

mdcfe commented Oct 28, 2018

This has been merged into the 1.13 branch and is now part of experimental builds.

@Banbeucmas
Copy link
Contributor Author

Thanks for the merge.
Guess I will back to my work then.

ressidell pushed a commit to ressidell/Essentials that referenced this pull request Apr 27, 2025
* 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?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement Features and feature requests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants