mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2026-02-28 18:45:10 +01:00
Add metrics
This commit is contained in:
@@ -21,6 +21,7 @@ import java.nio.file.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -66,6 +67,15 @@ public final class ConfigManager {
|
||||
|
||||
final Map<String, Object> data = YAML.load(content);
|
||||
config = GSON.fromJson(GSON.toJsonTree(data), PlaceholderAPIConfig.class);
|
||||
|
||||
if (config.metricsUuid() == null && config.metrics() == null) {
|
||||
config.metricsUuid(UUID.randomUUID());
|
||||
config.metrics(true);
|
||||
save();
|
||||
} else if (config.metricsUuid() == null && config.metrics()) {
|
||||
config.metricsUuid(UUID.randomUUID());
|
||||
save();
|
||||
}
|
||||
}
|
||||
|
||||
public PlaceholderAPIConfig config() {
|
||||
|
||||
@@ -24,36 +24,21 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public final class PlaceholderAPIConfig {
|
||||
private boolean checkUpdates;
|
||||
private boolean cloudEnabled;
|
||||
private boolean debugMode;
|
||||
private Boolean metrics;
|
||||
private ExpansionSort cloudSorting;
|
||||
private BooleanValue booleanValue;
|
||||
private String dateFormat;
|
||||
private Map<String, Object> expansions;
|
||||
private UUID metricsUuid;
|
||||
|
||||
public PlaceholderAPIConfig(boolean checkUpdates, boolean cloudEnabled, boolean debugMode, @NotNull ExpansionSort cloudSorting,
|
||||
@NotNull BooleanValue booleanValue, @NotNull String dateFormat) {
|
||||
this.checkUpdates = checkUpdates;
|
||||
this.cloudEnabled = cloudEnabled;
|
||||
this.debugMode = debugMode;
|
||||
this.cloudSorting = cloudSorting;
|
||||
this.booleanValue = booleanValue;
|
||||
this.dateFormat = dateFormat;
|
||||
this.expansions = new HashMap<>();
|
||||
}
|
||||
public PlaceholderAPIConfig() {
|
||||
|
||||
public PlaceholderAPIConfig(boolean checkUpdates, boolean cloudEnabled, boolean debugMode, @NotNull ExpansionSort cloudSorting,
|
||||
@NotNull BooleanValue booleanValue, @NotNull String dateFormat, Map<String, Object> expansions) {
|
||||
this.checkUpdates = checkUpdates;
|
||||
this.cloudEnabled = cloudEnabled;
|
||||
this.debugMode = debugMode;
|
||||
this.cloudSorting = cloudSorting;
|
||||
this.booleanValue = booleanValue;
|
||||
this.dateFormat = dateFormat;
|
||||
this.expansions = expansions;
|
||||
}
|
||||
|
||||
public boolean checkUpdates() {
|
||||
@@ -76,6 +61,14 @@ public final class PlaceholderAPIConfig {
|
||||
debugMode = value;
|
||||
}
|
||||
|
||||
public Boolean metrics() {
|
||||
return metrics;
|
||||
}
|
||||
|
||||
public void metrics(final boolean value) {
|
||||
metrics = value;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ExpansionSort cloudSorting() {
|
||||
return cloudSorting;
|
||||
@@ -111,4 +104,12 @@ public final class PlaceholderAPIConfig {
|
||||
public void expansions(@NotNull final Map<String, Object> value) {
|
||||
expansions = value;
|
||||
}
|
||||
|
||||
public UUID metricsUuid() {
|
||||
return metricsUuid;
|
||||
}
|
||||
|
||||
public void metricsUuid(@NotNull final UUID metricsUuid) {
|
||||
this.metricsUuid = metricsUuid;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user