mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-02-03 05:51:28 +01:00
Merge pull request #703 from Rsl1122/development
Pull Request for 4.4.5
This commit is contained in:
commit
c2b54e4254
@ -83,14 +83,11 @@
|
||||
<relocation>
|
||||
<pattern>org.slf4j</pattern>
|
||||
<shadedPattern>plan.org.slf4j</shadedPattern>
|
||||
<excludes>
|
||||
<exclude>org.slf4j.Logger</exclude>
|
||||
</excludes>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.bstats</pattern>
|
||||
<shadedPattern>com.djrapitops.plan.utilities.metrics</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.bstats</pattern>
|
||||
<shadedPattern>com.djrapitops.plan.utilities.metrics</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
</plugin>
|
||||
@ -149,14 +146,14 @@
|
||||
<id>sponge-repo</id>
|
||||
<url>https://repo.spongepowered.org/maven</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>md_5-snapshots</id>
|
||||
<url>http://repo.md-5.net/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>bstats-repo</id>
|
||||
<url>http://repo.bstats.org/content/repositories/releases/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>md_5-snapshots</id>
|
||||
<url>http://repo.md-5.net/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>bstats-repo</id>
|
||||
<url>http://repo.bstats.org/content/repositories/releases/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@ -359,12 +356,12 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.imaginarycode.minecraft</groupId>
|
||||
<artifactId>RedisBungee</artifactId>
|
||||
<version>0.3.8-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.imaginarycode.minecraft</groupId>
|
||||
<artifactId>RedisBungee</artifactId>
|
||||
<version>0.3.8-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
@ -388,7 +385,7 @@
|
||||
<dependency>
|
||||
<groupId>org.xerial</groupId>
|
||||
<artifactId>sqlite-jdbc</artifactId>
|
||||
<version>3.23.1</version>
|
||||
<version>3.23.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -223,6 +223,7 @@
|
||||
<exclude>org.mockito:*</exclude>
|
||||
<exclude>org.easymock:*</exclude>
|
||||
<exclude>junit:*</exclude>
|
||||
<!--<exclued>org.slf4j:*</exclued>-->
|
||||
</excludes>
|
||||
</artifactSet>
|
||||
<relocations>
|
||||
@ -248,9 +249,6 @@
|
||||
<relocation>
|
||||
<pattern>org.slf4j</pattern>
|
||||
<shadedPattern>plan.org.slf4j</shadedPattern>
|
||||
<excludes>
|
||||
<exclude>org.slf4j.Logger</exclude>
|
||||
</excludes>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.bstats</pattern>
|
||||
|
@ -25,7 +25,7 @@ import org.spongepowered.api.plugin.Plugin;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
|
||||
@Plugin(id = "plan", name = "Plan", version = "4.4.4", description = "Player Analytics Plugin by Rsl1122", authors = {"Rsl1122"})
|
||||
@Plugin(id = "plan", name = "Plan", version = "4.4.5", description = "Player Analytics Plugin by Rsl1122", authors = {"Rsl1122"})
|
||||
public class PlanSponge extends SpongePlugin implements PlanPlugin {
|
||||
|
||||
@Inject
|
||||
|
@ -3,7 +3,6 @@ package com.djrapitops.plan.command.commands.manage;
|
||||
import com.djrapitops.plan.PlanPlugin;
|
||||
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
||||
import com.djrapitops.plan.system.database.databases.Database;
|
||||
import com.djrapitops.plan.system.info.connection.ConnectionSystem;
|
||||
import com.djrapitops.plan.system.info.server.Server;
|
||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||
import com.djrapitops.plan.system.locale.Locale;
|
||||
@ -69,7 +68,7 @@ public class ManageUninstalledCommand extends CommandNode {
|
||||
}
|
||||
|
||||
private Optional<Server> getServer(String[] args) {
|
||||
if (args.length >= 1 && ConnectionSystem.getInstance().isServerAvailable()) {
|
||||
if (args.length >= 1) {
|
||||
Map<UUID, Server> bukkitServers = Database.getActive().fetch().getBukkitServers();
|
||||
String serverIdentifier = getGivenIdentifier(args);
|
||||
for (Map.Entry<UUID, Server> entry : bukkitServers.entrySet()) {
|
||||
|
@ -173,4 +173,7 @@ public class NetworkContainer extends DataContainer {
|
||||
putSupplier(NetworkKeys.PLAYERS_MONTH, () -> getUnsafe(uniqueMonth).count());
|
||||
}
|
||||
|
||||
public ServerContainer getBungeeContainer() {
|
||||
return bungeeContainer;
|
||||
}
|
||||
}
|
@ -367,7 +367,7 @@ public class ServerTable extends Table {
|
||||
}
|
||||
|
||||
public void setAsUninstalled(UUID serverUUID) {
|
||||
String sql = "UPDATE " + tableName + " SET (" + Col.INSTALLED + "=?) WHERE " + Col.SERVER_UUID + "=?";
|
||||
String sql = "UPDATE " + tableName + " SET " + Col.INSTALLED + "=? WHERE " + Col.SERVER_UUID + "=?";
|
||||
|
||||
execute(new ExecStatement(sql) {
|
||||
@Override
|
||||
|
@ -10,6 +10,7 @@ import com.djrapitops.plan.api.exceptions.connection.WebException;
|
||||
import com.djrapitops.plan.system.info.connection.BungeeConnectionSystem;
|
||||
import com.djrapitops.plan.system.info.request.CacheRequest;
|
||||
import com.djrapitops.plan.system.info.request.GenerateInspectPageRequest;
|
||||
import com.djrapitops.plan.system.info.request.GenerateInspectPluginsTabRequest;
|
||||
import com.djrapitops.plan.system.info.request.InfoRequest;
|
||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||
import com.djrapitops.plan.system.webserver.cache.PageId;
|
||||
@ -30,8 +31,10 @@ public class BungeeInfoSystem extends InfoSystem {
|
||||
|
||||
@Override
|
||||
public void runLocally(InfoRequest infoRequest) throws WebException {
|
||||
if (infoRequest instanceof CacheRequest ||
|
||||
infoRequest instanceof GenerateInspectPageRequest) {
|
||||
if (infoRequest instanceof CacheRequest
|
||||
|| infoRequest instanceof GenerateInspectPageRequest
|
||||
|| infoRequest instanceof GenerateInspectPluginsTabRequest
|
||||
) {
|
||||
infoRequest.runLocally();
|
||||
} else {
|
||||
// runLocally is called when ConnectionSystem has no servers.
|
||||
|
@ -7,6 +7,7 @@ package com.djrapitops.plan.system.info.connection;
|
||||
import com.djrapitops.plan.api.exceptions.connection.NoServersException;
|
||||
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
||||
import com.djrapitops.plan.system.database.databases.Database;
|
||||
import com.djrapitops.plan.system.info.InfoSystem;
|
||||
import com.djrapitops.plan.system.info.request.*;
|
||||
import com.djrapitops.plan.system.info.server.Server;
|
||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||
@ -44,7 +45,9 @@ public class BungeeConnectionSystem extends ConnectionSystem {
|
||||
protected Server selectServerForRequest(InfoRequest infoRequest) throws NoServersException {
|
||||
refreshServerMap();
|
||||
Server server = null;
|
||||
if (infoRequest instanceof CacheRequest || infoRequest instanceof GenerateInspectPageRequest) {
|
||||
if (infoRequest instanceof CacheRequest
|
||||
|| infoRequest instanceof GenerateInspectPageRequest
|
||||
|| infoRequest instanceof GenerateInspectPluginsTabRequest) {
|
||||
// Run locally
|
||||
return ServerInfo.getServer();
|
||||
} else if (infoRequest instanceof GenerateAnalysisPageRequest) {
|
||||
@ -66,6 +69,10 @@ public class BungeeConnectionSystem extends ConnectionSystem {
|
||||
for (Server server : bukkitServers.values()) {
|
||||
WebExceptionLogger.logIfOccurs(this.getClass(), () -> sendInfoRequest(infoRequest, server));
|
||||
}
|
||||
// Quick hack
|
||||
if (infoRequest instanceof GenerateInspectPluginsTabRequest) {
|
||||
WebExceptionLogger.logIfOccurs(this.getClass(), () -> InfoSystem.getInstance().sendRequest(infoRequest));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -7,6 +7,8 @@ import com.djrapitops.plan.system.processing.processors.TPSInsertProcessor;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import com.djrapitops.plugin.task.AbsRunnable;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.management.OperatingSystemMXBean;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -52,4 +54,27 @@ public abstract class TPSCountTimer<T extends PlanPlugin> extends AbsRunnable {
|
||||
public int getLatestPlayersOnline() {
|
||||
return latestPlayersOnline;
|
||||
}
|
||||
|
||||
protected long getUsedMemory() {
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
long totalMemory = runtime.totalMemory();
|
||||
return (totalMemory - runtime.freeMemory()) / 1000000;
|
||||
}
|
||||
|
||||
protected double getCPUUsage() {
|
||||
double averageCPUUsage;
|
||||
|
||||
OperatingSystemMXBean osBean = ManagementFactory.getOperatingSystemMXBean();
|
||||
if (osBean instanceof com.sun.management.OperatingSystemMXBean) {
|
||||
com.sun.management.OperatingSystemMXBean nativeOsBean = (com.sun.management.OperatingSystemMXBean) osBean;
|
||||
averageCPUUsage = nativeOsBean.getSystemCpuLoad();
|
||||
} else {
|
||||
int availableProcessors = osBean.getAvailableProcessors();
|
||||
averageCPUUsage = osBean.getSystemLoadAverage() / availableProcessors;
|
||||
}
|
||||
if (averageCPUUsage < 0) { // If unavailable, getSystemLoadAverage() returns -1
|
||||
averageCPUUsage = -1;
|
||||
}
|
||||
return averageCPUUsage * 100.0;
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,10 @@ public class BungeeTPSCountTimer extends TPSCountTimer<PlanBungee> {
|
||||
.date(now)
|
||||
.skipTPS()
|
||||
.playersOnline(onlineCount)
|
||||
.usedCPU(getCPUUsage())
|
||||
.usedMemory(getUsedMemory())
|
||||
.entities(-1)
|
||||
.chunksLoaded(-1)
|
||||
.toTPS();
|
||||
|
||||
history.add(tps);
|
||||
|
@ -7,9 +7,6 @@ import com.djrapitops.plugin.api.TimeAmount;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import org.bukkit.World;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.management.OperatingSystemMXBean;
|
||||
|
||||
public class BukkitTPSCountTimer extends TPSCountTimer<Plan> {
|
||||
|
||||
private long lastCheckNano;
|
||||
@ -43,10 +40,7 @@ public class BukkitTPSCountTimer extends TPSCountTimer<Plan> {
|
||||
private TPS calculateTPS(long diff, long now) {
|
||||
double averageCPUUsage = getCPUUsage();
|
||||
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
|
||||
long totalMemory = runtime.totalMemory();
|
||||
long usedMemory = (totalMemory - runtime.freeMemory()) / 1000000;
|
||||
long usedMemory = getUsedMemory();
|
||||
|
||||
int playersOnline = plugin.getServer().getOnlinePlayers().size();
|
||||
latestPlayersOnline = playersOnline;
|
||||
@ -58,22 +52,6 @@ public class BukkitTPSCountTimer extends TPSCountTimer<Plan> {
|
||||
return getTPS(diff, now, averageCPUUsage, usedMemory, entityCount, loadedChunks, playersOnline);
|
||||
}
|
||||
|
||||
private double getCPUUsage() {
|
||||
double averageCPUUsage;
|
||||
|
||||
OperatingSystemMXBean osBean = ManagementFactory.getOperatingSystemMXBean();
|
||||
if (osBean instanceof com.sun.management.OperatingSystemMXBean) {
|
||||
com.sun.management.OperatingSystemMXBean nativeOsBean = (com.sun.management.OperatingSystemMXBean) osBean;
|
||||
averageCPUUsage = nativeOsBean.getSystemCpuLoad();
|
||||
} else {
|
||||
int availableProcessors = osBean.getAvailableProcessors();
|
||||
averageCPUUsage = osBean.getSystemLoadAverage() / availableProcessors;
|
||||
}
|
||||
if (averageCPUUsage < 0) { // If unavailable, getSystemLoadAverage() returns -1
|
||||
averageCPUUsage = -1;
|
||||
}
|
||||
return averageCPUUsage * 100.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the TPS for Spigot / Bukkit
|
||||
|
@ -9,9 +9,6 @@ import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import org.spongepowered.api.Sponge;
|
||||
import org.spongepowered.api.world.World;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.management.OperatingSystemMXBean;
|
||||
|
||||
public class SpongeTPSCountTimer extends TPSCountTimer<PlanSponge> {
|
||||
|
||||
private long lastCheckNano;
|
||||
@ -42,18 +39,9 @@ public class SpongeTPSCountTimer extends TPSCountTimer<PlanSponge> {
|
||||
* @return the TPS
|
||||
*/
|
||||
private TPS calculateTPS(long now) {
|
||||
OperatingSystemMXBean operatingSystemMXBean = ManagementFactory.getOperatingSystemMXBean();
|
||||
int availableProcessors = operatingSystemMXBean.getAvailableProcessors();
|
||||
double averageCPUUsage = operatingSystemMXBean.getSystemLoadAverage() / availableProcessors * 100.0;
|
||||
double averageCPUUsage = getCPUUsage();
|
||||
|
||||
if (averageCPUUsage < 0) { // If unavailable, getSystemLoadAverage() returns -1
|
||||
averageCPUUsage = -1;
|
||||
}
|
||||
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
|
||||
long totalMemory = runtime.totalMemory();
|
||||
long usedMemory = (totalMemory - runtime.freeMemory()) / 1000000;
|
||||
long usedMemory = getUsedMemory();
|
||||
|
||||
double tps = Sponge.getGame().getServer().getTicksPerSecond();
|
||||
int playersOnline = ServerInfo.getServerProperties().getOnlinePlayers();
|
||||
|
@ -0,0 +1,39 @@
|
||||
package com.djrapitops.plan.utilities.html.graphs;
|
||||
|
||||
import com.djrapitops.plan.data.store.mutators.formatting.Formatters;
|
||||
|
||||
/**
|
||||
* Utility for creating ProgressBars.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class ProgressBar {
|
||||
|
||||
private final int obtained;
|
||||
private final int max;
|
||||
|
||||
private final String color;
|
||||
|
||||
public ProgressBar(int obtained, int max) {
|
||||
this(obtained, max, "teal");
|
||||
}
|
||||
|
||||
public ProgressBar(int obtained, int max, String color) {
|
||||
this.obtained = obtained;
|
||||
this.max = max;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public String toHtml() {
|
||||
double percentage = obtained * 1.0 / max;
|
||||
int percentageRounded = (int) percentage;
|
||||
|
||||
return "<div class=\"progress\"><div class=\"progress-bar bg-" + color + "\" role=\"progressbar\"" +
|
||||
" aria-valuenow=\"" + obtained + "\"" +
|
||||
" aria-valuemin=\"0\" aria-valuemax=\"" + max + "\"" +
|
||||
" style=\"width: " + percentageRounded + "%;\">" +
|
||||
obtained + " / " + max + " (" + Formatters.percentage().apply(percentage) + ")" +
|
||||
"</div></div>";
|
||||
}
|
||||
|
||||
}
|
@ -14,7 +14,6 @@ import com.djrapitops.plan.system.info.server.Server;
|
||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||
import com.djrapitops.plan.system.info.server.properties.ServerProperties;
|
||||
import com.djrapitops.plan.system.webserver.cache.ResponseCache;
|
||||
import com.djrapitops.plan.utilities.file.FileUtil;
|
||||
import com.djrapitops.plan.utilities.html.Html;
|
||||
import com.djrapitops.plan.utilities.html.HtmlStructure;
|
||||
import com.djrapitops.plan.utilities.html.icon.Icon;
|
||||
@ -23,11 +22,9 @@ import com.djrapitops.plugin.api.Benchmark;
|
||||
import com.djrapitops.plugin.api.utility.log.ErrorLogger;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.management.RuntimeMXBean;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@ -52,10 +49,9 @@ public class DebugPage implements Page {
|
||||
TabsElement.Tab info = new TabsElement.Tab(Icon.called("server") + " Server Information", createServerInfoContent());
|
||||
TabsElement.Tab errors = new TabsElement.Tab(Icon.called("exclamation-circle") + " Errors", createErrorContent());
|
||||
TabsElement.Tab debugLog = new TabsElement.Tab(Icon.called("bug") + " Debug Log", createDebugLogContent());
|
||||
TabsElement.Tab config = new TabsElement.Tab(Icon.called("cogs") + " Plan Config", createConfigContent());
|
||||
TabsElement.Tab caches = new TabsElement.Tab(Icon.called("archive") + " Plan Caches", createCacheContent());
|
||||
|
||||
TabsElement tabs = new TabsElement(info, errors, debugLog, config, caches);
|
||||
TabsElement tabs = new TabsElement(info, errors, debugLog, caches);
|
||||
|
||||
return preContent + tabs.toHtmlFull();
|
||||
}
|
||||
@ -105,12 +101,6 @@ public class DebugPage implements Page {
|
||||
}
|
||||
}
|
||||
|
||||
private String createConfigContent() {
|
||||
StringBuilder content = new StringBuilder();
|
||||
appendConfig(content);
|
||||
return content.toString();
|
||||
}
|
||||
|
||||
private String createDebugLogContent() {
|
||||
StringBuilder content = new StringBuilder();
|
||||
appendDebugLog(content);
|
||||
@ -221,21 +211,6 @@ public class DebugPage implements Page {
|
||||
content.append("</pre>");
|
||||
}
|
||||
|
||||
private void appendConfig(StringBuilder content) {
|
||||
try {
|
||||
File configFile = new File(PlanPlugin.getInstance().getDataFolder(), "config.yml");
|
||||
if (configFile.exists()) {
|
||||
content.append("<pre>### config.yml<br>```<br>");
|
||||
FileUtil.lines(configFile, Charset.forName("UTF-8"))
|
||||
.stream().filter(line -> !line.toLowerCase().contains("pass") && !line.toLowerCase().contains("secret"))
|
||||
.forEach(line -> content.append(line).append("<br>"));
|
||||
content.append("```</pre>");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Log.toLog(this.getClass(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private void appendBenchmarks(StringBuilder content) {
|
||||
content.append("<pre>### Benchmarks<br>```<br>");
|
||||
try {
|
||||
|
@ -13,6 +13,7 @@ import com.djrapitops.plan.system.webserver.cache.PageId;
|
||||
import com.djrapitops.plan.system.webserver.cache.ResponseCache;
|
||||
import com.djrapitops.plan.system.webserver.response.pages.parts.NetworkPageContent;
|
||||
import com.djrapitops.plan.utilities.file.FileUtil;
|
||||
import com.djrapitops.plan.utilities.html.structure.AnalysisPluginsTabContentCreator;
|
||||
|
||||
import static com.djrapitops.plan.data.store.keys.NetworkKeys.*;
|
||||
|
||||
@ -51,6 +52,13 @@ public class NetworkPage implements Page {
|
||||
ResponseCache.loadResponse(PageId.NETWORK_CONTENT.id(), NetworkPageContent::new);
|
||||
placeholderReplacer.put("tabContentServers", networkPageContent.getContents());
|
||||
|
||||
String[] content = AnalysisPluginsTabContentCreator.createContent(networkContainer.getUnsafe(NetworkKeys.PLAYERS_MUTATOR), null);
|
||||
String nav = content[0];
|
||||
String tabs = content[1];
|
||||
|
||||
placeholderReplacer.put("navPluginsTabs", nav);
|
||||
placeholderReplacer.put("tabsPlugins", tabs);
|
||||
|
||||
return placeholderReplacer.apply(FileUtil.getStringFromResource("web/network.html"));
|
||||
} catch (Exception e) {
|
||||
throw new ParseException(e);
|
||||
|
@ -1,4 +1,4 @@
|
||||
name: Plan
|
||||
author: Rsl1122
|
||||
main: com.djrapitops.plan.PlanBungee
|
||||
version: 4.4.4
|
||||
version: 4.4.5
|
@ -148,4 +148,9 @@ Servers:
|
||||
Example:
|
||||
WebServerPort: 8034
|
||||
ServerName: Example
|
||||
ThemeBase: Default
|
||||
ThemeBase: Default
|
||||
# -----------------------------------------------------
|
||||
Plugins:
|
||||
BuyCraft:
|
||||
# http://help.buycraft.net/article/36-where-to-find-the-secret-key
|
||||
Secret: "-"
|
@ -1,7 +1,7 @@
|
||||
name: Plan
|
||||
author: Rsl1122
|
||||
main: com.djrapitops.plan.Plan
|
||||
version: 4.4.4
|
||||
version: 4.4.5
|
||||
softdepend:
|
||||
- EssentialsX
|
||||
- Towny
|
||||
|
@ -130,6 +130,15 @@
|
||||
<span>Network Players</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="javascript:void(0);" class="menu-toggle">
|
||||
<i class="material-icons">extension</i>
|
||||
<span>Plugins</span>
|
||||
</a>
|
||||
<ul class="ml-menu">
|
||||
${navPluginsTabs}
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- #Menu -->
|
||||
@ -487,6 +496,7 @@
|
||||
<!-- #END# Geolocations -->
|
||||
</div>
|
||||
<!-- #END# Tab Geolocations -->
|
||||
${tabsPlugins}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
Binary file not shown.
@ -41,6 +41,10 @@
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>bungeecord-repo</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
@ -54,7 +58,7 @@
|
||||
<url>http://nexus.hc.to/content/repositories/pub_releases</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<id>jitpack.io (GriefPrevention)</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
<repository>
|
||||
@ -82,14 +86,14 @@
|
||||
<version>4.3.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Paper API -->
|
||||
|
||||
<!-- Server APIs -->
|
||||
<dependency>
|
||||
<groupId>com.destroystokyo.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>1.12.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Spigot API -->
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
@ -97,6 +101,15 @@
|
||||
<type>jar</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-api</artifactId>
|
||||
<version>1.12-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Plugins from repositories -->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.hm.achievement</groupId>
|
||||
<artifactId>advanced-achievements-api</artifactId>
|
||||
@ -104,39 +117,21 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.earth2me</groupId>
|
||||
<artifactId>essentials</artifactId>
|
||||
<version>2.0.1</version>
|
||||
<groupId>com.github.TechFortress</groupId>
|
||||
<artifactId>GriefPrevention</artifactId>
|
||||
<version>16.8</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.massivecraft</groupId>
|
||||
<artifactId>factions</artifactId>
|
||||
<version>2.10.0</version>
|
||||
<groupId>me.clip</groupId>
|
||||
<artifactId>placeholderapi</artifactId>
|
||||
<version>2.9.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.gamingmesh</groupId>
|
||||
<artifactId>jobs</artifactId>
|
||||
<version>4.0.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.massivecraft</groupId>
|
||||
<artifactId>mcore</artifactId>
|
||||
<version>2.10.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.gmail.nossr50</groupId>
|
||||
<artifactId>mcMMO</artifactId>
|
||||
<version>1.5.07</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.palmergames</groupId>
|
||||
<artifactId>towny</artifactId>
|
||||
<version>0.91.4.0</version>
|
||||
<groupId>br.net.fabiozumbi12.RedProtect</groupId>
|
||||
<artifactId>RedProtect-Spigot</artifactId>
|
||||
<version>7.5.3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -146,18 +141,56 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.wasteofplastic.askyblock</groupId>
|
||||
<artifactId>ASkyBlock</artifactId>
|
||||
<version>3.0.6.8</version>
|
||||
<groupId>us.myles</groupId>
|
||||
<artifactId>viaversion</artifactId>
|
||||
<version>1.5.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Plugins requiring local install -->
|
||||
|
||||
<dependency>
|
||||
<groupId>me.konsolas</groupId>
|
||||
<artifactId>AAC</artifactId>
|
||||
<version>3.5.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.TechFortress</groupId>
|
||||
<artifactId>GriefPrevention</artifactId>
|
||||
<version>16.7.1</version>
|
||||
<groupId>me.leoko</groupId>
|
||||
<artifactId>advancedban</artifactId>
|
||||
<version>2.1.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.wasteofplastic.askyblock</groupId>
|
||||
<artifactId>ASkyBlock</artifactId>
|
||||
<version>3.0.9.4</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.confuser</groupId>
|
||||
<artifactId>banmanager</artifactId>
|
||||
<version>5.15.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>EssentialsX</artifactId>
|
||||
<version>2.15.0.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.massivecraft</groupId>
|
||||
<artifactId>factions</artifactId>
|
||||
<version>2.14.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.massivecraft</groupId>
|
||||
<artifactId>mcore</artifactId>
|
||||
<version>2.14.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- https://github.com/KaiKikuchi/GriefPreventionPlus/releases -->
|
||||
<dependency>
|
||||
<groupId>net.kaikk.mc</groupId>
|
||||
<artifactId>GriefPreventionPlus</artifactId>
|
||||
@ -165,21 +198,9 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>litebans</groupId>
|
||||
<artifactId>api</artifactId>
|
||||
<version>0.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.minimum</groupId>
|
||||
<artifactId>minecraft.superbvote</artifactId>
|
||||
<version>0.4.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>us.myles</groupId>
|
||||
<artifactId>viaversion</artifactId>
|
||||
<version>1.1.1</version>
|
||||
<groupId>com.gamingmesh</groupId>
|
||||
<artifactId>jobs</artifactId>
|
||||
<version>4.7.4</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -189,51 +210,39 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.confuser</groupId>
|
||||
<artifactId>banmanager</artifactId>
|
||||
<version>5.15.0</version>
|
||||
<groupId>litebans</groupId>
|
||||
<artifactId>api</artifactId>
|
||||
<version>0.3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.gmail.nossr50</groupId>
|
||||
<artifactId>mcMMO</artifactId>
|
||||
<version>1.6.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>com.github.MCE-Plugins</groupId>-->
|
||||
<!--<artifactId>MinigamesLib-parent</artifactId>-->
|
||||
<!--<version>1.14.18</version>-->
|
||||
<!--<scope>provided</scope>-->
|
||||
<!--</dependency>-->
|
||||
<dependency>
|
||||
<groupId>com.github.ProtocolSupport</groupId>
|
||||
<artifactId>ProtocolSupport</artifactId>
|
||||
<version>4.28</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>br.net.fabiozumbi12.RedProtect</groupId>
|
||||
<artifactId>RedProtect-Spigot</artifactId>
|
||||
<version>RELEASE</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.konsolas</groupId>
|
||||
<artifactId>AAC</artifactId>
|
||||
<version>3.3.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.clip</groupId>
|
||||
<artifactId>placeholderapi</artifactId>
|
||||
<version>LATEST</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.volmit</groupId>
|
||||
<artifactId>react</artifactId>
|
||||
<version>6.549</version>
|
||||
<version>6.573</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.leoko</groupId>
|
||||
<artifactId>advancedban</artifactId>
|
||||
<version>2.1.5</version>
|
||||
<groupId>io.minimum</groupId>
|
||||
<artifactId>minecraft.superbvote</artifactId>
|
||||
<version>0.5.3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.palmergames</groupId>
|
||||
<artifactId>towny</artifactId>
|
||||
<version>0.92.0.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
@ -245,46 +254,6 @@
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>2.5.2</version>
|
||||
</plugin>
|
||||
<!--<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.9.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.5</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>-->
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
|
@ -16,14 +16,16 @@ import com.djrapitops.pluginbridge.plan.griefprevention.GriefPreventionHook;
|
||||
import com.djrapitops.pluginbridge.plan.griefprevention.plus.GriefPreventionPlusHook;
|
||||
import com.djrapitops.pluginbridge.plan.jobs.JobsHook;
|
||||
import com.djrapitops.pluginbridge.plan.kingdoms.KingdomsHook;
|
||||
import com.djrapitops.pluginbridge.plan.litebans.LiteBansHook;
|
||||
import com.djrapitops.pluginbridge.plan.litebans.LiteBansBukkitHook;
|
||||
import com.djrapitops.pluginbridge.plan.litebans.LiteBansBungeeHook;
|
||||
import com.djrapitops.pluginbridge.plan.mcmmo.McmmoHook;
|
||||
import com.djrapitops.pluginbridge.plan.protocolsupport.ProtocolSupportHook;
|
||||
import com.djrapitops.pluginbridge.plan.redprotect.RedProtectHook;
|
||||
import com.djrapitops.pluginbridge.plan.superbvote.SuperbVoteHook;
|
||||
import com.djrapitops.pluginbridge.plan.towny.TownyHook;
|
||||
import com.djrapitops.pluginbridge.plan.vault.VaultHook;
|
||||
import com.djrapitops.pluginbridge.plan.viaversion.ViaVersionHook;
|
||||
import com.djrapitops.pluginbridge.plan.viaversion.ViaVersionBukkitHook;
|
||||
import com.djrapitops.pluginbridge.plan.viaversion.ViaVersionBungeeHook;
|
||||
|
||||
/**
|
||||
* Manages connection to other plugins.
|
||||
@ -56,17 +58,30 @@ public class Bridge {
|
||||
|
||||
private static Hook[] getHooks(HookHandler h) {
|
||||
Hook[] hooks;
|
||||
if (Check.isBukkitAvailable()) {
|
||||
hooks = getBukkitHooks(h);
|
||||
} else {
|
||||
if (Check.isBungeeAvailable()) {
|
||||
hooks = getBungeeHooks(h);
|
||||
} else if (Check.isBukkitAvailable()) {
|
||||
hooks = getBukkitHooks(h);
|
||||
} else if (Check.isSpongeAvailable()) {
|
||||
hooks = getSpongeHooks(h);
|
||||
} else {
|
||||
return new Hook[0];
|
||||
}
|
||||
return hooks;
|
||||
}
|
||||
|
||||
private static Hook[] getSpongeHooks(HookHandler h) {
|
||||
return new Hook[]{
|
||||
new BuyCraftHook(h)
|
||||
};
|
||||
}
|
||||
|
||||
private static Hook[] getBungeeHooks(HookHandler h) {
|
||||
return new Hook[]{
|
||||
new AdvancedBanHook(h)
|
||||
new AdvancedBanHook(h),
|
||||
new BuyCraftHook(h),
|
||||
new LiteBansBungeeHook(h),
|
||||
new ViaVersionBungeeHook(h)
|
||||
};
|
||||
}
|
||||
|
||||
@ -84,7 +99,7 @@ public class Bridge {
|
||||
new GriefPreventionPlusHook(h),
|
||||
new JobsHook(h),
|
||||
new KingdomsHook(h),
|
||||
new LiteBansHook(h),
|
||||
new LiteBansBukkitHook(h),
|
||||
new McmmoHook(h),
|
||||
new SuperbVoteHook(h),
|
||||
new ProtocolSupportHook(h),
|
||||
@ -92,7 +107,7 @@ public class Bridge {
|
||||
new RedProtectHook(h),
|
||||
new TownyHook(h),
|
||||
new VaultHook(h),
|
||||
new ViaVersionHook(h)//,
|
||||
new ViaVersionBukkitHook(h)//,
|
||||
// new PlaceholderAPIHook(h)
|
||||
};
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ 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.utilities.FormatUtils;
|
||||
import com.djrapitops.plan.utilities.html.Html;
|
||||
import com.djrapitops.plan.utilities.html.HtmlUtils;
|
||||
@ -17,15 +16,13 @@ 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.plugin.api.utility.log.Log;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
import me.leoko.advancedban.manager.PunishmentManager;
|
||||
import me.leoko.advancedban.manager.UUIDManager;
|
||||
import me.leoko.advancedban.utils.Punishment;
|
||||
import me.leoko.advancedban.utils.PunishmentType;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* PluginData for AdvancedBan plugin.
|
||||
*
|
||||
@ -45,59 +42,52 @@ public class AdvancedBanData extends PluginData {
|
||||
return inspectContainer;
|
||||
}
|
||||
|
||||
Punishment ban = PunishmentManager.get().getBan(abUuid);
|
||||
Punishment mute = PunishmentManager.get().getMute(abUuid);
|
||||
long warnings = PunishmentManager.get().getWarns(abUuid).stream().filter(warning -> !warning.isExpired()).count();
|
||||
PunishmentManager punishmentManager = PunishmentManager.get();
|
||||
Punishment ban = punishmentManager.getBan(abUuid);
|
||||
Punishment mute = punishmentManager.getMute(abUuid);
|
||||
long warnings = punishmentManager.getWarns(abUuid).stream().filter(warning -> !warning.isExpired()).count();
|
||||
|
||||
inspectContainer.addValue(getWithIcon("Banned", Icons.BANNED), ban != null ? "Yes" : "No");
|
||||
inspectContainer.addValue(getWithIcon("Muted", Icon.called("bell-slash").of(Color.DEEP_ORANGE)), mute != null ? "Yes" : "No");
|
||||
if (ban != null) {
|
||||
addPunishment(inspectContainer, ban, "Permanent ban");
|
||||
}
|
||||
|
||||
inspectContainer.addValue(getWithIcon("Muted", Icon.called("bell-slash").of(Color.DEEP_ORANGE)), mute != null ? "Yes" : "No");
|
||||
if (mute != null) {
|
||||
addPunishment(inspectContainer, mute, "Permanent mute");
|
||||
}
|
||||
|
||||
inspectContainer.addValue(getWithIcon("Warnings", Icon.called("flag").of(Color.YELLOW)), warnings);
|
||||
|
||||
if (ban != null) {
|
||||
String operator = ban.getOperator();
|
||||
String link = Html.LINK.parse(PlanAPI.getInstance().getPlayerInspectPageLink(operator), operator);
|
||||
String reason = HtmlUtils.swapColorsToSpan(ban.getReason());
|
||||
long start = ban.getStart();
|
||||
String end = FormatUtils.formatTimeStampYear(ban.getEnd());
|
||||
|
||||
if (ban.getType() == PunishmentType.BAN || ban.getType() == PunishmentType.IP_BAN) { // Permanent
|
||||
end = "Permanent ban";
|
||||
}
|
||||
|
||||
if (operator.equals("CONSOLE")) {
|
||||
link = "CONSOLE";
|
||||
}
|
||||
|
||||
inspectContainer.addValue(" " + getWithIcon("Operator", Icon.called("user").of(Color.RED)), link);
|
||||
inspectContainer.addValue(" " + getWithIcon("Date", Icon.called("calendar").of(Color.RED).of(Family.REGULAR)), FormatUtils.formatTimeStampYear(start));
|
||||
inspectContainer.addValue(" " + getWithIcon("Ends", Icon.called("calendar-check").of(Color.RED).of(Family.REGULAR)), end);
|
||||
inspectContainer.addValue(" " + getWithIcon("Reason", Icon.called("comment").of(Color.RED).of(Family.REGULAR)), reason);
|
||||
}
|
||||
|
||||
if (mute != null) {
|
||||
String operator = mute.getOperator();
|
||||
String link = Html.LINK.parse(PlanAPI.getInstance().getPlayerInspectPageLink(operator), operator);
|
||||
String reason = HtmlUtils.swapColorsToSpan(mute.getReason());
|
||||
long start = mute.getStart();
|
||||
String end = FormatUtils.formatTimeStampYear(mute.getEnd());
|
||||
|
||||
if (mute.getType() == PunishmentType.MUTE) { // Permanent
|
||||
end = "Permanent mute";
|
||||
}
|
||||
|
||||
if (operator.equals("CONSOLE")) {
|
||||
link = "CONSOLE";
|
||||
}
|
||||
|
||||
inspectContainer.addValue(" " + getWithIcon("Operator", Icon.called("user").of(Color.DEEP_ORANGE)), link);
|
||||
inspectContainer.addValue(" " + getWithIcon("Date", Icon.called("calendar").of(Color.DEEP_ORANGE).of(Family.REGULAR)), FormatUtils.formatTimeStampYear(start));
|
||||
inspectContainer.addValue(" " + getWithIcon("Ends", Icon.called("calendar-check").of(Color.DEEP_ORANGE).of(Family.REGULAR)), end);
|
||||
inspectContainer.addValue(" " + getWithIcon("Reason", Icon.called("comment").of(Color.DEEP_ORANGE).of(Family.REGULAR)), reason);
|
||||
}
|
||||
|
||||
return inspectContainer;
|
||||
}
|
||||
|
||||
private void addPunishment(InspectContainer inspectContainer, Punishment punishment, String identifier) {
|
||||
String operator = punishment.getOperator();
|
||||
String link = Html.LINK.parse(PlanAPI.getInstance().getPlayerInspectPageLink(operator), operator);
|
||||
String reason = HtmlUtils.swapColorsToSpan(punishment.getReason());
|
||||
String start = FormatUtils.formatTimeStampYear(punishment.getStart());
|
||||
String end = FormatUtils.formatTimeStampYear(punishment.getEnd());
|
||||
|
||||
PunishmentType type = punishment.getType();
|
||||
// Permanent
|
||||
if (type == PunishmentType.BAN
|
||||
|| type == PunishmentType.IP_BAN
|
||||
|| type == PunishmentType.MUTE
|
||||
) {
|
||||
end = identifier;
|
||||
}
|
||||
|
||||
if (operator.equals("CONSOLE")) {
|
||||
link = "CONSOLE";
|
||||
}
|
||||
|
||||
inspectContainer.addValue(" " + getWithIcon("Operator", Icon.called("user").of(Color.RED)), link);
|
||||
inspectContainer.addValue(" " + getWithIcon("Date", Icon.called("calendar").of(Color.RED).of(Family.REGULAR)), start);
|
||||
inspectContainer.addValue(" " + getWithIcon("Ends", Icon.called("calendar-check").of(Color.RED).of(Family.REGULAR)), end);
|
||||
inspectContainer.addValue(" " + getWithIcon("Reason", Icon.called("comment").of(Color.RED).of(Family.REGULAR)), reason);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnalysisContainer getServerData(Collection<UUID> uuids, AnalysisContainer analysisContainer) {
|
||||
return analysisContainer;
|
||||
|
@ -6,14 +6,18 @@ package com.djrapitops.pluginbridge.plan.askyblock;
|
||||
|
||||
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.graphs.ProgressBar;
|
||||
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.plugin.utilities.Format;
|
||||
import com.wasteofplastic.askyblock.ASkyBlockAPI;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@ -35,7 +39,7 @@ public class ASkyBlockData extends PluginData {
|
||||
public InspectContainer getPlayerData(UUID uuid, InspectContainer inspectContainer) {
|
||||
if (api.hasIsland(uuid)) {
|
||||
String islandName = api.getIslandName(uuid);
|
||||
int level = api.getIslandLevel(uuid);
|
||||
long level = api.getLongIslandLevel(uuid);
|
||||
int resetsLeft = api.getResetsLeft(uuid);
|
||||
|
||||
inspectContainer.addValue(getWithIcon("Island Name", Icon.called("street-view").of(Color.GREEN)), islandName);
|
||||
@ -45,9 +49,39 @@ public class ASkyBlockData extends PluginData {
|
||||
inspectContainer.addValue(getWithIcon("Island Name", Icon.called("street-view").of(Color.GREEN)), "No Island");
|
||||
}
|
||||
|
||||
Map<String, Integer> challengeCompletion = api.getChallengeTimes(uuid);
|
||||
int obtained = (int) challengeCompletion.values().stream().filter(value -> value != 0).count();
|
||||
int max = challengeCompletion.size();
|
||||
|
||||
inspectContainer.addValue(getWithIcon("Challenge Progress", Icon.called("bookmark").of(Color.LIGHT_BLUE)), obtained + " / " + max);
|
||||
ProgressBar challengeProgress = new ProgressBar(obtained, max, "light-blue");
|
||||
inspectContainer.addHtml("challenge-progress", challengeProgress.toHtml());
|
||||
|
||||
addTable(inspectContainer, challengeCompletion);
|
||||
|
||||
return inspectContainer;
|
||||
}
|
||||
|
||||
private void addTable(InspectContainer inspectContainer, Map<String, Integer> challengeCompletion) {
|
||||
TableContainer challenges = new TableContainer(
|
||||
getWithIcon("Challenge", Icon.called("bookmark")),
|
||||
getWithIcon("Times completed", Icon.called("check"))
|
||||
);
|
||||
challenges.setColor("light-blue");
|
||||
challengeCompletion.entrySet().stream()
|
||||
.sorted((one, two) -> Integer.compare(two.getValue(), one.getValue()))
|
||||
.forEach(entry -> {
|
||||
String challenge = new Format(entry.getKey()).capitalize().toString();
|
||||
Integer completionTimes = entry.getValue();
|
||||
boolean complete = completionTimes > 0;
|
||||
challenges.addRow(
|
||||
"<span" + (complete ? " class=\"col-green\"" : "") + ">" + challenge + "</span>",
|
||||
completionTimes
|
||||
);
|
||||
});
|
||||
inspectContainer.addTable("challenge-table", challenges);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnalysisContainer getServerData(Collection<UUID> uuids, AnalysisContainer analysisContainer) {
|
||||
int islandCount = api.getIslandCount();
|
||||
|
@ -5,6 +5,7 @@ import com.djrapitops.plan.system.settings.Settings;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import com.djrapitops.pluginbridge.plan.Hook;
|
||||
import litebans.api.Database;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
/**
|
||||
* A Class responsible for hooking to LiteBans and registering data
|
||||
@ -13,7 +14,7 @@ import litebans.api.Database;
|
||||
* @author Rsl1122
|
||||
* @since 3.5.0
|
||||
*/
|
||||
public class LiteBansHook extends Hook {
|
||||
public class LiteBansBukkitHook extends Hook {
|
||||
|
||||
/**
|
||||
* Hooks the plugin and registers it's PluginData objects.
|
||||
@ -24,7 +25,7 @@ public class LiteBansHook extends Hook {
|
||||
* @throws NoClassDefFoundError when the plugin class can not be found.
|
||||
*/
|
||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||
public LiteBansHook(HookHandler hookH) {
|
||||
public LiteBansBukkitHook(HookHandler hookH) {
|
||||
super(hookH);
|
||||
try {
|
||||
Database.get();
|
||||
@ -39,7 +40,8 @@ public class LiteBansHook extends Hook {
|
||||
|
||||
public void hook() throws NoClassDefFoundError {
|
||||
if (enabled) {
|
||||
LiteBansDatabaseQueries db = new LiteBansDatabaseQueries();
|
||||
String tablePrefix = Bukkit.getPluginManager().getPlugin("LiteBans").getConfig().getString("sql.table_prefix");
|
||||
LiteBansDatabaseQueries db = new LiteBansDatabaseQueries(tablePrefix);
|
||||
addPluginDataSource(new LiteBansData(db));
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package com.djrapitops.pluginbridge.plan.litebans;
|
||||
|
||||
import com.djrapitops.plan.data.plugin.HookHandler;
|
||||
import com.djrapitops.plan.system.settings.Settings;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import com.djrapitops.pluginbridge.plan.Hook;
|
||||
import litebans.api.Database;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.config.Configuration;
|
||||
import net.md_5.bungee.config.ConfigurationProvider;
|
||||
import net.md_5.bungee.config.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* A Class responsible for hooking to LiteBans and registering data
|
||||
* sources.
|
||||
*
|
||||
* @author Rsl1122
|
||||
* @since 3.5.0
|
||||
*/
|
||||
public class LiteBansBungeeHook extends Hook {
|
||||
|
||||
/**
|
||||
* Hooks the plugin and registers it's PluginData objects.
|
||||
* <p>
|
||||
* API#addPluginDataSource uses the same method from HookHandler.
|
||||
*
|
||||
* @param hookH HookHandler instance for registering the data sources.
|
||||
* @throws NoClassDefFoundError when the plugin class can not be found.
|
||||
*/
|
||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||
public LiteBansBungeeHook(HookHandler hookH) {
|
||||
super(hookH);
|
||||
try {
|
||||
Database.get();
|
||||
enabled = true;
|
||||
} catch (NoClassDefFoundError | NoSuchFieldError | NoSuchMethodError | Exception e) {
|
||||
if (Settings.DEV_MODE.isTrue()) {
|
||||
Log.toLog(this.getClass(), e);
|
||||
}
|
||||
enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void hook() throws NoClassDefFoundError {
|
||||
if (enabled) {
|
||||
LiteBansDatabaseQueries db = new LiteBansDatabaseQueries(getTablePrefix());
|
||||
addPluginDataSource(new LiteBansData(db));
|
||||
}
|
||||
}
|
||||
|
||||
private String getTablePrefix() {
|
||||
String tablePrefix = "libeans_";
|
||||
try {
|
||||
File litebansDataFolder = ProxyServer.getInstance().getPluginManager().getPlugin("LiteBans").getDataFolder();
|
||||
File configFile = new File(litebansDataFolder, "config.yml");
|
||||
|
||||
Configuration configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(configFile);
|
||||
tablePrefix = configuration.getString("sql.table_prefix");
|
||||
} catch (NullPointerException | IOException e) {
|
||||
Logger.getLogger("Plan").log(Level.WARNING, "Could not get Litebans table prefix, using default (litebans_). " + e.toString());
|
||||
}
|
||||
return tablePrefix;
|
||||
}
|
||||
}
|
@ -44,7 +44,7 @@ public class LiteBansData extends PluginData implements BanData {
|
||||
public InspectContainer getPlayerData(UUID uuid, InspectContainer inspectContainer) {
|
||||
|
||||
inspectContainer.addValue(Icon.called("balance-scale").of(Color.RED) +
|
||||
"Hover over 'What' column entry for offence reasons", "");
|
||||
" 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"));
|
||||
|
@ -5,7 +5,6 @@ import com.djrapitops.plan.system.database.databases.sql.processing.QueryAllStat
|
||||
import com.djrapitops.plan.system.database.databases.sql.processing.QueryStatement;
|
||||
import com.djrapitops.plan.system.database.databases.sql.tables.Table;
|
||||
import litebans.api.Database;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
@ -30,10 +29,9 @@ public class LiteBansDatabaseQueries extends Table {
|
||||
|
||||
private final String selectSQL;
|
||||
|
||||
public LiteBansDatabaseQueries() {
|
||||
public LiteBansDatabaseQueries(String tablePrefix) {
|
||||
super("litebans", null);
|
||||
database = Database.get();
|
||||
String tablePrefix = Bukkit.getPluginManager().getPlugin("LiteBans").getConfig().getString("sql.table_prefix");
|
||||
banTable = tablePrefix + "bans";
|
||||
mutesTable = tablePrefix + "mutes";
|
||||
warningsTable = tablePrefix + "warnings";
|
||||
|
@ -7,8 +7,8 @@ import com.djrapitops.plugin.task.AbsRunnable;
|
||||
import com.volmit.react.React;
|
||||
import com.volmit.react.api.GraphSampleLine;
|
||||
import com.volmit.react.api.SampledType;
|
||||
import com.volmit.react.util.GMap;
|
||||
import com.volmit.react.util.M;
|
||||
import com.volmit.react.volume.lang.collections.GMap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
|
@ -24,11 +24,11 @@ import java.util.UUID;
|
||||
* @author Rsl1122
|
||||
* @since 3.5.0
|
||||
*/
|
||||
public class PlayerVersionListener implements Listener {
|
||||
public class BukkitPlayerVersionListener implements Listener {
|
||||
|
||||
private ViaAPI viaAPI;
|
||||
|
||||
public PlayerVersionListener(ViaAPI viaAPI) {
|
||||
public BukkitPlayerVersionListener(ViaAPI viaAPI) {
|
||||
this.viaAPI = viaAPI;
|
||||
}
|
||||
|
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.djrapitops.pluginbridge.plan.viaversion;
|
||||
|
||||
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
||||
import com.djrapitops.plan.system.database.databases.Database;
|
||||
import com.djrapitops.plan.system.database.databases.sql.SQLDB;
|
||||
import com.djrapitops.plan.system.processing.Processing;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import net.md_5.bungee.api.event.PostLoginEvent;
|
||||
import net.md_5.bungee.api.plugin.Listener;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
import us.myles.ViaVersion.api.ViaAPI;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Class responsible for listening join events for Version protocol.
|
||||
*
|
||||
* @author Rsl1122
|
||||
* @since 3.5.0
|
||||
*/
|
||||
public class BungeePlayerVersionListener implements Listener {
|
||||
|
||||
private ViaAPI viaAPI;
|
||||
|
||||
public BungeePlayerVersionListener(ViaAPI viaAPI) {
|
||||
this.viaAPI = viaAPI;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(PostLoginEvent event) {
|
||||
UUID uuid = event.getPlayer().getUniqueId();
|
||||
int playerVersion = viaAPI.getPlayerVersion(uuid);
|
||||
Processing.submitNonCritical(() -> {
|
||||
try {
|
||||
new ProtocolTable((SQLDB) Database.getActive()).saveProtocolVersion(uuid, playerVersion);
|
||||
} catch (DBOpException e) {
|
||||
Log.toLog(this.getClass(), e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -25,6 +25,8 @@ public class Protocol {
|
||||
*/
|
||||
public static String getMCVersion(int protocolVersion) {
|
||||
switch (protocolVersion) {
|
||||
case 401:
|
||||
return "1.13.1";
|
||||
case 390:
|
||||
case 391:
|
||||
case 392:
|
||||
|
@ -16,7 +16,7 @@ import us.myles.ViaVersion.api.ViaAPI;
|
||||
* @author Rsl1122
|
||||
* @since 3.1.0
|
||||
*/
|
||||
public class ViaVersionHook extends Hook {
|
||||
public class ViaVersionBukkitHook extends Hook {
|
||||
|
||||
/**
|
||||
* Hooks the plugin and registers it's PluginData objects.
|
||||
@ -25,7 +25,7 @@ public class ViaVersionHook extends Hook {
|
||||
*
|
||||
* @param hookH HookHandler instance for registering the data sources.
|
||||
*/
|
||||
public ViaVersionHook(HookHandler hookH) {
|
||||
public ViaVersionBukkitHook(HookHandler hookH) {
|
||||
super("us.myles.ViaVersion.ViaVersionPlugin", hookH);
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ public class ViaVersionHook extends Hook {
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
return;
|
||||
}
|
||||
plan.registerListener(new PlayerVersionListener(api));
|
||||
plan.registerListener(new BukkitPlayerVersionListener(api));
|
||||
addPluginDataSource(new ViaVersionData(table));
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package com.djrapitops.pluginbridge.plan.viaversion;
|
||||
|
||||
import com.djrapitops.plan.PlanBungee;
|
||||
import com.djrapitops.plan.api.exceptions.database.DBException;
|
||||
import com.djrapitops.plan.data.plugin.HookHandler;
|
||||
import com.djrapitops.plan.system.database.databases.Database;
|
||||
import com.djrapitops.plan.system.database.databases.sql.SQLDB;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import com.djrapitops.pluginbridge.plan.Hook;
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
import us.myles.ViaVersion.api.ViaAPI;
|
||||
|
||||
/**
|
||||
* A Class responsible for hooking to ViaVersion and registering data sources.
|
||||
*
|
||||
* @author Rsl1122
|
||||
* @since 3.1.0
|
||||
*/
|
||||
public class ViaVersionBungeeHook extends Hook {
|
||||
|
||||
/**
|
||||
* Hooks the plugin and registers it's PluginData objects.
|
||||
* <p>
|
||||
* API#addPluginDataSource uses the same method from HookHandler.
|
||||
*
|
||||
* @param hookH HookHandler instance for registering the data sources.
|
||||
*/
|
||||
public ViaVersionBungeeHook(HookHandler hookH) {
|
||||
super("us.myles.ViaVersion.BungeePlugin", hookH);
|
||||
}
|
||||
|
||||
public void hook() throws NoClassDefFoundError {
|
||||
if (!enabled) {
|
||||
return;
|
||||
}
|
||||
PlanBungee plan = PlanBungee.getInstance();
|
||||
ViaAPI api = Via.getAPI();
|
||||
ProtocolTable table = new ProtocolTable((SQLDB) Database.getActive());
|
||||
try {
|
||||
table.createTable();
|
||||
} catch (DBException e) {
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
return;
|
||||
}
|
||||
plan.registerListener(new BungeePlayerVersionListener(api));
|
||||
addPluginDataSource(new ViaVersionData(table));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user