forked from Upstream/mmocore
Fixed bug when class doesn't have any skills.
This commit is contained in:
parent
c64b88e36d
commit
c6b9372026
@ -11,6 +11,8 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class SkillsCommand extends RegisteredCommand {
|
||||
public SkillsCommand(ConfigurationSection config) {
|
||||
super(config, ToggleableCommand.SKILLS);
|
||||
@ -24,7 +26,12 @@ public class SkillsCommand extends RegisteredCommand {
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) return true;
|
||||
|
||||
if (data.getProfess().getSkills().size() < 1) {
|
||||
if (data.getProfess().getSkills()
|
||||
.stream()
|
||||
.filter((classSkill) -> data.hasUnlocked(classSkill.getSkill()))
|
||||
.sorted((classSkill1,classSkill2)->classSkill1.getUnlockLevel()-classSkill1.getUnlockLevel())
|
||||
.collect(Collectors.toList())
|
||||
.size() < 1) {
|
||||
MMOCore.plugin.configManager.getSimpleMessage("no-class-skill").send((Player) sender);
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user