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