mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2025-01-06 07:07:38 +01:00
Fixed issue related to wrong display for skill tree paths.
This commit is contained in:
parent
54bb1f2632
commit
ddf041aa30
@ -12,12 +12,12 @@ import net.Indyuce.mmocore.api.quest.PlayerQuests;
|
||||
import net.Indyuce.mmocore.experience.PlayerProfessions;
|
||||
import net.Indyuce.mmocore.experience.Profession;
|
||||
import net.Indyuce.mmocore.party.AbstractParty;
|
||||
import net.Indyuce.mmocore.skill.ClassSkill;
|
||||
import net.Indyuce.mmocore.skill.RegisteredSkill;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.attribute.AttributeInstance;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@ -143,9 +143,7 @@ public class RPGPlaceholders extends PlaceholderExpansion {
|
||||
else if (identifier.startsWith("party_count")) {
|
||||
final @Nullable AbstractParty party = playerData.getParty();
|
||||
return party == null ? "0" : String.valueOf(party.countMembers());
|
||||
}
|
||||
|
||||
else if (identifier.startsWith("party_member_")) {
|
||||
} else if (identifier.startsWith("party_member_")) {
|
||||
final int n = Integer.parseInt(identifier.substring(13)) - 1;
|
||||
final @Nullable AbstractParty party = playerData.getParty();
|
||||
if (party == null) return ERROR_PLACEHOLDER;
|
||||
@ -153,24 +151,18 @@ public class RPGPlaceholders extends PlaceholderExpansion {
|
||||
final @Nullable PlayerData member = party.getMember(n);
|
||||
if (member == null) return ERROR_PLACEHOLDER;
|
||||
return member.getPlayer().getName();
|
||||
}
|
||||
|
||||
else if (identifier.equals("online_friends")) {
|
||||
} else if (identifier.equals("online_friends")) {
|
||||
int count = 0;
|
||||
for (UUID friendId : playerData.getFriends())
|
||||
if (Bukkit.getPlayer(friendId) != null) count++;
|
||||
return String.valueOf(count);
|
||||
}
|
||||
|
||||
else if (identifier.startsWith("online_friend_")) {
|
||||
} else if (identifier.startsWith("online_friend_")) {
|
||||
final int n = Integer.parseInt(identifier.substring(14)) - 1;
|
||||
if (n >= playerData.getFriends().size()) return ERROR_PLACEHOLDER;
|
||||
final @Nullable Player friend = Bukkit.getPlayer(playerData.getFriends().get(n));
|
||||
if (friend == null) return ERROR_PLACEHOLDER;
|
||||
return friend.getName();
|
||||
}
|
||||
|
||||
else if (identifier.startsWith("profession_"))
|
||||
} else if (identifier.startsWith("profession_"))
|
||||
return String
|
||||
.valueOf(playerData.getCollectionSkills().getLevel(identifier.substring(11).replace(" ", "-").replace("_", "-").toLowerCase()));
|
||||
|
||||
@ -206,15 +198,11 @@ public class RPGPlaceholders extends PlaceholderExpansion {
|
||||
String format = identifier.substring(15).toLowerCase().replace("_", "-").replace(" ", "-");
|
||||
Profession profession = format.equals("main") ? null : MMOCore.plugin.professionManager.get(format);
|
||||
return MythicLib.plugin.getMMOConfig().decimal.format(MMOCore.plugin.boosterManager.getMultiplier(profession) * 100);
|
||||
}
|
||||
|
||||
else if (identifier.startsWith("exp_boost_")) {
|
||||
} else if (identifier.startsWith("exp_boost_")) {
|
||||
String format = identifier.substring(10).toLowerCase().replace("_", "-").replace(" ", "-");
|
||||
Profession profession = format.equals("main") ? null : MMOCore.plugin.professionManager.get(format);
|
||||
return MythicLib.plugin.getMMOConfig().decimal.format((MMOCore.plugin.boosterManager.getMultiplier(profession) - 1) * 100);
|
||||
}
|
||||
|
||||
else if (identifier.equals("stamina"))
|
||||
} else if (identifier.equals("stamina"))
|
||||
return MythicLib.plugin.getMMOConfig().decimal.format(playerData.getStamina());
|
||||
|
||||
else if (identifier.equals("stamina_bar")) {
|
||||
@ -225,14 +213,10 @@ public class RPGPlaceholders extends PlaceholderExpansion {
|
||||
: ratio >= j - .5 ? MMOCore.plugin.configManager.staminaHalf : MMOCore.plugin.configManager.staminaEmpty)
|
||||
.append(AltChar.listSquare);
|
||||
return format.toString();
|
||||
}
|
||||
|
||||
else if (identifier.startsWith("stat_")) {
|
||||
} else if (identifier.startsWith("stat_")) {
|
||||
final String stat = UtilityMethods.enumName(identifier.substring(5));
|
||||
return StatManager.format(stat, playerData.getMMOPlayerData());
|
||||
}
|
||||
|
||||
else if (identifier.equals("stellium"))
|
||||
} else if (identifier.equals("stellium"))
|
||||
return MythicLib.plugin.getMMOConfig().decimal.format(playerData.getStellium());
|
||||
|
||||
else if (identifier.equals("stellium_bar")) {
|
||||
@ -241,25 +225,17 @@ public class RPGPlaceholders extends PlaceholderExpansion {
|
||||
for (double j = 1; j < 20; j++)
|
||||
format.append(ratio >= j ? ChatColor.BLUE : ratio >= j - .5 ? ChatColor.AQUA : ChatColor.WHITE).append(AltChar.listSquare);
|
||||
return format.toString();
|
||||
}
|
||||
|
||||
else if (identifier.equals("quest")) {
|
||||
} else if (identifier.equals("quest")) {
|
||||
PlayerQuests data = playerData.getQuestData();
|
||||
return data.hasCurrent() ? data.getCurrent().getQuest().getName() : "None";
|
||||
}
|
||||
|
||||
else if (identifier.equals("quest_progress")) {
|
||||
} else if (identifier.equals("quest_progress")) {
|
||||
PlayerQuests data = playerData.getQuestData();
|
||||
return data.hasCurrent() ? MythicLib.plugin.getMMOConfig().decimal
|
||||
.format( (double) data.getCurrent().getObjectiveNumber() / data.getCurrent().getQuest().getObjectives().size() * 100L) : "0";
|
||||
}
|
||||
|
||||
else if (identifier.equals("quest_objective")) {
|
||||
.format((double) data.getCurrent().getObjectiveNumber() / data.getCurrent().getQuest().getObjectives().size() * 100L) : "0";
|
||||
} else if (identifier.equals("quest_objective")) {
|
||||
PlayerQuests data = playerData.getQuestData();
|
||||
return data.hasCurrent() ? data.getCurrent().getFormattedLore() : "None";
|
||||
}
|
||||
|
||||
else if (identifier.startsWith("guild_")) {
|
||||
} else if (identifier.startsWith("guild_")) {
|
||||
String placeholder = identifier.substring(6);
|
||||
if (playerData.getGuild() == null)
|
||||
return "";
|
||||
|
@ -340,10 +340,10 @@ public class SkillTreeViewer extends EditableInventory {
|
||||
|
||||
|
||||
public Icon getIcon(IntegerCoordinates coordinates) {
|
||||
boolean hasUpPath = skillTree.isPath(new IntegerCoordinates(coordinates.getX(), coordinates.getY() - 1));
|
||||
boolean hasDownPath = skillTree.isPath(new IntegerCoordinates(coordinates.getX(), coordinates.getY() + 1));
|
||||
boolean hasRightPath = skillTree.isPath(new IntegerCoordinates(coordinates.getX() + 1, coordinates.getY()));
|
||||
boolean hasLeftPath = skillTree.isPath(new IntegerCoordinates(coordinates.getX() - 1, coordinates.getY()));
|
||||
boolean hasUpPath = skillTree.isPathOrNode(new IntegerCoordinates(coordinates.getX(), coordinates.getY() - 1));
|
||||
boolean hasDownPath = skillTree.isPathOrNode(new IntegerCoordinates(coordinates.getX(), coordinates.getY() + 1));
|
||||
boolean hasRightPath = skillTree.isPathOrNode(new IntegerCoordinates(coordinates.getX() + 1, coordinates.getY()));
|
||||
boolean hasLeftPath = skillTree.isPathOrNode(new IntegerCoordinates(coordinates.getX() - 1, coordinates.getY()));
|
||||
|
||||
if (skillTree.isNode(coordinates)) {
|
||||
SkillTreeNode node = skillTree.getNode(coordinates);
|
||||
|
@ -232,6 +232,10 @@ public abstract class SkillTree extends PostLoadObject implements RegisteredObje
|
||||
return coordinatesPaths.keySet().contains(coordinates);
|
||||
}
|
||||
|
||||
public boolean isPathOrNode(IntegerCoordinates coordinates) {
|
||||
return isNode(coordinates) || isPath(coordinates);
|
||||
}
|
||||
|
||||
public Material getItem() {
|
||||
return item;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user