mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2025-10-07 11:45:26 +02:00
Format to Daddy code style
This commit is contained in:
@@ -20,32 +20,28 @@
|
||||
|
||||
package me.clip.placeholderapi.configuration;
|
||||
|
||||
import java.util.Comparator;
|
||||
import me.clip.placeholderapi.expansion.cloud.CloudExpansion;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Comparator;
|
||||
public enum ExpansionSort implements Comparator<CloudExpansion> {
|
||||
|
||||
public enum ExpansionSort implements Comparator<CloudExpansion>
|
||||
{
|
||||
|
||||
NAME(Comparator.comparing(CloudExpansion::getName)),
|
||||
AUTHOR(Comparator.comparing(CloudExpansion::getAuthor)),
|
||||
LATEST(Comparator.comparing(CloudExpansion::getLastUpdate).reversed());
|
||||
NAME(Comparator.comparing(CloudExpansion::getName)),
|
||||
AUTHOR(Comparator.comparing(CloudExpansion::getAuthor)),
|
||||
LATEST(Comparator.comparing(CloudExpansion::getLastUpdate).reversed());
|
||||
|
||||
|
||||
@NotNull
|
||||
private final Comparator<CloudExpansion> comparator;
|
||||
@NotNull
|
||||
private final Comparator<CloudExpansion> comparator;
|
||||
|
||||
ExpansionSort(@NotNull final Comparator<CloudExpansion> comparator)
|
||||
{
|
||||
this.comparator = comparator;
|
||||
}
|
||||
ExpansionSort(@NotNull final Comparator<CloudExpansion> comparator) {
|
||||
this.comparator = comparator;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public final int compare(final CloudExpansion expansion1, final CloudExpansion expansion2)
|
||||
{
|
||||
return comparator.compare(expansion1, expansion2);
|
||||
}
|
||||
@Override
|
||||
public final int compare(final CloudExpansion expansion1, final CloudExpansion expansion2) {
|
||||
return comparator.compare(expansion1, expansion2);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -20,88 +20,74 @@
|
||||
|
||||
package me.clip.placeholderapi.configuration;
|
||||
|
||||
import java.util.Optional;
|
||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Optional;
|
||||
public final class PlaceholderAPIConfig {
|
||||
|
||||
public final class PlaceholderAPIConfig
|
||||
{
|
||||
@NotNull
|
||||
private final PlaceholderAPIPlugin plugin;
|
||||
|
||||
@NotNull
|
||||
private final PlaceholderAPIPlugin plugin;
|
||||
|
||||
public PlaceholderAPIConfig(@NotNull final PlaceholderAPIPlugin plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
}
|
||||
public PlaceholderAPIConfig(@NotNull final PlaceholderAPIPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
|
||||
public boolean checkUpdates()
|
||||
{
|
||||
return plugin.getConfig().getBoolean("check_updates");
|
||||
}
|
||||
public boolean checkUpdates() {
|
||||
return plugin.getConfig().getBoolean("check_updates");
|
||||
}
|
||||
|
||||
public boolean cloudAllowUnverifiedExpansions()
|
||||
{
|
||||
return plugin.getConfig().getBoolean("cloud_allow_unverified_expansions");
|
||||
}
|
||||
public boolean cloudAllowUnverifiedExpansions() {
|
||||
return plugin.getConfig().getBoolean("cloud_allow_unverified_expansions");
|
||||
}
|
||||
|
||||
|
||||
public boolean isCloudEnabled()
|
||||
{
|
||||
return plugin.getConfig().getBoolean("cloud_enabled");
|
||||
}
|
||||
public boolean isCloudEnabled() {
|
||||
return plugin.getConfig().getBoolean("cloud_enabled");
|
||||
}
|
||||
|
||||
public void setCloudEnabled(boolean state)
|
||||
{
|
||||
plugin.getConfig().set("cloud_enabled", state);
|
||||
plugin.saveConfig();
|
||||
}
|
||||
public void setCloudEnabled(boolean state) {
|
||||
plugin.getConfig().set("cloud_enabled", state);
|
||||
plugin.saveConfig();
|
||||
}
|
||||
|
||||
|
||||
public boolean isDebugMode()
|
||||
{
|
||||
return plugin.getConfig().getBoolean("debug", false);
|
||||
}
|
||||
public boolean isDebugMode() {
|
||||
return plugin.getConfig().getBoolean("debug", false);
|
||||
}
|
||||
|
||||
|
||||
public Optional<ExpansionSort> getExpansionSort()
|
||||
{
|
||||
final String option = plugin.getConfig().getString("cloud_sorting", ExpansionSort.LATEST.name());
|
||||
public Optional<ExpansionSort> getExpansionSort() {
|
||||
final String option = plugin.getConfig()
|
||||
.getString("cloud_sorting", ExpansionSort.LATEST.name());
|
||||
|
||||
try
|
||||
{
|
||||
//noinspection ConstantConditions (bad spigot annotation)
|
||||
return Optional.of(ExpansionSort.valueOf(option.toUpperCase()));
|
||||
}
|
||||
catch (final IllegalArgumentException ignored)
|
||||
{
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
try {
|
||||
//noinspection ConstantConditions (bad spigot annotation)
|
||||
return Optional.of(ExpansionSort.valueOf(option.toUpperCase()));
|
||||
} catch (final IllegalArgumentException ignored) {
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
public String dateFormat()
|
||||
{
|
||||
//noinspection ConstantConditions (bad spigot annotation)
|
||||
return plugin.getConfig().getString("date_format", "MM/dd/yy HH:mm:ss");
|
||||
}
|
||||
@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 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");
|
||||
}
|
||||
@NotNull
|
||||
public String booleanFalse() {
|
||||
//noinspection ConstantConditions (bad spigot annotation)
|
||||
return plugin.getConfig().getString("boolean.false", "false");
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user