Database changes

This commit is contained in:
boy0001 2015-08-11 07:03:34 +10:00
parent a6d3c77d5a
commit 7a6f9e061d
9 changed files with 887 additions and 840 deletions

View File

@ -8,7 +8,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<artifactId>PlotSquared</artifactId>
<version>3.0.9</version>
<version>3.0.11</version>
<name>PlotSquared</name>
<packaging>jar</packaging>
<build>

View File

@ -42,7 +42,6 @@ import com.intellectualcrafters.plot.object.comment.PlotComment;
* @author Empire92
*/
public interface AbstractDB {
// TODO MongoDB @Brandon
/**
* The UUID that will count as everyone
*/
@ -207,20 +206,6 @@ public interface AbstractDB {
*/
void setPosition(final PlotCluster cluster, final String position);
/**
* @param id Plot Entry ID
*
* @return Plot Settings
*/
HashMap<String, Object> getSettings(final int id);
/**
*
* @param id
* @return HashMap<String, Object>
*/
HashMap<String, Object> getClusterSettings(final int id);
/**
* @param plot Plot Object
* @param uuid Player that should be removed

View File

@ -249,15 +249,6 @@ public class DBFunc {
dbManager.setPosition(plot, position);
}
/**
*
* @param id
* @return HashMap<String, Object>
*/
public static HashMap<String, Object> getSettings(final int id) {
return dbManager.getSettings(id);
}
/**
* @param plot
* @param comment
@ -429,8 +420,4 @@ public class DBFunc {
public static void setPosition(final PlotCluster cluster, final String position) {
dbManager.setPosition(cluster, position);
}
public static HashMap<String, Object> getClusterSettings(final int id) {
return dbManager.getClusterSettings(id);
}
}

View File

@ -90,6 +90,7 @@ public class MySQL extends Database {
return false;
}
this.connection.close();
this.connection = null;
return true;
}

View File

@ -86,6 +86,7 @@ public class SQLite extends Database {
return false;
}
this.connection.close();
this.connection = null;
return true;
}

View File

@ -56,6 +56,9 @@ public class InboxOwner extends CommentInbox {
plot.getSettings().addComment(comment);
}
}
else {
plot.getSettings().setComments(new ArrayList<PlotComment>());
}
TaskManager.runTask(whenDone);
}
});

View File

@ -126,6 +126,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
@Override
public void onDisable() {
Bukkit.getScheduler().cancelTasks(this);
PS.get().disable();
THIS = null;
}
@ -554,12 +555,6 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
World world = BukkitUtil.getWorld(worldname);
if (world == null) {
// create world
System.out.print("CREATING WORLD: " + worldname);
System.out.print("CREATING WORLD: " + worldname);
System.out.print("CREATING WORLD: " + worldname);
System.out.print("CREATING WORLD: " + worldname);
ConfigurationSection worldConfig = PS.get().config.getConfigurationSection("worlds." + worldname);
String manager = worldConfig.getString("generator.plugin");
if (manager == null) {

View File

@ -64,6 +64,7 @@ public class SendChunk {
if (!chunk.isLoaded()) {
continue;
}
boolean unload = true;
final Object c = methodGetHandle.of(chunk).call();
final Object w = world.of(c).get();
final Object p = players.of(w).get();
@ -73,6 +74,7 @@ public class SendChunk {
diffx = Math.abs(x - (chunk.getX() << 4));
diffz = Math.abs(z - (chunk.getZ() << 4));
if ((diffx <= view) && (diffz <= view)) {
unload = false;
if (v1_7_10) {
chunk.getWorld().refreshChunk(chunk.getX(), chunk.getZ());
chunk.load(true);
@ -84,6 +86,15 @@ public class SendChunk {
}
}
}
if (unload) {
try {
chunk.unload(true, true);
}
catch (Exception e) {
e.printStackTrace();
}
}
}
}