Fixed attribute stats display

This commit is contained in:
Indyuce 2022-07-26 12:41:01 +02:00
parent 33b9841182
commit b125dac155
3 changed files with 6 additions and 7 deletions

View File

@ -2,7 +2,6 @@ package net.Indyuce.mmocore.gui;
import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.MythicLib;
import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.lib.UtilityMethods;
import io.lumine.mythic.lib.api.stat.handler.StatHandler;
import io.lumine.mythic.lib.api.stat.modifier.StatModifier; import io.lumine.mythic.lib.api.stat.modifier.StatModifier;
import io.lumine.mythic.lib.version.VersionMaterial; import io.lumine.mythic.lib.version.VersionMaterial;
import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.MMOCore;
@ -124,14 +123,14 @@ public class PlayerStats extends EditableInventory {
public String apply(Player player, String str) { public String apply(Player player, String str) {
while (str.contains("{") && str.substring(str.indexOf("{")).contains("}")) { while (str.contains("{") && str.substring(str.indexOf("{")).contains("}")) {
String holder = str.substring(str.indexOf("{") + 1, str.indexOf("}")); final String holder = str.substring(str.indexOf("{") + 1, str.indexOf("}"));
String replaced; String replaced;
if (holder.endsWith("_base")) { if (holder.endsWith("_base")) {
StatInfo info = StatInfo.valueOf(UtilityMethods.enumName(holder.substring(0, holder.length() - 5))); StatInfo info = StatInfo.valueOf(UtilityMethods.enumName(holder.substring(0, holder.length() - 5)));
replaced = info.format(stats.getBase(info.name)); replaced = info.format(stats.getBase(info.name));
} else if (holder.endsWith("_extra")) { } else if (holder.endsWith("_extra")) {
StatInfo info = StatInfo.valueOf(UtilityMethods.enumName(holder.substring(0, holder.length() - 5))); StatInfo info = StatInfo.valueOf(UtilityMethods.enumName(holder.substring(0, holder.length() - 6)));
replaced = info.format(MythicLib.plugin.getStats().getTotalValue(info.name, stats.getMap()) - stats.getBase(info.name)); replaced = info.format(MythicLib.plugin.getStats().getTotalValue(info.name, stats.getMap()) - stats.getBase(info.name));
} else if (holder.startsWith("attribute_")) { } else if (holder.startsWith("attribute_")) {
PlayerAttribute attr = MMOCore.plugin.attributeManager.get(holder.substring(10).replace("_", "-").toLowerCase()); PlayerAttribute attr = MMOCore.plugin.attributeManager.get(holder.substring(10).replace("_", "-").toLowerCase());

View File

@ -73,8 +73,8 @@ skills:
attributes: attributes:
knockback-resistance: knockback-resistance:
base: 15 base: .15
per-level: 1 per-level: .01
speed-malus-reduction: speed-malus-reduction:
base: 10 base: 10
per-level: 2 per-level: 2

View File

@ -60,8 +60,8 @@ skills:
attributes: attributes:
knockback-resistance: knockback-resistance:
base: 30 base: .3
per-level: 1 per-level: .01
speed-malus-reduction: speed-malus-reduction:
base: 30 base: 30
per-level: 2 per-level: 2