Get around expensive validate calls (#2318)

This commit is contained in:
LOOHP authored and GitHub committed 2023-04-09 16:40:57 -05:00
1 parent ab32f938d7
commit d83dd9ab8a
1 file changed
+3 -1
@@ -178,7 +178,9 @@ class EntityUtilities {
Validate.notNull(entity, "entity cannot be null");
Object trackerEntry = this.getEntityTrackerEntry(entity.getWorld(), entity.getEntityId());
Validate.notNull(trackerEntry, "Could not find entity trackers for " + entity);
if (trackerEntry == null) { //entity.toString() is too expensive to be called every time
throw new IllegalArgumentException("Could not find entity trackers for " + entity);
}
if (this.trackedPlayersField == null) {
this.trackedPlayersField = Accessors.getFieldAccessor(