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

@@ -1,3 +1,7 @@
Version 2.2.048
Fixed error when loading Spears skill manager on older Minecraft versions
Fixed error when using /spears command on an older Minecraft version
Version 2.2.047
Fix bug where off-hand spears damage could be attributed to various combat skills and trigger their abilities

View File

@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>2.2.047</version>
<version>2.2.048</version>
<name>mcMMO</name>
<url>https://github.com/mcMMO-Dev/mcMMO</url>
<scm>

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)) {