You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The profile field inside GlowHumanEntity is set after the super() call to Glow[Living]Entity, which in turn spawns the entity by allocating the entity ID and setting the location field. However, the PlayerSpawnLocationEvent should be fired:
Before the player entity is spawned in the world, and the location set
After the Player instance is created (because it is required in the event constructor), and the profile field set.
Right now, the event is fired before both the entity spawn and the profile being set:
I think the solution to this would be to fire the event inside the GlowSession.setPlayer method (which creates the GlowPlayer instance) before creating the actual entity.
However, because the event needs the entity instance to be passed, I think one solution would be to create a "mock GlowPlayer" that would have stubs for the needed GlowPlayer methods, while not actually spawning that mock player in the world. After the event is fired, an actual entity is created from the spawnLocation result.
Alternatively, the entity spawning could be externalized from the GlowEntity constructor to be called after all subconstructors are completed.
The
profile
field insideGlowHumanEntity
is set after the super() call to Glow[Living]Entity, which in turn spawns the entity by allocating the entity ID and setting the location field. However, thePlayerSpawnLocationEvent
should be fired:profile
field set.Right now, the event is fired before both the entity spawn and the profile being set:
Glowstone/src/main/java/net/glowstone/entity/GlowHumanEntity.java
Lines 132 to 134 in 5ffb436
Glowstone/src/main/java/net/glowstone/entity/GlowEntity.java
Lines 271 to 285 in 5ffb436
I think the solution to this would be to fire the event inside the
GlowSession.setPlayer
method (which creates the GlowPlayer instance) before creating the actual entity.However, because the event needs the entity instance to be passed, I think one solution would be to create a "mock GlowPlayer" that would have stubs for the needed GlowPlayer methods, while not actually spawning that mock player in the world. After the event is fired, an actual entity is created from the spawnLocation result.
Alternatively, the entity spawning could be externalized from the
GlowEntity
constructor to be called after all subconstructors are completed.Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: