mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2025-02-09 12:31:27 +01:00
Fixed issue #805 about placeholders not being parsed in the profile GUI.
This commit is contained in:
parent
4b2cc5ea61
commit
9344ff99a6
@ -21,6 +21,7 @@ import net.Indyuce.mmocore.player.stats.StatInfo;
|
|||||||
import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute;
|
import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute;
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -122,9 +123,13 @@ public class PlayerStats extends EditableInventory {
|
|||||||
return new Placeholders() {
|
return new Placeholders() {
|
||||||
final net.Indyuce.mmocore.api.player.stats.PlayerStats stats = inv.target.getStats();
|
final net.Indyuce.mmocore.api.player.stats.PlayerStats stats = inv.target.getStats();
|
||||||
|
|
||||||
public String apply(Player player, String str) {
|
@Override
|
||||||
while (str.contains("{") && str.substring(str.indexOf("{")).contains("}")) {
|
public String apply(OfflinePlayer player, String str) {
|
||||||
final String holder = str.substring(str.indexOf("{") + 1, str.indexOf("}"));
|
String explored = str;
|
||||||
|
// Internal placeholders
|
||||||
|
while (explored.contains("{") && explored.substring(explored.indexOf("{")).contains("}")) {
|
||||||
|
final int begin = explored.indexOf("{"), end = explored.indexOf("}");
|
||||||
|
final String holder = explored.substring(begin + 1, end);
|
||||||
String replaced;
|
String replaced;
|
||||||
if (holder.endsWith("_base")) {
|
if (holder.endsWith("_base")) {
|
||||||
final String stat = UtilityMethods.enumName(holder.substring(0, holder.length() - 5));
|
final String stat = UtilityMethods.enumName(holder.substring(0, holder.length() - 5));
|
||||||
@ -141,6 +146,9 @@ public class PlayerStats extends EditableInventory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
str = str.replace("{" + holder + "}", replaced);
|
str = str.replace("{" + holder + "}", replaced);
|
||||||
|
|
||||||
|
// Increase counter
|
||||||
|
explored = explored.substring(end + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// External placeholders
|
// External placeholders
|
||||||
|
Loading…
Reference in New Issue
Block a user