mirror of
https://github.com/Zrips/Jobs.git
synced 2025-02-18 05:11:32 +01:00
Update ConfigManager.java
This commit is contained in:
parent
c4d482d234
commit
c5babc22d0
@ -368,7 +368,7 @@ public class ConfigManager {
|
|||||||
File f = new File(plugin.getDataFolder(), "jobConfig.yml");
|
File f = new File(plugin.getDataFolder(), "jobConfig.yml");
|
||||||
InputStreamReader s = new InputStreamReader(new FileInputStream(f), "UTF-8");
|
InputStreamReader s = new InputStreamReader(new FileInputStream(f), "UTF-8");
|
||||||
|
|
||||||
ArrayList<Job> jobs = new ArrayList<Job>();
|
ArrayList<Job> jobs = new ArrayList<>();
|
||||||
Jobs.setJobs(jobs);
|
Jobs.setJobs(jobs);
|
||||||
Jobs.setNoneJob(null);
|
Jobs.setNoneJob(null);
|
||||||
if (!f.exists()) {
|
if (!f.exists()) {
|
||||||
@ -446,7 +446,7 @@ public class ConfigManager {
|
|||||||
|
|
||||||
String description = org.bukkit.ChatColor.translateAlternateColorCodes('&', jobSection.getString("description", ""));
|
String description = org.bukkit.ChatColor.translateAlternateColorCodes('&', jobSection.getString("description", ""));
|
||||||
|
|
||||||
List<String> fDescription = new ArrayList<String>();
|
List<String> fDescription = new ArrayList<>();
|
||||||
if (jobSection.contains("FullDescription")) {
|
if (jobSection.contains("FullDescription")) {
|
||||||
if (jobSection.isString("FullDescription"))
|
if (jobSection.isString("FullDescription"))
|
||||||
fDescription.add(jobSection.getString("FullDescription"));
|
fDescription.add(jobSection.getString("FullDescription"));
|
||||||
@ -564,7 +564,7 @@ public class ConfigManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Permissions
|
// Permissions
|
||||||
ArrayList<JobPermission> jobPermissions = new ArrayList<JobPermission>();
|
ArrayList<JobPermission> jobPermissions = new ArrayList<>();
|
||||||
ConfigurationSection permissionsSection = jobSection.getConfigurationSection("permissions");
|
ConfigurationSection permissionsSection = jobSection.getConfigurationSection("permissions");
|
||||||
if (permissionsSection != null) {
|
if (permissionsSection != null) {
|
||||||
for (String permissionKey : permissionsSection.getKeys(false)) {
|
for (String permissionKey : permissionsSection.getKeys(false)) {
|
||||||
@ -582,7 +582,7 @@ public class ConfigManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Conditions
|
// Conditions
|
||||||
ArrayList<JobConditions> jobConditions = new ArrayList<JobConditions>();
|
ArrayList<JobConditions> jobConditions = new ArrayList<>();
|
||||||
ConfigurationSection conditionsSection = jobSection.getConfigurationSection("conditions");
|
ConfigurationSection conditionsSection = jobSection.getConfigurationSection("conditions");
|
||||||
if (conditionsSection != null) {
|
if (conditionsSection != null) {
|
||||||
for (String ConditionKey : conditionsSection.getKeys(false)) {
|
for (String ConditionKey : conditionsSection.getKeys(false)) {
|
||||||
@ -605,19 +605,19 @@ public class ConfigManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Command on leave
|
// Command on leave
|
||||||
List<String> JobsCommandOnLeave = new ArrayList<String>();
|
List<String> JobsCommandOnLeave = new ArrayList<>();
|
||||||
if (jobSection.isList("cmd-on-leave")) {
|
if (jobSection.isList("cmd-on-leave")) {
|
||||||
JobsCommandOnLeave = jobSection.getStringList("cmd-on-leave");
|
JobsCommandOnLeave = jobSection.getStringList("cmd-on-leave");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Command on join
|
// Command on join
|
||||||
List<String> JobsCommandOnJoin = new ArrayList<String>();
|
List<String> JobsCommandOnJoin = new ArrayList<>();
|
||||||
if (jobSection.isList("cmd-on-join")) {
|
if (jobSection.isList("cmd-on-join")) {
|
||||||
JobsCommandOnJoin = jobSection.getStringList("cmd-on-join");
|
JobsCommandOnJoin = jobSection.getStringList("cmd-on-join");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commands
|
// Commands
|
||||||
ArrayList<JobCommands> jobCommand = new ArrayList<JobCommands>();
|
ArrayList<JobCommands> jobCommand = new ArrayList<>();
|
||||||
ConfigurationSection commandsSection = jobSection.getConfigurationSection("commands");
|
ConfigurationSection commandsSection = jobSection.getConfigurationSection("commands");
|
||||||
if (commandsSection != null) {
|
if (commandsSection != null) {
|
||||||
for (String commandKey : commandsSection.getKeys(false)) {
|
for (String commandKey : commandsSection.getKeys(false)) {
|
||||||
@ -628,7 +628,7 @@ public class ConfigManager {
|
|||||||
Jobs.getPluginLogger().warning("Job " + jobKey + " has an invalid command key" + commandKey + "!");
|
Jobs.getPluginLogger().warning("Job " + jobKey + " has an invalid command key" + commandKey + "!");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
List<String> commands = new ArrayList<String>();
|
List<String> commands = new ArrayList<>();
|
||||||
if (commandSection.isString("command"))
|
if (commandSection.isString("command"))
|
||||||
commands.add(commandSection.getString("command"));
|
commands.add(commandSection.getString("command"));
|
||||||
else if (commandSection.isList("command"))
|
else if (commandSection.isList("command"))
|
||||||
@ -640,7 +640,7 @@ public class ConfigManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Items
|
// Items
|
||||||
HashMap<String, JobItems> jobItems = new HashMap<String, JobItems>();
|
HashMap<String, JobItems> jobItems = new HashMap<>();
|
||||||
ConfigurationSection itemsSection = jobSection.getConfigurationSection("items");
|
ConfigurationSection itemsSection = jobSection.getConfigurationSection("items");
|
||||||
if (itemsSection != null) {
|
if (itemsSection != null) {
|
||||||
for (String itemKey : itemsSection.getKeys(false)) {
|
for (String itemKey : itemsSection.getKeys(false)) {
|
||||||
@ -657,13 +657,13 @@ public class ConfigManager {
|
|||||||
if (itemSection.isString("name"))
|
if (itemSection.isString("name"))
|
||||||
name = itemSection.getString("name");
|
name = itemSection.getString("name");
|
||||||
|
|
||||||
List<String> lore = new ArrayList<String>();
|
List<String> lore = new ArrayList<>();
|
||||||
if (itemSection.getStringList("lore") != null)
|
if (itemSection.getStringList("lore") != null)
|
||||||
for (String eachLine : itemSection.getStringList("lore")) {
|
for (String eachLine : itemSection.getStringList("lore")) {
|
||||||
lore.add(org.bukkit.ChatColor.translateAlternateColorCodes('&', eachLine));
|
lore.add(org.bukkit.ChatColor.translateAlternateColorCodes('&', eachLine));
|
||||||
}
|
}
|
||||||
|
|
||||||
HashMap<Enchantment, Integer> enchants = new HashMap<Enchantment, Integer>();
|
HashMap<Enchantment, Integer> enchants = new HashMap<>();
|
||||||
if (itemSection.getStringList("enchants") != null)
|
if (itemSection.getStringList("enchants") != null)
|
||||||
for (String eachLine : itemSection.getStringList("enchants")) {
|
for (String eachLine : itemSection.getStringList("enchants")) {
|
||||||
|
|
||||||
@ -695,7 +695,7 @@ public class ConfigManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Limited Items
|
// Limited Items
|
||||||
ArrayList<JobLimitedItems> jobLimitedItems = new ArrayList<JobLimitedItems>();
|
ArrayList<JobLimitedItems> jobLimitedItems = new ArrayList<>();
|
||||||
ConfigurationSection LimitedItemsSection = jobSection.getConfigurationSection("limitedItems");
|
ConfigurationSection LimitedItemsSection = jobSection.getConfigurationSection("limitedItems");
|
||||||
if (LimitedItemsSection != null) {
|
if (LimitedItemsSection != null) {
|
||||||
for (String itemKey : LimitedItemsSection.getKeys(false)) {
|
for (String itemKey : LimitedItemsSection.getKeys(false)) {
|
||||||
@ -712,13 +712,13 @@ public class ConfigManager {
|
|||||||
if (itemSection.isString("name"))
|
if (itemSection.isString("name"))
|
||||||
name = itemSection.getString("name");
|
name = itemSection.getString("name");
|
||||||
|
|
||||||
List<String> lore = new ArrayList<String>();
|
List<String> lore = new ArrayList<>();
|
||||||
if (itemSection.getStringList("lore") != null)
|
if (itemSection.getStringList("lore") != null)
|
||||||
for (String eachLine : itemSection.getStringList("lore")) {
|
for (String eachLine : itemSection.getStringList("lore")) {
|
||||||
lore.add(org.bukkit.ChatColor.translateAlternateColorCodes('&', eachLine));
|
lore.add(org.bukkit.ChatColor.translateAlternateColorCodes('&', eachLine));
|
||||||
}
|
}
|
||||||
|
|
||||||
HashMap<Enchantment, Integer> enchants = new HashMap<Enchantment, Integer>();
|
HashMap<Enchantment, Integer> enchants = new HashMap<>();
|
||||||
if (itemSection.getStringList("enchants") != null)
|
if (itemSection.getStringList("enchants") != null)
|
||||||
for (String eachLine : itemSection.getStringList("enchants")) {
|
for (String eachLine : itemSection.getStringList("enchants")) {
|
||||||
|
|
||||||
@ -753,7 +753,7 @@ public class ConfigManager {
|
|||||||
|
|
||||||
if (jobSection.contains("Quests")) {
|
if (jobSection.contains("Quests")) {
|
||||||
|
|
||||||
List<Quest> quests = new ArrayList<Quest>();
|
List<Quest> quests = new ArrayList<>();
|
||||||
ConfigurationSection qsection = jobSection.getConfigurationSection("Quests");
|
ConfigurationSection qsection = jobSection.getConfigurationSection("Quests");
|
||||||
|
|
||||||
for (String one : qsection.getKeys(false)) {
|
for (String one : qsection.getKeys(false)) {
|
||||||
@ -816,7 +816,7 @@ public class ConfigManager {
|
|||||||
|
|
||||||
for (ActionType actionType : ActionType.values()) {
|
for (ActionType actionType : ActionType.values()) {
|
||||||
ConfigurationSection typeSection = jobSection.getConfigurationSection(actionType.getName());
|
ConfigurationSection typeSection = jobSection.getConfigurationSection(actionType.getName());
|
||||||
ArrayList<JobInfo> jobInfo = new ArrayList<JobInfo>();
|
ArrayList<JobInfo> jobInfo = new ArrayList<>();
|
||||||
if (typeSection != null) {
|
if (typeSection != null) {
|
||||||
for (String key : typeSection.getKeys(false)) {
|
for (String key : typeSection.getKeys(false)) {
|
||||||
ConfigurationSection section = typeSection.getConfigurationSection(key);
|
ConfigurationSection section = typeSection.getConfigurationSection(key);
|
||||||
|
Loading…
Reference in New Issue
Block a user