Paper/CraftBukkit-Patches/0155-Add-getFloat-method-to-configs.patch
2014-06-22 15:37:12 -05:00

48 lines
1.8 KiB
Diff

From 4ab2112e922501a5ea9f47ab927c97c8787b0cb7 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 5818cab..5ddd593 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