From 048ed1364db1ebf4999b8f236f6c55e6cac5f000 Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Sun, 16 Apr 2023 20:09:35 +0100 Subject: [PATCH] Fixed issue #788. --- .../main/java/net/Indyuce/mmocore/gui/SubclassSelect.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/SubclassSelect.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/SubclassSelect.java index 946da3bc..ad21f793 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/SubclassSelect.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/SubclassSelect.java @@ -4,6 +4,7 @@ import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.UtilityMethods; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.api.player.profess.ClassOption; import net.Indyuce.mmocore.gui.api.EditableInventory; import net.Indyuce.mmocore.gui.api.GeneratedInventory; import net.Indyuce.mmocore.gui.api.InventoryClickContext; @@ -112,13 +113,18 @@ public class SubclassSelect extends EditableInventory { if (item.getFunction().startsWith("sub-class")) { String classId = item.getFunction().substring(10); - + PlayerClass profess = MMOCore.plugin.classManager.get(classId); if (playerData.getClassPoints() < 1) { player.closeInventory(); MMOCore.plugin.soundManager.getSound(SoundEvent.CANT_SELECT_CLASS).playTo(getPlayer()); new ConfigMessage("cant-choose-new-class").send(player); return; } + if (profess.hasOption(ClassOption.NEEDS_PERMISSION) && !player.hasPermission("mmocore.class." + profess.getId().toLowerCase())) { + MMOCore.plugin.soundManager.getSound(SoundEvent.CANT_SELECT_CLASS).playTo(player); + new ConfigMessage("no-permission-for-class").send(player); + return; + } InventoryManager.CLASS_CONFIRM.get(classId).newInventory(playerData, this, true).open(); }