a bit of GUI, some variable descriptions...

This commit is contained in:
Morlok8k 2012-10-05 01:31:20 -07:00
parent 69a20d61d6
commit e12a527b27
3 changed files with 235 additions and 156 deletions

View File

@ -30,14 +30,14 @@ import javax.swing.UIManager;
import javax.swing.plaf.metal.MetalLookAndFeel; import javax.swing.plaf.metal.MetalLookAndFeel;
import javax.swing.plaf.metal.OceanTheme; import javax.swing.plaf.metal.OceanTheme;
import morlok8k.MinecraftLandGenerator.var;
/** /**
* *
* @author morlok8k * @author morlok8k
*/ */
public class MLG_GUI { public class MLG_GUI {
public boolean UsingGUI = true;
final Font arial = new Font("Arial", Font.PLAIN, 12); final Font arial = new Font("Arial", Font.PLAIN, 12);
final Font arialBold = new Font("Arial", Font.BOLD, 12); final Font arialBold = new Font("Arial", Font.BOLD, 12);
@ -85,6 +85,8 @@ public class MLG_GUI {
*/ */
public MLG_GUI() { public MLG_GUI() {
var.UsingGUI = true;
// Program-wide UI stuff here... // Program-wide UI stuff here...
MetalLookAndFeel.setCurrentTheme(new OceanTheme()); MetalLookAndFeel.setCurrentTheme(new OceanTheme());
try { try {
@ -637,7 +639,7 @@ public class MLG_GUI {
} }
void UpdateMLG() { static void UpdateMLG() {
// Update.updateMLG(); // Update.updateMLG();

View File

@ -90,7 +90,7 @@ public class Main {
} }
////// //////
GUI = false; // forcing GUI to be false for now, because I don't have the MLG_GUI code ready yet! //GUI = false; // forcing GUI to be false for now, because I don't have the MLG_GUI code ready yet!
////// //////
} else { } else {
@ -119,6 +119,8 @@ public class Main {
} else { //No GUI } else { //No GUI
// Finally, Lets Start MLG! // Finally, Lets Start MLG!
var.UsingGUI = false;
Main.runCLI(args); Main.runCLI(args);
} }

View File

@ -8,6 +8,8 @@ import java.util.Locale;
import java.util.Scanner; import java.util.Scanner;
/** /**
*
* This holds all the major variables that different sections of MLG uses...
* *
* @author morlok8k * @author morlok8k
*/ */
@ -15,300 +17,373 @@ public class var {
// //
// Program Info: // Program Info:
/** /**
* * display more output when debugging
*/ */
public static boolean testing = false; // display more output when debugging public static boolean testing = false;
/** /**
* * display more output
*/ */
public static boolean verbose = false; public static boolean verbose = false;
/** /**
* * Program Name
*/ */
public static final String PROG_NAME = "Minecraft Land Generator"; // Program Name public static final String PROG_NAME = "Minecraft Land Generator";
/** /**
* * Version Number!
*/ */
public static final String VERSION = "1.7.1 test 10"; // Version Number! public static final String VERSION = "1.7.1 test 15";
/** /**
* * Authors
*/ */
public static final String AUTHORS = "Corrodias, Morlok8k, pr0f1x"; // Authors public static final String AUTHORS = "Corrodias, Morlok8k, pr0f1x, jaseg";
// //
// Operating System Info: // Operating System Info:
/** /**
* * "/" or "\" depending on system
*/ */
public static final String fileSeparator = System.getProperty("file.separator"); public static final String fileSeparator = System.getProperty("file.separator");
/** /**
* * CRLF ('\r\n') on Windows, LF ('\n') on Linux, etc...
*/ */
public static final String newLine = System.getProperty("line.separator"); public static final String newLine = System.getProperty("line.separator");
// //
// Commonly Used Strings: // Commonly Used Strings:
/** /**
* * "[MLG] "
*/ */
public static String MLG = "[MLG] "; public static final String MLG = "[MLG] ";
/** /**
* * "[MLG-ERROR] "
*/ */
public static String MLGe = "[MLG-ERROR] "; public static final String MLGe = "[MLG-ERROR] ";
// //
// Date & Build-ID stuff: // Date & Build-ID stuff:
/** /**
* * Style: "January 1, 1970"
*/ */
public static DateFormat dateFormat_MDY = new SimpleDateFormat("MMMM d, yyyy", Locale.ENGLISH); public static final DateFormat dateFormat_MDY = new SimpleDateFormat("MMMM d, yyyy",
Locale.ENGLISH);
/** /**
* * class files of .jar were last modified on...
*/ */
public static Date MLG_Last_Modified_Date = null; public static Date MLG_Last_Modified_Date = null;
/** /**
* * Lets get a nice Date format for display<br>
* Style: "Sunday, September 16, 2012 at 5:12 PM, Pacific Daylight Time"
*/ */
public static DateFormat dateFormat = new SimpleDateFormat( // Lets get a nice Date format for display public static final DateFormat dateFormat = new SimpleDateFormat(
"EEEE, MMMM d, yyyy 'at' h:mm a zzzz", Locale.ENGLISH); "EEEE, MMMM d, yyyy 'at' h:mm a, zzzz", Locale.ENGLISH);
/** /**
* * a date
*/ */
public static Date date = null; // date stuff public static Date date = null;
/** /**
* * last modified date stored as a Long
*/ */
public static Long MLG_Last_Modified_Long = 0L; public static Long MLG_Last_Modified_Long = 0L;
/** /**
* * File: "MLG-BuildID"
*/ */
public static String buildIDFile = "MLG-BuildID"; public static String buildIDFile = "MLG-BuildID";
// //
// Filenames: // Filenames:
/** /**
* * "MinecraftLandGenerator.jar" by default. This actually tracks the current filename for the jar.
*/ */
public static String MLGFileNameShort = null; public static String MLGFileNameShort = null;
/** /**
* * "MinecraftLandGenerator.conf"
*/ */
public static final String MinecraftLandGeneratorConf = "MinecraftLandGenerator.conf"; public static final String MinecraftLandGeneratorConf = "MinecraftLandGenerator.conf";
/** /**
* * "_MLG_Readme.txt"
*/ */
public static final String defaultReadmeFile = "_MLG_Readme.txt"; public static final String defaultReadmeFile = "_MLG_Readme.txt";
/** /**
* * "MinecraftLandGenerator.jar"
*/ */
public static final String MLG_JarFile = "MinecraftLandGenerator.jar"; public static final String MLG_JarFile = "MinecraftLandGenerator.jar";
/** /**
* * entire path of currently running .jar file
*/ */
public static String MLGFileName = null; public static String MLGFileName = null;
// //
// Text Input // Text Input
/** /**
* * Command line input scanner
*/ */
public static Scanner sc = new Scanner(System.in); public static Scanner sc = new Scanner(System.in);
// //
// MinecraftLandGenerator.conf Stuff: // MinecraftLandGenerator.conf Stuff:
/** /**
* * Server Output: "[INFO] Done"
*/ */
public static String doneText = null; public static String doneText = null;
/** /**
* * Server Output: "[INFO] Preparing spawn area:"
*/ */
public static String preparingText = null; public static String preparingText = null;
/** /**
* * Server Output: "[INFO] Preparing start region for"
*/ */
public static String preparingLevel = null; public static String preparingLevel = null;
/** /**
* * The Overworld
*/ */
public static String level_0 = null; // the world public static String level_0 = null;
/** /**
* * The Nether
*/ */
public static String level_1 = null; // the nether public static String level_1 = null;
/** /**
* * The End
*/ */
public static String level_2 = null; // the end public static String level_2 = null;
/** /**
* * Future World (Level 3)
*/ */
public static String level_3 = null; // future worlds public static String level_3 = null;
/** /**
* * Future World (Level 4)
*/ */
public static String level_4 = null; public static String level_4 = null;
/** /**
* * Future World (Level 5)
*/ */
public static String level_5 = null; public static String level_5 = null;
/** /**
* * Future World (Level 6)
*/ */
public static String level_6 = null; public static String level_6 = null;
/** /**
* * Future World (Level 7)
*/ */
public static String level_7 = null; public static String level_7 = null;
/** /**
* * Future World (Level 8)
*/ */
public static String level_8 = null; public static String level_8 = null;
/** /**
* * Future World (Level 9)
*/ */
public static String level_9 = null; public static String level_9 = null;
/** /**
* * MLG's recommended default instead of "java -jar minecraft_server.jar"
*/ */
public static final String defaultJavaLine = public static final String defaultJavaLine =
"java -Djava.awt.headless=true -Djline.terminal=jline.UnsupportedTerminal -Duser.language=en" "java -Djava.awt.headless=true -Djline.terminal=jline.UnsupportedTerminal -Duser.language=en"
+ " -Xms1024m -Xmx1024m -Xincgc -jar minecraft_server.jar nogui"; + " -Xms1024m -Xmx1024m -Xincgc -jar minecraft_server.jar nogui";
/** /**
* * "." for current folder, else exact path.
*/ */
public static String serverPath = null; public static String serverPath = null;
/** /**
* * the folder the game save is in...
*/ */
public static String worldPath = null; public static String worldPath = null;
// //
//Server Launching: //Server Launching:
/** /**
* * the minecraft server
*/ */
public static ProcessBuilder minecraft = null; public static ProcessBuilder minecraft = null;
/** /**
* * the info from "java=" in the conf file.
*/ */
public static String javaLine = null; public static String javaLine = null;
// //
//Server Launching: //Server Launching:
/** /**
* * the name of the world. usually "world", unless its been changed...
*/ */
public static String worldName = null; public static String worldName = null;
/** /**
* * Beta 1.9 glitch workaround. (not needed unless using beta 1.9)
*/ */
public static boolean waitSave = false; public static boolean waitSave = false;
/** /**
* * Ignores Warnings from the server. Used for compatibility and special cases
*/ */
public static boolean ignoreWarnings = false; public static boolean ignoreWarnings = false;
/** /**
* * the worlds seed
*/ */
public static Long randomSeed = (long) 0; public static Long randomSeed = (long) 0;
// //
// Update URLs: // Update URLs:
/** /**
* * just removing some redundancy
*/ */
public static final String github_URL = public static final String github_URL =
"https://raw.github.com/Morlok8k/MinecraftLandGenerator/master/bin/"; // just removing some redundancy "https://raw.github.com/Morlok8k/MinecraftLandGenerator/master/bin/";
/** /**
* * URL to conf file
*/ */
public static final String github_MLG_Conf_URL = github_URL + MinecraftLandGeneratorConf; public static final String github_MLG_Conf_URL = github_URL + MinecraftLandGeneratorConf;
/** /**
* * URL to BuildID
*/ */
public static final String github_MLG_BuildID_URL = github_URL + buildIDFile; public static final String github_MLG_BuildID_URL = github_URL + buildIDFile;
/** /**
* * URL to .jar file
*/ */
public static final String github_MLG_jar_URL = github_URL + MLG_JarFile; public static final String github_MLG_jar_URL = github_URL + MLG_JarFile;
// //
// Update Stuff: // Update Stuff:
/** /**
* * The running Main.class
*/ */
public static final Class<?> cls = Main.class; public static final Class<?> cls = Main.class;
/** /**
* * For bad compiling...
*/ */
public static final String rsrcError = "rsrcERROR"; public static final String rsrcError = "rsrcERROR";
/** /**
* * is running code a .jar file?
*/ */
public static boolean isCompiledAsJar = false; public static boolean isCompiledAsJar = false;
/** /**
* * current hash
*/ */
public static String MLG_Current_Hash = null; public static String MLG_Current_Hash = null;
/** /**
* * Just a test to make sure we don't get stuck in an infinite loop. should never happen, unless there is bad code.
*/ */
public static int inf_loop_protect_BuildID = 0; public static int inf_loop_protect_BuildID = 0;
/** /**
* * we downloaded a copy of the BuildID...
*/ */
public static boolean flag_downloadedBuildID = false; public static boolean flag_downloadedBuildID = false;
/** /**
* * a list of timestamps
*/ */
public static ArrayList<String> timeStamps = new ArrayList<String>(); public static ArrayList<String> timeStamps = new ArrayList<String>();
// //
// Resume Data & Log Files // Resume Data & Log Files
/** /**
* * resume data for X, if needed.
*/ */
public static int resumeX = 0; //resume data, if needed. public static int resumeX = 0;
/** /**
* * resume data for Z, if needed.
*/ */
public static int resumeZ = 0; public static int resumeZ = 0;
/** /**
* * a saved copy of the original args given
*/ */
public static String[] originalArgs = {}; public static String[] originalArgs = {};
/** /**
* * which version of the server? oh yeah!
*/ */
public static String MC_Server_Version = ""; public static String MC_Server_Version = "";
// //
// Misc: // Misc:
/** /**
* * Launch website after generation.
*/ */
public static boolean webLaunch = true; // Launch website after generation. public static boolean webLaunch = true;
/** /**
* * for scripts, we don't wait. for human readability, we wait 10 seconds before exiting program
*/ */
public static boolean dontWait = false; public static boolean dontWait = false;
/** /**
* * alternate / compatibility mode
*/ */
public static boolean alternate = false; public static boolean alternate = false;
/** /**
* * standard server creates 625 chunks in a square around spawn.
*/ */
public static int MinecraftServerChunkPlayerCache = 625; //You see this number when you first launch the server in GUI mode, after the world is loaded, but before anyone has connected. public static int MinecraftServerChunkPlayerCache = 625; //You see this number when you first launch the server in GUI mode, after the world is loaded, but before anyone has connected.
/** /**
* * these 625 chunks create a 400x400 block square
*/ */
public static int incrementFull = (int) (Math.sqrt(MinecraftServerChunkPlayerCache) * 16); // 400, the length of a fresh (no players have ever logged in) server map. public static int incrementFull = (int) (Math.sqrt(MinecraftServerChunkPlayerCache) * 16); // 400, the length of a fresh (no players have ever logged in) server map.
/** /**
* * due to the edge chunks being not fully populated, we subtract a chunks worth...
*/ */
public static int increment = incrementFull - 16; //public static int increment = 384; // 384, what we use to iterate between sections of the map. Allows for some overlap to prevent "stripes" public static int increment = incrementFull - 16; //public static int increment = 384; // 384, what we use to iterate between sections of the map. Allows for some overlap to prevent "stripes"
/** /**
* * debugging use... use "java -ea -jar MinecraftlandGenerator.jar"
*/ */
public static boolean assertsEnabled = false; //debugging use... use java -ea -jar MinecraftlandGenerator.jar... public static boolean assertsEnabled = false;
/** /**
* * when the program started
*/ */
public static long startTime = 0L; public static long startTime = 0L;
/** /**
* * recheck toggle!
*/ */
public static Boolean recheckFlag = false; public static Boolean recheckFlag = false;
/**
* output GUI stuff when using GUI mode, or dont.
*/
public static boolean UsingGUI = false;
} }