forked from Upstream/mmocore
Fixed issue #788.
This commit is contained in:
parent
4de49070a0
commit
048ed1364d
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user