Not null.

This commit is contained in:
Business Goose 2022-03-29 22:44:45 +01:00
parent 3e32f8e294
commit 659867dfce
No known key found for this signature in database
GPG key ID: 77DCA801362E9645

View file

@ -1,5 +1,7 @@
package me.StevenLawson.TotalFreedomMod.config; package me.StevenLawson.TotalFreedomMod.config;
import com.avaje.ebean.validation.NotNull;
import com.google.common.collect.ImmutableList;
import me.StevenLawson.TotalFreedomMod.Log; import me.StevenLawson.TotalFreedomMod.Log;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
@ -100,6 +102,7 @@ public class MainConfig
} }
} }
@NotNull
public static String getString(ConfigurationEntry entry) public static String getString(ConfigurationEntry entry)
{ {
try try
@ -110,7 +113,7 @@ public class MainConfig
{ {
Log.severe(ex); Log.severe(ex);
} }
return null; return "";
} }
public static void setString(ConfigurationEntry entry, String value) public static void setString(ConfigurationEntry entry, String value)
@ -125,6 +128,7 @@ public class MainConfig
} }
} }
@NotNull
public static Double getDouble(ConfigurationEntry entry) public static Double getDouble(ConfigurationEntry entry)
{ {
try try
@ -135,7 +139,7 @@ public class MainConfig
{ {
Log.severe(ex); Log.severe(ex);
} }
return null; return 0D;
} }
public static void setDouble(ConfigurationEntry entry, Double value) public static void setDouble(ConfigurationEntry entry, Double value)
@ -150,6 +154,7 @@ public class MainConfig
} }
} }
@NotNull
public static Boolean getBoolean(ConfigurationEntry entry) public static Boolean getBoolean(ConfigurationEntry entry)
{ {
try try
@ -160,7 +165,7 @@ public class MainConfig
{ {
Log.severe(ex); Log.severe(ex);
} }
return null; return false;
} }
public static void setBoolean(ConfigurationEntry entry, Boolean value) public static void setBoolean(ConfigurationEntry entry, Boolean value)
@ -175,6 +180,7 @@ public class MainConfig
} }
} }
@NotNull
public static Integer getInteger(ConfigurationEntry entry) public static Integer getInteger(ConfigurationEntry entry)
{ {
try try
@ -185,7 +191,7 @@ public class MainConfig
{ {
Log.severe(ex); Log.severe(ex);
} }
return null; return 0;
} }
public static void setInteger(ConfigurationEntry entry, Integer value) public static void setInteger(ConfigurationEntry entry, Integer value)
@ -200,6 +206,7 @@ public class MainConfig
} }
} }
@NotNull
public static List getList(ConfigurationEntry entry) public static List getList(ConfigurationEntry entry)
{ {
try try
@ -210,9 +217,10 @@ public class MainConfig
{ {
Log.severe(ex); Log.severe(ex);
} }
return null; return ImmutableList.of();
} }
@NotNull
public static <T> T get(ConfigurationEntry entry, Class<T> type) throws IllegalArgumentException public static <T> T get(ConfigurationEntry entry, Class<T> type) throws IllegalArgumentException
{ {
Object value = ENTRY_MAP.get(entry); Object value = ENTRY_MAP.get(entry);