mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-07-29 02:25:27 +02:00
RepairManager: Fix unsafe enchantments being stripped, CombatUtils: Use instanceof for IronGolem (#5192)
* RepairManager: Fix unsafe enchantments being stripped * CombatUtils: Use instanceof for IronGolem check to avoid cast exceptions for pets/npcs/... --------- Co-authored-by: Dieu <info@l4b.org>
This commit is contained in:
@@ -411,7 +411,7 @@ public class RepairManager extends SkillManager {
|
||||
if (enchantLevel > enchant.getKey().getMaxLevel()) {
|
||||
enchantLevel = enchant.getKey().getMaxLevel();
|
||||
|
||||
item.addEnchantment(enchant.getKey(), enchantLevel);
|
||||
item.addUnsafeEnchantment(enchant.getKey(), enchantLevel);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -961,8 +961,8 @@ public final class CombatUtils {
|
||||
EntityType type = target.getType();
|
||||
|
||||
if (ExperienceConfig.getInstance().hasCombatXP(type)) {
|
||||
if (type == EntityType.IRON_GOLEM) {
|
||||
if (!((IronGolem) target).isPlayerCreated()) {
|
||||
if (type == EntityType.IRON_GOLEM && target instanceof IronGolem ironGolem) {
|
||||
if (!ironGolem.isPlayerCreated()) {
|
||||
baseXP = ExperienceConfig.getInstance().getCombatXP(type);
|
||||
}
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user