The current contents of the config.conf
file:
config {
testing=true
testingAgain=true
testingInt=2424
testingString=lolhi
}
Now, using the code below:
BufferedReader br = new BufferedReader(new InputStreamReader(this.getClass().getClassLoader().getResourceAsStream("config.conf")));
String line = null;
try {
while ((line = br.readLine()) != null) {
this.logger.warn(line);
}
this.logger.warn("END OF FILE");
} catch (IOException e) {
e.printStackTrace();
}
I get the output of:
[02:42:18] [Server thread/WARN] [voxelwars]: config {
[02:42:18] [Server thread/WARN] [voxelwars]: testing=true
[02:42:18] [Server thread/WARN] [voxelwars]: testingAgain=true
[02:42:18] [Server thread/WARN] [voxelwars]: testingInt=2424
[02:42:18] [Server thread/WARN] [voxelwars]: testingString=lolhi
[02:42:18] [Server thread/WARN] [voxelwars]: }
[02:42:18] [Server thread/WARN] [voxelwars]: END OF FILE
However, while the above file-loading method seems to work, I run into issues attempting to do the same thing with Configurate.
The Gist of my Config.java class
Using the below code for testing (similar to the above):
Config config = new Config("config.conf");
this.logger.warn("Testing " + config.get(ConfigPath.TESTING).getBoolean());
this.logger.warn("TestingAgain " + config.get(ConfigPath.TESTING_AGAIN).getBoolean());
this.logger.warn("TestingInt " + config.get(ConfigPath.TESTING_INT).getInt());
this.logger.warn("TestingString " + config.get(ConfigPath.TESTING_STRING).getString());
config.set(ConfigPath.NEW_VALUE, "Yup.");
this.logger.warn("NewValue " + config.get(ConfigPath.NEW_VALUE).getString());
config.set(ConfigPath.TESTING_STRING, "Testing Overriding Existing String");
this.logger.warn("TestingString " + config.get(ConfigPath.TESTING_STRING).getString());
I get the following output:
[02:42:18] [Server thread/WARN] [voxelwars]: Testing false
[02:42:18] [Server thread/WARN] [voxelwars]: TestingAgain false
[02:42:18] [Server thread/WARN] [voxelwars]: TestingInt 0
[02:42:18] [Server thread/WARN] [voxelwars]: TestingString null
[02:42:18] [Server thread/WARN] [voxelwars]: NewValue Yup.
[02:42:18] [Server thread/WARN] [voxelwars]: TestingString Testing Overriding Existing String
Now, considering that everyone else seems to have no issues in this regard, I'm fairly confident the issue lies within my own usage, but I can't for the life of me figure out WHAT I'm doing wrong.
I would assume that it lies between the difference of how, exactly, I'm casting the object. In the first method, I load is as a stream. Whereas, in the second method, I load it was a URL. However, this concession was necessary, as Configurate does not (currently) have an InputStream
alternative.
Any assistance I could receive on how to make this work would be very much so appreciated. :)