mcMMO-Dev/mcMMO — pull request #192 by bm01 (2012-03-04 21:07:22+00:00)
Title: Repair.addEnchants() messages fix and optimization

There was a problem with the three messages (perfect repair, downgraded, failed). You could get the wrong one or even two of them.

ItemStack.getEnchants() returns a newly allocated map of enchantments and their level, so I removed calls to ItemStack.getEnchantmentLevel() as well as both arrays.

Also reduced the number of arguments passed to methods, enchants are retrieved only when necessary (in addEnchants(), right after repairItem() has checked if the item can loose its enchants or not).

Enchants are removed only when they must be removed, no longer removed and maybe re-added.