Added message for the skill tree command.

This commit is contained in:
Ka0rX 2022-10-17 13:11:44 +02:00
parent e2ec78ff8d
commit 10ac569f44
2 changed files with 11 additions and 5 deletions

View File

@ -1,6 +1,7 @@
package net.Indyuce.mmocore.command;
import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.api.ConfigMessage;
import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
import net.Indyuce.mmocore.manager.InventoryManager;
@ -21,18 +22,22 @@ public class SkillTreeCommand extends BukkitCommand {
@Override
public boolean execute(@NotNull CommandSender sender, String s, String[] args) {
if (!(sender instanceof Player))
if (!(sender instanceof Player player))
return false;
PlayerData data = PlayerData.get((Player) sender);
PlayerData data = PlayerData.get(player);
MMOCommandEvent event = new MMOCommandEvent(data, "skilltree");
Bukkit.getServer().getPluginManager().callEvent(event);
if (event.isCancelled())
return true;
if (MMOCore.plugin.skillTreeManager.getAll().size() != 0) {
if (data.getProfess().getSkillTrees().size() != 0) {
InventoryManager.TREE_VIEW.newInventory(data).open();
return false;
}
return true;
else {
MMOCore.plugin.configManager.getSimpleMessage("no-skill-tree").send(player);
return true;
}
}

View File

@ -186,3 +186,4 @@ skill-node-max-level-hit: '&cYou already hit the max level for that skill node.'
not-enough-skill-tree-points: '&cYou need one skill tree point.'
reallocated-points: '&eYou successfully reset the skill tree {skill-tree}. &eYou now have &6{points} &eskill tree points.'
not-skill-tree-reallocation-point: '&cYou do not have 1 skill tree reallocation point.'
no-skill-tree: '&cYour class doesn''t have any skill tree.'