forked from Upstream/mmocore
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
2e5cb2b725
@ -2,6 +2,7 @@ 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;
|
||||||
@ -131,13 +132,13 @@ public class PlayerStats extends EditableInventory {
|
|||||||
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() - 5)));
|
||||||
replaced = info.format(stats.getStat(info.name) - 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());
|
||||||
replaced = String.valueOf(inv.target.getAttributes().getAttribute(attr));
|
replaced = String.valueOf(inv.target.getAttributes().getAttribute(attr));
|
||||||
} else {
|
} else {
|
||||||
StatInfo info = StatInfo.valueOf(UtilityMethods.enumName(holder));
|
StatInfo info = StatInfo.valueOf(UtilityMethods.enumName(holder));
|
||||||
replaced = info.format(stats.getStat(info.name));
|
replaced = info.format(MythicLib.plugin.getStats().getTotalValue(info.name, stats.getMap()));
|
||||||
}
|
}
|
||||||
|
|
||||||
str = str.replace("{" + holder + "}", replaced);
|
str = str.replace("{" + holder + "}", replaced);
|
||||||
|
@ -2,6 +2,7 @@ package net.Indyuce.mmocore.gui.api.item;
|
|||||||
|
|
||||||
import net.Indyuce.mmocore.MMOCore;
|
import net.Indyuce.mmocore.MMOCore;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -21,7 +22,9 @@ public class Placeholders {
|
|||||||
// Internal placeholders
|
// Internal placeholders
|
||||||
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("}"));
|
String holder = str.substring(str.indexOf("{") + 1, str.indexOf("}"));
|
||||||
str = str.replace("{" + holder + "}", placeholders.getOrDefault(holder, "Error"));
|
@Nullable String found = placeholders.get(holder);
|
||||||
|
if (found != null)
|
||||||
|
str = str.replace("{" + holder + "}", found);
|
||||||
}
|
}
|
||||||
|
|
||||||
// External placeholders
|
// External placeholders
|
||||||
|
Loading…
Reference in New Issue
Block a user