From 4e2af454281ac67a03044ffaea200cb60065dd85 Mon Sep 17 00:00:00 2001 From: "Kristian S. Stangeland" Date: Sun, 15 Sep 2013 20:42:07 +0200 Subject: [PATCH] More descriptive error message when an entities tracker is not found. --- .../com/comphenix/protocol/injector/EntityUtilities.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/EntityUtilities.java b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/EntityUtilities.java index fbf9eac1..8965fd60 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/EntityUtilities.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/EntityUtilities.java @@ -132,9 +132,14 @@ class EntityUtilities { List result = new ArrayList(); Object trackerEntry = getEntityTrackerEntry(entity.getWorld(), entity.getEntityId()); - if (trackedPlayersField == null) + if (trackerEntry == null) { + throw new IllegalArgumentException("Cannot find entity trackers for " + entity + + (entity.isDead() ? " - entity is dead." : ".")); + } + if (trackedPlayersField == null) { trackedPlayersField = FuzzyReflection.fromObject(trackerEntry).getFieldByType("java\\.util\\..*"); - + } + Collection trackedPlayers = (Collection) FieldUtils.readField(trackedPlayersField, trackerEntry, false); // Wrap every player - we also ensure that the underlying tracker list is immutable