Skip to content

Commit

Permalink
Add a fallback for getting a player entity when its missing from a wo…
Browse files Browse the repository at this point in the history
…rld's entity list.
  • Loading branch information
PseudoKnight committed Nov 3, 2019
1 parent 50ff675 commit 98c85f4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/java/com/laytonsmith/core/Static.java
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,12 @@ public static MCEntity getEntityByUuid(UUID id, Target t) {
}
MCEntity ent = getServer().getEntity(id);
if(ent == null) {
throw new CREBadEntityException("That entity (UUID: " + id + ") does not exist.", t);
// Sometimes a bug may cause a player entity to be missing from entity lists in the server,
// so we'll double check the player list.
ent = getServer().getPlayer(id);
if(ent == null) {
throw new CREBadEntityException("That entity (UUID: " + id + ") does not exist.", t);
}
}
return ent;
}
Expand Down

0 comments on commit 98c85f4

Please sign in to comment.