serialize() {
- return new HashMap<>();
- }
-
-}
diff --git a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/Hook.java b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/Hook.java
deleted file mode 100644
index 182b2aac5..000000000
--- a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/Hook.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * This file is part of Player Analytics (Plan).
- *
- * Plan is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License v3 as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Plan is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Plan. If not, see .
- */
-package com.djrapitops.pluginbridge.plan;
-
-import com.djrapitops.plan.data.plugin.HookHandler;
-import com.djrapitops.plugin.api.Check;
-
-/**
- * Abstract class for easy hooking of plugins.
- *
- * @author Rsl1122
-
- */
-public abstract class Hook {
-
- /**
- * Is the plugin being hooked properly enabled?
- */
- protected boolean enabled;
-
- /**
- * Class constructor.
- *
- * Checks if the given plugin (class path) is enabled.
- *
- * @param pluginClass Class path string of the plugin's main JavaPlugin class.
- */
- public Hook(String pluginClass) {
- enabled = Check.isAvailable(pluginClass);
- }
-
- public abstract void hook(HookHandler handler) throws NoClassDefFoundError;
-
- /**
- * Constructor to set enabled to false.
- */
- public Hook() {
- enabled = false;
- }
-}
diff --git a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/PluginBridgeModule.java b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/PluginBridgeModule.java
deleted file mode 100644
index 51b388bb8..000000000
--- a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/PluginBridgeModule.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * This file is part of Player Analytics (Plan).
- *
- * Plan is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License v3 as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Plan is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Plan. If not, see .
- */
-package com.djrapitops.pluginbridge.plan;
-
-import dagger.Module;
-import dagger.Provides;
-
-import javax.inject.Singleton;
-
-/**
- * Dagger modules for different plugin bridges.
- *
- * @author Rsl1122
- */
-public class PluginBridgeModule {
-
- @Module
- public static class Bukkit {
- @Provides
- @Singleton
- public Bridge provideBridge(BukkitBridge bridge) {
- return bridge;
- }
- }
-
- @Module
- public static class Bungee {
- @Provides
- @Singleton
- public Bridge provideBridge(BungeeBridge bridge) {
- return bridge;
- }
- }
-
- @Module
- public static class Sponge {
- @Provides
- @Singleton
- public Bridge provideBridge(SpongeBridge bridge) {
- return bridge;
- }
- }
-
- @Module
- public static class Velocity {
- @Provides
- @Singleton
- public Bridge provideBridge(VelocityBridge bridge) {
- return bridge;
- }
- }
-}
\ No newline at end of file
diff --git a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/SpongeBridge.java b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/SpongeBridge.java
deleted file mode 100644
index 3571bdb84..000000000
--- a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/SpongeBridge.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * This file is part of Player Analytics (Plan).
- *
- * Plan is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License v3 as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Plan is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Plan. If not, see .
- */
-package com.djrapitops.pluginbridge.plan;
-
-import com.djrapitops.plan.system.settings.config.PlanConfig;
-import com.djrapitops.plugin.logging.error.ErrorHandler;
-import com.djrapitops.pluginbridge.plan.buycraft.BuyCraftHook;
-import com.djrapitops.pluginbridge.plan.luckperms.LuckPermsHook;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-/**
- * Plugin bridge for Sponge plugins.
- *
- * @author Rsl1122
- */
-@Singleton
-public class SpongeBridge extends AbstractBridge {
-
- private final BuyCraftHook buyCraftHook;
- private final LuckPermsHook luckPermsHook;
-
- @Inject
- public SpongeBridge(
- PlanConfig config,
- ErrorHandler errorHandler,
-
- BuyCraftHook buyCraftHook,
- LuckPermsHook luckPermsHook
- ) {
- super(config, errorHandler);
- this.buyCraftHook = buyCraftHook;
- this.luckPermsHook = luckPermsHook;
- }
-
- @Override
- Hook[] getHooks() {
- return new Hook[]{
- buyCraftHook,
- luckPermsHook
- };
- }
-}
\ No newline at end of file
diff --git a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/VelocityBridge.java b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/VelocityBridge.java
deleted file mode 100644
index 6572d25fb..000000000
--- a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/VelocityBridge.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * This file is part of Player Analytics (Plan).
- *
- * Plan is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License v3 as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Plan is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Plan. If not, see .
- */
-package com.djrapitops.pluginbridge.plan;
-
-import com.djrapitops.plan.system.settings.config.PlanConfig;
-import com.djrapitops.plugin.logging.error.ErrorHandler;
-import com.djrapitops.pluginbridge.plan.buycraft.BuyCraftHook;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-/**
- * Plugin bridge for Velocity plugins.
- *
- * @author Rsl1122
- */
-@Singleton
-public class VelocityBridge extends AbstractBridge {
-
- private final BuyCraftHook buyCraftHook;
-
- @Inject
- public VelocityBridge(
- PlanConfig config,
- ErrorHandler errorHandler,
-
- BuyCraftHook buyCraftHook
- ) {
- super(config, errorHandler);
- this.buyCraftHook = buyCraftHook;
- }
-
- @Override
- Hook[] getHooks() {
- return new Hook[]{
- buyCraftHook
- };
- }
-}
\ No newline at end of file
diff --git a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/buycraft/BuyCraftData.java b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/buycraft/BuyCraftData.java
deleted file mode 100644
index 8a4cf8ad3..000000000
--- a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/buycraft/BuyCraftData.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * This file is part of Player Analytics (Plan).
- *
- * Plan is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License v3 as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Plan is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Plan. If not, see .
- */
-package com.djrapitops.pluginbridge.plan.buycraft;
-
-import com.djrapitops.plan.api.PlanAPI;
-import com.djrapitops.plan.api.exceptions.connection.ForbiddenException;
-import com.djrapitops.plan.data.element.AnalysisContainer;
-import com.djrapitops.plan.data.element.InspectContainer;
-import com.djrapitops.plan.data.element.TableContainer;
-import com.djrapitops.plan.data.plugin.ContainerSize;
-import com.djrapitops.plan.data.plugin.PluginData;
-import com.djrapitops.plan.system.settings.config.PlanConfig;
-import com.djrapitops.plan.utilities.formatting.Formatter;
-import com.djrapitops.plan.utilities.html.Html;
-import com.djrapitops.plan.utilities.html.icon.Color;
-import com.djrapitops.plan.utilities.html.icon.Family;
-import com.djrapitops.plan.utilities.html.icon.Icon;
-
-import java.util.*;
-
-/**
- * PluginData for BuyCraft plugin.
- *
- * @author Rsl1122
- */
-class BuyCraftData extends PluginData {
-
- private final String secret;
-
- private final PlanConfig config;
- private final Formatter timestampFormatter;
- private final Formatter decimalFormatter;
-
- BuyCraftData(
- String secret,
- PlanConfig config, Formatter timestampFormatter,
- Formatter decimalFormatter
- ) {
- super(ContainerSize.TAB, "BuyCraft");
- this.config = config;
- this.timestampFormatter = timestampFormatter;
- this.decimalFormatter = decimalFormatter;
- setPluginIcon(Icon.called("shopping-bag").of(Color.BLUE).build());
-
- this.secret = secret;
- }
-
- @Override
- public InspectContainer getPlayerData(UUID uuid, InspectContainer inspectContainer) {
- return inspectContainer;
- }
-
- @Override
- public AnalysisContainer getServerData(Collection collection, AnalysisContainer analysisContainer) throws Exception {
- try {
-
- List payments = new ListPaymentRequest(secret).makeRequest();
- Collections.sort(payments);
-
- addPaymentTotals(analysisContainer, payments);
- addPlayerTable(analysisContainer, payments);
-
- } catch (ForbiddenException e) {
- analysisContainer.addValue("Configuration error", e.getMessage());
- }
- return analysisContainer;
- }
-
- private void addPlayerTable(AnalysisContainer analysisContainer, List payments) {
- TableContainer payTable = new TableContainer(
- true,
- getWithIcon("Date", Icon.called("calendar").of(Family.REGULAR)),
- getWithIcon("Amount", Icon.called("money-bill-wave")),
- getWithIcon("Packages", Icon.called("cube"))
- );
- payTable.setColor("blue");
- for (Payment payment : payments) {
- String name = payment.getPlayerName();
- payTable.addRow(
- Html.LINK.parse(PlanAPI.getInstance().getPlayerInspectPageLink(name), name),
- timestampFormatter.apply(payment.getDate()),
- decimalFormatter.apply(payment.getAmount()) + " " + payment.getCurrency(),
- payment.getPackages()
- );
- }
- analysisContainer.addTable("payTable", payTable);
-
- MoneyStackGraph moneyStackGraph = new MoneyStackGraph(payments, config);
- String graphHtml = Html.PANEL_BODY.parse("") +
- "";
-
- analysisContainer.addHtml("moneygraph", graphHtml);
- }
-
- private void addPaymentTotals(AnalysisContainer analysisContainer, List payments) {
- Map paymentTotals = new HashMap<>();
- for (Payment payment : payments) {
- String currency = payment.getCurrency();
- double amount = payment.getAmount();
- paymentTotals.put(currency, paymentTotals.getOrDefault(currency, 0.0) + amount);
- }
- for (Map.Entry entry : paymentTotals.entrySet()) {
- analysisContainer.addValue(
- getWithIcon("Total " + entry.getKey(), Icon.called("money-bill-wave").of(Color.BLUE)),
- decimalFormatter.apply(entry.getValue())
- );
- }
- }
-}
\ No newline at end of file
diff --git a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/buycraft/BuyCraftHook.java b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/buycraft/BuyCraftHook.java
deleted file mode 100644
index 42ea87272..000000000
--- a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/buycraft/BuyCraftHook.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * This file is part of Player Analytics (Plan).
- *
- * Plan is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License v3 as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Plan is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Plan. If not, see .
- */
-package com.djrapitops.pluginbridge.plan.buycraft;
-
-import com.djrapitops.plan.data.plugin.HookHandler;
-import com.djrapitops.plan.system.settings.config.PlanConfig;
-import com.djrapitops.plan.system.settings.paths.PluginDataSettings;
-import com.djrapitops.plan.utilities.formatting.Formatters;
-import com.djrapitops.pluginbridge.plan.Hook;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-/**
- * Hook for BuyCraft plugin.
- *
- * @author Rsl1122
- */
-@Singleton
-public class BuyCraftHook extends Hook {
-
- private final PlanConfig config;
- private final Formatters formatters;
-
- @Inject
- public BuyCraftHook(
- PlanConfig config,
- Formatters formatters
- ) {
- super();
- this.config = config;
- this.formatters = formatters;
- }
-
- @Override
- public void hook(HookHandler handler) throws NoClassDefFoundError {
- String secret = config.get(PluginDataSettings.PLUGIN_BUYCRAFT_SECRET);
-
- enabled = !secret.equals("-") && !secret.isEmpty();
- if (enabled) {
- handler.addPluginDataSource(new BuyCraftData(secret, config, formatters.yearLong(), formatters.decimals()));
- }
- }
-}
\ No newline at end of file
diff --git a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/buycraft/ListPaymentRequest.java b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/buycraft/ListPaymentRequest.java
deleted file mode 100644
index 226d14f61..000000000
--- a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/buycraft/ListPaymentRequest.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * This file is part of Player Analytics (Plan).
- *
- * Plan is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License v3 as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Plan is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Plan. If not, see .
- */
-package com.djrapitops.pluginbridge.plan.buycraft;
-
-import com.djrapitops.plan.api.exceptions.connection.ForbiddenException;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.text.ParsePosition;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-/**
- * Request to Buycraft API for payment listings.
- *
- * @author Rsl1122
- */
-public class ListPaymentRequest {
-
- private final String secret;
-
- public ListPaymentRequest(String secret) {
- this.secret = secret;
- }
-
- public List makeRequest() throws IOException, ForbiddenException {
- URL url = new URL("https://plugin.buycraft.net/payments");
- HttpURLConnection connection = (HttpURLConnection) url.openConnection();
-
- connection.setRequestMethod("GET");
- connection.setRequestProperty("X-BuyCraft-Secret", secret);
-
- JsonElement json;
- try {
- InputStreamReader reader = new InputStreamReader(connection.getInputStream());
- json = new JsonParser().parse(reader);
- } finally {
- connection.disconnect();
- }
-
- if (json == null || json.isJsonNull()) {
- throw new NullPointerException("JSON should not be null");
- }
-
- List payments = new ArrayList<>();
- if (json.isJsonObject()) {
- return readError(json);
- } else if (json.isJsonArray()) {
- readAndAddPayments(json, payments);
- }
- return payments;
- }
-
- private void readAndAddPayments(JsonElement json, List payments) {
- JsonArray jsonArray = json.getAsJsonArray();
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
-
- for (JsonElement element : jsonArray) {
- JsonObject payment = element.getAsJsonObject();
- double amount = payment.get("amount").getAsDouble();
- String dateString = payment.get("date").getAsString();
- Date dateObj = dateFormat.parse(dateString, new ParsePosition(0));
- long date = dateObj.getTime();
- String currency = payment.get("currency").getAsJsonObject().get("iso_4217").getAsString();
- JsonObject player = payment.get("player").getAsJsonObject();
- String playerName = player.get("name").getAsString();
-// UUID uuid = UUID.fromString(player.get("uuid").getAsString().replaceFirst(
-// "(\\p{XDigit}{8})(\\p{XDigit}{4})(\\p{XDigit}{4})(\\p{XDigit}{4})(\\p{XDigit}+)", "$1-$2-$3-$4-$5"
-// ));
- StringBuilder packages = new StringBuilder();
- for (JsonElement pack : payment.get("packages").getAsJsonArray()) {
- packages.append(pack.getAsJsonObject().get("name")).append("
");
- }
-
- payments.add(new Payment(amount, currency, null, playerName, date, packages.toString()));
- }
- }
-
- private List readError(JsonElement json) throws ForbiddenException {
- JsonObject jsonObject = json.getAsJsonObject();
- int errorCode = jsonObject.get("error_code").getAsInt();
- String errorMessage = jsonObject.get("error_message").getAsString();
-
- if (errorCode == 403) {
- throw new ForbiddenException("Incorrect Server Secret. Check config.");
- } else {
- throw new IllegalStateException(errorCode + ": " + errorMessage);
- }
- }
-}
\ No newline at end of file
diff --git a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/buycraft/MoneyStackGraph.java b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/buycraft/MoneyStackGraph.java
deleted file mode 100644
index 1bd5e3a6a..000000000
--- a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/buycraft/MoneyStackGraph.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * This file is part of Player Analytics (Plan).
- *
- * Plan is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License v3 as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Plan is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Plan. If not, see .
- */
-package com.djrapitops.pluginbridge.plan.buycraft;
-
-import com.djrapitops.plan.system.settings.config.PlanConfig;
-import com.djrapitops.plan.system.settings.paths.PluginSettings;
-import com.djrapitops.plan.system.settings.paths.TimeSettings;
-import com.djrapitops.plan.system.settings.theme.ThemeVal;
-import com.djrapitops.plan.utilities.html.graphs.stack.StackDataSet;
-import com.djrapitops.plan.utilities.html.graphs.stack.StackGraph;
-import com.djrapitops.plugin.api.TimeAmount;
-
-import java.time.Instant;
-import java.time.LocalDate;
-import java.time.ZoneId;
-import java.time.ZoneOffset;
-import java.time.format.TextStyle;
-import java.util.*;
-
-/**
- * Utility for creating Money Stack Graph.
- *
- * @author Rsl1122
- */
-class MoneyStackGraph {
-
- private final StackGraph stackGraph;
- private final ZoneId timeZoneID;
- private String locale;
-
- MoneyStackGraph(List payments, PlanConfig config) {
- timeZoneID = config.get(TimeSettings.USE_SERVER_TIME) ? ZoneId.systemDefault() : ZoneOffset.UTC;
- locale = config.get(PluginSettings.LOCALE);
-
- long now = System.currentTimeMillis();
- long oldestDate = payments.isEmpty() ? now : payments.get(payments.size() - 1).getDate();
-
- String[] labels = getLabels(now, oldestDate);
- Map> stacks = getStacks(payments);
-
- StackDataSet[] dataSets = getDataSets(labels, stacks);
-
- this.stackGraph = new StackGraph(labels, dataSets);
- }
-
- private StackDataSet[] getDataSets(String[] labels, Map> stacks) {
- String[] colors = ThemeVal.GRAPH_GM_PIE.getDefaultValue().split(", ");
- int maxCol = colors.length;
-
- List stackDataSets = new ArrayList<>();
-
- int i = 0;
- for (Map.Entry> entry : stacks.entrySet()) {
- String currency = entry.getKey();
- List payments = entry.getValue();
-
- List values = sortValuesByLabels(labels, getValueMap(payments));
-
- String color = colors[(i) % maxCol];
-
- stackDataSets.add(new StackDataSet(values, currency, color));
-
- i++;
- }
-
- return stackDataSets.toArray(new StackDataSet[0]);
- }
-
- private List sortValuesByLabels(String[] labels, Map valueMap) {
- List values = new ArrayList<>();
- for (String label : labels) {
- values.add(valueMap.getOrDefault(label, 0.0));
- }
- return values;
- }
-
- private Map getValueMap(List payments) {
- Map valueMap = new HashMap<>();
- for (Payment payment : payments) {
- String label = getLabel(payment.getDate());
- Double value = valueMap.getOrDefault(label, 0.0);
- valueMap.put(label, value + payment.getAmount());
- }
- return valueMap;
- }
-
- private Map> getStacks(List payments) {
- Map> stacks = new HashMap<>();
- for (Payment payment : payments) {
- String currency = payment.getCurrency();
-
- List dataSetPayments = stacks.getOrDefault(currency, new ArrayList<>());
- dataSetPayments.add(payment);
- stacks.put(currency, dataSetPayments);
- }
- return stacks;
- }
-
- private String[] getLabels(long now, long oldestDate) {
- long oneYearAgo = now - TimeAmount.YEAR.toMillis(1L);
-
- long leftLimit = Math.max(oldestDate, oneYearAgo);
-
- List labels = new ArrayList<>();
- for (long time = leftLimit; time < now; time += TimeAmount.MONTH.toMillis(1L)) {
- labels.add(getLabel(time));
- }
-
- return labels.toArray(new String[0]);
- }
-
- private String getLabel(long time) {
- Locale usedLocale = locale.equalsIgnoreCase("default") ? Locale.ENGLISH : Locale.forLanguageTag(locale);
-
- LocalDate date = Instant.ofEpochMilli(time).atZone(timeZoneID).toLocalDate();
- String month = date.getMonth().getDisplayName(TextStyle.FULL, usedLocale);
- int year = date.getYear();
- return month + " " + year;
- }
-
- public String toHighChartsLabels() {
- return stackGraph.toHighChartsLabels();
- }
-
- public String toHighChartsSeries() {
- return stackGraph.toHighChartsSeries();
- }
-}
\ No newline at end of file
diff --git a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/buycraft/Payment.java b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/buycraft/Payment.java
deleted file mode 100644
index d045cda75..000000000
--- a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/buycraft/Payment.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * This file is part of Player Analytics (Plan).
- *
- * Plan is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License v3 as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Plan is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Plan. If not, see .
- */
-package com.djrapitops.pluginbridge.plan.buycraft;
-
-import java.util.UUID;
-
-/**
- * Represents a BuyCraft payment.
- *
- * Payments are sorted most recent first by natural ordering.
- *
- * @author Rsl1122
- */
-class Payment implements Comparable {
-
- private final double amount;
- private final String currency;
- private final UUID uuid;
- private final String playerName;
- private final long date;
- private final String packages;
-
- Payment(double amount, String currency, UUID uuid, String playerName, long date, String packages) {
- this.amount = amount;
- this.currency = currency;
- this.uuid = uuid;
- this.playerName = playerName;
- this.date = date;
- this.packages = packages;
- }
-
- public double getAmount() {
- return amount;
- }
-
- public String getCurrency() {
- return currency;
- }
-
- public String getPlayerName() {
- return playerName;
- }
-
- public long getDate() {
- return date;
- }
-
- public UUID getUuid() {
- return uuid;
- }
-
- public String getPackages() {
- return packages;
- }
-
- @Override
- public int compareTo(Payment o) {
- return -Long.compare(this.date, o.date);
- }
-}
\ No newline at end of file
diff --git a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/factions/FactionComparator.java b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/factions/FactionComparator.java
deleted file mode 100644
index 47291c8f3..000000000
--- a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/factions/FactionComparator.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * This file is part of Player Analytics (Plan).
- *
- * Plan is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License v3 as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Plan is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Plan. If not, see .
- */
-package com.djrapitops.pluginbridge.plan.factions;
-
-import com.massivecraft.factions.entity.Faction;
-
-import java.util.Comparator;
-
-/**
- * This class is used to compare factions in terms of Power.
- *
- * Compare method should only be used if FactionsHook.isEnabled() returns true.
- *
- * Note: this comparator imposes orderings that are inconsistent with equals.
- *
- * @author Rsl1122
-
- * @see FactionsHook
- */
-public class FactionComparator implements Comparator {
-
- @Override
- public int compare(Faction fac1, Faction fac2) {
- return -Double.compare(fac1.getPower(), fac2.getPower());
- }
-}
diff --git a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/factions/FactionsAccordion.java b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/factions/FactionsAccordion.java
deleted file mode 100644
index 0b85701a3..000000000
--- a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/factions/FactionsAccordion.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * This file is part of Player Analytics (Plan).
- *
- * Plan is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License v3 as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Plan is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Plan. If not, see .
- */
-package com.djrapitops.pluginbridge.plan.factions;
-
-import com.djrapitops.plan.data.store.keys.PlayerKeys;
-import com.djrapitops.plan.data.store.mutators.PlayersMutator;
-import com.djrapitops.plan.data.store.mutators.SessionsMutator;
-import com.djrapitops.plan.utilities.formatting.Formatter;
-import com.djrapitops.plan.utilities.html.HtmlStructure;
-import com.djrapitops.plan.utilities.html.icon.Color;
-import com.djrapitops.plan.utilities.html.icon.Family;
-import com.djrapitops.plan.utilities.html.icon.Icon;
-import com.djrapitops.plan.utilities.html.icon.Icons;
-import com.djrapitops.plan.utilities.html.structure.Accordion;
-import com.djrapitops.plan.utilities.html.structure.AccordionElement;
-import com.djrapitops.plan.utilities.html.structure.AccordionElementContentBuilder;
-import com.massivecraft.factions.entity.Faction;
-import com.massivecraft.factions.entity.MPlayer;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.UUID;
-
-/**
- * Utility for creating Factions Accordion Html.
- *
- * @author Rsl1122
- */
-class FactionsAccordion extends Accordion {
-
- private final List factions;
- private final PlayersMutator playersMutator;
-
- private final Formatter timestampFormatter;
- private final Formatter decimalFormatter;
-
- FactionsAccordion(
- List factions,
- PlayersMutator playersMutator,
- Formatter timestampFormatter,
- Formatter decimalFormatter
- ) {
- super("faction_accordion");
- this.factions = factions;
- this.playersMutator = playersMutator;
- this.timestampFormatter = timestampFormatter;
- this.decimalFormatter = decimalFormatter;
-
- addElements();
- }
-
- private void addElements() {
- for (Faction faction : factions) {
- String factionName = faction.getName();
- long createdAtMillis = faction.getCreatedAtMillis();
- String created = timestampFormatter.apply(createdAtMillis);
- double power = faction.getPower();
- double maxPower = faction.getPowerMax();
- String powerString = decimalFormatter.apply(power) + " / " + decimalFormatter.apply(maxPower);
- MPlayer leader = faction.getLeader();
- String leaderName = leader != null ? leader.getName() : "No Leader";
-
- int landCount = faction.getLandCount();
-
- Set members = new HashSet<>();
- List mPlayers = faction.getMPlayers();
- int memberCount = mPlayers.size();
- for (MPlayer mPlayer : mPlayers) {
- if (mPlayer == null) {
- continue;
- }
- members.add(mPlayer.getUuid());
- }
-
- PlayersMutator memberMutator = this.playersMutator.filterBy(
- player -> player.getValue(PlayerKeys.UUID)
- .map(members::contains).orElse(false)
- );
-
- SessionsMutator memberSessionsMutator = new SessionsMutator(memberMutator.getSessions());
-
- long playerKills = memberSessionsMutator.toPlayerKillCount();
- long deaths = memberSessionsMutator.toDeathCount();
-
- String separated = HtmlStructure.separateWithDots(("Power: " + powerString), leaderName);
-
- String htmlID = "faction_" + factionName + "_" + createdAtMillis;
-
- String leftSide = new AccordionElementContentBuilder()
- .addRowBold(Icon.called("calendar").of(Color.DEEP_PURPLE).of(Family.REGULAR), "Created", created)
- .addRowBold(Icon.called("bolt").of(Color.PURPLE), "Power", powerString)
- .addRowBold(Icon.called("user").of(Color.PURPLE), "Leader", leaderName)
- .addRowBold(Icon.called("users").of(Color.PURPLE), "Members", memberCount)
- .addRowBold(Icon.called("map").of(Color.PURPLE), "Land Count", landCount)
- .toHtml();
-
- String rightSide = new AccordionElementContentBuilder()
- .addRowBold(Icons.PLAYER_KILLS, "Player Kills", playerKills)
- .addRowBold(Icons.DEATHS, "Deaths", deaths)
- .toHtml();
-
- addElement(
- new AccordionElement(htmlID, factionName + "" + separated + "")
- .setColor("deep-purple")
- .setLeftSide(leftSide)
- .setRightSide(rightSide)
- );
- }
- }
-}
\ No newline at end of file
diff --git a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/factions/FactionsData.java b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/factions/FactionsData.java
deleted file mode 100644
index 3c9f67e67..000000000
--- a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/factions/FactionsData.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * This file is part of Player Analytics (Plan).
- *
- * Plan is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License v3 as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Plan is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Plan. If not, see .
- */
-package com.djrapitops.pluginbridge.plan.factions;
-
-import com.djrapitops.plan.api.PlanAPI;
-import com.djrapitops.plan.data.element.AnalysisContainer;
-import com.djrapitops.plan.data.element.InspectContainer;
-import com.djrapitops.plan.data.plugin.ContainerSize;
-import com.djrapitops.plan.data.plugin.PluginData;
-import com.djrapitops.plan.data.store.keys.AnalysisKeys;
-import com.djrapitops.plan.data.store.mutators.PlayersMutator;
-import com.djrapitops.plan.system.settings.config.PlanConfig;
-import com.djrapitops.plan.system.settings.paths.PluginDataSettings;
-import com.djrapitops.plan.utilities.formatting.Formatter;
-import com.djrapitops.plan.utilities.html.Html;
-import com.djrapitops.plan.utilities.html.icon.Color;
-import com.djrapitops.plan.utilities.html.icon.Icon;
-import com.massivecraft.factions.entity.Faction;
-import com.massivecraft.factions.entity.FactionColl;
-import com.massivecraft.factions.entity.MPlayer;
-
-import java.util.*;
-import java.util.stream.Collectors;
-
-/**
- * PluginData for Factions plugin.
- *
- * @author Rsl1122
- */
-class FactionsData extends PluginData {
-
- private final PlanConfig config;
- private final Formatter timestampFormatter;
- private final Formatter decimalFormatter;
-
- FactionsData(
- PlanConfig config,
- Formatter timestampFormatter,
- Formatter decimalFormatter
- ) {
- super(ContainerSize.TAB, "Factions");
- this.config = config;
- this.timestampFormatter = timestampFormatter;
- this.decimalFormatter = decimalFormatter;
- setPluginIcon(Icon.called("map").of(Color.DEEP_PURPLE).build());
- }
-
- @Override
- public InspectContainer getPlayerData(UUID uuid, InspectContainer inspectContainer) {
- MPlayer mPlayer = MPlayer.get(uuid);
-
- if (mPlayer == null) {
- return inspectContainer;
- }
-
- if (mPlayer.hasFaction()) {
- Faction faction = mPlayer.getFaction();
- if (faction != null) {
- String factionName = faction.isNone() ? "-" : faction.getName();
- String factionLeader = faction.getLeader().getName();
- String factionLeaderLink = Html.LINK.parse(PlanAPI.getInstance().getPlayerInspectPageLink(factionLeader), factionLeader);
-
- inspectContainer.addValue(getWithIcon("Faction", Icon.called("flag").of(Color.DEEP_PURPLE)), factionName);
- inspectContainer.addValue(getWithIcon("Leader", Icon.called("user").of(Color.PURPLE)), factionLeaderLink);
- }
- }
-
- double power = mPlayer.getPower();
- double maxPower = mPlayer.getPowerMax();
- String powerString = decimalFormatter.apply(power) + " / " + decimalFormatter.apply(maxPower);
- inspectContainer.addValue(getWithIcon("Power", Icon.called("bolt").of(Color.PURPLE)), powerString);
-
- return inspectContainer;
- }
-
- @Override
- public AnalysisContainer getServerData(Collection uuids, AnalysisContainer analysisContainer) {
- List factions = getTopFactions();
-
- analysisContainer.addValue(getWithIcon("Number of Factions", Icon.called("flag").of(Color.DEEP_PURPLE)), factions.size());
-
- if (!factions.isEmpty()) {
- FactionsAccordion factionsAccordion = new FactionsAccordion(
- factions,
- Optional.ofNullable(analysisData).flatMap(c -> c.getValue(AnalysisKeys.PLAYERS_MUTATOR))
- .orElse(new PlayersMutator(new ArrayList<>())),
- timestampFormatter, decimalFormatter);
- analysisContainer.addHtml("factionAccordion", factionsAccordion.toHtml());
-
- Map userFactions = new HashMap<>();
- for (UUID uuid : uuids) {
- MPlayer mPlayer = MPlayer.get(uuid);
-
- if (mPlayer.hasFaction()) {
- Faction faction = mPlayer.getFaction();
- if (faction == null) {
- continue;
- }
- MPlayer leader = faction.getLeader();
- String leaderName = leader != null ? leader.getName() : "";
- String factionName = faction.isNone() ? "-" : faction.getName();
-
- userFactions.put(uuid, mPlayer.getName().equals(leaderName) ? "" + factionName + "" : factionName);
- }
- }
-
- analysisContainer.addPlayerTableValues(getWithIcon("Faction", Icon.called("flag")), userFactions);
- }
-
- return analysisContainer;
- }
-
- private List getTopFactions() {
- List topFactions = new ArrayList<>(FactionColl.get().getAll());
- topFactions.remove(FactionColl.get().getWarzone());
- topFactions.remove(FactionColl.get().getSafezone());
- topFactions.remove(FactionColl.get().getNone());
- List hide = config.get(PluginDataSettings.HIDE_FACTIONS);
- return topFactions.stream()
- .filter(faction -> !hide.contains(faction.getName()))
- .sorted(new FactionComparator())
- .collect(Collectors.toList());
- }
-}
\ No newline at end of file
diff --git a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/factions/FactionsHook.java b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/factions/FactionsHook.java
deleted file mode 100644
index 9d46588fd..000000000
--- a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/factions/FactionsHook.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * This file is part of Player Analytics (Plan).
- *
- * Plan is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License v3 as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Plan is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Plan. If not, see .
- */
-package com.djrapitops.pluginbridge.plan.factions;
-
-import com.djrapitops.plan.data.plugin.HookHandler;
-import com.djrapitops.plan.system.settings.config.PlanConfig;
-import com.djrapitops.plan.utilities.formatting.Formatters;
-import com.djrapitops.pluginbridge.plan.Hook;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-/**
- * A Class responsible for hooking to Factions and registering 4 data sources.
- *
- * @author Rsl1122
-
- */
-@Singleton
-public class FactionsHook extends Hook {
-
- private final PlanConfig config;
- private final Formatters formatters;
-
- @Inject
- public FactionsHook(
- PlanConfig config,
- Formatters formatters
- ) {
- super("com.massivecraft.factions.entity.MPlayer");
- this.config = config;
- this.formatters = formatters;
- }
-
- public void hook(HookHandler handler) throws NoClassDefFoundError {
- if (enabled) {
- handler.addPluginDataSource(new FactionsData(config, formatters.yearLong(), formatters.decimals()));
- }
- }
-}
diff --git a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/jobs/JobsData.java b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/jobs/JobsData.java
deleted file mode 100644
index 584ba2c34..000000000
--- a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/jobs/JobsData.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * This file is part of Player Analytics (Plan).
- *
- * Plan is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License v3 as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Plan is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Plan. If not, see .
- */
-package com.djrapitops.pluginbridge.plan.jobs;
-
-import com.djrapitops.plan.data.element.AnalysisContainer;
-import com.djrapitops.plan.data.element.InspectContainer;
-import com.djrapitops.plan.data.element.TableContainer;
-import com.djrapitops.plan.data.plugin.ContainerSize;
-import com.djrapitops.plan.data.plugin.PluginData;
-import com.djrapitops.plan.utilities.formatting.Formatter;
-import com.djrapitops.plan.utilities.html.icon.Color;
-import com.djrapitops.plan.utilities.html.icon.Icon;
-import com.gamingmesh.jobs.Jobs;
-import com.gamingmesh.jobs.dao.JobsDAOData;
-
-import java.util.*;
-import java.util.stream.Collectors;
-
-/**
- * PluginData for Jobs plugin.
- *
- * @author Rsl1122
- */
-class JobsData extends PluginData {
-
- private final Formatter decimalFormatter;
-
- JobsData(Formatter decimalFormatter) {
- super(ContainerSize.THIRD, "Jobs");
- this.decimalFormatter = decimalFormatter;
- setPluginIcon(Icon.called("suitcase").of(Color.BROWN).build());
- }
-
- @Override
- public InspectContainer getPlayerData(UUID uuid, InspectContainer inspectContainer) {
- List playersJobs = Jobs.getDBManager().getDB().getAllJobs(null, uuid);
-
- TableContainer jobTable = new TableContainer(
- getWithIcon("Job", Icon.called("suitcase")),
- getWithIcon("Level", Icon.called("plus")));
- for (JobsDAOData job : playersJobs) {
- jobTable.addRow(job.getJobName(), job.getLevel());
- }
- if (playersJobs.isEmpty()) {
- jobTable.addRow("No Jobs");
- }
- inspectContainer.addTable("jobTable", jobTable);
-
- return inspectContainer;
- }
-
- @Override
- public AnalysisContainer getServerData(Collection collection, AnalysisContainer analysisContainer) {
- List allJobs = Jobs.getDBManager().getDB().getAllJobs()
- .values().stream()
- .flatMap(Collection::stream)
- .collect(Collectors.toList());
-
- TableContainer jobTable = new TableContainer(
- getWithIcon("Job", Icon.called("suitcase")),
- getWithIcon("Workers", Icon.called("users")),
- getWithIcon("Total Level", Icon.called("plus")),
- getWithIcon("Average Level", Icon.called("plus"))
- );
-
- if (allJobs.isEmpty()) {
- jobTable.addRow("No Jobs with Workers");
- } else {
- Map workers = new HashMap<>();
- Map totals = new HashMap<>();
- for (JobsDAOData data : allJobs) {
- String job = data.getJobName();
- int level = data.getLevel();
- workers.put(job, workers.getOrDefault(job, 0) + 1);
- totals.put(job, totals.getOrDefault(job, 0L) + level);
- }
-
- List order = new ArrayList<>(workers.keySet());
- Collections.sort(order);
-
- for (String job : order) {
- int amountOfWorkers = workers.getOrDefault(job, 0);
- long totalLevel = totals.getOrDefault(job, 0L);
- jobTable.addRow(
- job,
- amountOfWorkers,
- totalLevel,
- amountOfWorkers != 0 ? decimalFormatter.apply(totalLevel * 1.0 / amountOfWorkers) : "-"
- );
- }
- }
- analysisContainer.addTable("jobTable", jobTable);
-
- return analysisContainer;
- }
-}
\ No newline at end of file
diff --git a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/jobs/JobsHook.java b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/jobs/JobsHook.java
deleted file mode 100644
index 5337c87ee..000000000
--- a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/jobs/JobsHook.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * This file is part of Player Analytics (Plan).
- *
- * Plan is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License v3 as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Plan is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Plan. If not, see .
- */
-package com.djrapitops.pluginbridge.plan.jobs;
-
-import com.djrapitops.plan.data.plugin.HookHandler;
-import com.djrapitops.plan.utilities.formatting.Formatter;
-import com.djrapitops.plan.utilities.formatting.Formatters;
-import com.djrapitops.pluginbridge.plan.Hook;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-/**
- * A Class responsible for hooking to Jobs and registering data sources.
- *
- * @author Rsl1122
-
- */
-@Singleton
-public class JobsHook extends Hook {
-
- private final Formatter decimalFormatter;
-
- @Inject
- public JobsHook(Formatters formatters) {
- super("com.gamingmesh.jobs.Jobs");
- decimalFormatter = formatters.decimals();
- }
-
- public void hook(HookHandler handler) throws NoClassDefFoundError {
- if (enabled) {
- handler.addPluginDataSource(new JobsData(decimalFormatter));
- }
- }
-}
diff --git a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansBukkitHook.java b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansBukkitHook.java
deleted file mode 100644
index effb56429..000000000
--- a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansBukkitHook.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * This file is part of Player Analytics (Plan).
- *
- * Plan is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License v3 as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Plan is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Plan. If not, see .
- */
-package com.djrapitops.pluginbridge.plan.litebans;
-
-import com.djrapitops.plan.data.plugin.HookHandler;
-import com.djrapitops.plan.utilities.formatting.Formatter;
-import com.djrapitops.plan.utilities.formatting.Formatters;
-import com.djrapitops.pluginbridge.plan.Hook;
-import litebans.api.Database;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-/**
- * A Class responsible for hooking to LiteBans and registering data
- * sources.
- *
- * @author Rsl1122
-
- */
-@Singleton
-public class LiteBansBukkitHook extends Hook {
-
- private Formatter timestampFormatter;
-
- @Inject
- public LiteBansBukkitHook(
- Formatters formatters
- ) {
- super();
- try {
- enabled = Database.get() != null;
- timestampFormatter = formatters.secondLong();
- } catch (NoClassDefFoundError | NoSuchFieldError | NoSuchMethodError | Exception e) {
- enabled = false;
- }
- }
-
- public void hook(HookHandler handler) throws NoClassDefFoundError {
- if (enabled) {
- LiteBansDatabaseQueries db = new LiteBansDatabaseQueries();
- handler.addPluginDataSource(new LiteBansData(db, timestampFormatter));
- }
- }
-}
diff --git a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansBungeeHook.java b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansBungeeHook.java
deleted file mode 100644
index c66325825..000000000
--- a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansBungeeHook.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * This file is part of Player Analytics (Plan).
- *
- * Plan is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License v3 as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Plan is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Plan. If not, see .
- */
-package com.djrapitops.pluginbridge.plan.litebans;
-
-import com.djrapitops.plan.data.plugin.HookHandler;
-import com.djrapitops.plan.utilities.formatting.Formatter;
-import com.djrapitops.plan.utilities.formatting.Formatters;
-import com.djrapitops.pluginbridge.plan.Hook;
-import litebans.api.Database;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-/**
- * A Class responsible for hooking to LiteBans and registering data
- * sources.
- *
- * @author Rsl1122
-
- */
-@Singleton
-public class LiteBansBungeeHook extends Hook {
-
- private Formatter timestampFormatter;
-
- @Inject
- public LiteBansBungeeHook(
- Formatters formatters
- ) {
- super();
- try {
- enabled = Database.get() != null;
- timestampFormatter = formatters.secondLong();
- } catch (NoClassDefFoundError | NoSuchFieldError | NoSuchMethodError | Exception e) {
- enabled = false;
- }
- }
-
- public void hook(HookHandler handler) throws NoClassDefFoundError {
- if (enabled) {
- LiteBansDatabaseQueries db = new LiteBansDatabaseQueries();
- handler.addPluginDataSource(new LiteBansData(db, timestampFormatter));
- }
- }
-}
diff --git a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansDBObj.java b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansDBObj.java
deleted file mode 100644
index f48d29f25..000000000
--- a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansDBObj.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * This file is part of Player Analytics (Plan).
- *
- * Plan is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License v3 as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Plan is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Plan. If not, see .
- */
-package com.djrapitops.pluginbridge.plan.litebans;
-
-import java.util.UUID;
-
-/**
- * Class representing LiteBans database data about a ban.
- *
- * @author Rsl1122
- */
-public class LiteBansDBObj {
- private final UUID uuid;
- private final String reason;
- private final String bannedBy;
- private final long expiry;
- private final boolean active;
- private final long time;
-
- public LiteBansDBObj(UUID uuid, String reason, String bannedBy, long expiry, boolean active, long time) {
- this.uuid = uuid;
- this.reason = reason;
- this.bannedBy = bannedBy;
- this.expiry = expiry;
- this.active = active;
- this.time = time;
- }
-
- public UUID getUuid() {
- return uuid;
- }
-
- public String getReason() {
- return reason;
- }
-
- public String getBannedBy() {
- return bannedBy;
- }
-
- public long getExpiry() {
- return expiry;
- }
-
- public boolean isActive() {
- return active;
- }
-
- public long getTime() {
- return time;
- }
-}
diff --git a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansData.java b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansData.java
deleted file mode 100644
index 427d2899e..000000000
--- a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansData.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * This file is part of Player Analytics (Plan).
- *
- * Plan is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License v3 as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Plan is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Plan. If not, see .
- */
-package com.djrapitops.pluginbridge.plan.litebans;
-
-import com.djrapitops.plan.api.PlanAPI;
-import com.djrapitops.plan.api.exceptions.database.DBOpException;
-import com.djrapitops.plan.data.element.AnalysisContainer;
-import com.djrapitops.plan.data.element.InspectContainer;
-import com.djrapitops.plan.data.element.TableContainer;
-import com.djrapitops.plan.data.plugin.BanData;
-import com.djrapitops.plan.data.plugin.ContainerSize;
-import com.djrapitops.plan.data.plugin.PluginData;
-import com.djrapitops.plan.data.store.keys.AnalysisKeys;
-import com.djrapitops.plan.utilities.formatting.Formatter;
-import com.djrapitops.plan.utilities.html.Html;
-import com.djrapitops.plan.utilities.html.icon.Color;
-import com.djrapitops.plan.utilities.html.icon.Family;
-import com.djrapitops.plan.utilities.html.icon.Icon;
-import com.djrapitops.plan.utilities.html.icon.Icons;
-import com.djrapitops.plan.utilities.html.structure.TabsElement;
-
-import java.util.*;
-import java.util.stream.Collectors;
-
-/**
- * PluginData for LiteBans plugin.
- *
- * @author Rsl1122
- */
-class LiteBansData extends PluginData implements BanData {
-
- private final LiteBansDatabaseQueries db;
-
- private final Formatter timestampFormatter;
-
- LiteBansData(
- LiteBansDatabaseQueries db,
- Formatter timestampFormatter
- ) {
- super(ContainerSize.TAB, "LiteBans");
- this.timestampFormatter = timestampFormatter;
- setPluginIcon(Icon.called("ban").of(Color.RED).build());
- this.db = db;
- }
-
- @Override
- public InspectContainer getPlayerData(UUID uuid, InspectContainer inspectContainer) {
-
- inspectContainer.addValue(Icon.called("balance-scale").of(Color.RED) +
- " Hover over 'What' column entry for offence reasons", "");
-
- String what = getWithIcon("Effect", Icon.called("times-circle").of(Family.REGULAR));
- String by = getWithIcon("By", Icon.called("gavel"));
- String date = getWithIcon("Expires", Icon.called("calendar-times").of(Family.REGULAR));
- TableContainer table = new TableContainer(what, by, date);
- table.setColor("red");
-
- try {
- List bans = db.getBans(uuid);
- List mutes = db.getMutes(uuid);
- List warns = db.getWarnings(uuid);
- List kicks = db.getKicks(uuid);
- if (bans.isEmpty() && mutes.isEmpty() && warns.isEmpty() && kicks.isEmpty()) {
- table.addRow("None");
- } else {
- for (LiteBansDBObj ban : bans) {
- long expiry = ban.getExpiry();
- String expires = expiry <= 0 ? "Never" : timestampFormatter.apply(expiry);
- table.addRow(
- "Ban",
- Html.LINK.parse(PlanAPI.getInstance().getPlayerInspectPageLink(ban.getBannedBy()), ban.getBannedBy()),
- expires
- );
- }
- for (LiteBansDBObj mute : mutes) {
- long expiry = mute.getExpiry();
- String expires = expiry <= 0 ? "Never" : timestampFormatter.apply(expiry);
- table.addRow(
- "Mute",
- Html.LINK.parse(PlanAPI.getInstance().getPlayerInspectPageLink(mute.getBannedBy()), mute.getBannedBy()),
- expires
- );
- }
- for (LiteBansDBObj warn : warns) {
- long expiry = warn.getExpiry();
- String expires = expiry <= 0 ? "Never" : timestampFormatter.apply(expiry);
- table.addRow(
- "Warning",
- Html.LINK.parse(PlanAPI.getInstance().getPlayerInspectPageLink(warn.getBannedBy()), warn.getBannedBy()),
- expires
- );
- }
- for (LiteBansDBObj kick : kicks) {
- long expiry = kick.getExpiry();
- String expires = expiry <= 0 ? "Never" : timestampFormatter.apply(expiry);
- table.addRow(
- "Kick",
- Html.LINK.parse(PlanAPI.getInstance().getPlayerInspectPageLink(kick.getBannedBy()), kick.getBannedBy()),
- expires
- );
- }
- }
- } catch (DBOpException ex) {
- table.addRow("Error: " + ex);
- } catch (IllegalStateException e) {
- inspectContainer.addValue(getWithIcon("Error", Icons.RED_WARN), "Database connection is not available");
- return inspectContainer;
- }
- inspectContainer.addTable("table", table);
- return inspectContainer;
- }
-
- @Override
- public AnalysisContainer getServerData(Collection collection, AnalysisContainer analysisContainer) {
- try {
- TableContainer banTable = getBanTable();
- TableContainer muteTable = getMuteTable();
- TableContainer warningTable = getWarningTable();
- TableContainer kickTable = getKickTable();
-
- Html spacing = Html.PANEL_BODY;
- String[] navAndHtml = new TabsElement(
- new TabsElement.Tab(getWithIcon("Bans", Icon.called("ban")), spacing.parse(banTable.parseHtml())),
- new TabsElement.Tab(getWithIcon("Mutes", Icon.called("bell-slash").of(Family.REGULAR)), spacing.parse(muteTable.parseHtml())),
- new TabsElement.Tab(getWithIcon("Warnings", Icon.called("exclamation-triangle")), spacing.parse(warningTable.parseHtml())),
- new TabsElement.Tab(getWithIcon("Kicks", Icon.called("user-times")), spacing.parse(kickTable.parseHtml()))
- ).toHtml();
- analysisContainer.addHtml("Tables", navAndHtml[0] + navAndHtml[1]);
- } catch (IllegalStateException e) {
- analysisContainer.addValue(getWithIcon("Error", Icons.RED_WARN), "Database connection is not available");
- }
- return analysisContainer;
- }
-
- private TableContainer getBanTable() {
- String banned = getWithIcon("Banned", Icon.called("ban"));
- String by = getWithIcon("Banned By", Icon.called("gavel"));
- TableContainer banTable = createTableContainer(banned, by);
- banTable.useJqueryDataTables();
- addRows(banTable, db.getBans());
- return banTable;
- }
-
- private TableContainer getMuteTable() {
- String muted = getWithIcon("Muted", Icon.called("bell-slash").of(Family.REGULAR));
- String by = getWithIcon("Muted By", Icon.called("gavel"));
- TableContainer muteTable = createTableContainer(muted, by);
- muteTable.useJqueryDataTables();
- addRows(muteTable, db.getMutes());
- return muteTable;
- }
-
- private TableContainer getWarningTable() {
- String warned = getWithIcon("Warned", Icon.called("exclamation-triangle"));
- String by = getWithIcon("Warned By", Icon.called("gavel"));
- TableContainer warnTable = createTableContainer(warned, by);
- warnTable.useJqueryDataTables();
- addRows(warnTable, db.getWarnings());
- return warnTable;
- }
-
- private TableContainer getKickTable() {
- String kicked = getWithIcon("Kicked", Icon.called("user-times"));
- String by = getWithIcon("Kicked By", Icon.called("gavel"));
- TableContainer kickTable = createTableContainer(kicked, by);
- kickTable.useJqueryDataTables();
- addRows(kickTable, db.getKicks());
- return kickTable;
- }
-
- private TableContainer createTableContainer(String who, String by) {
- String reason = getWithIcon("Reason", Icon.called("balance-scale"));
- String given = getWithIcon("Given", Icon.called("clock").of(Family.REGULAR));
- String expiry = getWithIcon("Expires", Icon.called("calendar-times").of(Family.REGULAR));
- String active = getWithIcon("Active", Icon.called("hourglass"));
-
- return new TableContainer(who, by, reason, given, expiry, active);
- }
-
- private void addRows(TableContainer table, List objects) {
- if (objects.isEmpty()) {
- table.addRow("No Data");
- } else {
- Map playerNames = Optional.ofNullable(analysisData)
- .flatMap(c -> c.getValue(AnalysisKeys.PLAYER_NAMES)).orElse(new HashMap<>());
- for (LiteBansDBObj object : objects) {
- UUID uuid = object.getUuid();
- String name = playerNames.getOrDefault(uuid, uuid.toString());
- long expiry = object.getExpiry();
- String expires = expiry <= 0 ? "Never" : timestampFormatter.apply(expiry);
- long time = object.getTime();
- String given = time <= 0 ? "Unknown" : timestampFormatter.apply(time);
-
- table.addRow(
- Html.LINK.parse(PlanAPI.getInstance().getPlayerInspectPageLink(name), name),
- Html.LINK.parse(PlanAPI.getInstance().getPlayerInspectPageLink(object.getBannedBy()), object.getBannedBy()),
- object.getReason(),
- given,
- expires,
- object.isActive() ? "Yes" : "No"
- );
- }
- }
- }
-
- @Override
- public boolean isBanned(UUID uuid) {
- try {
- return db.getBans(uuid).stream().anyMatch(LiteBansDBObj::isActive);
- } catch (DBOpException e) {
- return false;
- }
- }
-
- @Override
- public Collection filterBanned(Collection collection) {
- try {
- Set banned = db.getBans().stream()
- .filter(LiteBansDBObj::isActive)
- .map(LiteBansDBObj::getUuid)
- .collect(Collectors.toSet());
-
- return collection.stream().filter(banned::contains).collect(Collectors.toSet());
- } catch (DBOpException e) {
- return new HashSet<>();
- }
- }
-}
\ No newline at end of file
diff --git a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansDatabaseQueries.java b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansDatabaseQueries.java
deleted file mode 100644
index 51fc09b90..000000000
--- a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansDatabaseQueries.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * This file is part of Player Analytics (Plan).
- *
- * Plan is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License v3 as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Plan is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Plan. If not, see .
- */
-package com.djrapitops.pluginbridge.plan.litebans;
-
-import com.djrapitops.plan.api.exceptions.database.DBOpException;
-import com.djrapitops.plan.db.access.QueryAllStatement;
-import com.djrapitops.plan.db.access.QueryStatement;
-import litebans.api.Database;
-
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-/**
- * Class responsible for making queries to LiteBans database.
- *
- * @author Rsl1122
- */
-public class LiteBansDatabaseQueries {
- private final Database database;
-
- private final String banTable;
- private final String mutesTable;
- private final String warningsTable;
- private final String kicksTable;
-
- private final String selectSQL;
-
- public LiteBansDatabaseQueries() {
- database = Database.get();
- banTable = "{bans}";
- mutesTable = "{mutes}";
- warningsTable = "{warnings}";
- kicksTable = "{kicks}";
- selectSQL = "SELECT uuid, reason, banned_by_name, until, active, time FROM ";
- }
-
- protected T query(QueryStatement statement) {
- try (PreparedStatement preparedStatement = database.prepareStatement(statement.getSql())) {
- return statement.executeQuery(preparedStatement);
- } catch (SQLException e) {
- throw DBOpException.forCause(statement.getSql(), e);
- }
- }
-
- private List getObjs(String table) {
- String sql = selectSQL + table + " LIMIT 5000";
-
- return query(new QueryAllStatement>(sql, 2000) {
- @Override
- public List processResults(ResultSet resultSet) throws SQLException {
- return processIntoObjects(resultSet);
- }
- });
- }
-
- public List getBans() {
- return getObjs(banTable);
- }
-
- public List getMutes() {
- return getObjs(mutesTable);
- }
-
- public List getWarnings() {
- return getObjs(warningsTable);
- }
-
- public List getKicks() {
- return getObjs(kicksTable);
- }
-
- private List processIntoObjects(ResultSet set) throws SQLException {
- List objs = new ArrayList<>();
- while (set.next()) {
- String uuidS = set.getString("uuid");
- if (uuidS == null) {
- continue;
- }
- UUID uuid;
- try {
- uuid = UUID.fromString(uuidS);
- } catch (IllegalArgumentException e) {
- continue;
- }
- String reason = set.getString("reason");
- String bannedBy = set.getString("banned_by_name");
- long until = set.getLong("until");
- long time = set.getLong("time");
- boolean active = set.getBoolean("active");
- objs.add(new LiteBansDBObj(uuid, reason, bannedBy, until, active, time));
- }
- return objs;
- }
-
- public List getBans(UUID playerUUID) {
- return getObjs(playerUUID, banTable);
- }
-
- public List getMutes(UUID playerUUID) {
- return getObjs(playerUUID, mutesTable);
- }
-
- public List getWarnings(UUID playerUUID) {
- return getObjs(playerUUID, warningsTable);
- }
-
- public List getKicks(UUID playerUUID) {
- return getObjs(playerUUID, kicksTable);
- }
-
- private List getObjs(UUID playerUUID, String table) {
- String sql = selectSQL + table + " WHERE uuid=?";
-
- return query(new QueryStatement>(sql, 2000) {
- @Override
- public void prepare(PreparedStatement statement) throws SQLException {
- statement.setString(1, playerUUID.toString());
- }
-
- @Override
- public List processResults(ResultSet resultSet) throws SQLException {
- return processIntoObjects(resultSet);
- }
- });
- }
-}
diff --git a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/luckperms/LuckPermsData.java b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/luckperms/LuckPermsData.java
deleted file mode 100644
index 646f8e7c9..000000000
--- a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/luckperms/LuckPermsData.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * This file is part of Player Analytics (Plan).
- *
- * Plan is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License v3 as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Plan is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Plan. If not, see .
- */
-package com.djrapitops.pluginbridge.plan.luckperms;
-
-import com.djrapitops.plan.data.element.AnalysisContainer;
-import com.djrapitops.plan.data.element.InspectContainer;
-import com.djrapitops.plan.data.element.TableContainer;
-import com.djrapitops.plan.data.plugin.ContainerSize;
-import com.djrapitops.plan.data.plugin.PluginData;
-import com.djrapitops.plan.utilities.html.icon.Color;
-import com.djrapitops.plan.utilities.html.icon.Family;
-import com.djrapitops.plan.utilities.html.icon.Icon;
-import me.lucko.luckperms.api.*;
-import me.lucko.luckperms.api.caching.MetaData;
-import org.apache.commons.text.TextStringBuilder;
-
-import java.util.*;
-import java.util.stream.Collectors;
-
-/**
- * PluginData for LuckPerms plugin.
- *
- * @author Vankka
- */
-class LuckPermsData extends PluginData {
-
- private final LuckPermsApi api;
-
- LuckPermsData(LuckPermsApi api) {
- super(ContainerSize.THIRD, "LuckPerms");
- setPluginIcon(Icon.called("exclamation-triangle").of(Color.LIGHT_GREEN).build());
-
- this.api = api;
- }
-
- @Override
- public InspectContainer getPlayerData(UUID uuid, InspectContainer inspectContainer) {
- User user = api.getUser(uuid);
-
- if (user == null) {
- inspectContainer.addValue("Data unavailable", "Could not get user data");
- return inspectContainer;
- }
-
- MetaData metaData = user.getCachedData().getMetaData(Contexts.allowAll());
- String prefix = metaData.getPrefix();
- String suffix = metaData.getSuffix();
-
- inspectContainer.addValue(getWithIcon("Primary group", Icon.called("user-friends").of(Family.SOLID)), user.getPrimaryGroup());
- inspectContainer.addValue(getWithIcon("Prefix", Icon.called("file-signature").of(Family.SOLID).of(Color.GREEN)), prefix != null ? prefix : "None");
- inspectContainer.addValue(getWithIcon("Suffix", Icon.called("file-signature").of(Family.SOLID).of(Color.BLUE)),suffix != null ? suffix : "None");
-
- if (!metaData.getMeta().isEmpty()) {
- TableContainer metaTable = new TableContainer(
- getWithIcon("Meta", Icon.called("info-circle").of(Family.SOLID)),
- getWithIcon("Value", Icon.called("file-alt").of(Family.SOLID))
- );
- metaData.getMeta().forEach((key, value) -> metaTable.addRow(key, value));
- inspectContainer.addTable("Meta", metaTable);
- }
-
- List groups = user.getPermissions().stream()
- .filter(Node::isGroupNode)
- .map(Node::getGroupName)
- .sorted()
- .collect(Collectors.toList());
-
- inspectContainer.addValue(
- getWithIcon("Groups", Icon.called("user-friends").of(Family.SOLID)),
- new TextStringBuilder().appendWithSeparators(groups, ", ").build()
- );
-
- Set