mirror of
https://github.com/TotalFreedomMC/TF-PlotSquared.git
synced 2024-12-23 00:15:06 +00:00
Fix SQLite table creation statement and add legacy SQLite uuids as a provider
This commit is contained in:
parent
d19df3b6eb
commit
cc168d5ae9
2 changed files with 11 additions and 4 deletions
|
@ -256,7 +256,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||
impromptuPipeline.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;
|
||||
if (Bukkit.getPluginManager().getPlugin("LuckPerms") != null) {
|
||||
|
@ -288,6 +289,9 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||
impromptuPipeline.registerConsumer(sqLiteUUIDService);
|
||||
backgroundPipeline.registerConsumer(sqLiteUUIDService);
|
||||
|
||||
impromptuPipeline.registerService(legacyUUIDSerivce);
|
||||
backgroundPipeline.registerService(legacyUUIDSerivce);
|
||||
|
||||
// Plugin providers
|
||||
if (luckPermsUUIDService != null) {
|
||||
impromptuPipeline.registerService(luckPermsUUIDService);
|
||||
|
@ -307,6 +311,9 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||
backgroundPipeline.registerService(sqLiteUUIDService);
|
||||
impromptuPipeline.registerConsumer(sqLiteUUIDService);
|
||||
backgroundPipeline.registerConsumer(sqLiteUUIDService);
|
||||
|
||||
impromptuPipeline.registerService(legacyUUIDSerivce);
|
||||
backgroundPipeline.registerService(legacyUUIDSerivce);
|
||||
}
|
||||
|
||||
impromptuPipeline.storeImmediately("*", DBFunc.EVERYONE);
|
||||
|
|
|
@ -49,9 +49,9 @@ public class SQLiteUUIDService implements UUIDService, Consumer<List<UUIDMapping
|
|||
|
||||
private final SQLite sqlite;
|
||||
|
||||
public SQLiteUUIDService() {
|
||||
public SQLiteUUIDService(final String fileName) {
|
||||
this.sqlite =
|
||||
new SQLite(MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), "usercache.db"));
|
||||
new SQLite(MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), fileName));
|
||||
try {
|
||||
this.sqlite.openConnection();
|
||||
} catch (ClassNotFoundException | SQLException e) {
|
||||
|
@ -59,7 +59,7 @@ public class SQLiteUUIDService implements UUIDService, Consumer<List<UUIDMapping
|
|||
}
|
||||
|
||||
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();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
|
|
Loading…
Reference in a new issue