Paper/CraftBukkit-Patches/0153-Add-getFloat-method-to-configs.patch
2014-06-22 15:55:54 -05:00

48 lines
1.8 KiB
Diff

From 5a76dd1adc306ba33b20b2f8845b3dfd9358be47 Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.com>
Date: Mon, 19 May 2014 21:08:44 -0500
Subject: [PATCH] Add getFloat method to configs
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 7c9b298..1e30d4d 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -120,6 +120,14 @@ public class SpigotConfig
return config.getBoolean( path, config.getBoolean( path ) );
}
+ // PaperSpigot start - Add getFloat
+ private static float getFloat(String path, float def)
+ {
+ config.addDefault( path, def );
+ return config.getFloat( path, config.getFloat( path ) );
+ }
+ // PaperSpigot end
+
private static int getInt(String path, int def)
{
config.addDefault( path, def );
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index f9f8c05..c340fb3 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -52,6 +52,14 @@ public class SpigotWorldConfig
return config.getDouble( "world-settings." + worldName + "." + path, config.getDouble( "world-settings.default." + path ) );
}
+ // PaperSpigot start - Add getFloat
+ 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 ) );
+ }
+ // PaperSpigot end
+
private int getInt(String path, int def)
{
config.addDefault( "world-settings.default." + path, def );
--
1.9.1