= Format revision
This commit is contained in:
+19
-5
@@ -3,25 +3,39 @@ import java.nio.file.Path;
|
||||
|
||||
import utils.GlobalLog;
|
||||
import utils.LogFilter;
|
||||
import utils.io.MonitoredFile;
|
||||
import utils.io.FileMonitor;
|
||||
|
||||
public class Config
|
||||
{
|
||||
private static final Path filepath = Constants.AssetDirectory + Constants.ConfigFilename;
|
||||
MonitoredFile configFile;
|
||||
private static final String filepath = Constants.AssetDirectory + Constants.ConfigFilename;
|
||||
FileMonitor configFile;
|
||||
|
||||
Config instance;
|
||||
public static Config instance;
|
||||
|
||||
// Accessable config related things
|
||||
public LocStrings locStrings;
|
||||
public LocCommands locCommands;
|
||||
public CommandEnabler commandEnabler;
|
||||
|
||||
public Config()
|
||||
{
|
||||
if(instance == null)
|
||||
{
|
||||
configFile = new MonitoredFile(filepath);
|
||||
// Start by reading from things that are external. Because
|
||||
// we require these things to be resolved before the rest of the application,
|
||||
// we place them here.
|
||||
configFile = new FileMonitor(filepath);
|
||||
|
||||
commandEnabler = new CommandEnabler();
|
||||
locStrings = new LocStrings();
|
||||
locCommands = new LocCommands();
|
||||
|
||||
instance = this;
|
||||
}
|
||||
else
|
||||
{
|
||||
GlobalLog.error(LogFilter.Core, "You can't have two of the following: " + this.getClass().getSimpleName());
|
||||
System.exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,9 +40,4 @@ public class LocStrings extends BaseLocFile
|
||||
{
|
||||
return instance.getKey(stubbedPreviously);
|
||||
}
|
||||
|
||||
public static void upkeep()
|
||||
{
|
||||
instance.update();
|
||||
}
|
||||
}
|
||||
@@ -57,8 +57,8 @@ public class ObjectBuilderFactory
|
||||
@SuppressWarnings("unused") private static LocStrings locStrings;
|
||||
@SuppressWarnings("unused") private static LocCommands locCommands;
|
||||
|
||||
// Handles if we can or can't use specific commands, parsing a config file based on loc data to do so.
|
||||
private static CommandEnabler commandEnabler;
|
||||
// Config
|
||||
private static Config config;
|
||||
|
||||
// Lazy initialization multithreaded mutex stuff to prevent explosions.
|
||||
// TODO: Investigate using 'synchronized' instead potentially
|
||||
@@ -85,11 +85,8 @@ public class ObjectBuilderFactory
|
||||
database = null;
|
||||
stats = null;
|
||||
|
||||
// Start by reading from things that are external. Because
|
||||
// we require these things to be resolved before the rest of the application,
|
||||
// we place them here.
|
||||
locStrings = new LocStrings();
|
||||
locCommands = new LocCommands();
|
||||
// Create the config. We need to do this all first.
|
||||
config = new Config();
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -442,17 +439,6 @@ public class ObjectBuilderFactory
|
||||
return manager;
|
||||
}
|
||||
|
||||
// Constructs a CommandEnabler if it doesn't exist, and gets the existing one if it does.
|
||||
public static CommandEnabler constructCommandEnabler()
|
||||
{
|
||||
lazyInit();
|
||||
|
||||
if(commandEnabler == null)
|
||||
commandEnabler = new CommandEnabler();
|
||||
|
||||
return commandEnabler;
|
||||
}
|
||||
|
||||
// Default database manager construction. It can be constructed
|
||||
// in different ways, and so we construct it outside of the constructor for
|
||||
// the factory since it doesn't have to be present / can be elsewhere.
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
package core;
|
||||
|
||||
public class Settings {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user