Minor remake xD

This commit is contained in:
Sauilitired 2014-11-15 12:29:30 +01:00
parent 8f8fa01389
commit 0914b7bec9
2 changed files with 9 additions and 11 deletions

View File

@ -1252,15 +1252,15 @@ public class PlotMain extends JavaPlugin {
return plots; return plots;
} }
public static void setAllPlotsRaw(final LinkedHashMap<String, HashMap<PlotId, Plot>> plots) {
PlotMain.plots = plots;
}
public static void setAllPlotsRaw(final HashMap<String, HashMap<PlotId, Plot>> plots) { public static void setAllPlotsRaw(final HashMap<String, HashMap<PlotId, Plot>> plots) {
PlotMain.plots = new LinkedHashMap<>(plots); PlotMain.plots = new LinkedHashMap<>(plots);
// PlotMain.plots.putAll(plots); // PlotMain.plots.putAll(plots);
} }
public static void setAllPlotsRaw(final LinkedHashMap<String, HashMap<PlotId, Plot>> plots) {
PlotMain.plots = plots;
}
/** /**
* !!WorldGeneration!! * !!WorldGeneration!!
*/ */
@ -1343,10 +1343,6 @@ public class PlotMain extends JavaPlugin {
// Use mysql? // Use mysql?
if (Settings.DB.USE_MYSQL) { if (Settings.DB.USE_MYSQL) {
// TODO: Remake SQLManager
if (DBFunc.dbManager == null) {
DBFunc.dbManager = new SQLManager(connection, Settings.DB.PREFIX);
}
try { try {
mySQL = new MySQL(this, Settings.DB.HOST_NAME, Settings.DB.PORT, Settings.DB.DATABASE, Settings.DB.USER, Settings.DB.PASSWORD); mySQL = new MySQL(this, Settings.DB.HOST_NAME, Settings.DB.PORT, Settings.DB.DATABASE, Settings.DB.USER, Settings.DB.PASSWORD);
connection = mySQL.openConnection(); connection = mySQL.openConnection();
@ -1377,15 +1373,16 @@ public class PlotMain extends JavaPlugin {
Bukkit.getPluginManager().disablePlugin(this); Bukkit.getPluginManager().disablePlugin(this);
return; return;
} }
if (DBFunc.dbManager == null) {
DBFunc.dbManager = new SQLManager(connection, Settings.DB.PREFIX);
}
plots = DBFunc.getPlots(); plots = DBFunc.getPlots();
} }
// TODO: Implement mongo // TODO: Implement mongo
else if (Settings.DB.USE_MONGO) { else if (Settings.DB.USE_MONGO) {
// DBFunc.dbManager = new MongoManager(); // DBFunc.dbManager = new MongoManager();
sendConsoleSenderMessage(C.PREFIX.s() + "MongoDB is not yet implemented"); sendConsoleSenderMessage(C.PREFIX.s() + "MongoDB is not yet implemented");
} else if (Settings.DB.USE_SQLITE) { } else if (Settings.DB.USE_SQLITE) {
DBFunc.dbManager = new SQLManager(connection, Settings.DB.PREFIX);
try { try {
connection = new SQLite(this, Settings.DB.SQLITE_DB + ".db").openConnection(); connection = new SQLite(this, Settings.DB.SQLITE_DB + ".db").openConnection();
{ {
@ -1410,6 +1407,7 @@ public class PlotMain extends JavaPlugin {
Bukkit.getPluginManager().disablePlugin(this); Bukkit.getPluginManager().disablePlugin(this);
return; return;
} }
DBFunc.dbManager = new SQLManager(connection, Settings.DB.PREFIX);
plots = DBFunc.getPlots(); plots = DBFunc.getPlots();
} else { } else {
Logger.add(LogLevel.DANGER, "No storage type is set."); Logger.add(LogLevel.DANGER, "No storage type is set.");

View File

@ -95,7 +95,7 @@ public enum Command {
/** /**
* *
*/ */
DEBUG("debug", "database", new CommandPermission("plots.admin")), DEBUG("debug", "debug", new CommandPermission("plots.admin")),
/** /**
* *
*/ */