mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-08-01 20:15:28 +02:00
Fix bug with levels up commands reporting incorrect level
This commit is contained in:
@@ -263,7 +263,6 @@ public final class EventUtils {
|
||||
if (isLevelUp) {
|
||||
NotificationManager.processLevelUpBroadcasting(mmoPlayer, skill, mmoPlayer.getSkillLevel(skill));
|
||||
NotificationManager.processPowerLevelUpBroadcasting(mmoPlayer, mmoPlayer.getPowerLevel());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -6,6 +6,7 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.LogUtils;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.jetbrains.annotations.VisibleForTesting;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
@@ -25,7 +26,19 @@ public class FormulaManager {
|
||||
public FormulaManager() {
|
||||
/* Setting for Classic Mode (Scales a lot of stuff up by * 10) */
|
||||
initExperienceNeededMaps();
|
||||
loadFormula();
|
||||
if (!formulaFile.exists()) {
|
||||
previousFormula = FormulaType.UNKNOWN;
|
||||
return;
|
||||
}
|
||||
|
||||
previousFormula = FormulaType.getFormulaType(YamlConfiguration.loadConfiguration(formulaFile).getString("Previous_Formula", "UNKNOWN"));
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public FormulaManager(FormulaType previousFormulaType) {
|
||||
/* Setting for Classic Mode (Scales a lot of stuff up by * 10) */
|
||||
initExperienceNeededMaps();
|
||||
this.previousFormula = previousFormulaType;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -122,7 +135,7 @@ public class FormulaManager {
|
||||
*/
|
||||
|
||||
//TODO: When the heck is Unknown used?
|
||||
if (formulaType == FormulaType.UNKNOWN) {
|
||||
if (formulaType == null || formulaType == FormulaType.UNKNOWN) {
|
||||
formulaType = FormulaType.LINEAR;
|
||||
}
|
||||
|
||||
@@ -209,18 +222,6 @@ public class FormulaManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load formula file.
|
||||
*/
|
||||
public void loadFormula() {
|
||||
if (!formulaFile.exists()) {
|
||||
previousFormula = FormulaType.UNKNOWN;
|
||||
return;
|
||||
}
|
||||
|
||||
previousFormula = FormulaType.getFormulaType(YamlConfiguration.loadConfiguration(formulaFile).getString("Previous_Formula", "UNKNOWN"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Save formula file.
|
||||
*/
|
||||
|
@@ -139,7 +139,7 @@ public class NotificationManager {
|
||||
notificationType, message, destination, mcMMO.p.getAdvancedConfig().doesNotificationSendCopyToChat(notificationType));
|
||||
|
||||
//Call event
|
||||
Bukkit.getServer().getPluginManager().callEvent(customEvent);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(customEvent);
|
||||
return customEvent;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user