2.2.048 hotfix for spear manager exception Fixes #5237
Some checks failed
EpicKnarvik97/mcMMO/pipeline/head There was a failure building this commit

This commit is contained in:
nossr50
2025-12-14 16:27:51 -08:00
parent e2f18a9e89
commit 1036aabc32
4 changed files with 13 additions and 12 deletions

View File

@@ -181,7 +181,6 @@ public class McMMOPlayer implements Identified {
}
}
//TODO: Add test
private void initManager(PrimarySkillType primarySkillType) throws InvalidSkillException {
final var version = mcMMO.getCompatibilityManager().getMinecraftGameVersion();
@@ -203,20 +202,12 @@ public class McMMOPlayer implements Identified {
case TRIDENTS -> new TridentsManager(this);
case UNARMED -> new UnarmedManager(this);
case WOODCUTTING -> new WoodcuttingManager(this);
case MACES -> version.isAtLeast(1, 21, 0)
? new MacesManager(this)
: null; // keep current behavior: no manager on older versions
case SPEARS -> version.isAtLeast(1, 21, 11)
? new SpearsManager(this)
: null; // same here
case MACES -> version.isAtLeast(1, 21, 0) ? new MacesManager(this) : null;
case SPEARS -> version.isAtLeast(1, 21, 11) ? new SpearsManager(this) : null;
};
if (manager != null) {
skillManagers.put(primarySkillType, manager);
} else {
throw new InvalidSkillException("No valid skill manager for skill: " + primarySkillType);
}
}

View File

@@ -64,6 +64,12 @@ public final class CommandRegistrationManager {
private static void registerSkillCommands() {
for (PrimarySkillType primarySkillType : PrimarySkillType.values()) {
if (primarySkillType == PrimarySkillType.SPEARS
&& !mcMMO.getCompatibilityManager().getMinecraftGameVersion()
.isAtLeast(1, 21, 11)) {
continue;
}
if (primarySkillType == PrimarySkillType.MACES
&& !mcMMO.getCompatibilityManager().getMinecraftGameVersion()
.isAtLeast(1, 21, 0)) {