World#getEntitiesByClass(Class<T>) only returns entities created since server start

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major
    • None
    • Affects Version/s: None
    • None
    • Environment:
    • CraftBukkit version 4489-Spigot-3dafb73-d63a32e (MC: 1.21.5) (Implementing API version 1.21.5-R0.1-SNAPSHOT)
    • Yes

      With v1.21.5, when using World#getEntitiesByClass(Class<T>) or World#getEntitiesByClasses(<Class<T>...) the returned collection contains only the matching entities that were created since the server started. Other entities created before a server restart won't be included.

      In version CraftBukkit version 4458-Spigot-73860e0-fb3f2b6 (MC: 1.21.4) (Implementing API version 1.21.4-R0.1-SNAPSHOT), this was returning pre-existing entities as expected.

      1. To reproduce this issue :
        Create a new server with the provided plugin used for testing. This plugin will log every second for every world the number of ArmorStands found by getEntitiesByClass.
      2. Once the server is started, place an armor stand, notice the logged number of found armor stands changes to 1.
      3. Stop the server, and start it again.
      4. The number of armor stands is back to 0, even when joining the server to make sure the chunk is loaded.

      This issue is not limited to armor stands, at least Mob.class and Vehicle.class showed the same behaviour.

      Thank you for looking into this.

            Assignee:
            Unassigned
            Reporter:
            Renaud Gaspard
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: