-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add PreTeleportEvents #10173
Add PreTeleportEvents #10173
Conversation
I think that it doesn't needed in this event, so just call it with a cloned |
The |
I agree here. This event should be solely for "preparation" purposes and to make stuff more compatible with other plugins. |
In situations like this I wish there was an Immutable Location |
can just always return a clone of the stored Location object |
Yup good idea. |
Yeah, that works just thought it'd be handy for clarity |
Ok so, I am working on the changes right now and the more I am working on the |
f281cf4
to
30137d7
Compare
The |
No it doesn't. |
30137d7
to
5926232
Compare
Ok so I started adding the |
What's left regarding actual implementation? It looks pretty complete |
Implementations of the EntityTeleportEvent aren't fully covered yet. Minor cleanup of the Patches are also necessary. Then I would hope someone in the team could take a look if that what I have done is alright. Did change quite a bit in the Also need to figure out why the gh action cries. |
cff017e
to
249b0e8
Compare
Ok so i finished the initial work and this should be ready for testing and reviewing. |
In my current scenario, I have a cosmetic plugin that adds a passenger to the player (a TextDisplay), and all teleportations are blocked because the player has at least one passenger, with no event being called to remove it. This forces the use of NMS (which is discouraged today). This event would allow plugin developers the opportunity to ensure compliance with checks before teleportation occurs. |
249b0e8
to
e20366b
Compare
Hello, |
Maybe I am just misunderstanding something but I don't really know why there is a |
The issue that this resolves is mentioned at the top of this PR: #10168 |
If the player/entity has at least one passenger, the PlayerTeleportEvent is not triggered and teleportation is blocked. |
I mean, nevertheless, the name |
I think it's perfectly fine personally, PreTeleportEvent implies that is is called before the teleport event. |
Yeah, it does. Still, the existing |
Do you have a better suggestion how to name the events? |
I am literally fine with any name. If it ends up being named like it currently is - so be it.
That's a good point, however I don't see how the name
Yeah, probably to be able to cancel them. The Again, if it stays at |
Didn't say it will be misleading. I'm saying that the first name that comes into my mind if I want to search an event that happens before the teleport event I would search for a |
Now I'm also think that |
It seems like both are used in Paper, as the purpose of the event is to prepare I agree that Examples of current events:
|
e20366b
to
feff6a6
Compare
Hello, |
Would it make sense to make the flags present in the event mutable? That way plugins can directly modify the behavior of teleporting passengers/vehicles by adding/removing the flags. |
Is there a use case you can provide where this makes sense? |
I'd say a major reason the pre teleport events are useful is for plugins that wish to have display entities or armor stands ride on players, but of course doing so breaks if another plugin attempts to teleport without using the passenger flag. You could work around it using these pre teleport events and temporarily dismounting and remounting, but allowing them to add the flag in would make the process much smoother. Not really sure if there's really a reason against allowing flag modification - its on a similar level to changing where the teleport is from/to on the teleport events. |
I mean I am generally waiting for maintainers to review the diff and whether we should rename it to PrepareTeleport event. I can make the Flags modifiable but I think there it would also be nice if a maintainer could give their opinion about it. |
feff6a6
to
d56035c
Compare
This would be extremely useful, PlayerPrepareTeleportEvent sounds like a better fit however |
Hello, |
d56035c
to
d9d8c38
Compare
You can just build this fork if it is that important |
We've been waiting for over 3 months... so we're doing without. It's really silly when the solution is right here. We're not going to have fun making forks of forks |
I'm on vacation for another 4 weeks so I won't be able to update the branch unfortunately. |
Joining in on the chorus that I would love to see this merged so we can mount passengers to players without breaking every plugin using Player#teleport |
Wouldn't something like |
Purpur already has an event like that and for my use case, it would work too, but I don't see why we couldn't also have this event |
A pre event in this case literally makes no sense when the teleport event is triggered anyway |
I think that both events would make sense here. I don't know what maintainers would prefer. |
Ok so i finally got time to have a look at the PR again. Looking at the code i realized that it's kind of impossible to call the Now i could add boolean parameters that handle whether to call the events or create the portal, but I don't know if we want this. Maybe i am overseeing something and there is another way to do this, but I don't see any other way. Maybe it is actually better to create a |
This pull request adds a
PlayerPreTeleportEvent
. Resolves #10168Ready for review. It is currently called where I think it makes the most sense. If we want to call it earlier, it needs some serious refactoring at some places and sometimes it really does not make sense to call it earlier.
EntityPreTeleportEvent
Modifiability?