Save the Jails when the server shuts down and when we add a cell.

This commit is contained in:
graywolf336 2013-12-09 15:12:32 -06:00
parent aa8443a8f7
commit 7743897b9d
2 changed files with 6 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import com.graywolf336.jail.beans.Jail;
import com.graywolf336.jail.command.CommandHandler; import com.graywolf336.jail.command.CommandHandler;
import com.graywolf336.jail.listeners.BlockListener; import com.graywolf336.jail.listeners.BlockListener;
import com.graywolf336.jail.listeners.EntityListener; import com.graywolf336.jail.listeners.EntityListener;
@ -37,6 +38,10 @@ public class JailMain extends JavaPlugin {
} }
public void onDisable() { public void onDisable() {
if(jm != null)
for(Jail j : jm.getJails())
io.saveJail(j);
cmdHand = null; cmdHand = null;
jm = null; jm = null;
io = null; io = null;

View File

@ -131,6 +131,7 @@ public class Jail {
/** Adds a cell to the Jail. */ /** Adds a cell to the Jail. */
public void addCell(Cell cell) { public void addCell(Cell cell) {
plugin.getJailIO().saveJail(this);
this.cells.put(cell.getName(), cell); this.cells.put(cell.getName(), cell);
} }