Not null.

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

View file

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