Skip to content

RepairManager: Fix unsafe enchantments being stripped, CombatUtils: Use instanceof for IronGolem #5192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 9, 2025

Conversation

Techirion
Copy link
Contributor

RepairManager: Fix unsafe enchantments being stripped
CombatUtils: Use instanceof for IronGolem check to avoid cast exceptions for pets/npcs/...

@@ -883,8 +883,8 @@ public static void processCombatXP(@NotNull McMMOPlayer mcMMOPlayer,
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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't it just be the instanceOf check here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, I've added instance of check cause we saw cast exceptions flying. I'll check once I'm back, but I think you're right.

@nossr50
Copy link
Member

nossr50 commented Jul 9, 2025

Thank you for the two fixes.
In the future it would be preferable for each fix to be in its own PR, but no biggie.

@nossr50 nossr50 merged commit c377544 into mcMMO-Dev:master Jul 9, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants