lenis0012 / NPCFactory

NPC Library for CraftBukkit mod.
MIT License
24 stars 19 forks source link

NPC Metadata interefes with actual Player Metadata #19

Closed SupaHam closed 9 years ago

SupaHam commented 9 years ago

When an NPC is spawned its CraftPlayer is given the "NPC" Metadata. When a real CraftPlayer instance (actual player) is checked for the 'NPC' metadata, and an NPC has the name of the player, then it returns true. This is due to the way Player metadata is stored, it's stored 'name:key', this is a rather big issue and can easily be prevented.

1) Override the NPCEntity's CraftPlayer PlayerMetadataStore to store by entity id or something.

2) when checking for isNPC, return entity instanceof NPCEntity

I'd recommend the former.

SupaHam commented 9 years ago

I would've overridden CraftPlayer's metadata methods, but I was having issues with the old invalid int methods relating to damage and health.