finalized config, added nullability annotations

This commit is contained in:
Sxtanna 2020-07-22 20:40:47 -04:00
parent 656f9ad03c
commit d7b947ddad

View File

@ -21,50 +21,69 @@
package me.clip.placeholderapi.configuration;
import me.clip.placeholderapi.PlaceholderAPIPlugin;
import org.jetbrains.annotations.NotNull;
public class PlaceholderAPIConfig {
public final class PlaceholderAPIConfig
{
@NotNull
private final PlaceholderAPIPlugin plugin;
public PlaceholderAPIConfig(PlaceholderAPIPlugin i) {
plugin = i;
public PlaceholderAPIConfig(@NotNull final PlaceholderAPIPlugin plugin)
{
this.plugin = plugin;
}
public void loadDefConfig() {
plugin.saveDefaultConfig();
plugin.reloadConfig();
}
public boolean checkUpdates() {
public boolean checkUpdates()
{
return plugin.getConfig().getBoolean("check_updates");
}
public boolean cloudAllowUnverifiedExpansions() {
public boolean cloudAllowUnverifiedExpansions()
{
return plugin.getConfig().getBoolean("cloud_allow_unverified_expansions");
}
public boolean isCloudEnabled() {
public boolean isCloudEnabled()
{
return plugin.getConfig().getBoolean("cloud_enabled");
}
public void setCloudEnabled(boolean b) {
plugin.getConfig().set("cloud_enabled", b);
plugin.reloadConfig();
public void setCloudEnabled(boolean state)
{
plugin.getConfig().set("cloud_enabled", state);
plugin.saveConfig();
}
public boolean isDebugMode() {
public boolean isDebugMode()
{
return plugin.getConfig().getBoolean("debug", false);
}
public String booleanTrue() {
return plugin.getConfig().getString("boolean.true");
@NotNull
public String dateFormat()
{
//noinspection ConstantConditions (bad spigot annotation)
return plugin.getConfig().getString("date_format", "MM/dd/yy HH:mm:ss");
}
public String booleanFalse() {
return plugin.getConfig().getString("boolean.false");
@NotNull
public String booleanTrue()
{
//noinspection ConstantConditions (bad spigot annotation)
return plugin.getConfig().getString("boolean.true", "true");
}
public String dateFormat() {
return plugin.getConfig().getString("date_format");
@NotNull
public String booleanFalse()
{
//noinspection ConstantConditions (bad spigot annotation)
return plugin.getConfig().getString("boolean.false", "false");
}
}