Temporarily use getDouble() internally for calls to getFloat() in Paper configs

getFloat() seems to have an issue with reading modified values and always
returns the default value instead. This needs further investigating, but
for now making it use getDouble() internally appears to resolve the issue.
This commit is contained in:
Byteflux 2015-08-04 17:57:17 -07:00
parent febaf3c5a1
commit 5b6b8beff8
2 changed files with 6 additions and 6 deletions

View file

@ -26,13 +26,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
{
containerUpdateTickRate = getInt("container-update-tick-rate", 1);
containerUpdateTickRate = getInt( "container-update-tick-rate", 1 );
}
+
+ public float tntExplosionVolume;
+ private void tntExplosionVolume()
+ {
+ tntExplosionVolume = getFloat("tnt-explosion-volume", 4.0F);
+ tntExplosionVolume = getFloat( "tnt-explosion-volume", 4.0F );
+ }
}
--

View file

@ -211,8 +211,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ private static float getFloat(String path, float def)
+ {
+ config.addDefault( path, def );
+ return config.getFloat( path, config.getFloat( path ) );
+ // TODO: Figure out why getFloat() always returns the default value.
+ return (float) getDouble( path, (double) def );
+ }
+
+ private static int getInt(String path, int def)
@ -300,8 +300,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ private float getFloat(String path, float def)
+ {
+ config.addDefault( "world-settings.default." + path, def );
+ return config.getFloat( "world-settings." + worldName + "." + path, config.getFloat( "world-settings.default." + path ) );
+ // TODO: Figure out why getFloat() always returns the default value.
+ return (float) getDouble( path, (double) def );
+ }
+
+ private <T> List getList(String path, T def)