[Merge] Version 4.8.8 (#1112)

This commit is contained in:
Risto Lahtela 2019-07-25 11:44:43 +03:00 committed by GitHub
commit 88c3b07356
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
38 changed files with 83 additions and 437 deletions

View File

@ -9,7 +9,7 @@ addons:
token:
secure: "bTqGEUlfpVGgXgwC9UiIwYN+LsUtXFHTbWkAjnNJcCKTLDvHzUfDzY8/M7YIpIlcS7EWggNgJhskkg/WBglESx/0KcVl4NukMgbylqvp7y1F7eOkYLuriWBpuwMaSCHTWjmyq1iWNJ26i569PETbKiS+sNYnx9lPIpXI4ph0M9EKK3nQpTLr1aeVHi+XilJu6UNY7whipoW1fEwn02s2SvIXUMJN1fS0tmUjMavlOnlxt0lCU/oayMVG7vFKE2wWDJ5Ucd6lLGLPA1at4ypy6nJVcl8Bn547qoXBoIyMbtAhpcLUzkkFLK8BxuSsQ5neK71GLlmbiU+bIU5dpfRgsS3XLOXSSgide0ly/Za4zQVUBfu36F5xJOFGGdALGfMBhWdCzW1j0oDcINauUhjK/VB9v8M8qpxBCV6Q570FH2CQdNotfUWvHHGVZf1+yqXnC5iUcIh4cuxNCrOgp3uql8cpLGtMfqScV4l7GkcYGXLZlLUhGPK5K8UhwPym31CJU8If6ExMiKttxvpCtcGsXx2bRl7gRl3+xdjlY0PzIfbBbgYY6uu5v6cK8RHxp/+sLsBDfPtVvRZnnOVACLUFzTRSr6nP0Cm8rr+91S3rTmf4Qug+IN32xMDVcs6Sm68v/KTn2QoA2XyXOMLbIR39/0ani00xCd3FPF9Ae115YHg="
jdk:
- oraclejdk8
- openjdk8
services:
- mysql

View File

@ -12,7 +12,7 @@ allprojects {
wrapper.gradleVersion = "5.0"
group "com.djrapitops"
version "4.8.7"
version "4.8.8"
test {
useJUnitPlatform()
@ -47,7 +47,7 @@ subprojects {
ext.daggerCompilerVersion = "2.23.2"
ext.abstractPluginFrameworkVersion = "3.4.1"
ext.planPluginBridgeVersion = "4.8.7-R0.1"
ext.planPluginBridgeVersion = "4.8.8-R0.2"
ext.bukkitVersion = "1.12.2-R0.1-SNAPSHOT"
ext.spigotVersion = "1.12.2-R0.1-SNAPSHOT"
@ -62,7 +62,7 @@ subprojects {
ext.htmlCompressorVersion = "1.5.2"
ext.caffeineVersion = "2.7.0"
ext.h2Version = "1.4.199"
ext.mysqlVersion = "8.0.16"
ext.mysqlVersion = "8.0.17"
ext.hikariVersion = "3.3.1"
ext.slf4jVersion = "1.7.26"
ext.geoIpVersion = "2.12.0"
@ -104,10 +104,10 @@ subprojects {
testAnnotationProcessor "com.google.dagger:dagger-compiler:$daggerCompilerVersion"
// Test Tooling Dependencies
testCompile "org.junit.jupiter:junit-jupiter-engine:5.5.0" // JUnit 5
testCompile "org.junit.platform:junit-platform-runner:1.5.0" // JUnit 4 runner for JUnit 5 tests
testCompile "org.junit.vintage:junit-vintage-engine:5.5.0" // JUnit 4 compatibility for JUnit 5
testCompile "org.junit.jupiter:junit-jupiter-params:5.5.0" // JUnit 5, parameterized tests
testCompile "org.junit.jupiter:junit-jupiter-engine:5.5.1" // JUnit 5
testCompile "org.junit.platform:junit-platform-runner:1.5.1" // JUnit 4 runner for JUnit 5 tests
testCompile "org.junit.vintage:junit-vintage-engine:5.5.1" // JUnit 4 compatibility for JUnit 5
testCompile "org.junit.jupiter:junit-jupiter-params:5.5.1" // JUnit 5, parameterized tests
testCompile "org.mockito:mockito-core:3.0.0" // Mockito Core
testCompile "org.mockito:mockito-junit-jupiter:3.0.0" // Mockito JUnit 5 Extension
testCompile "org.seleniumhq.selenium:selenium-java:3.141.59" // Selenium (Browser tests)

View File

@ -50,6 +50,10 @@ public interface PlanAPI {
}
}
/**
* @deprecated PluginData API has been deprecated - see https://github.com/plan-player-analytics/Plan/wiki/APIv5---DataExtension-API for new API.
*/
@Deprecated
void addPluginDataSource(PluginData pluginData);
String getPlayerInspectPageLink(UUID uuid);

View File

@ -77,27 +77,33 @@ public class ManageMoveCommand extends CommandNode {
Verify.isTrue(args.length >= 2,
() -> new IllegalArgumentException(locale.getString(CommandLang.FAIL_REQ_ARGS, 2, Arrays.toString(this.getArguments()))));
String fromDB = args[0].toLowerCase();
boolean isCorrectDB = DBType.exists(fromDB);
Verify.isTrue(isCorrectDB,
() -> new IllegalArgumentException(locale.getString(ManageLang.FAIL_INCORRECT_DB, fromDB)));
DBType fromDB = DBType.getForName(args[0])
.orElseThrow(() -> new IllegalArgumentException(locale.getString(ManageLang.FAIL_INCORRECT_DB, args[0])));
String toDB = args[1].toLowerCase();
isCorrectDB = DBType.exists(toDB);
Verify.isTrue(isCorrectDB,
() -> new IllegalArgumentException(locale.getString(ManageLang.FAIL_INCORRECT_DB, toDB)));
DBType toDB = DBType.getForName(args[1])
.orElseThrow(() -> new IllegalArgumentException(locale.getString(ManageLang.FAIL_INCORRECT_DB, args[1])));
Verify.isFalse(fromDB.equalsIgnoreCase(toDB),
Verify.isFalse(fromDB == toDB,
() -> new IllegalArgumentException(locale.getString(ManageLang.FAIL_SAME_DB)));
if (!Verify.contains("-a", args)) {
sender.sendMessage(locale.getString(ManageLang.CONFIRMATION, locale.getString(ManageLang.CONFIRM_OVERWRITE, toDB)));
sender.sendMessage(locale.getString(ManageLang.CONFIRMATION, locale.getString(ManageLang.CONFIRM_OVERWRITE, toDB.getConfigName())));
return;
}
// Temporarily disabled due to issues
boolean transferH2 = fromDB == DBType.H2 || toDB == DBType.H2;
boolean transferMySQL = fromDB == DBType.MYSQL || toDB == DBType.MYSQL;
if (transferH2 && transferMySQL) {
sender.sendMessage("§cDirect transfers between H2 and MySQL are temporarily disabled due to a bug: See the issue link for workaround");
sender.sendLink("Link to Github Issue", "https://github.com/plan-player-analytics/Plan/issues/1111");
return;
}
try {
final Database fromDatabase = dbSystem.getActiveDatabaseByName(fromDB);
final Database toDatabase = dbSystem.getActiveDatabaseByName(toDB);
final Database fromDatabase = dbSystem.getActiveDatabaseByType(fromDB);
final Database toDatabase = dbSystem.getActiveDatabaseByType(toDB);
fromDatabase.init();
toDatabase.init();

View File

@ -38,7 +38,9 @@ import java.util.UUID;
* @author Rsl1122
* @see TableContainer
* @see InspectContainer
* @deprecated PluginData API has been deprecated - see https://github.com/plan-player-analytics/Plan/wiki/APIv5---DataExtension-API for new API.
*/
@Deprecated
public final class AnalysisContainer extends InspectContainer {
private Map<String, Map<UUID, ? extends Serializable>> playerTableValues;

View File

@ -35,7 +35,9 @@ import java.util.TreeMap;
*
* @author Rsl1122
* @see TableContainer
* @deprecated PluginData API has been deprecated - see https://github.com/plan-player-analytics/Plan/wiki/APIv5---DataExtension-API for new API.
*/
@Deprecated
public class InspectContainer {
protected List<String> values;

View File

@ -29,7 +29,9 @@ import java.util.List;
* Container used for parsing Html tables.
*
* @author Rsl1122
* @deprecated PluginData API has been deprecated - see https://github.com/plan-player-analytics/Plan/wiki/APIv5---DataExtension-API for new API.
*/
@Deprecated
public class TableContainer {
protected final String[] header;

View File

@ -23,8 +23,7 @@ import java.util.UUID;
* Interface for PluginData objects that affect Ban state of players.
*
* @author Rsl1122
* @deprecated New implementations should not be created as better plugin data integration is
* being created.
* @deprecated PluginData API has been deprecated - see https://github.com/plan-player-analytics/Plan/wiki/APIv5---DataExtension-API for new API.
*/
@Deprecated
public interface BanData {

View File

@ -20,7 +20,9 @@ package com.djrapitops.plan.data.plugin;
* Enum class for PluginData to estimate the required width of the contained items.
*
* @author Rsl1122
* @deprecated PluginData API has been deprecated - see https://github.com/plan-player-analytics/Plan/wiki/APIv5---DataExtension-API for new API.
*/
@Deprecated
public enum ContainerSize {
THIRD,
TWO_THIRDS,

View File

@ -34,7 +34,9 @@ import java.util.UUID;
* to register objects extending this class.
*
* @author Rsl1122
* @deprecated PluginData API has been deprecated - see https://github.com/plan-player-analytics/Plan/wiki/APIv5---DataExtension-API for new API.
*/
@Deprecated
public abstract class PluginData {
private final ContainerSize size;

View File

@ -37,6 +37,7 @@ public class PluginsConfigSection {
this.config = config;
}
@Deprecated
public boolean hasSection(PluginData dataSource) {
return hasSection(dataSource.getSourcePlugin());
}
@ -51,6 +52,7 @@ public class PluginsConfigSection {
.orElse(config.addNode("Plugins"));
}
@Deprecated
public void createSection(PluginData dataSource) throws IOException {
createSection(dataSource.getSourcePlugin());
}
@ -63,6 +65,7 @@ public class PluginsConfigSection {
section.save();
}
@Deprecated
public boolean isEnabled(PluginData dataSource) {
return isEnabled(dataSource.getSourcePlugin());
}

View File

@ -81,7 +81,6 @@ public enum DBType {
return Optional.of(dbType);
}
}
return Optional.empty();
}

View File

@ -121,7 +121,7 @@ public class IPAnonPatch extends Patch {
") SELECT " +
identifiers + ", ip, geolocation, MAX(last_used) FROM plan_ips_temp GROUP BY ip, " +
(hasUserIdColumn ? userIdColumn : "uuid") +
", geolocation");
", geolocation, id");
dropTable(tempTableName);
}

View File

@ -162,8 +162,9 @@ public class GeolocationCache implements SubSystem {
CountryResponse response = reader.country(inetAddress);
Country country = response.getCountry();
String countryName = country.getName();
return country.getName();
return countryName != null ? countryName : "Not Known";
}
} catch (IOException | GeoIp2Exception e) {

View File

@ -18,6 +18,7 @@ package com.djrapitops.plan.system.database;
import com.djrapitops.plan.api.exceptions.EnableException;
import com.djrapitops.plan.api.exceptions.database.DBInitException;
import com.djrapitops.plan.db.DBType;
import com.djrapitops.plan.db.Database;
import com.djrapitops.plan.db.H2DB;
import com.djrapitops.plan.db.SQLiteDB;
@ -27,7 +28,6 @@ import com.djrapitops.plan.system.locale.lang.PluginLang;
import com.djrapitops.plugin.benchmarking.Timings;
import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.djrapitops.plugin.utilities.Verify;
import javax.inject.Singleton;
import java.util.HashSet;
@ -69,13 +69,18 @@ public abstract class DBSystem implements SubSystem {
}
public Database getActiveDatabaseByName(String dbName) {
return DBType.getForName(dbName)
.map(this::getActiveDatabaseByType)
.orElseThrow(() -> new IllegalArgumentException(locale.getString(PluginLang.ENABLE_FAIL_WRONG_DB, dbName)));
}
public Database getActiveDatabaseByType(DBType type) {
for (Database database : getDatabases()) {
String dbConfigName = database.getType().getConfigName();
if (Verify.equalsIgnoreCase(dbName, dbConfigName)) {
if (database.getType() == type) {
return database;
}
}
throw new IllegalArgumentException(locale.getString(PluginLang.ENABLE_FAIL_WRONG_DB, dbName));
throw new IllegalArgumentException(locale.getString(PluginLang.ENABLE_FAIL_WRONG_DB, type != null ? type.getName() : "null"));
}
public Set<Database> getDatabases() {

View File

@ -106,6 +106,7 @@ public class InfoRequestFactory {
);
}
@Deprecated
public CacheRequest cacheInspectPluginsTabRequest(UUID uuid, String nav, String html) {
return new CacheInspectPluginsTabRequest(uuid, nav, html);
}
@ -118,6 +119,7 @@ public class InfoRequestFactory {
return new GenerateInspectPageRequest(uuid, this, responseFactory.get(), pageFactory.get(), infoSystem.get());
}
@Deprecated
public GenerateInspectPluginsTabRequest generateInspectPluginsTabRequest(UUID uuid) {
return new GenerateInspectPluginsTabRequest(uuid, infoSystem.get(), this, pageFactory.get());
}

View File

@ -22,7 +22,9 @@ import com.djrapitops.plan.data.store.containers.ServerContainer;
* Raw Data JSON response for a Server.
*
* @author Rsl1122
* @deprecated Marked for removal in 5.0.0
*/
@Deprecated
public class RawServerDataResponse extends RawDataResponse {
public RawServerDataResponse(ServerContainer serverContainer) {

View File

@ -33,7 +33,7 @@ import java.util.*;
* <p>
* Extends Response so that it can be stored in ResponseCache.
*
* @deprecated Marked for removal when the connection system will be removed.
* @deprecated PluginData API has been deprecated - see https://github.com/plan-player-analytics/Plan/wiki/APIv5---DataExtension-API for new API.
* @author Rsl1122
*/
@Deprecated

View File

@ -25,6 +25,7 @@ import java.util.Comparator;
*
* @author Rsl1122
*/
@Deprecated
public class PluginDataNameComparator implements Comparator<PluginData> {
@Override

View File

@ -50,6 +50,7 @@ public class HtmlStructure {
return builder.toString();
}
@Deprecated
public static String[] createInspectPageTabContentCalculating() {
String tab = "<div class=\"tab\">" +
"<div class=\"row clearfix\">" +

View File

@ -37,8 +37,10 @@ import java.util.*;
* Creates Plugin section contents for Analysis page.
*
* @author Rsl1122
* @deprecated PluginData API has been deprecated - see https://github.com/plan-player-analytics/Plan/wiki/APIv5---DataExtension-API for new API.
*/
@Singleton
@Deprecated
public class AnalysisPluginsTabContentCreator {
private final HookHandler hookHandler;

View File

@ -25,7 +25,7 @@ Plugin:
# Supported databases: SQLite, H2, MySQL
# -----------------------------------------------------
Database:
Type: H2
Type: SQLite
MySQL:
Host: localhost
Port: 3306

View File

@ -1,7 +1,7 @@
name: Plan
author: Rsl1122
main: com.djrapitops.plan.PlanBungee
version: 4.8.7
version: 4.8.8
softdepend:
- AdvancedBan
- LiteBans

View File

@ -1,7 +1,7 @@
name: Plan
author: Rsl1122
main: com.djrapitops.plan.Plan
version: 4.8.7
version: 4.8.8
softdepend:
- ASkyBlock
- AdvancedAchievements

View File

@ -15,6 +15,7 @@ dependencies {
compile 'com.djrapitops:Extension-Nucleus:1.9.2-R0.2'
compile "com.djrapitops:Extension-RedProtect:7.5.6-R0.2"
compile "com.djrapitops:Extension-Sponge-Economy:7.1.0-R0.3"
compile "com.djrapitops:Extension-SuperbVote:0.5.4-R0.1"
compile "com.djrapitops:Extension-Vault:1.7-R0.2"
}

View File

@ -56,6 +56,7 @@ public class ExtensionRegister {
new NucleusExtensionFactory().createExtension().ifPresent(extensionService::register);
new RedProtectExtensionFactory().createExtension().ifPresent(extensionService::register);
new SpongeEconomyExtensionFactory().createExtension().ifPresent(extensionService::register);
new SuperbVoteExtensionFactory().createExtension().ifPresent(extensionService::register);
new VaultExtensionFactory().createExtension().ifPresent(extensionService::register);
}

View File

@ -42,7 +42,7 @@ import java.io.InputStream;
@Plugin(
id = "plan",
name = "Plan",
version = "4.8.7",
version = "4.8.8",
description = "Player Analytics Plugin by Rsl1122",
authors = {"Rsl1122"},
dependencies = {

View File

@ -46,7 +46,7 @@ import java.nio.file.Path;
@Plugin(
id = "plan",
name = "Plan",
version = "4.8.7",
version = "4.8.8",
description = "Player Analytics Plugin by Rsl1122",
authors = {"Rsl1122"}
)

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.djrapitops</groupId>
<artifactId>PlanPluginBridge</artifactId>
<version>4.8.7-R0.1</version>
<version>4.8.8-R0.2</version>
<packaging>jar</packaging>
<name>${project.groupId}:${project.artifactId}</name>
@ -75,7 +75,7 @@
<dependency>
<groupId>com.djrapitops</groupId>
<artifactId>Plan-plugin</artifactId>
<version>4.7.0-SNAPSHOT</version>
<version>4.8.7</version>
<scope>provided</scope>
</dependency>
<dependency>
@ -145,7 +145,7 @@
<dependency>
<groupId>me.konsolas</groupId>
<artifactId>AAC</artifactId>
<version>3.5.0</version>
<version>4.0.0-b1</version>
<scope>provided</scope>
</dependency>
<dependency>
@ -163,19 +163,13 @@
<dependency>
<groupId>com.gamingmesh</groupId>
<artifactId>jobs</artifactId>
<version>4.7.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.kingdoms</groupId>
<artifactId>kingdoms_demo</artifactId>
<version>13.3.40</version>
<version>4.13.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>litebans</groupId>
<artifactId>api</artifactId>
<version>0.3</version>
<version>0.3.1</version>
<scope>provided</scope>
</dependency>
<dependency>
@ -187,13 +181,7 @@
<dependency>
<groupId>com.volmit</groupId>
<artifactId>react</artifactId>
<version>6.573</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.minimum</groupId>
<artifactId>minecraft.superbvote</artifactId>
<version>0.5.3</version>
<version>6.612</version>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -22,11 +22,9 @@ import com.djrapitops.pluginbridge.plan.aac.AdvancedAntiCheatHook;
import com.djrapitops.pluginbridge.plan.buycraft.BuyCraftHook;
import com.djrapitops.pluginbridge.plan.factions.FactionsHook;
import com.djrapitops.pluginbridge.plan.jobs.JobsHook;
import com.djrapitops.pluginbridge.plan.kingdoms.KingdomsHook;
import com.djrapitops.pluginbridge.plan.litebans.LiteBansBukkitHook;
import com.djrapitops.pluginbridge.plan.luckperms.LuckPermsHook;
import com.djrapitops.pluginbridge.plan.protocolsupport.ProtocolSupportHook;
import com.djrapitops.pluginbridge.plan.superbvote.SuperbVoteHook;
import com.djrapitops.pluginbridge.plan.towny.TownyHook;
import com.djrapitops.pluginbridge.plan.viaversion.ViaVersionBukkitHook;
@ -45,11 +43,9 @@ public class BukkitBridge extends AbstractBridge {
private final BuyCraftHook buyCraftHook;
private final FactionsHook factionsHook;
private final JobsHook jobsHook;
private final KingdomsHook kingdomsHook;
private final LiteBansBukkitHook liteBansHook;
private final LuckPermsHook luckPermsHook;
private final ProtocolSupportHook protocolSupportHook;
private final SuperbVoteHook superbVoteHook;
private final ProtocolSupportHook protocolSupportHook;
private final TownyHook townyHook;
private final ViaVersionBukkitHook viaVersionHook;
@ -62,11 +58,9 @@ private final ProtocolSupportHook protocolSupportHook;
BuyCraftHook buyCraftHook,
FactionsHook factionsHook,
JobsHook jobsHook,
KingdomsHook kingdomsHook,
LiteBansBukkitHook liteBansHook,
LuckPermsHook luckPermsHook,
ProtocolSupportHook protocolSupportHook,
SuperbVoteHook superbVoteHook,
TownyHook townyHook,
ViaVersionBukkitHook viaVersionHook
) {
@ -75,11 +69,9 @@ private final ProtocolSupportHook protocolSupportHook;
this.buyCraftHook = buyCraftHook;
this.factionsHook = factionsHook;
this.jobsHook = jobsHook;
this.kingdomsHook = kingdomsHook;
this.liteBansHook = liteBansHook;
this.luckPermsHook = luckPermsHook;
this.protocolSupportHook = protocolSupportHook;
this.superbVoteHook = superbVoteHook;
this.townyHook = townyHook;
this.viaVersionHook = viaVersionHook;
}
@ -91,11 +83,9 @@ private final ProtocolSupportHook protocolSupportHook;
buyCraftHook,
factionsHook,
jobsHook,
kingdomsHook,
liteBansHook,
luckPermsHook,
protocolSupportHook,
superbVoteHook,
townyHook,
viaVersionHook
};

View File

@ -51,7 +51,8 @@ public class PlayerHackKickListener implements Listener {
HackType hackType = event.getHackType();
String hackTypeName = hackType.getName();
long time = System.currentTimeMillis();
int violations = AACAPIProvider.getAPI().getViolationLevel(player, hackType);
int violations = new AACAPIProvider().getAPI().getViolationLevel(player, hackType);
HackObject hackObject = new HackObject(uuid, time, hackTypeName, violations);

View File

@ -41,7 +41,7 @@ public class FactionsHook extends Hook {
PlanConfig config,
Formatters formatters
) {
super("com.massivecraft.factions.Factions");
super("com.massivecraft.factions.entity.MPlayer");
this.config = config;
this.formatters = formatters;
}

View File

@ -1,103 +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 <https://www.gnu.org/licenses/>.
*/
package com.djrapitops.pluginbridge.plan.kingdoms;
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.html.HtmlStructure;
import com.djrapitops.plan.utilities.html.icon.Color;
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 org.kingdoms.constants.kingdom.OfflineKingdom;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
* Utility for creating Kingdoms Accordion Html.
*
* @author Rsl1122
*/
class KingdomsAccordion extends Accordion {
private final Map<String, OfflineKingdom> kingdoms;
private final PlayersMutator playersMutator;
KingdomsAccordion(Map<String, OfflineKingdom> kingdoms, PlayersMutator playersMutator) {
super("kingdoms_accordion");
this.kingdoms = kingdoms;
this.playersMutator = playersMutator;
addElements();
}
private void addElements() {
for (Map.Entry<String, OfflineKingdom> entry : kingdoms.entrySet()) {
String kingdomName = entry.getKey();
OfflineKingdom kingdom = entry.getValue();
String kingName = kingdom.getKingName();
String kingdomLore = kingdom.getKingdomLore();
int might = kingdom.getMight();
int resourcePoints = kingdom.getResourcepoints();
List<UUID> members = kingdom.getMembersList();
int memberCount = members.size();
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 mobKills = memberSessionsMutator.toMobKillCount();
long deaths = memberSessionsMutator.toDeathCount();
String separated = HtmlStructure.separateWithDots(("Members: " + memberCount), kingName);
String htmlID = "kingdom_" + kingdomName.replace(" ", "-");
String leftSide = new AccordionElementContentBuilder()
.addHtml(kingdomLore != null ? "<p>" + kingdomLore + "</p>" : "")
.addRowBold(Icon.called("chess-king").of(Color.AMBER), "King", kingName)
.addRowBold(Icon.called("users").of(Color.AMBER), "Members", memberCount)
.addRowBold(Icon.called("bolt").of(Color.AMBER), "Might", might)
.addRowBold(Icon.called("cubes").of(Color.AMBER), "Resources", resourcePoints)
.toHtml();
String rightSide = new AccordionElementContentBuilder()
.addRowBold(Icons.PLAYER_KILLS, "Player Kills", playerKills)
.addRowBold(Icons.MOB_KILLS, "Mob Kills", mobKills)
.addRowBold(Icons.DEATHS, "Deaths", deaths)
.toHtml();
addElement(new AccordionElement(htmlID, kingdomName + "<span class=\"pull-right\">" + separated + "</span>")
.setColor("amber")
.setLeftSide(leftSide)
.setRightSide(rightSide));
}
}
}

View File

@ -1,102 +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 <https://www.gnu.org/licenses/>.
*/
package com.djrapitops.pluginbridge.plan.kingdoms;
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.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 org.kingdoms.constants.kingdom.OfflineKingdom;
import org.kingdoms.constants.player.OfflineKingdomPlayer;
import org.kingdoms.manager.game.GameManagement;
import java.util.*;
/**
* PluginData for Kingdoms and Kingdoms+ plugins.
*
* @author Rsl1122
*/
class KingdomsData extends PluginData {
KingdomsData() {
super(ContainerSize.TAB, "Kingdoms");
setPluginIcon(Icon.called("crown").of(Color.AMBER).build());
}
@Override
public InspectContainer getPlayerData(UUID uuid, InspectContainer inspectContainer) {
OfflineKingdomPlayer kingdomPlayer = GameManagement.getPlayerManager().getOfflineKingdomPlayer(uuid);
String kingdomName = kingdomPlayer.getKingdomName();
if (kingdomName == null) {
inspectContainer.addValue(getWithIcon("Kingdom", Icon.called("fort-awesome").of(Family.BRAND).of(Color.AMBER)), "No Kingdom");
} else {
OfflineKingdom kingdom = GameManagement.getKingdomManager().getOfflineKingdom(kingdomName);
if (kingdom != null) {
String king = kingdom.getKingName();
String link = Html.LINK.parse(PlanAPI.getInstance().getPlayerInspectPageLink(king), king);
inspectContainer.addValue(getWithIcon("Kingdom", Icon.called("fort-awesome").of(Family.BRAND).of(Color.AMBER)), kingdomName);
inspectContainer.addValue(getWithIcon("King", Icon.called("chess-king").of(Color.AMBER)), link);
}
}
return inspectContainer;
}
@Override
public AnalysisContainer getServerData(Collection<UUID> collection, AnalysisContainer analysisContainer) {
Map<String, OfflineKingdom> kingdoms = GameManagement.getKingdomManager().getKingdomList();
analysisContainer.addValue(getWithIcon("Number of Kingdoms", Icon.called("fort-awesome").of(Family.BRAND).of(Color.AMBER)), kingdoms.size());
if (!kingdoms.isEmpty()) {
KingdomsAccordion kingdomsAccordion = new KingdomsAccordion(
kingdoms,
Optional.ofNullable(analysisData).flatMap(c -> c.getValue(AnalysisKeys.PLAYERS_MUTATOR))
.orElse(new PlayersMutator(new ArrayList<>()))
);
analysisContainer.addHtml("kingdomsAccordion", kingdomsAccordion.toHtml());
Map<UUID, String> userKingDoms = new HashMap<>();
for (Map.Entry<String, OfflineKingdom> entry : kingdoms.entrySet()) {
String kingdomName = entry.getKey();
OfflineKingdom kingdom = entry.getValue();
UUID king = kingdom.getKing();
for (UUID member : kingdom.getMembersList()) {
if (member.equals(king)) {
userKingDoms.put(member, "<b>" + kingdomName + "</b>");
} else {
userKingDoms.put(member, kingdomName);
}
}
}
analysisContainer.addPlayerTableValues(getWithIcon("Kingdom", Icon.called("fort-awesome").of(Family.BRAND)), userKingDoms);
}
return analysisContainer;
}
}

View File

@ -1,44 +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 <https://www.gnu.org/licenses/>.
*/
package com.djrapitops.pluginbridge.plan.kingdoms;
import com.djrapitops.plan.data.plugin.HookHandler;
import com.djrapitops.pluginbridge.plan.Hook;
import javax.inject.Inject;
import javax.inject.Singleton;
/**
* Hook for Kingdoms and Kingdoms+ plugins.
*
* @author Rsl1122
*/
@Singleton
public class KingdomsHook extends Hook {
@Inject
public KingdomsHook() {
super("org.kingdoms.main.Kingdoms");
}
@Override
public void hook(HookHandler handler) throws NoClassDefFoundError {
if (enabled) {
handler.addPluginDataSource(new KingdomsData());
}
}
}

View File

@ -22,7 +22,7 @@ import com.volmit.react.React;
import com.volmit.react.api.GraphSampleLine;
import com.volmit.react.api.SampledType;
import com.volmit.react.util.M;
import com.volmit.react.volume.lang.collections.GMap;
import primal.lang.collection.GMap;
import java.util.ArrayList;
import java.util.EnumMap;

View File

@ -1,71 +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 <https://www.gnu.org/licenses/>.
*/
package com.djrapitops.pluginbridge.plan.superbvote;
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.utilities.html.icon.Color;
import com.djrapitops.plan.utilities.html.icon.Icon;
import io.minimum.minecraft.superbvote.storage.VoteStorage;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
/**
* PluginData for SuperbVote plugin;
*
* @author Rsl1122
*/
class SuperbVoteData extends PluginData {
private final VoteStorage store;
SuperbVoteData(VoteStorage store) {
super(ContainerSize.THIRD, "SuperbVote");
setPluginIcon(Icon.called("check").of(Color.TEAL).build());
this.store = store;
}
@Override
public InspectContainer getPlayerData(UUID uuid, InspectContainer inspectContainer) {
int votes = store.getVotes(uuid).getVotes();
inspectContainer.addValue(getWithIcon("Votes", Icon.called("check").of(Color.TEAL)), votes);
return inspectContainer;
}
@Override
public AnalysisContainer getServerData(Collection<UUID> uuids, AnalysisContainer analysisContainer) {
Map<UUID, Integer> votes = new HashMap<>();
long total = 0;
for (UUID uuid : uuids) {
int votesCount = store.getVotes(uuid).getVotes();
votes.put(uuid, votesCount);
total += votesCount;
}
analysisContainer.addValue(getWithIcon("Total Votes", Icon.called("check").of(Color.TEAL)), total);
analysisContainer.addPlayerTableValues(getWithIcon("Votes", Icon.called("check")), votes);
return analysisContainer;
}
}

View File

@ -1,50 +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 <https://www.gnu.org/licenses/>.
*/
package com.djrapitops.pluginbridge.plan.superbvote;
import com.djrapitops.plan.data.plugin.HookHandler;
import com.djrapitops.pluginbridge.plan.Hook;
import io.minimum.minecraft.superbvote.SuperbVote;
import io.minimum.minecraft.superbvote.storage.VoteStorage;
import javax.inject.Inject;
import javax.inject.Singleton;
import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
/**
* A Class responsible for hooking to SuperbVote and registering data
* sources.
*
* @author Rsl1122
*/
@Singleton
public class SuperbVoteHook extends Hook {
@Inject
public SuperbVoteHook() {
super("io.minimum.minecraft.superbvote.SuperbVote");
}
public void hook(HookHandler handler) throws NoClassDefFoundError {
if (enabled) {
VoteStorage store = getPlugin(SuperbVote.class).getVoteStorage();
handler.addPluginDataSource(new SuperbVoteData(store));
}
}
}