PaperSpigot-Parent/CraftBukkit-Patches/0007-Add-getFloat-method-to-configs.patch

48 lines
1.8 KiB
Diff

From b9b862aedb0d9a26c58bc9e42c49b813299d6337 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 55914bf..5abecfd 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