mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-09 04:11:50 +01:00
Litebans PluginData no longer uses hardcoded table prefix (#480)
This commit is contained in:
parent
f9883473f5
commit
f0efc39c83
@ -2,6 +2,7 @@ package com.djrapitops.pluginbridge.plan.litebans;
|
|||||||
|
|
||||||
import com.djrapitops.plan.system.database.databases.sql.tables.Table;
|
import com.djrapitops.plan.system.database.databases.sql.tables.Table;
|
||||||
import litebans.api.Database;
|
import litebans.api.Database;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@ -18,17 +19,20 @@ import java.util.UUID;
|
|||||||
*/
|
*/
|
||||||
public class LiteBansDatabaseQueries extends Table {
|
public class LiteBansDatabaseQueries extends Table {
|
||||||
private final Database database;
|
private final Database database;
|
||||||
|
private String litebansTable;
|
||||||
|
|
||||||
public LiteBansDatabaseQueries() {
|
public LiteBansDatabaseQueries() {
|
||||||
super("litebans", null);
|
super("litebans", null);
|
||||||
database = Database.get();
|
database = Database.get();
|
||||||
|
String tablePrefix = Bukkit.getPluginManager().getPlugin("LiteBans").getConfig().getString("sql.table_prefix");
|
||||||
|
litebansTable = tablePrefix + "bans";
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<BanObject> getBans() throws SQLException {
|
public List<BanObject> getBans() throws SQLException {
|
||||||
PreparedStatement statement = null;
|
PreparedStatement statement = null;
|
||||||
ResultSet set = null;
|
ResultSet set = null;
|
||||||
try {
|
try {
|
||||||
statement = database.prepareStatement("SELECT uuid, reason, banned_by_name, until FROM litebans_bans");
|
statement = database.prepareStatement("SELECT uuid, reason, banned_by_name, until FROM " + litebansTable);
|
||||||
set = statement.executeQuery();
|
set = statement.executeQuery();
|
||||||
return getBanObjects(set);
|
return getBanObjects(set);
|
||||||
} finally {
|
} finally {
|
||||||
@ -59,7 +63,7 @@ public class LiteBansDatabaseQueries extends Table {
|
|||||||
PreparedStatement statement = null;
|
PreparedStatement statement = null;
|
||||||
ResultSet set = null;
|
ResultSet set = null;
|
||||||
try {
|
try {
|
||||||
statement = database.prepareStatement("SELECT uuid, reason, banned_by_name, until FROM litebans_bans WHERE uuid=?");
|
statement = database.prepareStatement("SELECT uuid, reason, banned_by_name, until FROM " + litebansTable + " WHERE uuid=?");
|
||||||
statement.setString(1, playerUUID.toString());
|
statement.setString(1, playerUUID.toString());
|
||||||
set = statement.executeQuery();
|
set = statement.executeQuery();
|
||||||
return getBanObjects(set);
|
return getBanObjects(set);
|
||||||
|
Loading…
Reference in New Issue
Block a user