EchoPet

EchoPet

882k Downloads

Conflict with PhatLoots for Sheep

Matmorcat opened this issue ยท 4 comments

commented

I get an error when a sheep pet is summoned, dies, or is changed.
http://pastebin.com/iTXMv0P0

I submitted a ticket to PhatLoots and the creator, Codisimus replied:
"I would have to say that is an issue with EchoPets, It should not claim that the Mob type is a sheep when it is not an instance of a Sheep object."
Source: http://dev.bukkit.org/bukkit-plugins/phatloots/tickets/124-conflict-with-echo-pets/

commented

The same seems to by for other pets such as Zombie, but not all of them.
http://pastebin.com/vWHV3jjW

commented

Plugins should not be casting without performing an instance check on the entity object. It is not guaranteed that every entity of the "Sheep" type is going to be a Bukkit entity. As can be clearly seen here, PhatLoots is casting to the Sheep object without checking if the entity in question is indeed a Sheep. In this case, it is not a Bukkit Sheep, and is instead a custom Sheep, thus causing the stacktrace above.

Although this problem should not be an issue from my end, I have implemented sufficient compatibility to deal with with the problem you have provided. This support will not exist for the newer pets I have in mind.

A warning to the author of PhatLoots: Accessing Pet data in this way can yield unpredictable results. It is not my place to deal with such errors if casting is not checked properly.

commented

Commits involved:
bd7bc37
9688fae

commented

I understand what you are saying. Your entity is a "Sheep" but just not a Bukkit Sheep. I will add the extra check within my code but you may want to keep your compatibility fix because I am sure you will see this issue a lot with other plugins especially when dealing with zombies. Even if it is their fault, you can't expect them to care to fix it.