2018-03-21 14:15:51 +01:00
|
|
|
/*
|
2020-07-27 09:21:35 +02:00
|
|
|
* This file is part of PlaceholderAPI
|
2018-03-21 14:15:51 +01:00
|
|
|
*
|
|
|
|
* PlaceholderAPI
|
2021-01-20 21:29:13 +01:00
|
|
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
2018-03-21 14:15:51 +01:00
|
|
|
*
|
2020-07-27 09:21:35 +02:00
|
|
|
* PlaceholderAPI free software: you can redistribute it and/or modify
|
2018-03-21 14:15:51 +01:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
2020-07-27 09:21:35 +02:00
|
|
|
* PlaceholderAPI is distributed in the hope that it will be useful,
|
2018-03-21 14:15:51 +01:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2020-07-27 09:21:35 +02:00
|
|
|
|
2018-03-21 00:04:14 +01:00
|
|
|
package me.clip.placeholderapi.configuration;
|
|
|
|
|
2020-08-01 04:52:07 +02:00
|
|
|
import java.util.Optional;
|
2018-03-21 00:04:14 +01:00
|
|
|
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
2020-07-23 02:40:47 +02:00
|
|
|
import org.jetbrains.annotations.NotNull;
|
2018-03-21 00:04:14 +01:00
|
|
|
|
2020-08-01 04:52:07 +02:00
|
|
|
public final class PlaceholderAPIConfig {
|
2018-03-21 00:04:14 +01:00
|
|
|
|
2020-08-01 04:52:07 +02:00
|
|
|
@NotNull
|
|
|
|
private final PlaceholderAPIPlugin plugin;
|
2018-03-21 00:04:14 +01:00
|
|
|
|
2020-08-01 04:52:07 +02:00
|
|
|
public PlaceholderAPIConfig(@NotNull final PlaceholderAPIPlugin plugin) {
|
|
|
|
this.plugin = plugin;
|
|
|
|
}
|
2018-07-16 09:28:56 +02:00
|
|
|
|
|
|
|
|
2020-08-01 04:52:07 +02:00
|
|
|
public boolean checkUpdates() {
|
|
|
|
return plugin.getConfig().getBoolean("check_updates");
|
|
|
|
}
|
2018-07-16 09:28:56 +02:00
|
|
|
|
2020-08-01 04:52:07 +02:00
|
|
|
public boolean cloudAllowUnverifiedExpansions() {
|
|
|
|
return plugin.getConfig().getBoolean("cloud_allow_unverified_expansions");
|
|
|
|
}
|
2018-07-16 09:28:56 +02:00
|
|
|
|
|
|
|
|
2020-08-01 04:52:07 +02:00
|
|
|
public boolean isCloudEnabled() {
|
|
|
|
return plugin.getConfig().getBoolean("cloud_enabled");
|
|
|
|
}
|
2020-03-26 05:04:00 +01:00
|
|
|
|
2020-08-01 04:52:07 +02:00
|
|
|
public void setCloudEnabled(boolean state) {
|
|
|
|
plugin.getConfig().set("cloud_enabled", state);
|
|
|
|
plugin.saveConfig();
|
|
|
|
}
|
2018-07-16 09:28:56 +02:00
|
|
|
|
|
|
|
|
2020-08-01 04:52:07 +02:00
|
|
|
public boolean isDebugMode() {
|
|
|
|
return plugin.getConfig().getBoolean("debug", false);
|
|
|
|
}
|
2020-07-23 02:40:47 +02:00
|
|
|
|
|
|
|
|
2020-08-01 04:52:07 +02:00
|
|
|
public Optional<ExpansionSort> getExpansionSort() {
|
|
|
|
final String option = plugin.getConfig()
|
|
|
|
.getString("cloud_sorting", ExpansionSort.LATEST.name());
|
2020-07-26 19:39:33 +02:00
|
|
|
|
2020-08-01 04:52:07 +02:00
|
|
|
try {
|
|
|
|
//noinspection ConstantConditions (bad spigot annotation)
|
|
|
|
return Optional.of(ExpansionSort.valueOf(option.toUpperCase()));
|
|
|
|
} catch (final IllegalArgumentException ignored) {
|
|
|
|
return Optional.empty();
|
|
|
|
}
|
|
|
|
}
|
2020-07-26 19:39:33 +02:00
|
|
|
|
|
|
|
|
2020-08-01 04:52:07 +02:00
|
|
|
@NotNull
|
|
|
|
public String dateFormat() {
|
|
|
|
//noinspection ConstantConditions (bad spigot annotation)
|
|
|
|
return plugin.getConfig().getString("date_format", "MM/dd/yy HH:mm:ss");
|
|
|
|
}
|
2020-07-23 02:40:47 +02:00
|
|
|
|
|
|
|
|
2020-08-01 04:52:07 +02:00
|
|
|
@NotNull
|
|
|
|
public String booleanTrue() {
|
|
|
|
//noinspection ConstantConditions (bad spigot annotation)
|
|
|
|
return plugin.getConfig().getString("boolean.true", "true");
|
|
|
|
}
|
2020-07-23 02:40:47 +02:00
|
|
|
|
2020-08-01 04:52:07 +02:00
|
|
|
@NotNull
|
|
|
|
public String booleanFalse() {
|
|
|
|
//noinspection ConstantConditions (bad spigot annotation)
|
|
|
|
return plugin.getConfig().getString("boolean.false", "false");
|
|
|
|
}
|
2018-07-16 09:28:56 +02:00
|
|
|
|
2018-03-21 00:04:14 +01:00
|
|
|
}
|