You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Very weird problem I'm encountering. I'm using the Gson extension for dazzleconf. I have the following value in my config interface (HexCrawlerConfig):
Whenever my config is loaded, it changes the value to be 1 less:
"channel": 1184252858728726528
If I leave it at this new value it chose for it, it stays like this every time I load up. When I set it back to the original value, it overrides it back to this value... Something I figured I'd try was just set the value to be 1 greater than what I need it to be, but it still locks the value to the one with the 8 at the end.
Here is how I am loading the config itself:
publicfinalclassJsonDazzleConfHandler<C> extendsConfigurationHelper<C>
{
privatevolatileCconfigData;
privateJsonDazzleConfHandler(PathconfigFolder, StringfileName, ConfigurationFactory<C> factory)
{
super(configFolder, fileName, factory);
}
publicstatic <C> JsonDazzleConfHandler<C> create(PathconfigFolder, StringfileName, Class<C> configClass)
{
GsonOptionsjsonOptions = newGsonOptions.Builder()
.build();
returnnewJsonDazzleConfHandler<>(
configFolder, fileName,
GsonConfigurationFactory.create(
configClass,
newConfigurationOptions.Builder().sorter(newAnnotationBasedSorter()).build(),
jsonOptions
)
);
}
publicvoidreload()
{
try
{
configData = reloadConfigData();
}
catch (IOExceptionex)
{
thrownewUncheckedIOException(ex);
}
catch (ConfigFormatSyntaxExceptionex)
{
configData = getFactory().loadDefaults();
System.err.println("Uh-oh! The syntax of your configuration are invalid.");
ex.printStackTrace();
}
catch (InvalidConfigExceptionex)
{
configData = getFactory().loadDefaults();
System.err.println("Uh-oh! The values in your configuration are invalid. Check to make sure you have specified the right data types.");
ex.printStackTrace();
}
}
publicCget()
{
if(configData == null)
{
thrownewIllegalStateException("Configuration has not been loaded yet");
}
returnconfigData;
}
}
A working solution is to write the long as a string in the json. Dazzleconf reads it as a long just fine. Although when the config is loaded, it converts it back to a long and gets rid of the quotation marks around the channel value. This can be worked around using the following code:
Very weird problem I'm encountering. I'm using the Gson extension for dazzleconf. I have the following value in my config interface (HexCrawlerConfig):
In my .json config file it is defined like so:
Whenever my config is loaded, it changes the value to be 1 less:
If I leave it at this new value it chose for it, it stays like this every time I load up. When I set it back to the original value, it overrides it back to this value... Something I figured I'd try was just set the value to be 1 greater than what I need it to be, but it still locks the value to the one with the 8 at the end.
Here is how I am loading the config itself:
The text was updated successfully, but these errors were encountered: