1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 14:05:25 +01:00

Sorting jobs alphabetically, mainly for GUI purposes

This commit is contained in:
Zrips 2022-05-26 12:45:42 +03:00
parent ab07c80b62
commit 4341e2a333
2 changed files with 8 additions and 5 deletions

View File

@ -1,7 +1,5 @@
package com.gamingmesh.jobs.commands.list;
import java.util.List;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

View File

@ -26,6 +26,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import org.apache.commons.lang.StringEscapeUtils;
import org.bukkit.configuration.ConfigurationSection;
@ -947,14 +948,18 @@ public class ConfigManager {
return;
}
List<Job> jobs = new ArrayList<>();
Map<String, Job> map = new TreeMap<>();
for (YmlMaker conf : jobFiles) {
Job job = loadJobs(conf.getConfig().getConfigurationSection(""));
if (job != null) {
jobs.add(job);
map.put(job.getName(), job);
}
}
List<Job> jobs = new ArrayList<>();
jobs.addAll(map.values());
Jobs.setJobs(jobs);
if (!jobs.isEmpty()) {