Clean up ConfigLoader variables a bit

This commit is contained in:
Pim van der Loos 2021-11-04 13:04:01 +01:00
parent 4c8cf55021
commit 6dbb359eb2
No known key found for this signature in database
GPG Key ID: C16F020ADAE6D5A8

View File

@ -19,19 +19,18 @@ import java.util.logging.Level;
public class ConfigLoader public class ConfigLoader
{ {
private final String header; private static final String HEADER =
"Config file for ArmoredElytra. Don't forget to make a backup before making changes!";
private final ArmoredElytra plugin;
private final int[] repairCounts = new int[ArmorTier.values().length];
private final ArrayList<ConfigOption<?>> configOptionsList = new ArrayList<>();
private boolean allowStats; private boolean allowStats;
private boolean unbreakable; private boolean unbreakable;
private boolean enableDebug; private boolean enableDebug;
private String languageFile; private String languageFile;
private final int[] repairCounts = new int[ArmorTier.values().length];
private int goldToFull;
private int ironToFull;
private int leatherToFull;
private int diamondsToFull;
private int netheriteToFull;
private boolean uninstallMode; private boolean uninstallMode;
private boolean checkForUpdates; private boolean checkForUpdates;
private boolean noFlightDurability; private boolean noFlightDurability;
@ -46,14 +45,9 @@ public class ConfigLoader
private boolean allowRenaming; private boolean allowRenaming;
private boolean allowAddingEnchantments; private boolean allowAddingEnchantments;
private final ArrayList<nl.pim16aap2.armoredElytra.util.ConfigOption<?>> configOptionsList;
private final ArmoredElytra plugin;
public ConfigLoader(ArmoredElytra plugin) public ConfigLoader(ArmoredElytra plugin)
{ {
this.plugin = plugin; this.plugin = plugin;
configOptionsList = new ArrayList<>();
header = "Config file for ArmoredElytra. Don't forget to make a backup before making changes!";
makeConfig(); makeConfig();
} }
@ -285,8 +279,8 @@ public class ConfigLoader
FileWriter fw = new FileWriter(saveTo, true); FileWriter fw = new FileWriter(saveTo, true);
PrintWriter pw = new PrintWriter(fw); PrintWriter pw = new PrintWriter(fw);
if (header != null) if (HEADER != null)
pw.println("# " + header + "\n"); pw.println("# " + HEADER + "\n");
for (int idx = 0; idx < configOptionsList.size(); ++idx) for (int idx = 0; idx < configOptionsList.size(); ++idx)
pw.println(configOptionsList.get(idx).toString() + pw.println(configOptionsList.get(idx).toString() +