Skip to content

ItemSpawnEvent gets called twice #12

@fadijalal07

Description

@fadijalal07

I have the plugin on my server for a very long time, however today i decided to work on a feature called Collection Chests (Picks up all dropped items in the chunk the chest is in)

i completed the feature, when i tested it, by dropping 1 stone, the chest gets filled with 2, which confused it me as i didnt have duplicate events or the listener registered twice, i kept debugging and i found out that ItemSpawnEvent is getting called twice for 1 item drop.

i had a feeling it was your plugin perhaps colliding w it, so i disabled it and tried again and it worked smoothly.

this is most likely happening due to your EntitySpawnListener file, specifically the "$newEntity = new ItemEntity($entity->getLocation(), $entity->getItem());" line. which causes the item entity to call the event twice...

https://streamable.com/lowoh9 perhaps this can help

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions