Removed useless PAPI placeholders

This commit is contained in:
Indyuce 2020-03-27 23:07:58 +01:00
parent f7884d785d
commit 93966947aa

View File

@ -13,7 +13,9 @@ import net.Indyuce.mmocore.api.player.PlayerQuests;
import net.Indyuce.mmocore.api.player.Professions; import net.Indyuce.mmocore.api.player.Professions;
import net.Indyuce.mmocore.api.player.stats.StatType; import net.Indyuce.mmocore.api.player.stats.StatType;
public class RPGPlaceholders extends PlaceholderExpansion /** implements Relational*/ { public class RPGPlaceholders
extends PlaceholderExpansion /** implements Relational */
{
@Override @Override
public String getAuthor() { public String getAuthor() {
@ -46,7 +48,7 @@ public class RPGPlaceholders extends PlaceholderExpansion /** implements Relatio
return String.valueOf(PlayerData.get(player).isInCombat()); return String.valueOf(PlayerData.get(player).isInCombat());
else if (identifier.equals("health")) else if (identifier.equals("health"))
return MMOCore.plugin.configManager.decimals.format(player.getHealth()); return StatType.MAX_HEALTH.format(player.getHealth());
else if (identifier.equals("class")) else if (identifier.equals("class"))
return PlayerData.get(player).getProfess().getName(); return PlayerData.get(player).getProfess().getName();
@ -62,7 +64,7 @@ public class RPGPlaceholders extends PlaceholderExpansion /** implements Relatio
return "" + PlayerData.get(player).getCollectionSkills().getLevel(identifier.substring(11).replace(" ", "-").replace("_", "-").toLowerCase()); return "" + PlayerData.get(player).getCollectionSkills().getLevel(identifier.substring(11).replace(" ", "-").replace("_", "-").toLowerCase());
else if (identifier.equals("max_health")) else if (identifier.equals("max_health"))
return MMOCore.plugin.configManager.decimals.format(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()); return StatType.MAX_HEALTH.format(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
else if (identifier.equals("experience")) else if (identifier.equals("experience"))
return "" + PlayerData.get(player).getExperience(); return "" + PlayerData.get(player).getExperience();
@ -88,9 +90,6 @@ public class RPGPlaceholders extends PlaceholderExpansion /** implements Relatio
else if (identifier.equals("mana")) else if (identifier.equals("mana"))
return MMOCore.plugin.configManager.decimal.format(PlayerData.get(player).getMana()); return MMOCore.plugin.configManager.decimal.format(PlayerData.get(player).getMana());
else if (identifier.equals("max_mana"))
return MMOCore.plugin.configManager.decimal.format(PlayerData.get(player).getStats().getStat(StatType.MAX_MANA));
else if (identifier.equals("mana_bar")) { else if (identifier.equals("mana_bar")) {
String format = ""; String format = "";
PlayerData data = PlayerData.get(player); PlayerData data = PlayerData.get(player);
@ -103,9 +102,6 @@ public class RPGPlaceholders extends PlaceholderExpansion /** implements Relatio
else if (identifier.equals("stamina")) else if (identifier.equals("stamina"))
return MMOCore.plugin.configManager.decimal.format(PlayerData.get(player).getStamina()); return MMOCore.plugin.configManager.decimal.format(PlayerData.get(player).getStamina());
else if (identifier.equals("max_stamina"))
return MMOCore.plugin.configManager.decimal.format(PlayerData.get(player).getStats().getStat(StatType.MAX_STAMINA));
else if (identifier.equals("stamina_bar")) { else if (identifier.equals("stamina_bar")) {
String format = ""; String format = "";
PlayerData data = PlayerData.get(player); PlayerData data = PlayerData.get(player);
@ -115,12 +111,14 @@ public class RPGPlaceholders extends PlaceholderExpansion /** implements Relatio
return format; return format;
} }
else if (identifier.startsWith("stat_")) {
StatType type = StatType.valueOf(identifier.substring(5).toUpperCase());
return type == null ? "Invalid Stat" : type.format(PlayerData.get(player).getStats().getStat(type));
}
else if (identifier.equals("stellium")) else if (identifier.equals("stellium"))
return MMOCore.plugin.configManager.decimal.format(PlayerData.get(player).getStellium()); return MMOCore.plugin.configManager.decimal.format(PlayerData.get(player).getStellium());
else if (identifier.equals("max_stellium"))
return MMOCore.plugin.configManager.decimal.format(PlayerData.get(player).getStats().getStat(StatType.MAX_STELLIUM));
else if (identifier.equals("stellium_bar")) { else if (identifier.equals("stellium_bar")) {
String format = ""; String format = "";
PlayerData data = PlayerData.get(player); PlayerData data = PlayerData.get(player);
@ -145,15 +143,11 @@ public class RPGPlaceholders extends PlaceholderExpansion /** implements Relatio
return data.hasCurrent() ? data.getCurrent().getFormattedLore() : "None"; return data.hasCurrent() ? data.getCurrent().getFormattedLore() : "None";
} }
else if (identifier.startsWith("stat_"))
return StatType.valueOf(identifier.substring(5).toUpperCase()) != null ? "" + PlayerData.get(player).getStats().getStat(StatType.valueOf(identifier.substring(5).toUpperCase())) : "Invalid stat";
else if (identifier.startsWith("formatted_stat_"))
return StatType.valueOf(identifier.substring(15).toUpperCase()) != null ? "" + StatType.valueOf(identifier.substring(15).toUpperCase()).format(PlayerData.get(player).getStats().getStat(StatType.valueOf(identifier.substring(15).toUpperCase()))) : "Invalid stat";
else if (identifier.startsWith("guild_")) { else if (identifier.startsWith("guild_")) {
String placeholder = identifier.substring(6); String placeholder = identifier.substring(6);
PlayerData data = PlayerData.get(player); PlayerData data = PlayerData.get(player);
if(data.getGuild() == null) return ""; if (data.getGuild() == null)
return "";
if (placeholder.equalsIgnoreCase("name")) if (placeholder.equalsIgnoreCase("name"))
return data.getGuild().getName(); return data.getGuild().getName();
@ -169,9 +163,4 @@ public class RPGPlaceholders extends PlaceholderExpansion /** implements Relatio
return null; return null;
} }
/**@Override
public String onPlaceholderRequest(Player player1, Player player2, String identifier) {
return null;
}*/
} }