Null Error
madtomic opened this issue ยท 16 comments
Using mcMMO 1.5.04-SNAPSHOT-b82 + McCombatLevel 2.0 + ItemControl 1.0
I included this for you to review as ItemControl has no issue. The Null is from McCombatLevel
ItemControl
Download: https://www.dropbox.com/s/w1uw04hj1dsjdto/ItemControl.jar?dl=0
Source: https://github.com/EcMiner/ItemControl
I get this null error from mcCombatLevel
http://pastebin.com/xZarxPxx
This error started after mcmmo 1.5.01+
It's a different plugin:
me.ecminer.itemcontrol.listeners.LevelListener.onPlayerCombatLevelCha
nge
Yes, we look at the source for both itemcontrol and mcmmo and it all leads to mccombatlevel.
As itemcontrol uses mccombatlevel as API for the combatlevel events.
What the plugin does it do is, it limits what tools, armor and weapons a player can use based on mccombatlevel.
Why does the plugin this?
But the plugin shouldn't call the update method. McCombatLevel already does that.
And according to the stacktrace, the error happens in line 49 which is the access to a data collection within ItemControl.
Sigh, I wished EcMiner could help. Do you think you could help me fix this? I had been through like 4 other devs and no one is able to fix this and I hate not having mccombatlevel on the server as it's my oldest plugin and everyone loves it.
One more thing, the source on itemcontrol isn't updated.
UPDATE: the origins of this issue is from this line
oldLevel.put(player.getName(), plugin.getMcCombatLevel().getCombatLevel(player));
getCombatLevel returns null
And that's because McCombatLevel cache doesn't contain the player for some reason
I had, I created many fresh install for this test and the error still comes up when someone gains a combatlevel.
I checked it. It's the fault of ItemControl. The account isn't loaded at the time it tries to add it to the collection.
So, this is why it breaks after mcmmo 1.5.01, it changes when the player data is loaded.