mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-04 23:48:42 +01:00
[Merge] Version 4.6.2 (#909)
This commit is contained in:
commit
9b08037d68
@ -26,10 +26,13 @@ jobs:
|
|||||||
- stage: "System Tests"
|
- stage: "System Tests"
|
||||||
name: "Test environment setup"
|
name: "Test environment setup"
|
||||||
script: bash scripts/prepareServerJars.sh
|
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:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
- '$HOME/.m2/repository'
|
- '$HOME/.m2/repository'
|
||||||
- '$HOME/.sonar/cache'
|
- '$HOME/.sonar/cache'
|
||||||
- '$HOME/.gradle'
|
- '$HOME/.gradle/caches/'
|
||||||
- '.gradle'
|
- '$HOME/.gradle/wrapper/'
|
||||||
- '$HOME/servers/'
|
- '$HOME/servers/'
|
||||||
|
@ -12,7 +12,7 @@ allprojects {
|
|||||||
wrapper.gradleVersion = "5.0"
|
wrapper.gradleVersion = "5.0"
|
||||||
|
|
||||||
group "com.djrapitops"
|
group "com.djrapitops"
|
||||||
version "4.6.1-SNAPSHOT"
|
version "4.6.2-SNAPSHOT"
|
||||||
|
|
||||||
test {
|
test {
|
||||||
testLogging {
|
testLogging {
|
||||||
@ -46,7 +46,7 @@ subprojects {
|
|||||||
ext.daggerCompilerVersion = "2.21"
|
ext.daggerCompilerVersion = "2.21"
|
||||||
|
|
||||||
ext.abstractPluginFrameworkVersion = "3.4.1"
|
ext.abstractPluginFrameworkVersion = "3.4.1"
|
||||||
ext.planPluginBridgeVersion = "4.6.1"
|
ext.planPluginBridgeVersion = "4.6.2"
|
||||||
|
|
||||||
ext.bukkitVersion = "1.12.2-R0.1-SNAPSHOT"
|
ext.bukkitVersion = "1.12.2-R0.1-SNAPSHOT"
|
||||||
ext.spigotVersion = "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.velocityVersion = "1.0-SNAPSHOT"
|
||||||
ext.redisBungeeVersion = "0.3.8-SNAPSHOT"
|
ext.redisBungeeVersion = "0.3.8-SNAPSHOT"
|
||||||
|
|
||||||
ext.httpClientVersion = "4.5.6"
|
ext.httpClientVersion = "4.5.7"
|
||||||
ext.commonsTextVersion = "1.6"
|
ext.commonsTextVersion = "1.6"
|
||||||
ext.htmlCompressorVersion = "1.5.2"
|
ext.htmlCompressorVersion = "1.5.2"
|
||||||
ext.caffeineVersion = "2.6.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.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.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.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-core:2.24.0" // Mockito Core
|
||||||
testCompile "org.mockito:mockito-junit-jupiter:2.23.4" // Mockito JUnit 5 Extension
|
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 "org.seleniumhq.selenium:selenium-java:3.141.59" // Selenium (Browser tests)
|
||||||
testCompile "com.jayway.awaitility:awaitility:1.7.0" // Awaitility (Concurrent wait conditions)
|
testCompile "com.jayway.awaitility:awaitility:1.7.0" // Awaitility (Concurrent wait conditions)
|
||||||
|
|
||||||
// Testing dependencies required by Plan
|
// Testing dependencies required by Plan
|
||||||
testCompile "org.xerial:sqlite-jdbc:3.25.2" // SQLite
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ public class NetworkContainer extends DataContainer {
|
|||||||
"<h2><i class=\"col-light-green fa fa-servers\"></i> No Servers</h2>" +
|
"<h2><i class=\"col-light-green fa fa-servers\"></i> No Servers</h2>" +
|
||||||
"</div><div class=\"body\">" +
|
"</div><div class=\"body\">" +
|
||||||
"<p>No Bukkit/Sponge servers connected to Plan.</p>" +
|
"<p>No Bukkit/Sponge servers connected to Plan.</p>" +
|
||||||
"</div></div></div></div>");
|
"</div></div></div></div></div></div>");
|
||||||
}
|
}
|
||||||
return serverBoxes.toString();
|
return serverBoxes.toString();
|
||||||
});
|
});
|
||||||
|
@ -39,7 +39,7 @@ public class KillsServerIDPatch extends Patch {
|
|||||||
|
|
||||||
// KillsOptimizationPatch makes this patch incompatible with newer patch versions.
|
// KillsOptimizationPatch makes this patch incompatible with newer patch versions.
|
||||||
return hasColumn(tableName, KillsTable.Col.SERVER_UUID.get())
|
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) {
|
private Boolean allValuesHaveServerID(String tableName, String columnName) {
|
||||||
@ -59,6 +59,10 @@ public class KillsServerIDPatch extends Patch {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void applyPatch() {
|
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");
|
addColumn(KillsTable.TABLE_NAME, "server_id integer NOT NULL DEFAULT 0");
|
||||||
|
|
||||||
Map<Integer, Integer> sessionIDServerIDRelation = db.getSessionsTable().getIDServerIDRelation();
|
Map<Integer, Integer> sessionIDServerIDRelation = db.getSessionsTable().getIDServerIDRelation();
|
||||||
|
@ -178,7 +178,7 @@ public class WorldTimesTable extends UserUUIDTable {
|
|||||||
|
|
||||||
public WorldTimes getWorldTimesOfServer(UUID serverUUID) {
|
public WorldTimes getWorldTimesOfServer(UUID serverUUID) {
|
||||||
String worldIDColumn = worldTable + "." + WorldTable.Col.ID;
|
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 " +
|
String sql = "SELECT " +
|
||||||
"SUM(" + Col.SURVIVAL + ") as survival, " +
|
"SUM(" + Col.SURVIVAL + ") as survival, " +
|
||||||
"SUM(" + Col.CREATIVE + ") as creative, " +
|
"SUM(" + Col.CREATIVE + ") as creative, " +
|
||||||
@ -188,7 +188,7 @@ public class WorldTimesTable extends UserUUIDTable {
|
|||||||
" FROM " + tableName +
|
" FROM " + tableName +
|
||||||
" INNER JOIN " + worldTable + " on " + worldIDColumn + "=" + Col.WORLD_ID +
|
" INNER JOIN " + worldTable + " on " + worldIDColumn + "=" + Col.WORLD_ID +
|
||||||
" WHERE " + tableName + "." + Col.SERVER_UUID + "=?" +
|
" WHERE " + tableName + "." + Col.SERVER_UUID + "=?" +
|
||||||
" GROUP BY " + Col.WORLD_ID;
|
" GROUP BY world";
|
||||||
|
|
||||||
return query(new QueryStatement<WorldTimes>(sql, 1000) {
|
return query(new QueryStatement<WorldTimes>(sql, 1000) {
|
||||||
@Override
|
@Override
|
||||||
@ -202,7 +202,7 @@ public class WorldTimesTable extends UserUUIDTable {
|
|||||||
|
|
||||||
WorldTimes worldTimes = new WorldTimes(new HashMap<>());
|
WorldTimes worldTimes = new WorldTimes(new HashMap<>());
|
||||||
while (set.next()) {
|
while (set.next()) {
|
||||||
String worldName = set.getString("world_name");
|
String worldName = set.getString("world");
|
||||||
|
|
||||||
Map<String, Long> gmMap = new HashMap<>();
|
Map<String, Long> gmMap = new HashMap<>();
|
||||||
gmMap.put(gms[0], set.getLong("survival"));
|
gmMap.put(gms[0], set.getLong("survival"));
|
||||||
@ -220,7 +220,7 @@ public class WorldTimesTable extends UserUUIDTable {
|
|||||||
|
|
||||||
public WorldTimes getWorldTimesOfUser(UUID uuid) {
|
public WorldTimes getWorldTimesOfUser(UUID uuid) {
|
||||||
String worldIDColumn = worldTable + "." + WorldTable.Col.ID;
|
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 " +
|
String sql = "SELECT " +
|
||||||
"SUM(" + Col.SURVIVAL + ") as survival, " +
|
"SUM(" + Col.SURVIVAL + ") as survival, " +
|
||||||
"SUM(" + Col.CREATIVE + ") as creative, " +
|
"SUM(" + Col.CREATIVE + ") as creative, " +
|
||||||
@ -230,7 +230,7 @@ public class WorldTimesTable extends UserUUIDTable {
|
|||||||
" FROM " + tableName +
|
" FROM " + tableName +
|
||||||
" INNER JOIN " + worldTable + " on " + worldIDColumn + "=" + Col.WORLD_ID +
|
" INNER JOIN " + worldTable + " on " + worldIDColumn + "=" + Col.WORLD_ID +
|
||||||
" WHERE " + Col.UUID + "=?" +
|
" WHERE " + Col.UUID + "=?" +
|
||||||
" GROUP BY " + Col.WORLD_ID;
|
" GROUP BY world";
|
||||||
|
|
||||||
return query(new QueryStatement<WorldTimes>(sql) {
|
return query(new QueryStatement<WorldTimes>(sql) {
|
||||||
@Override
|
@Override
|
||||||
@ -244,7 +244,7 @@ public class WorldTimesTable extends UserUUIDTable {
|
|||||||
|
|
||||||
WorldTimes worldTimes = new WorldTimes(new HashMap<>());
|
WorldTimes worldTimes = new WorldTimes(new HashMap<>());
|
||||||
while (set.next()) {
|
while (set.next()) {
|
||||||
String worldName = set.getString("world_name");
|
String worldName = set.getString("world");
|
||||||
|
|
||||||
Map<String, Long> gmMap = new HashMap<>();
|
Map<String, Long> gmMap = new HashMap<>();
|
||||||
gmMap.put(gms[0], set.getLong("survival"));
|
gmMap.put(gms[0], set.getLong("survival"));
|
||||||
@ -262,7 +262,7 @@ public class WorldTimesTable extends UserUUIDTable {
|
|||||||
|
|
||||||
public Map<Integer, WorldTimes> getAllWorldTimesBySessionID() {
|
public Map<Integer, WorldTimes> getAllWorldTimesBySessionID() {
|
||||||
String worldIDColumn = worldTable + "." + WorldTable.Col.ID;
|
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 " +
|
String sql = "SELECT " +
|
||||||
Col.SESSION_ID + ", " +
|
Col.SESSION_ID + ", " +
|
||||||
Col.SURVIVAL + ", " +
|
Col.SURVIVAL + ", " +
|
||||||
@ -282,7 +282,7 @@ public class WorldTimesTable extends UserUUIDTable {
|
|||||||
while (set.next()) {
|
while (set.next()) {
|
||||||
int sessionID = set.getInt(Col.SESSION_ID.get());
|
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<>();
|
Map<String, Long> gmMap = new HashMap<>();
|
||||||
gmMap.put(gms[0], set.getLong(Col.SURVIVAL.get()));
|
gmMap.put(gms[0], set.getLong(Col.SURVIVAL.get()));
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
name: Plan
|
name: Plan
|
||||||
author: Rsl1122
|
author: Rsl1122
|
||||||
main: com.djrapitops.plan.PlanBungee
|
main: com.djrapitops.plan.PlanBungee
|
||||||
version: 4.6.1
|
version: 4.6.2
|
||||||
softdepend:
|
softdepend:
|
||||||
- AdvancedBan
|
- AdvancedBan
|
||||||
- LiteBans
|
- LiteBans
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
name: Plan
|
name: Plan
|
||||||
author: Rsl1122
|
author: Rsl1122
|
||||||
main: com.djrapitops.plan.Plan
|
main: com.djrapitops.plan.Plan
|
||||||
version: 4.6.1
|
version: 4.6.2
|
||||||
softdepend:
|
softdepend:
|
||||||
- EssentialsX
|
- EssentialsX
|
||||||
- Towny
|
- Towny
|
||||||
|
@ -637,6 +637,7 @@
|
|||||||
if (slideIndex < 0) {
|
if (slideIndex < 0) {
|
||||||
slideIndex = max
|
slideIndex = max
|
||||||
}
|
}
|
||||||
|
window.scrollTo(0, 0);
|
||||||
window.sessionStorage.setItem("NetworkSlideIndex", slideIndex);
|
window.sessionStorage.setItem("NetworkSlideIndex", slideIndex);
|
||||||
var value = slideIndex * percent;
|
var value = slideIndex * percent;
|
||||||
x.style.transition = "0.5s";
|
x.style.transition = "0.5s";
|
||||||
|
@ -910,6 +910,7 @@
|
|||||||
if (slideIndex < 0) {
|
if (slideIndex < 0) {
|
||||||
slideIndex = max
|
slideIndex = max
|
||||||
}
|
}
|
||||||
|
window.scrollTo(0, 0);
|
||||||
window.sessionStorage.setItem("InspectSlideIndex", slideIndex);
|
window.sessionStorage.setItem("InspectSlideIndex", slideIndex);
|
||||||
var value = slideIndex * percent;
|
var value = slideIndex * percent;
|
||||||
x.style.transition = "0.5s";
|
x.style.transition = "0.5s";
|
||||||
|
@ -331,6 +331,7 @@
|
|||||||
if (slideIndex < 0) {
|
if (slideIndex < 0) {
|
||||||
slideIndex = max
|
slideIndex = max
|
||||||
}
|
}
|
||||||
|
window.scrollTo(0, 0);
|
||||||
window.sessionStorage.setItem("AnalysisSlideIndex", slideIndex);
|
window.sessionStorage.setItem("AnalysisSlideIndex", slideIndex);
|
||||||
var value = slideIndex * percent;
|
var value = slideIndex * percent;
|
||||||
x.style.transition = "0.5s";
|
x.style.transition = "0.5s";
|
||||||
|
@ -1542,6 +1542,7 @@
|
|||||||
if (slideIndex < 0) {
|
if (slideIndex < 0) {
|
||||||
slideIndex = max
|
slideIndex = max
|
||||||
}
|
}
|
||||||
|
window.scrollTo(0, 0);
|
||||||
window.sessionStorage.setItem("AnalysisSlideIndex", slideIndex);
|
window.sessionStorage.setItem("AnalysisSlideIndex", slideIndex);
|
||||||
var value = slideIndex * percent;
|
var value = slideIndex * percent;
|
||||||
x.style.transition = "0.5s";
|
x.style.transition = "0.5s";
|
||||||
|
@ -42,7 +42,7 @@ import java.io.InputStream;
|
|||||||
@Plugin(
|
@Plugin(
|
||||||
id = "plan",
|
id = "plan",
|
||||||
name = "Plan",
|
name = "Plan",
|
||||||
version = "4.6.1",
|
version = "4.6.2",
|
||||||
description = "Player Analytics Plugin by Rsl1122",
|
description = "Player Analytics Plugin by Rsl1122",
|
||||||
authors = {"Rsl1122"},
|
authors = {"Rsl1122"},
|
||||||
dependencies = {
|
dependencies = {
|
||||||
|
@ -46,7 +46,7 @@ import java.nio.file.Path;
|
|||||||
@Plugin(
|
@Plugin(
|
||||||
id = "plan",
|
id = "plan",
|
||||||
name = "Plan",
|
name = "Plan",
|
||||||
version = "4.6.1",
|
version = "4.6.2",
|
||||||
description = "Player Analytics Plugin by Rsl1122",
|
description = "Player Analytics Plugin by Rsl1122",
|
||||||
authors = {"Rsl1122"}
|
authors = {"Rsl1122"}
|
||||||
)
|
)
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.djrapitops</groupId>
|
<groupId>com.djrapitops</groupId>
|
||||||
<artifactId>PlanPluginBridge</artifactId>
|
<artifactId>PlanPluginBridge</artifactId>
|
||||||
<version>4.6.1</version>
|
<version>4.6.2</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>${project.groupId}:${project.artifactId}</name>
|
<name>${project.groupId}:${project.artifactId}</name>
|
||||||
@ -95,7 +95,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.djrapitops</groupId>
|
<groupId>com.djrapitops</groupId>
|
||||||
<artifactId>Plan-plugin</artifactId>
|
<artifactId>Plan-plugin</artifactId>
|
||||||
<version>4.5.0-SNAPSHOT</version>
|
<version>4.6.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -132,6 +132,13 @@
|
|||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.dagger</groupId>
|
||||||
|
<artifactId>dagger</artifactId>
|
||||||
|
<version>2.20</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Plugins from repositories -->
|
<!-- Plugins from repositories -->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -315,7 +322,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.jacoco</groupId>
|
<groupId>org.jacoco</groupId>
|
||||||
<artifactId>jacoco-maven-plugin</artifactId>
|
<artifactId>jacoco-maven-plugin</artifactId>
|
||||||
<version>0.8.2</version>
|
<version>0.8.3</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
@ -25,8 +25,6 @@ import litebans.api.Database;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import static github.scarsz.discordsrv.util.PluginUtil.getPlugin;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Class responsible for hooking to LiteBans and registering data
|
* A Class responsible for hooking to LiteBans and registering data
|
||||||
* sources.
|
* sources.
|
||||||
@ -54,8 +52,7 @@ public class LiteBansBukkitHook extends Hook {
|
|||||||
|
|
||||||
public void hook(HookHandler handler) throws NoClassDefFoundError {
|
public void hook(HookHandler handler) throws NoClassDefFoundError {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
String tablePrefix = getPlugin("LiteBans").getConfig().getString("sql.table_prefix");
|
LiteBansDatabaseQueries db = new LiteBansDatabaseQueries();
|
||||||
LiteBansDatabaseQueries db = new LiteBansDatabaseQueries(tablePrefix);
|
|
||||||
handler.addPluginDataSource(new LiteBansData(db, timestampFormatter));
|
handler.addPluginDataSource(new LiteBansData(db, timestampFormatter));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,17 +21,9 @@ import com.djrapitops.plan.utilities.formatting.Formatter;
|
|||||||
import com.djrapitops.plan.utilities.formatting.Formatters;
|
import com.djrapitops.plan.utilities.formatting.Formatters;
|
||||||
import com.djrapitops.pluginbridge.plan.Hook;
|
import com.djrapitops.pluginbridge.plan.Hook;
|
||||||
import litebans.api.Database;
|
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.Inject;
|
||||||
import javax.inject.Singleton;
|
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
|
* 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 {
|
public void hook(HookHandler handler) throws NoClassDefFoundError {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
LiteBansDatabaseQueries db = new LiteBansDatabaseQueries(getTablePrefix());
|
LiteBansDatabaseQueries db = new LiteBansDatabaseQueries();
|
||||||
handler.addPluginDataSource(new LiteBansData(db, timestampFormatter));
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -45,13 +45,13 @@ public class LiteBansDatabaseQueries extends Table {
|
|||||||
|
|
||||||
private final String selectSQL;
|
private final String selectSQL;
|
||||||
|
|
||||||
public LiteBansDatabaseQueries(String tablePrefix) {
|
public LiteBansDatabaseQueries() {
|
||||||
super("litebans", null);
|
super("litebans", null);
|
||||||
database = Database.get();
|
database = Database.get();
|
||||||
banTable = tablePrefix + "bans";
|
banTable = "{bans}";
|
||||||
mutesTable = tablePrefix + "mutes";
|
mutesTable = "{mutes}";
|
||||||
warningsTable = tablePrefix + "warnings";
|
warningsTable = "{warnings}";
|
||||||
kicksTable = tablePrefix + "kicks";
|
kicksTable = "{kicks}";
|
||||||
selectSQL = "SELECT uuid, reason, banned_by_name, until, active, time FROM ";
|
selectSQL = "SELECT uuid, reason, banned_by_name, until, active, time FROM ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user