Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-6782

EntityPortalEvent should not destroy entity when setTo() uses same world as getFrom()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • None
    • 3273-Spigot-3892929-376edf4 (MC: 1.17.1)
    • Linked Portals
    • Yes

      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.

            DerFrZocker Marvin Rieple
            born2code Paul Palmer
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: