mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
Fix SQLite table creation statement and add legacy SQLite uuids as a provider
This commit is contained in:
parent
d19df3b6eb
commit
cc168d5ae9
@ -256,7 +256,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
impromptuPipeline.registerService(offlinePlayerUUIDService);
|
impromptuPipeline.registerService(offlinePlayerUUIDService);
|
||||||
backgroundPipeline.registerService(offlinePlayerUUIDService);
|
backgroundPipeline.registerService(offlinePlayerUUIDService);
|
||||||
|
|
||||||
final SQLiteUUIDService sqLiteUUIDService = new SQLiteUUIDService();
|
final SQLiteUUIDService sqLiteUUIDService = new SQLiteUUIDService("user_cache.db");
|
||||||
|
final SQLiteUUIDService legacyUUIDSerivce = new SQLiteUUIDService("usercache.db");
|
||||||
|
|
||||||
final LuckPermsUUIDService luckPermsUUIDService;
|
final LuckPermsUUIDService luckPermsUUIDService;
|
||||||
if (Bukkit.getPluginManager().getPlugin("LuckPerms") != null) {
|
if (Bukkit.getPluginManager().getPlugin("LuckPerms") != null) {
|
||||||
@ -288,6 +289,9 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
impromptuPipeline.registerConsumer(sqLiteUUIDService);
|
impromptuPipeline.registerConsumer(sqLiteUUIDService);
|
||||||
backgroundPipeline.registerConsumer(sqLiteUUIDService);
|
backgroundPipeline.registerConsumer(sqLiteUUIDService);
|
||||||
|
|
||||||
|
impromptuPipeline.registerService(legacyUUIDSerivce);
|
||||||
|
backgroundPipeline.registerService(legacyUUIDSerivce);
|
||||||
|
|
||||||
// Plugin providers
|
// Plugin providers
|
||||||
if (luckPermsUUIDService != null) {
|
if (luckPermsUUIDService != null) {
|
||||||
impromptuPipeline.registerService(luckPermsUUIDService);
|
impromptuPipeline.registerService(luckPermsUUIDService);
|
||||||
@ -307,6 +311,9 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
backgroundPipeline.registerService(sqLiteUUIDService);
|
backgroundPipeline.registerService(sqLiteUUIDService);
|
||||||
impromptuPipeline.registerConsumer(sqLiteUUIDService);
|
impromptuPipeline.registerConsumer(sqLiteUUIDService);
|
||||||
backgroundPipeline.registerConsumer(sqLiteUUIDService);
|
backgroundPipeline.registerConsumer(sqLiteUUIDService);
|
||||||
|
|
||||||
|
impromptuPipeline.registerService(legacyUUIDSerivce);
|
||||||
|
backgroundPipeline.registerService(legacyUUIDSerivce);
|
||||||
}
|
}
|
||||||
|
|
||||||
impromptuPipeline.storeImmediately("*", DBFunc.EVERYONE);
|
impromptuPipeline.storeImmediately("*", DBFunc.EVERYONE);
|
||||||
|
@ -49,9 +49,9 @@ public class SQLiteUUIDService implements UUIDService, Consumer<List<UUIDMapping
|
|||||||
|
|
||||||
private final SQLite sqlite;
|
private final SQLite sqlite;
|
||||||
|
|
||||||
public SQLiteUUIDService() {
|
public SQLiteUUIDService(final String fileName) {
|
||||||
this.sqlite =
|
this.sqlite =
|
||||||
new SQLite(MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), "usercache.db"));
|
new SQLite(MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), fileName));
|
||||||
try {
|
try {
|
||||||
this.sqlite.openConnection();
|
this.sqlite.openConnection();
|
||||||
} catch (ClassNotFoundException | SQLException e) {
|
} catch (ClassNotFoundException | SQLException e) {
|
||||||
@ -59,7 +59,7 @@ public class SQLiteUUIDService implements UUIDService, Consumer<List<UUIDMapping
|
|||||||
}
|
}
|
||||||
|
|
||||||
try (PreparedStatement stmt = getConnection().prepareStatement(
|
try (PreparedStatement stmt = getConnection().prepareStatement(
|
||||||
"CREATE TABLE IF NOT EXISTS `usercache` (uuid VARCHAR(32) NOT NULL, username VARCHAR(32) NOT NULL, PRIMARY KEY (uuid, username))")) {
|
"CREATE TABLE IF NOT EXISTS `usercache` (uuid VARCHAR(32) NOT NULL, username VARCHAR(32) NOT NULL, PRIMARY KEY (uuid))")) {
|
||||||
stmt.execute();
|
stmt.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
Loading…
Reference in New Issue
Block a user