Removed use of deprecated methods

This commit is contained in:
Jules 2024-02-20 00:27:54 +01:00
parent a653ffbfe1
commit 0fd1f6bbce
4 changed files with 24 additions and 25 deletions

View File

@ -46,7 +46,7 @@ public class PlayerStats {
} }
public double getStat(String stat) { public double getStat(String stat) {
return getMap().getInstance(stat).getTotal(); return getMap().getStat(stat);
} }
/** /**

View File

@ -33,7 +33,7 @@ public class StatModifiersCommandTreeNode extends CommandTreeNode {
sender.sendMessage("Stat Modifiers (" + instance.getKeys().size() + "):"); sender.sendMessage("Stat Modifiers (" + instance.getKeys().size() + "):");
for (String key : instance.getKeys()) { for (String key : instance.getKeys()) {
StatModifier mod = instance.getModifier(key); StatModifier mod = instance.getModifier(key);
sender.sendMessage("- " + key + ": " + mod.getValue() + " " + mod.getType().name()); sender.sendMessage("-> '" + key + "' " + mod.getValue() + " " + mod.getType().name() + " " + mod.getSlot() + " " + mod.getSource());
} }
return CommandResult.SUCCESS; return CommandResult.SUCCESS;

View File

@ -133,7 +133,7 @@ public class PlayerStats extends EditableInventory {
if (holder.endsWith("_extra")) { if (holder.endsWith("_extra")) {
final String stat = UtilityMethods.enumName(holder.substring(0, holder.length() - 6)); final String stat = UtilityMethods.enumName(holder.substring(0, holder.length() - 6));
return StatManager.format(stat, MythicLib.plugin.getStats().getTotalValue(stat, stats.getMap()) - stats.getBase(stat)); return StatManager.format(stat, stats.getStat(stat) - stats.getBase(stat));
} }
if (holder.startsWith("attribute_")) { if (holder.startsWith("attribute_")) {
@ -142,7 +142,7 @@ public class PlayerStats extends EditableInventory {
} }
final String stat = UtilityMethods.enumName(holder); final String stat = UtilityMethods.enumName(holder);
return StatManager.format(stat, MythicLib.plugin.getStats().getTotalValue(stat, stats.getMap())); return StatManager.format(stat, stats.getStat(stat));
} }
}; };
} }

View File

@ -50,8 +50,7 @@ public class AttributeManager implements MMOCoreManager {
final ConfigurationSection statsConfig = new ConfigFile(MythicLib.plugin, "", "stats").getConfig(); final ConfigurationSection statsConfig = new ConfigFile(MythicLib.plugin, "", "stats").getConfig();
for (PlayerAttribute attr : getAll()) { for (PlayerAttribute attr : getAll()) {
final MMOCoreAttributeStatHandler handler = new MMOCoreAttributeStatHandler(statsConfig, attr); final MMOCoreAttributeStatHandler handler = new MMOCoreAttributeStatHandler(statsConfig, attr);
MythicLib.plugin.getStats().registerStat(handler.getStat(), handler); MythicLib.plugin.getStats().registerStat(handler, handler.getStat() + "_PERCENT");
MythicLib.plugin.getStats().registerStat(handler.getStat() + "_PERCENT", handler);
} }
} }
} }