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 80e87de54f
commit bde7f6bbbd
2 changed files with 12 additions and 12 deletions

View file

@ -1,4 +1,4 @@
From a47bb6f79e5625beba2876cb3f3d72dba15add9e Mon Sep 17 00:00:00 2001
From 173dc14f7675fadf49fe31bc7e790ec5369c046a Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Thu, 28 May 2015 00:08:15 -0500
Subject: [PATCH] PaperSpigot config files
@ -88,7 +88,7 @@ index 337aa29..c936219 100644
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
new file mode 100644
index 0000000..a2fabf5
index 0000000..006ca37
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
@@ -0,0 +1,141 @@
@ -211,8 +211,8 @@ index 0000000..a2fabf5
+
+ 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)
@ -235,7 +235,7 @@ index 0000000..a2fabf5
+}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
new file mode 100644
index 0000000..f3bc3aa
index 0000000..146324a
--- /dev/null
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +1,77 @@
@ -300,8 +300,8 @@ index 0000000..f3bc3aa
+
+ 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)
@ -317,5 +317,5 @@ index 0000000..f3bc3aa
+ }
+}
--
2.5.0
2.4.6.windows.1

View file

@ -1,4 +1,4 @@
From e794a7dc6ebf8ad1bec934760beea280bb11935a Mon Sep 17 00:00:00 2001
From 410ae1f136e532793a05d6508ab7c8629c660185 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Tue, 4 Aug 2015 17:45:00 -0700
Subject: [PATCH] Configurable TNT explosion volume
@ -21,18 +21,18 @@ index 6617899..2763e74 100644
this.world.addParticle(EnumParticle.EXPLOSION_HUGE, this.posX, this.posY, this.posZ, 1.0D, 0.0D, 0.0D, new int[0]);
} else {
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index bd1b363..ebfa991 100644
index 84cdb12..d16c9fe 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -402,4 +402,10 @@ 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 );
+ }
}
--