diff --git a/.travis.yml b/.travis.yml index c1a7bf55d..dc93c9817 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,10 +26,13 @@ jobs: - stage: "System Tests" name: "Test environment setup" script: bash scripts/prepareServerJars.sh +before_cache: + - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock + - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ cache: directories: - '$HOME/.m2/repository' - '$HOME/.sonar/cache' - - '$HOME/.gradle' - - '.gradle' + - '$HOME/.gradle/caches/' + - '$HOME/.gradle/wrapper/' - '$HOME/servers/' diff --git a/Plan/build.gradle b/Plan/build.gradle index af3475c85..e51a12805 100644 --- a/Plan/build.gradle +++ b/Plan/build.gradle @@ -12,7 +12,7 @@ allprojects { wrapper.gradleVersion = "5.0" group "com.djrapitops" - version "4.6.1-SNAPSHOT" + version "4.6.2-SNAPSHOT" test { testLogging { @@ -46,7 +46,7 @@ subprojects { ext.daggerCompilerVersion = "2.21" ext.abstractPluginFrameworkVersion = "3.4.1" - ext.planPluginBridgeVersion = "4.6.1" + ext.planPluginBridgeVersion = "4.6.2" ext.bukkitVersion = "1.12.2-R0.1-SNAPSHOT" ext.spigotVersion = "1.12.2-R0.1-SNAPSHOT" @@ -56,7 +56,7 @@ subprojects { ext.velocityVersion = "1.0-SNAPSHOT" ext.redisBungeeVersion = "0.3.8-SNAPSHOT" - ext.httpClientVersion = "4.5.6" + ext.httpClientVersion = "4.5.7" ext.commonsTextVersion = "1.6" ext.htmlCompressorVersion = "1.5.2" ext.caffeineVersion = "2.6.2" @@ -107,14 +107,14 @@ subprojects { testCompile "org.junit.vintage:junit-vintage-engine:5.3.2" // JUnit 4 compatibility for JUnit 5 testCompile "org.junit.jupiter:junit-jupiter-params:5.3.2" // JUnit 5, parameterized tests testCompile "org.junit-pioneer:junit-pioneer:0.3.0" // TempDirectory TODO REMOVE W/ JUNIT 5.4 - testCompile "org.mockito:mockito-core:2.23.4" // Mockito Core - testCompile "org.mockito:mockito-junit-jupiter:2.23.4" // Mockito JUnit 5 Extension + testCompile "org.mockito:mockito-core:2.24.0" // Mockito Core + testCompile "org.mockito:mockito-junit-jupiter:2.24.0" // Mockito JUnit 5 Extension testCompile "org.seleniumhq.selenium:selenium-java:3.141.59" // Selenium (Browser tests) testCompile "com.jayway.awaitility:awaitility:1.7.0" // Awaitility (Concurrent wait conditions) // Testing dependencies required by Plan testCompile "org.xerial:sqlite-jdbc:3.25.2" // SQLite - testCompile "mysql:mysql-connector-java:8.0.13" // MySQL + testCompile "mysql:mysql-connector-java:8.0.15" // MySQL } diff --git a/Plan/common/src/main/java/com/djrapitops/plan/data/store/containers/NetworkContainer.java b/Plan/common/src/main/java/com/djrapitops/plan/data/store/containers/NetworkContainer.java index 5d04f8b22..47e6e7b66 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/data/store/containers/NetworkContainer.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/data/store/containers/NetworkContainer.java @@ -126,7 +126,7 @@ public class NetworkContainer extends DataContainer { "

No Servers

" + "
" + "

No Bukkit/Sponge servers connected to Plan.

" + - "
"); + ""); } return serverBoxes.toString(); }); diff --git a/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/KillsServerIDPatch.java b/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/KillsServerIDPatch.java index 7d4b6eb5e..fde15b077 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/KillsServerIDPatch.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/KillsServerIDPatch.java @@ -39,7 +39,7 @@ public class KillsServerIDPatch extends Patch { // KillsOptimizationPatch makes this patch incompatible with newer patch versions. return hasColumn(tableName, KillsTable.Col.SERVER_UUID.get()) - || hasColumn(tableName, columnName) && allValuesHaveServerID(tableName, columnName); + || (hasColumn(tableName, columnName) && allValuesHaveServerID(tableName, columnName)); } private Boolean allValuesHaveServerID(String tableName, String columnName) { @@ -59,6 +59,10 @@ public class KillsServerIDPatch extends Patch { @Override protected void applyPatch() { + if (hasColumn(KillsTable.TABLE_NAME, KillsTable.Col.SERVER_UUID.get())) { + return; + } + addColumn(KillsTable.TABLE_NAME, "server_id integer NOT NULL DEFAULT 0"); Map sessionIDServerIDRelation = db.getSessionsTable().getIDServerIDRelation(); diff --git a/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/WorldTimesTable.java b/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/WorldTimesTable.java index ef3e3bb59..bff0ee16e 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/WorldTimesTable.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/WorldTimesTable.java @@ -178,7 +178,7 @@ public class WorldTimesTable extends UserUUIDTable { public WorldTimes getWorldTimesOfServer(UUID serverUUID) { String worldIDColumn = worldTable + "." + WorldTable.Col.ID; - String worldNameColumn = worldTable + "." + WorldTable.Col.NAME + " as world_name"; + String worldNameColumn = worldTable + "." + WorldTable.Col.NAME + " as world"; String sql = "SELECT " + "SUM(" + Col.SURVIVAL + ") as survival, " + "SUM(" + Col.CREATIVE + ") as creative, " + @@ -188,7 +188,7 @@ public class WorldTimesTable extends UserUUIDTable { " FROM " + tableName + " INNER JOIN " + worldTable + " on " + worldIDColumn + "=" + Col.WORLD_ID + " WHERE " + tableName + "." + Col.SERVER_UUID + "=?" + - " GROUP BY " + Col.WORLD_ID; + " GROUP BY world"; return query(new QueryStatement(sql, 1000) { @Override @@ -202,7 +202,7 @@ public class WorldTimesTable extends UserUUIDTable { WorldTimes worldTimes = new WorldTimes(new HashMap<>()); while (set.next()) { - String worldName = set.getString("world_name"); + String worldName = set.getString("world"); Map gmMap = new HashMap<>(); gmMap.put(gms[0], set.getLong("survival")); @@ -220,7 +220,7 @@ public class WorldTimesTable extends UserUUIDTable { public WorldTimes getWorldTimesOfUser(UUID uuid) { String worldIDColumn = worldTable + "." + WorldTable.Col.ID; - String worldNameColumn = worldTable + "." + WorldTable.Col.NAME + " as world_name"; + String worldNameColumn = worldTable + "." + WorldTable.Col.NAME + " as world"; String sql = "SELECT " + "SUM(" + Col.SURVIVAL + ") as survival, " + "SUM(" + Col.CREATIVE + ") as creative, " + @@ -230,7 +230,7 @@ public class WorldTimesTable extends UserUUIDTable { " FROM " + tableName + " INNER JOIN " + worldTable + " on " + worldIDColumn + "=" + Col.WORLD_ID + " WHERE " + Col.UUID + "=?" + - " GROUP BY " + Col.WORLD_ID; + " GROUP BY world"; return query(new QueryStatement(sql) { @Override @@ -244,7 +244,7 @@ public class WorldTimesTable extends UserUUIDTable { WorldTimes worldTimes = new WorldTimes(new HashMap<>()); while (set.next()) { - String worldName = set.getString("world_name"); + String worldName = set.getString("world"); Map gmMap = new HashMap<>(); gmMap.put(gms[0], set.getLong("survival")); @@ -262,7 +262,7 @@ public class WorldTimesTable extends UserUUIDTable { public Map getAllWorldTimesBySessionID() { String worldIDColumn = worldTable + "." + WorldTable.Col.ID; - String worldNameColumn = worldTable + "." + WorldTable.Col.NAME + " as world_name"; + String worldNameColumn = worldTable + "." + WorldTable.Col.NAME + " as world"; String sql = "SELECT " + Col.SESSION_ID + ", " + Col.SURVIVAL + ", " + @@ -282,7 +282,7 @@ public class WorldTimesTable extends UserUUIDTable { while (set.next()) { int sessionID = set.getInt(Col.SESSION_ID.get()); - String worldName = set.getString("world_name"); + String worldName = set.getString("world"); Map gmMap = new HashMap<>(); gmMap.put(gms[0], set.getLong(Col.SURVIVAL.get())); diff --git a/Plan/common/src/main/resources/bungee.yml b/Plan/common/src/main/resources/bungee.yml index 99b1766a3..d1943a60b 100644 --- a/Plan/common/src/main/resources/bungee.yml +++ b/Plan/common/src/main/resources/bungee.yml @@ -1,7 +1,7 @@ name: Plan author: Rsl1122 main: com.djrapitops.plan.PlanBungee -version: 4.6.1 +version: 4.6.2 softdepend: - AdvancedBan - LiteBans diff --git a/Plan/common/src/main/resources/plugin.yml b/Plan/common/src/main/resources/plugin.yml index 8b58da689..d5fb1762d 100644 --- a/Plan/common/src/main/resources/plugin.yml +++ b/Plan/common/src/main/resources/plugin.yml @@ -1,7 +1,7 @@ name: Plan author: Rsl1122 main: com.djrapitops.plan.Plan -version: 4.6.1 +version: 4.6.2 softdepend: - EssentialsX - Towny diff --git a/Plan/common/src/main/resources/web/network.html b/Plan/common/src/main/resources/web/network.html index 4fe271323..ca241fd42 100644 --- a/Plan/common/src/main/resources/web/network.html +++ b/Plan/common/src/main/resources/web/network.html @@ -637,6 +637,7 @@ if (slideIndex < 0) { slideIndex = max } + window.scrollTo(0, 0); window.sessionStorage.setItem("NetworkSlideIndex", slideIndex); var value = slideIndex * percent; x.style.transition = "0.5s"; diff --git a/Plan/common/src/main/resources/web/player.html b/Plan/common/src/main/resources/web/player.html index 134b989fd..d9ce81df8 100644 --- a/Plan/common/src/main/resources/web/player.html +++ b/Plan/common/src/main/resources/web/player.html @@ -910,6 +910,7 @@ if (slideIndex < 0) { slideIndex = max } + window.scrollTo(0, 0); window.sessionStorage.setItem("InspectSlideIndex", slideIndex); var value = slideIndex * percent; x.style.transition = "0.5s"; diff --git a/Plan/common/src/main/resources/web/players.html b/Plan/common/src/main/resources/web/players.html index ab35092c1..a074636f0 100644 --- a/Plan/common/src/main/resources/web/players.html +++ b/Plan/common/src/main/resources/web/players.html @@ -331,6 +331,7 @@ if (slideIndex < 0) { slideIndex = max } + window.scrollTo(0, 0); window.sessionStorage.setItem("AnalysisSlideIndex", slideIndex); var value = slideIndex * percent; x.style.transition = "0.5s"; diff --git a/Plan/common/src/main/resources/web/server.html b/Plan/common/src/main/resources/web/server.html index c98fcec6c..f1265210b 100644 --- a/Plan/common/src/main/resources/web/server.html +++ b/Plan/common/src/main/resources/web/server.html @@ -1542,6 +1542,7 @@ if (slideIndex < 0) { slideIndex = max } + window.scrollTo(0, 0); window.sessionStorage.setItem("AnalysisSlideIndex", slideIndex); var value = slideIndex * percent; x.style.transition = "0.5s"; diff --git a/Plan/sponge/src/main/java/com/djrapitops/plan/PlanSponge.java b/Plan/sponge/src/main/java/com/djrapitops/plan/PlanSponge.java index a57ae380e..0560b94f4 100644 --- a/Plan/sponge/src/main/java/com/djrapitops/plan/PlanSponge.java +++ b/Plan/sponge/src/main/java/com/djrapitops/plan/PlanSponge.java @@ -42,7 +42,7 @@ import java.io.InputStream; @Plugin( id = "plan", name = "Plan", - version = "4.6.1", + version = "4.6.2", description = "Player Analytics Plugin by Rsl1122", authors = {"Rsl1122"}, dependencies = { diff --git a/Plan/velocity/src/main/java/com/djrapitops/plan/PlanVelocity.java b/Plan/velocity/src/main/java/com/djrapitops/plan/PlanVelocity.java index 92ca95fed..0b591bfc4 100644 --- a/Plan/velocity/src/main/java/com/djrapitops/plan/PlanVelocity.java +++ b/Plan/velocity/src/main/java/com/djrapitops/plan/PlanVelocity.java @@ -46,7 +46,7 @@ import java.nio.file.Path; @Plugin( id = "plan", name = "Plan", - version = "4.6.1", + version = "4.6.2", description = "Player Analytics Plugin by Rsl1122", authors = {"Rsl1122"} ) diff --git a/PlanPluginBridge/pom.xml b/PlanPluginBridge/pom.xml index 0065390e3..1a84ccfe7 100644 --- a/PlanPluginBridge/pom.xml +++ b/PlanPluginBridge/pom.xml @@ -4,7 +4,7 @@ 4.0.0 com.djrapitops PlanPluginBridge - 4.6.1 + 4.6.2 jar ${project.groupId}:${project.artifactId} @@ -95,7 +95,7 @@ com.djrapitops Plan-plugin - 4.5.0-SNAPSHOT + 4.6.1-SNAPSHOT provided @@ -132,6 +132,13 @@ jar provided + + + com.google.dagger + dagger + 2.20 + + @@ -315,7 +322,7 @@ org.jacoco jacoco-maven-plugin - 0.8.2 + 0.8.3 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 index f20b8b60c..bc656e065 100644 --- a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansBukkitHook.java +++ b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansBukkitHook.java @@ -25,8 +25,6 @@ import litebans.api.Database; import javax.inject.Inject; import javax.inject.Singleton; -import static github.scarsz.discordsrv.util.PluginUtil.getPlugin; - /** * A Class responsible for hooking to LiteBans and registering data * sources. @@ -54,8 +52,7 @@ public class LiteBansBukkitHook extends Hook { public void hook(HookHandler handler) throws NoClassDefFoundError { if (enabled) { - String tablePrefix = getPlugin("LiteBans").getConfig().getString("sql.table_prefix"); - LiteBansDatabaseQueries db = new LiteBansDatabaseQueries(tablePrefix); + 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 index 03715e19a..57952985f 100644 --- a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansBungeeHook.java +++ b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansBungeeHook.java @@ -21,17 +21,9 @@ 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 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 javax.inject.Inject; import javax.inject.Singleton; -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 @@ -60,22 +52,8 @@ public class LiteBansBungeeHook extends Hook { public void hook(HookHandler handler) throws NoClassDefFoundError { if (enabled) { - LiteBansDatabaseQueries db = new LiteBansDatabaseQueries(getTablePrefix()); + LiteBansDatabaseQueries db = new LiteBansDatabaseQueries(); handler.addPluginDataSource(new LiteBansData(db, timestampFormatter)); } } - - 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; - } } 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 index 1885c5334..15cb950bd 100644 --- a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansDatabaseQueries.java +++ b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansDatabaseQueries.java @@ -45,13 +45,13 @@ public class LiteBansDatabaseQueries extends Table { private final String selectSQL; - public LiteBansDatabaseQueries(String tablePrefix) { + public LiteBansDatabaseQueries() { super("litebans", null); database = Database.get(); - banTable = tablePrefix + "bans"; - mutesTable = tablePrefix + "mutes"; - warningsTable = tablePrefix + "warnings"; - kicksTable = tablePrefix + "kicks"; + banTable = "{bans}"; + mutesTable = "{mutes}"; + warningsTable = "{warnings}"; + kicksTable = "{kicks}"; selectSQL = "SELECT uuid, reason, banned_by_name, until, active, time FROM "; }