Added categories to registeredSkills

This commit is contained in:
Ka0rX 2023-03-09 18:58:17 +01:00
parent 4dce534d74
commit ef173a2336

View File

@ -11,11 +11,7 @@ import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
public class RegisteredSkill implements Unlockable { public class RegisteredSkill implements Unlockable {
private final SkillHandler<?> handler; private final SkillHandler<?> handler;
@ -23,7 +19,7 @@ public class RegisteredSkill implements Unlockable {
private final Map<String, LinearValue> defaultModifiers = new HashMap<>(); private final Map<String, LinearValue> defaultModifiers = new HashMap<>();
private final ItemStack icon; private final ItemStack icon;
private final List<String> lore; private final List<String> lore;
private final List<String> categories;
@NotNull @NotNull
private final TriggerType triggerType; private final TriggerType triggerType;
@ -33,7 +29,7 @@ public class RegisteredSkill implements Unlockable {
name = Objects.requireNonNull(config.getString("name"), "Could not find skill name"); name = Objects.requireNonNull(config.getString("name"), "Could not find skill name");
icon = MMOCoreUtils.readIcon(Objects.requireNonNull(config.getString("material"), "Could not find skill icon")); icon = MMOCoreUtils.readIcon(Objects.requireNonNull(config.getString("material"), "Could not find skill icon"));
lore = Objects.requireNonNull(config.getStringList("lore"), "Could not find skill lore"); lore = Objects.requireNonNull(config.getStringList("lore"), "Could not find skill lore");
categories = config.getStringList("categories");
// Trigger type // Trigger type
triggerType = getHandler().isTriggerable() ? (config.contains("passive-type") ? TriggerType.valueOf(UtilityMethods.enumName(config.getString("passive-type"))) : TriggerType.CAST) : TriggerType.API; triggerType = getHandler().isTriggerable() ? (config.contains("passive-type") ? TriggerType.valueOf(UtilityMethods.enumName(config.getString("passive-type"))) : TriggerType.CAST) : TriggerType.API;
@ -54,6 +50,7 @@ public class RegisteredSkill implements Unlockable {
this.icon = icon; this.icon = icon;
this.lore = lore; this.lore = lore;
this.triggerType = triggerType; this.triggerType = triggerType;
this.categories = new ArrayList<>();
} }
@Override @Override
@ -73,6 +70,10 @@ public class RegisteredSkill implements Unlockable {
return lore; return lore;
} }
public List<String> getCategories() {
return categories;
}
public ItemStack getIcon() { public ItemStack getIcon() {
return icon.clone(); return icon.clone();
} }