Permalink
Browse files

Merge pull request #486 from Ecconia/Fix-Playerinsertion-JoinEvent

JoinEvent inject Entity
  • Loading branch information...
PseudoKnight committed Jun 9, 2018
2 parents ca72bc5 + 1a703a2 commit 78f108566ba88a9c744450e43c619f1763466681
Showing with 18 additions and 0 deletions.
  1. +18 −0 src/main/java/com/laytonsmith/core/events/drivers/PlayerEvents.java
@@ -817,6 +817,24 @@ public BindableEvent convert(CArray manual, Target t) {
return e;
}
@Override
public void preExecution(Environment env, ActiveEvent activeEvent) {
if(activeEvent.getUnderlyingEvent() instanceof MCPlayerJoinEvent) {
//Static lookups of the player as entity don't seem to work here, but
//the player is passed in with the event.
MCPlayer player = ((MCPlayerJoinEvent) activeEvent.getUnderlyingEvent()).getPlayer();
Static.InjectEntity(player);
}
}
@Override
public void postExecution(Environment env, ActiveEvent activeEvent) {
if(activeEvent.getUnderlyingEvent() instanceof MCPlayerJoinEvent) {
MCPlayer player = ((MCPlayerJoinEvent) activeEvent.getUnderlyingEvent()).getPlayer();
Static.UninjectEntity(player);
}
}
}
@api

0 comments on commit 78f1085

Please sign in to comment.