[SPIGOT-6782] EntityPortalEvent should not destroy entity when setTo() uses same world as getFrom() Created: 03/Nov/21  Updated: 05/Feb/22  Resolved: 05/Feb/22

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Paul Palmer Assignee: Marvin Rieple
Resolution: Fixed Votes: 1
Labels: None

Version: 3273-Spigot-3892929-376edf4 (MC: 1.17.1)
Plugin: Linked Portals
Guidelines Read: Yes

 Description   

I have a plugin that allows players to override the "to" location of a nether portal. It does this using setTo() from within an EntityPortalEvent handler. However, if the plugin sets "to" to a location that is the same world as the entity is already in, the entity appears to be silently destroyed instead of being teleported.

When this happens there will be a warning in the logs that begins: "UUID of added entity already exists" ...

I suspect what is happening is that the code may be copying the entity into the "to" world and then deleting it from the "from" world. However, if these are the same, the code issues the warning and fails to generate the copy and then proceeds to delete the original entity, leaving no copy of the entity anywhere.

The enhancement would be for the entity to not disappear in these circumstances. My hope is that a simple change to only attempt the copy entity semantics when the "from" and "to" worlds are different and if they are the same the original entity is used instead.



 Comments   
Comment by Marvin Rieple [ 05/Feb/22 ]

Made a PR for this: craftbukkit#1006

Generated at Sun Mar 30 02:32:24 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.