Fixed an issue with required levels stats

This commit is contained in:
Jules 2023-04-07 13:11:26 +02:00
parent a179722ee8
commit 3318be847a
2 changed files with 5 additions and 5 deletions

View File

@ -1,10 +1,10 @@
package net.Indyuce.mmoitems.comp.mmocore.stat;
import io.lumine.mythic.lib.api.item.NBTItem;
import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.experience.Profession;
import net.Indyuce.mmoitems.api.player.RPGPlayer;
import net.Indyuce.mmoitems.api.util.message.Message;
import net.Indyuce.mmoitems.comp.mmocore.MMOCoreHook;
import net.Indyuce.mmoitems.stat.type.DoubleStat;
import net.Indyuce.mmoitems.stat.type.GemStoneStat;
import net.Indyuce.mmoitems.stat.type.ItemRestriction;
@ -25,8 +25,8 @@ public class RequiredProfession extends DoubleStat implements ItemRestriction, G
@Override
public boolean canUse(RPGPlayer player, NBTItem item, boolean message) {
MMOCoreHook.MMOCoreRPGPlayer mmocore = (MMOCoreHook.MMOCoreRPGPlayer) player;
if (mmocore.getData().getCollectionSkills().getLevel(this.profession) < item.getStat(getId())) {
final PlayerData mmocorePlayerData = PlayerData.get(player.getPlayer());
if (mmocorePlayerData.getCollectionSkills().getLevel(this.profession) < item.getStat(getId())) {
if (message) {
Message.NOT_ENOUGH_PROFESSION.format(ChatColor.RED, "#profession#", profession.getName()).send(player.getPlayer());
player.getPlayer().playSound(player.getPlayer().getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1.5f);

View File

@ -148,8 +148,8 @@ public class AureliumSkillsHook implements RPGHandler, Listener {
@Override
public boolean canUse(RPGPlayer player, NBTItem item, boolean message) {
int skillLevel = player instanceof AureliumSkillsPlayer ? ((AureliumSkillsPlayer) player).info.getSkillLevel(skill) : 0;
int required = item.getInteger("MMOITEMS_REQUIRED_" + skill.name());
final int skillLevel = AureliumAPI.getSkillLevel(player.getPlayer(), skill);
final int required = item.getInteger("MMOITEMS_REQUIRED_" + skill.name());
if (skillLevel < required && !player.getPlayer().hasPermission("mmoitems.bypass.level")) {
if (message) {