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