Added 'display-order' to classes

This commit is contained in:
Aria 2019-10-13 20:54:28 +02:00
parent b47e1eb334
commit 3ca8ad817e
2 changed files with 9 additions and 2 deletions

View File

@ -38,7 +38,7 @@ public class PlayerClass {
private final ItemStack icon;
private final Map<ClassOption, Boolean> options = new HashMap<>();
private final ManaDisplayOptions manaDisplay;
private final int maxLevel;
private final int maxLevel, displayOrder;
private final Map<StatType, LinearValue> stats = new HashMap<>();
private final Map<String, SkillInfo> skills = new LinkedHashMap<>();
@ -66,6 +66,7 @@ public class PlayerClass {
attrDescription.add(ChatColor.GRAY + ChatColor.translateAlternateColorCodes('&', string));
manaDisplay = new ManaDisplayOptions(config.getConfigurationSection("mana"));
maxLevel = config.getInt("max-level");
displayOrder = config.getInt("display-order");
if (config.contains("attributes"))
for (String key : config.getConfigurationSection("attributes").getKeys(false))
@ -135,6 +136,7 @@ public class PlayerClass {
this.fileName = id;
manaDisplay = new ManaDisplayOptions(ChatColor.BLUE, "Mana", AltChar.listSquare.charAt(0));
maxLevel = 0;
displayOrder = 0;
this.icon = new ItemStack(material);
setOption(ClassOption.DISPLAY, false);
@ -171,6 +173,10 @@ public class PlayerClass {
return maxLevel;
}
public int getDisplayOrder() {
return displayOrder;
}
public String getFileName() {
return fileName;
}

View File

@ -1,6 +1,7 @@
package net.Indyuce.mmocore.gui;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
@ -96,7 +97,7 @@ public class ClassSelect extends EditableInventory {
}
public class ProfessSelectionInventory extends GeneratedInventory {
private final List<PlayerClass> classes = MMOCore.plugin.classManager.getAll().stream().filter(c -> c.hasOption(ClassOption.DISPLAY)).collect(Collectors.toList());
private final List<PlayerClass> classes = MMOCore.plugin.classManager.getAll().stream().filter(c -> c.hasOption(ClassOption.DISPLAY)).sorted(Comparator.comparingInt(PlayerClass::getDisplayOrder)).collect(Collectors.toList());
public ProfessSelectionInventory(PlayerData playerData, EditableInventory editable) {
super(playerData, editable);