MobHunting

MobHunting

114k Downloads

MyPet Error

Sikatsu opened this issue ยท 12 comments

commented

I think this has been following us around for years.

https://pastebin.com/tMjFQkth

commented

Why do you think it is the same bug??? :-) all java bugs look like the same ;-)

Anyway, do you know what trigger this bug? Im able to see mypet is involved...

commented

No idea, but I mean MyPet errors in general have been here for years. I have no idea, it just shows up in my console frequently.

commented

https://github.com/Rocologo/MobHunting/blob/master/src/one/lindegaard/MobHunting/MobHuntingManager.java#L1832

Could it be that killer is null when Entity dies from fall damage?

By the way a cleanup would help here. Reducing the method length from around 1.200 lines to a maximum of 100 lines.

commented

Its a good idea. I will check what happens if the pet dies while the killer is null.

Do you have away to reduce the code by 90%? :-)

commented

Do you have away to reduce the code by 90%? :-)

Split it up and reduce the complexity.

commented

I have actually reworked the code more than 5 times over the years.

The code is very complex because it integrates to many other plugins. I could probably spilt ud the code, but in the end it would not reduce the total number of lines... i think ...

commented

But it will reduce lines per method and lines per class. Complexity will be reduced.

  • Single Responsible Principle
  • Open Closed Principle
  • Liskov Substitution Principle
  • Interface Segregation Principle
  • Dependency Inversion Principle

https://hackernoon.com/solid-principles-made-easy-67b1246bcdf

commented

I dont think killed can be null

This is how killed is created

	private void onMobDeath(EntityDeathEvent event) {
		LivingEntity killed = event.getEntity();

Looking at the error text, it looks like a MyPet attacked a zombie and then the zombie was killed by fire (daylight) ???? but I dont know how to reproduce / verify that

commented

I dont think killed can be null

This is how killed is created

	private void onMobDeath(EntityDeathEvent event) {
		LivingEntity killed = event.getEntity();

Looking at the error text, it looks like a MyPet attacked a zombie and then the zombie was killed by fire (daylight) ???? but I dont know how to reproduce / verify that

I said Killer is null. Not killed. Killer != killed.

killed -> victim dying
Killer -> the entity that kills the victim

check if killed.getKiller() is null

commented

killed.getKiller() is null if the killer is not a Player... so that is not a solution.

commented

@Sikatsu do you still see this error?

If yes, could you please provide me with a fresh error text?

commented

Hmm not really. If it happens again i'll let you know.