Save the Jails when the server shuts down and when we add a cell.
This commit is contained in:
		@@ -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;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user