mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-01-11 19:51:05 +01:00
Fixed offline player UUID cache issue.
This commit is contained in:
parent
1fd8b18d6f
commit
f116b13cc7
@ -834,6 +834,13 @@ import java.util.concurrent.TimeUnit;
|
||||
public static void worldLoad(WorldLoadEvent event) {
|
||||
if (!UUIDHandler.CACHED) {
|
||||
UUIDHandler.cacheAll();
|
||||
if (Bukkit.getServer().getPluginManager().getPlugin("PlotMe") != null) {
|
||||
try {
|
||||
new PlotMeConverter(PlotMain.getMain()).runAsync();
|
||||
} catch (final Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1318,7 +1325,7 @@ import java.util.concurrent.TimeUnit;
|
||||
sendConsoleSenderMessage(C.PREFIX.s() + "MongoDB is not yet implemented");
|
||||
} else if (Settings.DB.USE_SQLITE) {
|
||||
try {
|
||||
connection = new SQLite(this, Settings.DB.SQLITE_DB + ".db").openConnection();
|
||||
connection = new SQLite(this, this.getDataFolder() + File.separator + Settings.DB.SQLITE_DB + ".db").openConnection();
|
||||
{
|
||||
DBFunc.dbManager = new SQLManager(connection, Settings.DB.PREFIX);
|
||||
final DatabaseMetaData meta = connection.getMetaData();
|
||||
@ -1349,17 +1356,6 @@ import java.util.concurrent.TimeUnit;
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
// We should not start the plugin if
|
||||
// plotme is present. Maybe do this
|
||||
// earlier, and no register any commands
|
||||
// nor listeners, just run the converter?
|
||||
if (getServer().getPluginManager().getPlugin("PlotMe") != null) {
|
||||
try {
|
||||
new PlotMeConverter(this).runAsync();
|
||||
} catch (final Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
// Setup the command handler
|
||||
{
|
||||
final MainCommand command = new MainCommand();
|
||||
|
@ -47,8 +47,6 @@ public class Delete extends SubCommand {
|
||||
return !sendMessage(plr, C.UNLINK_REQUIRED);
|
||||
}
|
||||
if ((((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.uuidWrapper.getUUID(plr)))) && !PlotMain.hasPermission(plr, "plots.admin")) {
|
||||
System.out.print(UUIDHandler.uuidWrapper.getUUID(plr));
|
||||
System.out.print(plot.getOwner());
|
||||
return !sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
}
|
||||
assert plot != null;
|
||||
|
@ -107,9 +107,10 @@ public class PlotMeConverter {
|
||||
while (r.next()) {
|
||||
PlotId id = new PlotId(r.getInt("idX"), r.getInt("idZ"));
|
||||
String name = r.getString("owner");
|
||||
System.out.print("NAME: "+name);
|
||||
String world = r.getString("world");
|
||||
if (!plotSize.containsKey(world)) {
|
||||
int size = r.getInt("topZ") - r.getInt("botZ");
|
||||
int size = r.getInt("topZ") - r.getInt("bottomZ");
|
||||
plotSize.put(world,size);
|
||||
plots.put(world, new HashMap<PlotId, Plot>());
|
||||
}
|
||||
|
@ -671,7 +671,6 @@ public class SQLManager implements AbstractDB {
|
||||
if (element.contains(":")) {
|
||||
final String[] split = element.split(":");
|
||||
try {
|
||||
System.out.print("NEW FLAG] "+element);
|
||||
flags.add(new Flag(FlagManager.getFlag(split[0], true), split[1].replaceAll("\u00AF", ":").replaceAll("<EFBFBD>", ",")));
|
||||
} catch (final Exception e) {
|
||||
e.printStackTrace();
|
||||
@ -755,7 +754,6 @@ public class SQLManager implements AbstractDB {
|
||||
final PreparedStatement stmt = SQLManager.this.connection.prepareStatement("UPDATE `" + SQLManager.this.prefix + "plot_settings` SET `flags` = ? WHERE `plot_plot_id` = ?");
|
||||
stmt.setString(1, flag_string.toString());
|
||||
stmt.setInt(2, getId(world, plot.id));
|
||||
System.out.print(stmt.toString());
|
||||
stmt.execute();
|
||||
stmt.close();
|
||||
} catch (final SQLException e) {
|
||||
|
@ -58,7 +58,7 @@ public class SQLite extends Database {
|
||||
if (!this.plugin.getDataFolder().exists()) {
|
||||
this.plugin.getDataFolder().mkdirs();
|
||||
}
|
||||
final File file = new File(this.plugin.getDataFolder(), this.dbLocation);
|
||||
final File file = new File(this.dbLocation);
|
||||
if (!(file.exists())) {
|
||||
try {
|
||||
file.createNewFile();
|
||||
@ -67,7 +67,7 @@ public class SQLite extends Database {
|
||||
}
|
||||
}
|
||||
Class.forName("org.sqlite.JDBC");
|
||||
this.connection = DriverManager.getConnection("jdbc:sqlite:" + this.plugin.getDataFolder().toPath().toString() + "/" + this.dbLocation);
|
||||
this.connection = DriverManager.getConnection("jdbc:sqlite:" + this.dbLocation);
|
||||
return this.connection;
|
||||
}
|
||||
|
||||
|
@ -53,15 +53,12 @@ public class ExpireManager {
|
||||
ExpireManager.task = Bukkit.getScheduler().scheduleSyncRepeatingTask(PlotMain.getMain(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
System.out.print("RUNNING TASK");
|
||||
for (String world : PlotMain.getPlotWorldsString()) {
|
||||
System.out.print(" - check world");
|
||||
if (!ExpireManager.updatingPlots.contains(world)) {
|
||||
ExpireManager.updatingPlots.put(world, false);
|
||||
}
|
||||
Boolean updating = ExpireManager.updatingPlots.get(world);
|
||||
if (updating) {
|
||||
System.out.print(" - ERR UPDATING");
|
||||
return;
|
||||
}
|
||||
ArrayList<Plot> plots = expiredPlots.get(world);
|
||||
|
@ -201,7 +201,8 @@ public class UUIDHandler {
|
||||
}
|
||||
|
||||
// check cache
|
||||
UUID uuid = UUIDHandler.uuidMap.get(name);
|
||||
StringWrapper wrap = new StringWrapper(name);
|
||||
UUID uuid = UUIDHandler.uuidMap.get(wrap);
|
||||
if (uuid != null) {
|
||||
return uuid;
|
||||
}
|
||||
@ -209,7 +210,9 @@ public class UUIDHandler {
|
||||
// Read from disk
|
||||
if (Settings.UUID_FROM_DISK) {
|
||||
OfflinePlayer op = Bukkit.getOfflinePlayer(name);
|
||||
return UUIDHandler.uuidWrapper.getUUID(op);
|
||||
uuid = UUIDHandler.uuidWrapper.getUUID(op);
|
||||
add(new StringWrapper(name), uuid);
|
||||
return uuid;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
Loading…
Reference in New Issue
Block a user