GlowstoneMC/Glowstone — pull request #543 by Johni0702 (2014-11-14 12:04:00+00:00)
Title: Use the same entity id to remove entities as used to add them

This PR fixes a bug caused by when teleporting entities to other worlds due to which entities are displayed multiple times to the clients.
**Current behavior**
The `GlowPlayer.pulse()` method used to send `DestroyEntitiesMessage`s with the entity's current id (as returned by `Entity.getEntityId()`). However when teleporting over worlds the id of an entity changes, resulting in an invalid id getting send and the real entity still being visible to the client.
**New behaviour**
With this PR the entity id sent to the client is stored alongside with the entity and is used once that entity is out of view. This way the old entity id is sent to the client and the entity gets removed as expected.

**Related Links:**
- Ticket: #486