Bug Fix: Safe Entity UUID Rebinding
- ✅ Added UUID null check during spawnNPC() to prevent crashes:
java.lang.IllegalArgumentException: UUID id cannot be null
- Improved fallback logic to scan nearby entities using:
World#getNearbyEntities()
rather than assuming the stored UUID is always valid.
- If no entity is found, the system now logs a warning and skips gracefully, preventing plugin crashes and NPC misbehavior.
Summary
This patch ensures that
NPCs with null or outdated UUIDs no longer cause fatal errors during spawn, and the system attempts recovery by
smartly relinking to entities based on their metadata.