diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java index 317da3bb0..6eb73eb40 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java @@ -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(); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Delete.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Delete.java index aab8da4b7..1fd440f77 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Delete.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Delete.java @@ -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; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/PlotMeConverter.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/PlotMeConverter.java index 36e51f9dc..20e27057f 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/PlotMeConverter.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/PlotMeConverter.java @@ -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()); } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java index c89494446..9cf9736ad 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java @@ -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("�", ","))); } 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) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLite.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLite.java index 7b1891b86..651216e0d 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLite.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLite.java @@ -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; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java index 1fb7efe14..2be340e20 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java @@ -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 plots = expiredPlots.get(world); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/UUIDHandler.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/UUIDHandler.java index 04cc5306f..30f073452 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/UUIDHandler.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/UUIDHandler.java @@ -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;