Fixed issue #811.

This commit is contained in:
Ka0rX 2023-05-04 10:05:38 +01:00
parent 1cdbd08d6b
commit b0cab10da2
3 changed files with 11 additions and 9 deletions

View File

@ -1073,6 +1073,11 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
return getProfess().hasSkill(skill.getHandler().getId()) && hasSkillUnlocked(getProfess().getSkill(skill.getHandler().getId())); return getProfess().hasSkill(skill.getHandler().getId()) && hasSkillUnlocked(getProfess().getSkill(skill.getHandler().getId()));
} }
@Deprecated
public boolean hasSkillUnlocked(ClassSkill skill) {
return hasUnlockedLevel(skill);
}
/** /**
* Checks for the player's level and compares it to the skill unlock level. * Checks for the player's level and compares it to the skill unlock level.
* <p> * <p>
@ -1083,7 +1088,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
* *
* @return If the player unlocked the skill * @return If the player unlocked the skill
*/ */
public boolean hasSkillUnlocked(ClassSkill skill) { public boolean hasUnlockedLevel(ClassSkill skill){
return getLevel() >= skill.getUnlockLevel(); return getLevel() >= skill.getUnlockLevel();
} }

View File

@ -1,10 +1,8 @@
package net.Indyuce.mmocore.gui; package net.Indyuce.mmocore.gui;
import io.lumine.mythic.core.utils.MythicUtil;
import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.MythicLib;
import io.lumine.mythic.lib.api.item.ItemTag; import io.lumine.mythic.lib.api.item.ItemTag;
import io.lumine.mythic.lib.api.item.NBTItem; import io.lumine.mythic.lib.api.item.NBTItem;
import me.ulrich.clans.manager.I;
import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.api.SoundEvent; import net.Indyuce.mmocore.api.SoundEvent;
import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.PlayerData;
@ -442,7 +440,7 @@ public class SkillList extends EditableInventory {
return; return;
} }
if (!playerData.hasSkillUnlocked(selected)) { if (!playerData.hasUnlockedLevel(selected)) {
MMOCore.plugin.configManager.getSimpleMessage("skill-level-not-met").send(player); MMOCore.plugin.configManager.getSimpleMessage("skill-level-not-met").send(player);
player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 2); player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 2);
return; return;
@ -470,8 +468,8 @@ public class SkillList extends EditableInventory {
if (item.getFunction().equals("upgrade")) { if (item.getFunction().equals("upgrade")) {
int shiftCost = ((UpgradeItem) item).shiftCost; int shiftCost = ((UpgradeItem) item).shiftCost;
if (!playerData.hasSkillUnlocked(selected)) { if (!playerData.hasUnlockedLevel(selected)) {
MMOCore.plugin.configManager.getSimpleMessage("not-unlocked-skill").send(player); MMOCore.plugin.configManager.getSimpleMessage("skill-level-not-met").send(player);
player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 2); player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 2);
return; return;
} }

View File

@ -1,7 +1,6 @@
package net.Indyuce.mmocore.skill; package net.Indyuce.mmocore.skill;
import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.MythicLib;
import io.lumine.mythic.lib.api.player.MMOPlayerData;
import io.lumine.mythic.lib.comp.flags.CustomFlag; import io.lumine.mythic.lib.comp.flags.CustomFlag;
import io.lumine.mythic.lib.player.cooldown.CooldownInfo; import io.lumine.mythic.lib.player.cooldown.CooldownInfo;
import io.lumine.mythic.lib.skill.Skill; import io.lumine.mythic.lib.skill.Skill;
@ -48,8 +47,8 @@ public class CastableSkill extends Skill {
boolean loud = !getTrigger().isSilent(); boolean loud = !getTrigger().isSilent();
// Skill is not usable yet // Skill is not usable yet
if (!playerData.hasSkillUnlocked(skill)) { if (!playerData.hasUnlockedLevel(skill)) {
if (loud) MMOCore.plugin.configManager.getSimpleMessage("not-unlocked-skill").send(playerData.getPlayer()); if (loud) MMOCore.plugin.configManager.getSimpleMessage("skill-level-not-met").send(playerData.getPlayer());
return false; return false;
} }