package gui;

import java.util.ArrayList;

import entity.Creature;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;

public class MainGUI extends Application {

    public static final String IMAGEFOLDER = System.getProperty("user.dir") + "\\images\\";

    public static ArrayList<Creature> creatureList;
    public static Stage mainStage;

    public static void main(String[] args) {
	creatureList = new ArrayList<Creature>();
	launch(args);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
	Parent root = FXMLLoader.load(getClass().getResource("gui.fxml"));
	Scene scene = new Scene(root, 1280, 720);
	scene.getStylesheets().add(getClass().getResource("customstyle.css").toString());
	mainStage = primaryStage;

	primaryStage.getIcons().add(new Image(getClass().getResourceAsStream("icon.png")));
	primaryStage.setTitle("D&D Encounter Tool v2.0");
	primaryStage.setScene(scene);
	primaryStage.show();
    }
}

@@ -36,24 +36,53 @@
 rayList;%0D%0A%0D%0A
+import encounter.Encounter;%0D%0A
 import entit
@@ -503,22 +503,209 @@
 tic 
-Stage mainStag
+Encounter encounter;%0D%0A    public static Stage mainStage;%0D%0A%0D%0A    private static Thread autoSaveThread;%0D%0A    private static final int AUTOSAVEINTERVAL = 60000;%0D%0A    private static boolean autosave = fals
 e;%0D%0A
@@ -1122,16 +1122,573 @@
 yStage;%0D
+%0A%09autoSaveThread = new Thread(new Runnable() %7B%0D%0A%09    @Override%0D%0A%09    public void run() %7B%0D%0A%09%09try %7B%0D%0A%09%09    Thread.sleep(5000);%0D%0A%09%09%7D catch (InterruptedException e1) %7B%0D%0A%09%09    e1.printStackTrace();%0D%0A%09%09%7D%0D%0A%09%09while (autosave) %7B%0D%0A%09%09    if (encounter.getCreatureList().size() %3E 0) %7B%0D%0A%09%09%09encounter.autoSave();%0D%0A%09%09%09System.out.println(%22AutoSave Complete%22);%0D%0A%09%09    %7D%0D%0A%09%09    try %7B%0D%0A%09%09%09Thread.sleep(AUTOSAVEINTERVAL);%0D%0A%09%09    %7D catch (InterruptedException e) %7B%0D%0A%09%09%09e.printStackTrace();%0D%0A%09%09    %7D%0D%0A%09%09%7D%0D%0A%09    %7D%0D%0A%09%7D);%0D%0A%09autoSaveThread.setDaemon(true);%0D%0A%09autoSaveThread.start();%0D
 %0A%0D%0A%09prim

add autosavethread