Hi, I'm spawning parrots on players' shoulders and want to kill / remove them as soon as they jump off the player. My check triggers correctly, but Entity#remove doesn't do anything, neither do Entity#setHealth or Entity#damage. I'm executing this code from a synchronized Bukkit TaskTimer. Any ideas? I save the parrot as an Entity and already made sure it is the right entity. Using 1.15.2 Spigot API, running on 1.12.2 server.
Are you getting any errors? My first thought is that perhaps the entity on the shoulder and one in world are in fact different.
You should generally be using the API for the version that your're coding for. There are many things that are different between the 1.15.2 and 1.13.2 APIs. The material flattening is one such example. With that said, if it's not working at a specific time, have you tried scheduling a task that does it the tick after?
The entities were in fact different. I solved my problem in a more elegant way using information from https://www.spigotmc.org/threads/parrots-not-firing-entitydismountevent-or-veichleexitevent.366595/. The parrot on the shoulder is not an entity that I spawned in the world before, I now use the CreatureSpawnEvent and check for SpawnReason ShoulderEntity.