Skip to content

Commit

Permalink
[Merge] Version 4.6.2 (#909)
Browse files Browse the repository at this point in the history
  • Loading branch information
AuroraLS3 authored Feb 4, 2019
2 parents e6a57f0 + 9321f2f commit 9b08037
Show file tree
Hide file tree
Showing 17 changed files with 50 additions and 57 deletions.
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/'
12 changes: 6 additions & 6 deletions Plan/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ allprojects {
wrapper.gradleVersion = "5.0"

group "com.djrapitops"
version "4.6.1-SNAPSHOT"
version "4.6.2-SNAPSHOT"

test {
testLogging {
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private void addServerBoxes() {
"<h2><i class=\"col-light-green fa fa-servers\"></i> No Servers</h2>" +
"</div><div class=\"body\">" +
"<p>No Bukkit/Sponge servers connected to Plan.</p>" +
"</div></div></div></div>");
"</div></div></div></div></div></div>");
}
return serverBoxes.toString();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public boolean hasBeenApplied() {

// 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) {
Expand All @@ -59,6 +59,10 @@ public Boolean processResults(ResultSet set) throws SQLException {

@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<Integer, Integer> sessionIDServerIDRelation = db.getSessionsTable().getIDServerIDRelation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public void prepare(PreparedStatement statement) throws SQLException {

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, " +
Expand All @@ -188,7 +188,7 @@ public WorldTimes getWorldTimesOfServer(UUID serverUUID) {
" 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<WorldTimes>(sql, 1000) {
@Override
Expand All @@ -202,7 +202,7 @@ public WorldTimes processResults(ResultSet set) throws SQLException {

WorldTimes worldTimes = new WorldTimes(new HashMap<>());
while (set.next()) {
String worldName = set.getString("world_name");
String worldName = set.getString("world");

Map<String, Long> gmMap = new HashMap<>();
gmMap.put(gms[0], set.getLong("survival"));
Expand All @@ -220,7 +220,7 @@ public WorldTimes processResults(ResultSet set) throws SQLException {

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, " +
Expand All @@ -230,7 +230,7 @@ public WorldTimes getWorldTimesOfUser(UUID uuid) {
" 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<WorldTimes>(sql) {
@Override
Expand All @@ -244,7 +244,7 @@ public WorldTimes processResults(ResultSet set) throws SQLException {

WorldTimes worldTimes = new WorldTimes(new HashMap<>());
while (set.next()) {
String worldName = set.getString("world_name");
String worldName = set.getString("world");

Map<String, Long> gmMap = new HashMap<>();
gmMap.put(gms[0], set.getLong("survival"));
Expand All @@ -262,7 +262,7 @@ public WorldTimes processResults(ResultSet set) throws SQLException {

public Map<Integer, WorldTimes> 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 + ", " +
Expand All @@ -282,7 +282,7 @@ public Map<Integer, WorldTimes> processResults(ResultSet set) throws SQLExceptio
while (set.next()) {
int sessionID = set.getInt(Col.SESSION_ID.get());

String worldName = set.getString("world_name");
String worldName = set.getString("world");

Map<String, Long> gmMap = new HashMap<>();
gmMap.put(gms[0], set.getLong(Col.SURVIVAL.get()));
Expand Down
2 changes: 1 addition & 1 deletion Plan/common/src/main/resources/bungee.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Plan
author: Rsl1122
main: com.djrapitops.plan.PlanBungee
version: 4.6.1
version: 4.6.2
softdepend:
- AdvancedBan
- LiteBans
Expand Down
2 changes: 1 addition & 1 deletion Plan/common/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Plan
author: Rsl1122
main: com.djrapitops.plan.Plan
version: 4.6.1
version: 4.6.2
softdepend:
- EssentialsX
- Towny
Expand Down
1 change: 1 addition & 0 deletions Plan/common/src/main/resources/web/network.html
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,7 @@ <h2><i class="col-green fa fa-globe"></i> Geolocations</h2>
if (slideIndex < 0) {
slideIndex = max
}
window.scrollTo(0, 0);
window.sessionStorage.setItem("NetworkSlideIndex", slideIndex);
var value = slideIndex * percent;
x.style.transition = "0.5s";
Expand Down
1 change: 1 addition & 0 deletions Plan/common/src/main/resources/web/player.html
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,7 @@ <h2><i class="col-red fa fa-skull"></i> Player caused Deaths</h2>
if (slideIndex < 0) {
slideIndex = max
}
window.scrollTo(0, 0);
window.sessionStorage.setItem("InspectSlideIndex", slideIndex);
var value = slideIndex * percent;
x.style.transition = "0.5s";
Expand Down
1 change: 1 addition & 0 deletions Plan/common/src/main/resources/web/players.html
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ <h2><i class="fa fa-users"></i> Player List</h2>
if (slideIndex < 0) {
slideIndex = max
}
window.scrollTo(0, 0);
window.sessionStorage.setItem("AnalysisSlideIndex", slideIndex);
var value = slideIndex * percent;
x.style.transition = "0.5s";
Expand Down
1 change: 1 addition & 0 deletions Plan/common/src/main/resources/web/server.html
Original file line number Diff line number Diff line change
Expand Up @@ -1542,6 +1542,7 @@ <h2><i class="col-lime fa fa-terminal"></i> Command Usage</h2>
if (slideIndex < 0) {
slideIndex = max
}
window.scrollTo(0, 0);
window.sessionStorage.setItem("AnalysisSlideIndex", slideIndex);
var value = slideIndex * percent;
x.style.transition = "0.5s";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
@Plugin(
id = "plan",
name = "Plan",
version = "4.6.1",
version = "4.6.2",
description = "Player Analytics Plugin by Rsl1122",
authors = {"Rsl1122"},
dependencies = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
@Plugin(
id = "plan",
name = "Plan",
version = "4.6.1",
version = "4.6.2",
description = "Player Analytics Plugin by Rsl1122",
authors = {"Rsl1122"}
)
Expand Down
13 changes: 10 additions & 3 deletions PlanPluginBridge/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.djrapitops</groupId>
<artifactId>PlanPluginBridge</artifactId>
<version>4.6.1</version>
<version>4.6.2</version>
<packaging>jar</packaging>

<name>${project.groupId}:${project.artifactId}</name>
Expand Down Expand Up @@ -95,7 +95,7 @@
<dependency>
<groupId>com.djrapitops</groupId>
<artifactId>Plan-plugin</artifactId>
<version>4.5.0-SNAPSHOT</version>
<version>4.6.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -132,6 +132,13 @@
<type>jar</type>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.google.dagger</groupId>
<artifactId>dagger</artifactId>
<version>2.20</version>
</dependency>

<!-- Plugins from repositories -->

<dependency>
Expand Down Expand Up @@ -315,7 +322,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.2</version>
<version>0.8.3</version>
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
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.
Expand Down Expand Up @@ -54,8 +52,7 @@ public LiteBansBukkitHook(

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));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,9 @@
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
Expand Down Expand Up @@ -60,22 +52,8 @@ public LiteBansBungeeHook(

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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 ";
}

Expand Down

0 comments on commit 9b08037

Please sign in to comment.