[SPIGOT-248] PortalCreateEvent not fired when exit portal is created automatically. Created: 20/Dec/14 Updated: 05/May/19 Resolved: 05/May/19 |
|
Status: | Resolved |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | Minor |
Reporter: | Arne | Assignee: | md_5 |
Resolution: | Fixed | Votes: | 1 |
Labels: | None |
Description |
When a player enters a nether portal with no existing exit portal, a new portal is created automatically but no PortalCreateEvent is sent. Steps to reproduce:
I discoved this while trying to find a way to stop portals from automatically forming in specific areas. |
Comments |
Comment by Stuperfied [ 18/Mar/18 ] |
Not sure about this but Should PortalTravelAgent.CreatePortal contain a call to PortalCreateEvent with CreateReason.OBC_DESTINATION
Update: I ran the test suggested by reporter (Arne ) on a spigot 1.12.2 server and have uploaded the latest.log with the results. |
Comment by Ryan Hamshire [ 15/Jan/15 ] |
I worked this out in GriefPrevention. Check the github to see how I did it - it's rather expensive because I have to ask the travel agent to find a place for the portal, but it works. Basically, instead of using PortalCreateEvent, I use PlayerPortalEvent and ask the travel agent to calculate for me where the portal would be. Then I check the block type there - if it's a portal block, then this is an existing portal. If it's not, then it's a new portal and I can choose to cancel the event or not in that case. I can imagine a better API which would allow me to consider and possibly cancel the event AFTER the portal location had been determined so that I don't have to ask for that calculation to happen on my behalf, but this is good enough considering that players don't go through portals very often, and when they do, idling doesn't cause them to hop back and forth - they have to step out and then back in to trigger another teleportation, and then there's the delay before the teleport actually happens to slow down any would-be server laggers. |
Comment by Arne [ 23/Dec/14 ] |
Oh, that is weird. That makes me unsure if this even is a bug. But what other purpose can CreateReason have if not this? I tried working around it (implementing my own TravelAgent), but that means messing with NMS code which I would rather avoid. The problem remains; I have no way of stopping a portal from being created automatically in any world, or affect where it is placed. |
Comment by md_5 [ 20/Dec/14 ] |
This hasn't existed since Minecraft 1.4! |
Comment by md_5 [ 20/Dec/14 ] |
Seems CraftBukkit 1.7.10 did not have this either. |