working on integrating a GUI for 2.0
This commit is contained in:
parent
b596f06bf9
commit
9149083293
@ -183,7 +183,7 @@ public class FileRead {
|
||||
Out.outD(" webLaunch: " + var.webLaunch);
|
||||
}
|
||||
} catch (final FileNotFoundException ex) {
|
||||
Out.out("Could not find "
|
||||
Out.err("Could not find "
|
||||
+ var.MinecraftLandGeneratorConf
|
||||
+ ". It is recommended that you run the application with the -conf option to create it.");
|
||||
return;
|
||||
|
@ -20,6 +20,7 @@ import javax.swing.JLabel;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuBar;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JProgressBar;
|
||||
import javax.swing.JRadioButton;
|
||||
@ -30,6 +31,8 @@ import javax.swing.UIManager;
|
||||
import javax.swing.plaf.metal.MetalLookAndFeel;
|
||||
import javax.swing.plaf.metal.OceanTheme;
|
||||
|
||||
import morlok8k.MinecraftLandGenerator.Out;
|
||||
import morlok8k.MinecraftLandGenerator.Startup;
|
||||
import morlok8k.MinecraftLandGenerator.Update;
|
||||
import morlok8k.MinecraftLandGenerator.var;
|
||||
|
||||
@ -42,7 +45,7 @@ public class MLG_GUI {
|
||||
final Font arial = new Font("Arial", Font.PLAIN, 12);
|
||||
final Font arialBold = new Font("Arial", Font.BOLD, 12);
|
||||
|
||||
public JFrame frmMLG_GUI;
|
||||
public static JFrame frmMLG_GUI;
|
||||
|
||||
JButton btnStart;
|
||||
JButton btnStop;
|
||||
@ -139,8 +142,17 @@ public class MLG_GUI {
|
||||
*/
|
||||
private void initialize() {
|
||||
|
||||
// Basic Program Initialization
|
||||
Startup.initialStart();
|
||||
boolean quit = false;
|
||||
quit = Startup.confFile();
|
||||
if (quit) { return; }
|
||||
|
||||
//WorldVerify.verifyWorld(); //TODO: need to do this at a later point
|
||||
|
||||
// Frame:
|
||||
frmMLG_GUI = new JFrame();
|
||||
frmMLG_GUI.setTitle("Minecraft Land Generator - Loading...");
|
||||
frmMLG_GUI.setResizable(false);
|
||||
frmMLG_GUI.setBounds(100, 100, 475, 400);
|
||||
frmMLG_GUI.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
@ -425,12 +437,15 @@ public class MLG_GUI {
|
||||
pnlSizeSquarify.setLayout(new BorderLayout(0, 0));
|
||||
|
||||
rdbtnSizeSquarify = new JRadioButton("Squarify Existing Land");
|
||||
rdbtnSizeSquarify.setToolTipText("Not Functional Yet...");
|
||||
rdbtnSizeSquarify.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
|
||||
SizeSetEnable(false);
|
||||
CenterPointSetEnable(false);
|
||||
|
||||
}
|
||||
});
|
||||
pnlSizeSquarify.add(rdbtnSizeSquarify, BorderLayout.CENTER);
|
||||
@ -452,10 +467,8 @@ public class MLG_GUI {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
|
||||
txtCPX.setEnabled(false);
|
||||
txtCPZ.setEnabled(false);
|
||||
lblCPX.setEnabled(false);
|
||||
lblCPZ.setEnabled(false);
|
||||
CenterPointSetEnable(false);
|
||||
|
||||
}
|
||||
});
|
||||
rdbtnCenterSpawnPoint.setSelected(true);
|
||||
@ -467,10 +480,8 @@ public class MLG_GUI {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
|
||||
txtCPX.setEnabled(true);
|
||||
txtCPZ.setEnabled(true);
|
||||
lblCPX.setEnabled(true);
|
||||
lblCPZ.setEnabled(true);
|
||||
CenterPointSetEnable(true);
|
||||
|
||||
}
|
||||
});
|
||||
pnlCPrb.add(rdbtnCenterOther, BorderLayout.EAST);
|
||||
@ -565,9 +576,11 @@ public class MLG_GUI {
|
||||
pnlTotPrg.add(pgbTotPer, BorderLayout.CENTER);
|
||||
|
||||
// Frame size and location
|
||||
|
||||
frmMLG_GUI.validate();
|
||||
frmMLG_GUI.pack();
|
||||
frmMLG_GUI.setLocationRelativeTo(null);
|
||||
|
||||
frmMLG_GUI.setTitle("Minecraft Land Generator");
|
||||
// Finished creation of frame
|
||||
}
|
||||
|
||||
@ -593,6 +606,44 @@ public class MLG_GUI {
|
||||
rdbtnCenterSpawnPoint.setEnabled(false);
|
||||
rdbtnCenterOther.setEnabled(false);
|
||||
|
||||
pgbCurPer.setIndeterminate(true);
|
||||
pgbTotPer.setIndeterminate(true);
|
||||
|
||||
//TODO: add values from textboxes and radio buttons to the actual vars.
|
||||
|
||||
if (rdbtnAlignRegions.isSelected()) {
|
||||
var.useChunks = false;
|
||||
} else {
|
||||
var.useChunks = true;
|
||||
}
|
||||
|
||||
if (rdbtnSizeCustomSize.isSelected()) {
|
||||
var.xRange = Integer.parseInt(txtSizeX.getText().trim());
|
||||
var.zRange = Integer.parseInt(txtSizeZ.getText().trim());
|
||||
} else {
|
||||
var.xRange = 1000; // Umm... This code shouldn't run at this point in time...
|
||||
var.zRange = 1000;
|
||||
|
||||
//TODO: add squarifying code here.
|
||||
|
||||
}
|
||||
|
||||
if (rdbtnCenterOther.isSelected()) {
|
||||
|
||||
var.xOffset = Integer.parseInt(txtCPX.getText().trim());
|
||||
var.zOffset = Integer.parseInt(txtCPZ.getText().trim());
|
||||
|
||||
} else {
|
||||
|
||||
var.xOffset = 0;
|
||||
var.zOffset = 0;
|
||||
// TODO: get spawnpoint
|
||||
|
||||
txtCPX.setText(var.xOffset.toString());
|
||||
txtCPZ.setText(var.zOffset.toString());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void stop_GUI() {
|
||||
@ -611,7 +662,7 @@ public class MLG_GUI {
|
||||
CenterPointSetEnable(true);
|
||||
}
|
||||
|
||||
rdbtnSizeSquarify.setEnabled(true);
|
||||
//rdbtnSizeSquarify.setEnabled(true);
|
||||
rdbtnSizeCustomSize.setEnabled(true);
|
||||
|
||||
rdbtnAlignRegions.setEnabled(true);
|
||||
@ -626,17 +677,33 @@ public class MLG_GUI {
|
||||
btnStart.setEnabled(true);
|
||||
btnStop.setEnabled(false);
|
||||
|
||||
pgbCurPer.setIndeterminate(false);
|
||||
pgbTotPer.setIndeterminate(false);
|
||||
|
||||
}
|
||||
|
||||
void MapInfo() {
|
||||
static void MapInfo() {
|
||||
|
||||
// TODO: Display Map Info
|
||||
JOptionPane.showMessageDialog(frmMLG_GUI, "Seed:" + var.newLine + "SpawnPoint:");
|
||||
|
||||
}
|
||||
|
||||
void AboutMLG() {
|
||||
static void AboutMLG() {
|
||||
|
||||
// TODO: Display MLG About box
|
||||
final String n = var.newLine;
|
||||
final String N = n + n;
|
||||
final String message =
|
||||
"This program uses the Minecraft Server to expand your Minecraft world." + N
|
||||
+ var.WEBSITE + N + "Authors: " + var.AUTHORS + n
|
||||
+ "Special Thanks to: Graham Edgecombe (aka ancient) for JNBT" + N
|
||||
+ "BuildID: (" + var.MLG_Last_Modified_Date.getTime() + ")" + n
|
||||
+ "This version was last modified on "
|
||||
+ var.dateFormat.format(var.MLG_Last_Modified_Date);
|
||||
final String title = var.PROG_NAME + " v" + var.VERSION;
|
||||
|
||||
//JOptionPane.showMessageDialog(frmMLG_GUI, message, title, JOptionPane.INFORMATION_MESSAGE);
|
||||
Out.msg(message, title, JOptionPane.INFORMATION_MESSAGE);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,15 +1,10 @@
|
||||
package morlok8k.MinecraftLandGenerator;
|
||||
|
||||
import java.awt.EventQueue;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@ -23,18 +18,6 @@ import morlok8k.MinecraftLandGenerator.GUI.MLG_GUI;
|
||||
*/
|
||||
public class Main {
|
||||
|
||||
/** Range of X to generate */
|
||||
public static int xRange = 0;
|
||||
|
||||
/** Range of Z to generate */
|
||||
public static int zRange = 0;
|
||||
|
||||
/** X Offset (Either spawnpoint or specified) */
|
||||
public static Integer xOffset = null;
|
||||
|
||||
/** Z Offset (Either spawnpoint or specified) */
|
||||
public static Integer zOffset = null;
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
// REMINDER: Because I always forget/mix up languages: //
|
||||
// "static" in java means "global" to this class //
|
||||
@ -67,8 +50,12 @@ public class Main {
|
||||
Out.outD("");
|
||||
}
|
||||
|
||||
boolean GUI = false;
|
||||
boolean NOGUI = false;
|
||||
boolean GUI = false; // GUI needs to be true to run in graphical mode
|
||||
boolean NOGUI = false; // NOGUI is a flag that finds reasons to not use a graphical mode.
|
||||
|
||||
if (args.length != 0) { // if args are present, then we assume we want NOGUI
|
||||
NOGUI = true; // if no args are present, we will attempt GUI
|
||||
}
|
||||
|
||||
String[] argsNOGUI = new String[args.length];
|
||||
argsNOGUI = args;
|
||||
@ -86,7 +73,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 {
|
||||
@ -101,6 +88,7 @@ public class Main {
|
||||
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
|
||||
@SuppressWarnings("static-access")
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
@ -117,7 +105,8 @@ public class Main {
|
||||
// Finally, Lets Start MLG!
|
||||
|
||||
var.UsingGUI = false;
|
||||
Main.runCLI(args);
|
||||
var.args = args;
|
||||
Main.runCLI();
|
||||
}
|
||||
|
||||
}
|
||||
@ -129,282 +118,15 @@ public class Main {
|
||||
* @param args
|
||||
*
|
||||
*/
|
||||
private static void runCLI(String[] args) {
|
||||
private static void runCLI() {
|
||||
|
||||
// Lets get the date, and our BuildID
|
||||
var.date = new Date();
|
||||
Update.readBuildID();
|
||||
|
||||
// The following displays no matter what happens, so we needed this date stuff to happen first.
|
||||
|
||||
Out.out(var.PROG_NAME + " version " + var.VERSION);
|
||||
Out.out("BuildID: (" + var.MLG_Last_Modified_Date.getTime() + ")"); // instead of dateformatting the buildid, we return the raw Long number.
|
||||
// thus different timezones wont display a different buildID
|
||||
Out.out("This version was last modified on "
|
||||
+ var.dateFormat.format(var.MLG_Last_Modified_Date));
|
||||
Out.out("");
|
||||
Out.out("Uses a Minecraft server to generate square land of a specified size.");
|
||||
Out.out("");
|
||||
Out.out("");
|
||||
|
||||
// =====================================================================
|
||||
// INSTRUCTIONS
|
||||
// =====================================================================
|
||||
|
||||
// check for -nowait, and remove from arguments if it exists. (we remove it for compatibility reasons with the rest of the existing code.)
|
||||
// (-nowait is the only universal switch - it can be used with anything. its basically for scripting, as it turns off the 10sec wait for human readability)
|
||||
String[] newArgs = new String[args.length];
|
||||
newArgs = args;
|
||||
newArgs = StringArrayParse.Parse(newArgs, "-n"); //parse out -n
|
||||
newArgs = StringArrayParse.Parse(newArgs, "-nowait"); //parse out -nowait
|
||||
if (!(args.equals(newArgs))) { //do the freshly parsed args match the original?
|
||||
var.dontWait = true; //if not, we dont wait for anything!
|
||||
args = newArgs; //use the freshly parsed args for everything else now...
|
||||
Out.out("Notice: Not waiting for anything...");
|
||||
}
|
||||
|
||||
if (args.length == 0) { //we didn't find a an X and Z size, so lets ask for one.
|
||||
Out.out("Please Enter the size of world you want. Example: X:1000 Z:1000");
|
||||
Out.outP(var.MLG + "X:");
|
||||
xRange = Input_CLI.getInt("X:");
|
||||
Out.outP(var.MLG + "Z:");
|
||||
zRange = Input_CLI.getInt("Z:");
|
||||
args = new String[] { String.valueOf(xRange), String.valueOf(zRange) };
|
||||
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("-version") || args[0].equalsIgnoreCase("-help")
|
||||
|| args[0].equals("/?")) {
|
||||
|
||||
Readme_and_HelpInfo.showHelp(true);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// =====================================================================
|
||||
// STARTUP AND CONFIG
|
||||
// =====================================================================
|
||||
|
||||
// the arguments are apparently okay so far. parse the conf file.
|
||||
if (args[0].equalsIgnoreCase("-conf")) {
|
||||
|
||||
if (args.length == 2) {
|
||||
if (args[1].equalsIgnoreCase("download")) {
|
||||
final boolean fileSuccess =
|
||||
DownloadFile.downloadFile(var.github_MLG_Conf_URL, var.testing);
|
||||
if (fileSuccess) {
|
||||
Out.out(var.MinecraftLandGeneratorConf + " file downloaded.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FileWrite.saveConf(true); //new conf file
|
||||
return;
|
||||
|
||||
} else if (args[0].equalsIgnoreCase("-ps") || args[0].equalsIgnoreCase("-printspawn")) {
|
||||
// okay, sorry, this is an ugly hack, but it's just a last-minute feature.
|
||||
Misc.printSpawn();
|
||||
Time.waitTenSec(false);
|
||||
return;
|
||||
} else if (args[0].equalsIgnoreCase("-build")) {
|
||||
Update.buildID(false);
|
||||
return;
|
||||
} else if (args[0].equalsIgnoreCase("-update")) {
|
||||
Update.updateMLG();
|
||||
Time.waitTenSec(false);
|
||||
return;
|
||||
} else if (args[0].equalsIgnoreCase("-readme")) {
|
||||
|
||||
if (args.length == 2) {
|
||||
Readme_and_HelpInfo.readMe(args[1]);
|
||||
} else {
|
||||
Readme_and_HelpInfo.readMe(null);
|
||||
}
|
||||
return;
|
||||
} else if (args[0].equalsIgnoreCase("-downloadfile")) {
|
||||
if (args.length == 2) {
|
||||
DownloadFile.downloadFile(args[1], true);
|
||||
} else {
|
||||
Out.out("No File to Download!");
|
||||
Time.waitTenSec(false);
|
||||
}
|
||||
return;
|
||||
|
||||
} else if (args[0].equalsIgnoreCase("-downloadlist")) {
|
||||
|
||||
if (args.length == 2) {
|
||||
String origMD5 = "";
|
||||
String recheckMD5 = "";
|
||||
|
||||
try {
|
||||
final File config = new File(args[1]);
|
||||
try {
|
||||
origMD5 = MD5.fileMD5(config.toString());
|
||||
} catch (final NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
final BufferedReader in = new BufferedReader(new FileReader(config));
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
if (line.contains("###RECHECK###")) {
|
||||
var.recheckFlag = !var.recheckFlag;
|
||||
} else {
|
||||
DownloadFile.downloadFile(line, true);
|
||||
}
|
||||
}
|
||||
in.close();
|
||||
|
||||
if (var.recheckFlag == true) { // the first line is always the location of this file. the second is the recheck flag, if we want to.
|
||||
try {
|
||||
recheckMD5 = MD5.fileMD5(config.toString());
|
||||
} catch (final NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (!origMD5.contentEquals(recheckMD5)) {
|
||||
final BufferedReader in_recheck =
|
||||
new BufferedReader(new FileReader(config));
|
||||
String line_recheck;
|
||||
while ((line_recheck = in_recheck.readLine()) != null) {
|
||||
if (line_recheck.contains("###RECHECK###")) {
|
||||
var.recheckFlag = !var.recheckFlag;
|
||||
} else {
|
||||
DownloadFile.downloadFile(line_recheck, true);
|
||||
}
|
||||
}
|
||||
in_recheck.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} catch (final FileNotFoundException ex) {
|
||||
System.err.println(args[1] + " - File not found");
|
||||
Time.waitTenSec(false);
|
||||
return;
|
||||
} catch (final IOException ex) {
|
||||
System.err.println(args[1] + " - Could not read file.");
|
||||
Time.waitTenSec(false);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
Out.out("No File with links!");
|
||||
Time.waitTenSec(false);
|
||||
}
|
||||
return;
|
||||
|
||||
} else if (args.length == 1) {
|
||||
Out.out("For help, use java -jar " + var.MLGFileNameShort + " -help");
|
||||
Time.waitTenSec(false);
|
||||
return;
|
||||
}
|
||||
|
||||
FileRead.readConf();
|
||||
|
||||
boolean oldConf = false; // This next section checks to see if we have a old configuration file (or none!)
|
||||
|
||||
if ((var.serverPath == null) || (var.javaLine == null)) { // MLG 1.2 Check for a valid .conf file.
|
||||
Out.err(var.MinecraftLandGeneratorConf
|
||||
+ " does not contain all required properties. Making New File!"); // Please recreate it by running this application with -conf.
|
||||
|
||||
// return;
|
||||
|
||||
// We no longer quit. We generate a new one with defaults.
|
||||
|
||||
var.javaLine = var.defaultJavaLine;
|
||||
var.serverPath = ".";
|
||||
oldConf = true;
|
||||
}
|
||||
|
||||
if (var.doneText == null) { // MLG 1.4.0
|
||||
oldConf = true;
|
||||
} else if (var.preparingText == null) { // MLG 1.4.0
|
||||
oldConf = true;
|
||||
} else if (var.preparingLevel == null) { // MLG 1.4.5 / 1.5.0
|
||||
oldConf = true;
|
||||
} else if (var.level_1 == null) { // MLG 1.4.5 / 1.5.0
|
||||
oldConf = true;
|
||||
} else if (var.level_0 == null) { // MLG 1.5.1 / 1.6.0
|
||||
oldConf = true;
|
||||
}
|
||||
|
||||
if (oldConf) {
|
||||
Out.err("Old Version of " + var.MinecraftLandGeneratorConf + " found. Updating...");
|
||||
|
||||
FileWrite.saveConf(false); //old conf
|
||||
|
||||
Time.waitTenSec(false);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
// ARGUMENTS
|
||||
try {
|
||||
xRange = Integer.parseInt(args[0]);
|
||||
zRange = Integer.parseInt(args[1]);
|
||||
|
||||
if ((xRange < 1000) && (xRange != 0)) {
|
||||
xRange = 1000; //if less than 1000, (and not 0) set to 1000 (Calculations don't work well on very small maps)
|
||||
Out.err("X size too small - Changing X to 1000");
|
||||
}
|
||||
if ((zRange < 1000) && (zRange != 0)) {
|
||||
zRange = 1000;
|
||||
Out.err("Z size too small - Changing Z to 1000");
|
||||
}
|
||||
|
||||
} catch (final NumberFormatException ex) {
|
||||
Out.err("Invalid X or Z argument.");
|
||||
Out.err("Please Enter the size of world you want. Example: X:1000 Z:1000");
|
||||
xRange = Input_CLI.getInt("X:");
|
||||
zRange = Input_CLI.getInt("Z:");
|
||||
|
||||
//return;
|
||||
}
|
||||
|
||||
var.verbose = false; // Verifing that these vars are false
|
||||
var.alternate = false; // before changing them...
|
||||
|
||||
// This is embarrassing. Don't look.
|
||||
try {
|
||||
for (int i = 0; i < (args.length - 2); i++) {
|
||||
final String nextSwitch = args[i + 2].toLowerCase();
|
||||
if (nextSwitch.equals("-verbose") || nextSwitch.equals("-v")) {
|
||||
var.verbose = true;
|
||||
Out.out("Notice: Verbose Mode");
|
||||
|
||||
} else if (nextSwitch.startsWith("-i")) {
|
||||
var.increment = Integer.parseInt(args[i + 2].substring(2));
|
||||
Out.out("Notice: Non-Default Increment: " + var.increment);
|
||||
|
||||
} else if (nextSwitch.startsWith("-w")) {
|
||||
var.ignoreWarnings = true;
|
||||
Out.out("Notice: Warnings from Server are Ignored");
|
||||
|
||||
} else if (nextSwitch.equals("-alt") || nextSwitch.equals("-a")) {
|
||||
var.alternate = true;
|
||||
Out.out("Notice: Using Alternate Launching");
|
||||
|
||||
} else if (nextSwitch.startsWith("-x")) {
|
||||
xOffset = Integer.valueOf(args[i + 2].substring(2));
|
||||
Out.out("Notice: X Offset: " + xOffset);
|
||||
|
||||
} else if (nextSwitch.startsWith("-y") || nextSwitch.startsWith("-z")) { //NOTE: "-y" is just here for backwards compatibility
|
||||
zOffset = Integer.valueOf(args[i + 2].substring(2));
|
||||
Out.out("Notice: Z Offset: " + zOffset);
|
||||
if (nextSwitch.startsWith("-y")) {
|
||||
Out.out("Notice: MLG now uses Z instead of Y. Please use the -z switch instead");
|
||||
Time.waitTenSec(false);
|
||||
}
|
||||
|
||||
} else {
|
||||
var.serverPath = args[i + 2];
|
||||
Out.out("Notice: Attempting to use Alternate Server:" + var.serverPath);
|
||||
}
|
||||
}
|
||||
} catch (final NumberFormatException ex) {
|
||||
Out.err("Invalid switch value.");
|
||||
return;
|
||||
}
|
||||
// Basic Program Initialization
|
||||
Startup.initialStart();
|
||||
boolean quit = false;
|
||||
quit = Startup.programArguments();
|
||||
if (quit) { return; }
|
||||
quit = Startup.confFile();
|
||||
if (quit) { return; }
|
||||
|
||||
WorldVerify.verifyWorld();
|
||||
|
||||
@ -436,8 +158,8 @@ public class Main {
|
||||
|
||||
System.gc(); //run the garbage collector - hopefully free up some memory!
|
||||
|
||||
xRange = var.resumeX;
|
||||
zRange = var.resumeZ;
|
||||
var.xRange = var.resumeX;
|
||||
var.zRange = var.resumeZ;
|
||||
|
||||
}
|
||||
}
|
||||
@ -469,7 +191,7 @@ public class Main {
|
||||
System.exit(1); // we got a warning or severe error
|
||||
}
|
||||
|
||||
if ((xRange == 0) & (zRange == 0)) { //If the server is launched with an X and a Z of zero, then we just shutdown MLG after the initial launch.
|
||||
if ((var.xRange == 0) & (var.zRange == 0)) { //If the server is launched with an X and a Z of zero, then we just shutdown MLG after the initial launch.
|
||||
return;
|
||||
}
|
||||
|
||||
@ -478,7 +200,8 @@ public class Main {
|
||||
"# " + var.PROG_NAME + " " + var.VERSION + " - " + SelfAware.JVMinfo()
|
||||
+ var.newLine + "# " + var.MC_Server_Version + var.newLine
|
||||
+ "# Started: " + var.dateFormat.format(generationStartTimeTracking)
|
||||
+ var.newLine + "##Size: X" + xRange + "Z" + zRange + var.newLine);
|
||||
+ var.newLine + "##Size: X" + var.xRange + "Z" + var.zRange
|
||||
+ var.newLine);
|
||||
|
||||
Out.out("");
|
||||
|
||||
@ -498,34 +221,31 @@ public class Main {
|
||||
+ "# Spawn: " + spawn.toString() + var.newLine);
|
||||
|
||||
boolean overridden = false;
|
||||
if (xOffset == null) {
|
||||
xOffset = spawn.getX();
|
||||
if (var.xOffset == null) {
|
||||
var.xOffset = spawn.getX();
|
||||
} else {
|
||||
overridden = true;
|
||||
}
|
||||
if (zOffset == null) {
|
||||
zOffset = spawn.getZ();
|
||||
if (var.zOffset == null) {
|
||||
var.zOffset = spawn.getZ();
|
||||
} else {
|
||||
overridden = true;
|
||||
}
|
||||
|
||||
//TODO: make this optional
|
||||
final boolean useChunks = true;
|
||||
|
||||
if (useChunks) { // use Chunks or Regions
|
||||
xRange = (int) (Math.ceil(((double) xRange) / ((double) 16))) * 16; //say xRange was entered as 1000. this changes it to be 1008, a multiple of 16. (the size of a chunk)
|
||||
zRange = (int) (Math.ceil(((double) zRange) / ((double) 16))) * 16; //say zRange was entered as 2000. there is no change, as it already is a multiple of 16.
|
||||
xOffset = (int) (Math.ceil(((double) xOffset) / ((double) 16))) * 16;
|
||||
zOffset = (int) (Math.ceil(((double) zOffset) / ((double) 16))) * 16;
|
||||
if (var.useChunks) { // use Chunks or Regions
|
||||
var.xRange = (int) (Math.ceil(((double) var.xRange) / ((double) 16))) * 16; //say xRange was entered as 1000. this changes it to be 1008, a multiple of 16. (the size of a chunk)
|
||||
var.zRange = (int) (Math.ceil(((double) var.zRange) / ((double) 16))) * 16; //say zRange was entered as 2000. there is no change, as it already is a multiple of 16.
|
||||
var.xOffset = (int) (Math.ceil(((double) var.xOffset) / ((double) 16))) * 16;
|
||||
var.zOffset = (int) (Math.ceil(((double) var.zOffset) / ((double) 16))) * 16;
|
||||
} else {
|
||||
xRange = (int) (Math.ceil(((double) xRange) / ((double) 512))) * 512; //say xRange was entered as 1000. this changes it to be 1024, a multiple of 512. (the size of a region)
|
||||
zRange = (int) (Math.ceil(((double) zRange) / ((double) 512))) * 512; //say zRange was entered as 2048. there is no change, as it already is a multiple of 512.
|
||||
xOffset = (int) (Math.ceil(((double) xOffset) / ((double) 512))) * 512;
|
||||
zOffset = (int) (Math.ceil(((double) zOffset) / ((double) 512))) * 512;
|
||||
var.xRange = (int) (Math.ceil(((double) var.xRange) / ((double) 512))) * 512; //say xRange was entered as 1000. this changes it to be 1024, a multiple of 512. (the size of a region)
|
||||
var.zRange = (int) (Math.ceil(((double) var.zRange) / ((double) 512))) * 512; //say zRange was entered as 2048. there is no change, as it already is a multiple of 512.
|
||||
var.xOffset = (int) (Math.ceil(((double) var.xOffset) / ((double) 512))) * 512;
|
||||
var.zOffset = (int) (Math.ceil(((double) var.zOffset) / ((double) 512))) * 512;
|
||||
}
|
||||
|
||||
if (overridden) {
|
||||
Out.out("Centering land generation on [" + xOffset + ", " + zOffset
|
||||
Out.out("Centering land generation on [" + var.xOffset + ", " + var.zOffset
|
||||
+ "] due to switches.");
|
||||
}
|
||||
|
||||
@ -543,13 +263,13 @@ public class Main {
|
||||
// run mlg on remaining list of spawn points.
|
||||
|
||||
// X
|
||||
xLoops = ((double) xRange / (double) var.increment); //How many loops do we need?
|
||||
xLoops = ((double) var.xRange / (double) var.increment); //How many loops do we need?
|
||||
xLoops = Math.ceil(xLoops); //round up to find out!
|
||||
xRangeAdj = (int) (xLoops * var.increment);
|
||||
xLoops = xLoops + 1;
|
||||
|
||||
// Z
|
||||
zLoops = ((double) zRange / (double) var.increment); //How many loops do we need?
|
||||
zLoops = ((double) var.zRange / (double) var.increment); //How many loops do we need?
|
||||
zLoops = Math.ceil(zLoops); //round up to find out!
|
||||
zRangeAdj = (int) (zLoops * var.increment);
|
||||
zLoops = zLoops + 1;
|
||||
@ -568,9 +288,9 @@ public class Main {
|
||||
for (int currentX = 0; currentX <= (xRangeAdj / 2); currentX += var.increment) {
|
||||
curXloops++;
|
||||
if (curXloops == 1) {
|
||||
currentX = (((0 - xRange) / 2) + (var.incrementFull / 2)); // West Edge of map
|
||||
currentX = (((0 - var.xRange) / 2) + (var.incrementFull / 2)); // West Edge of map
|
||||
} else if (currentX >= ((xRangeAdj / 2) - (var.increment / 2))) {
|
||||
currentX = ((xRange / 2) - (var.incrementFull / 2)); // East Edge of map
|
||||
currentX = ((var.xRange / 2) - (var.incrementFull / 2)); // East Edge of map
|
||||
}
|
||||
|
||||
for (int currentZ = 0; currentZ <= (zRangeAdj / 2); currentZ += var.increment) {
|
||||
@ -578,15 +298,15 @@ public class Main {
|
||||
|
||||
curZloops++;
|
||||
if (curZloops == 1) {
|
||||
currentZ = (((0 - zRange) / 2) + (var.incrementFull / 2)); // North Edge of map
|
||||
currentZ = (((0 - var.zRange) / 2) + (var.incrementFull / 2)); // North Edge of map
|
||||
} else if (currentZ >= ((zRangeAdj / 2) - (var.increment / 2))) {
|
||||
currentZ = ((zRange / 2) - (var.incrementFull / 2)); // South Edge of map
|
||||
currentZ = ((var.zRange / 2) - (var.incrementFull / 2)); // South Edge of map
|
||||
}
|
||||
|
||||
{
|
||||
// add Coordinates to arraylist here
|
||||
final Coordinates tempCoords =
|
||||
new Coordinates(currentX + xOffset, 64, currentZ + zOffset);
|
||||
new Coordinates(currentX + var.xOffset, 64, currentZ + var.zOffset);
|
||||
launchList.add(tempCoords);
|
||||
|
||||
if (var.testing) {
|
||||
@ -701,9 +421,7 @@ public class Main {
|
||||
}
|
||||
|
||||
if (var.webLaunch && java.awt.Desktop.isDesktopSupported()) {
|
||||
final URI splashPage =
|
||||
//URI.create("https://sites.google.com/site/minecraftlandgenerator/home/mlg_splash");
|
||||
URI.create("http://adf.ly/520855/splashbanner");
|
||||
final URI splashPage = URI.create("http://adf.ly/520855/splashbanner");
|
||||
try {
|
||||
java.awt.Desktop.getDesktop().browse(splashPage);
|
||||
} catch (final IOException e) {
|
||||
@ -711,7 +429,7 @@ public class Main {
|
||||
}
|
||||
} else {
|
||||
Out.out("Please Visit: http://adf.ly/520855/mlg");
|
||||
Out.out("Or: https://sites.google.com/site/minecraftlandgenerator/");
|
||||
Out.out("Or: " + var.WEBSITE);
|
||||
Out.out("Thanks!");
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,9 @@
|
||||
package morlok8k.MinecraftLandGenerator;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import morlok8k.MinecraftLandGenerator.GUI.MLG_GUI;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author morlok8k
|
||||
@ -60,4 +64,45 @@ public class Out {
|
||||
static void outS(final String str) {
|
||||
System.out.println("[Server] " + str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a dialog box, and outputs a formatted string to System.out as a line.
|
||||
*
|
||||
* @param msg
|
||||
* Message
|
||||
* @param title
|
||||
* title
|
||||
* @param messageType
|
||||
* JOptionPane messageType
|
||||
*
|
||||
* @author Morlok8k
|
||||
*/
|
||||
public static void msg(final String msg, final String title, final int messageType) {
|
||||
String msgType = "";
|
||||
|
||||
switch (messageType) {
|
||||
case JOptionPane.ERROR_MESSAGE:
|
||||
msgType = "Error Message";
|
||||
break;
|
||||
case JOptionPane.INFORMATION_MESSAGE:
|
||||
msgType = "Information Message";
|
||||
break;
|
||||
case JOptionPane.WARNING_MESSAGE:
|
||||
msgType = "Warning Message";
|
||||
break;
|
||||
case JOptionPane.QUESTION_MESSAGE:
|
||||
msgType = "Question Message";
|
||||
break;
|
||||
case JOptionPane.PLAIN_MESSAGE:
|
||||
msgType = "Message";
|
||||
break;
|
||||
default:
|
||||
msgType = "Message";
|
||||
break;
|
||||
}
|
||||
|
||||
System.out.println("[" + msgType + "] Title: " + title + var.newLine + msg);
|
||||
JOptionPane.showMessageDialog(MLG_GUI.frmMLG_GUI, msg, title, messageType);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public class Readme_and_HelpInfo {
|
||||
+ "The program makes a backup of level.dat as level_backup.dat before editing, and restores the backup at the end. In the event that a level_backup.dat file already exists, the program will refuse to proceed, leaving the user to determine why the level_backup.dat file exists and whether they would rather restore it or delete it, which must be done manually." + n
|
||||
+ n
|
||||
+ "This program is public domain, and the source code is included in the .jar file. (If accidently missing, like in 1.3.0 and 1.4.0, it is always available at Github.)" + n
|
||||
+ "The JNLP library is included (inside the .jar). It is not public domain. Its license is included, as LICENSE.TXT." + n
|
||||
+ "The JNBT library is included (inside the .jar). It is not public domain. Its license is included, as LICENSE.TXT." + n
|
||||
+ "It is also available at: http://jnbt.sourceforge.net/" + n
|
||||
+ n
|
||||
+ "The \"unescape\" method/function is also not Public Domain. Its License is the W3C\u00A9 Software License, and located here: http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231"
|
||||
|
312
src/morlok8k/MinecraftLandGenerator/Startup.java
Normal file
312
src/morlok8k/MinecraftLandGenerator/Startup.java
Normal file
@ -0,0 +1,312 @@
|
||||
package morlok8k.MinecraftLandGenerator;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
* Program Initialization code. placed here so both CLI and GUI can use it.
|
||||
*
|
||||
* @author morlok8k
|
||||
*
|
||||
*/
|
||||
public class Startup {
|
||||
|
||||
public static void initialStart() {
|
||||
|
||||
// Lets get the date, and our BuildID
|
||||
var.date = new Date();
|
||||
Update.readBuildID();
|
||||
|
||||
// The following displays no matter what happens, so we needed this date stuff to happen first.
|
||||
|
||||
Out.out(var.PROG_NAME + " version " + var.VERSION);
|
||||
Out.out("BuildID: (" + var.MLG_Last_Modified_Date.getTime() + ")"); // instead of dateformatting the buildid, we return the raw Long number.
|
||||
// thus different timezones wont display a different buildID
|
||||
Out.out("This version was last modified on "
|
||||
+ var.dateFormat.format(var.MLG_Last_Modified_Date));
|
||||
Out.out("");
|
||||
Out.out("Uses a Minecraft server to generate square land of a specified size.");
|
||||
Out.out("");
|
||||
Out.out("");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* CLI only: Reads arguments from command line
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static boolean programArguments() {
|
||||
|
||||
// =====================================================================
|
||||
// INSTRUCTIONS
|
||||
// =====================================================================
|
||||
|
||||
// check for -nowait, and remove from arguments if it exists. (we remove it for compatibility reasons with the rest of the existing code.)
|
||||
// (-nowait is the only universal switch - it can be used with anything. its basically for scripting, as it turns off the 10sec wait for human readability)
|
||||
String[] newArgs = new String[var.args.length];
|
||||
newArgs = var.args;
|
||||
newArgs = StringArrayParse.Parse(newArgs, "-n"); //parse out -n
|
||||
newArgs = StringArrayParse.Parse(newArgs, "-nowait"); //parse out -nowait
|
||||
if (!(var.args.equals(newArgs))) { //do the freshly parsed args match the original?
|
||||
var.dontWait = true; //if not, we dont wait for anything!
|
||||
var.args = newArgs; //use the freshly parsed args for everything else now...
|
||||
Out.out("Notice: Not waiting for anything...");
|
||||
}
|
||||
|
||||
if (var.args.length == 0) { //we didn't find a an X and Z size, so lets ask for one.
|
||||
Out.out("Please Enter the size of world you want. Example: X:1000 Z:1000");
|
||||
Out.outP(var.MLG + "X:");
|
||||
var.xRange = Input_CLI.getInt("X:");
|
||||
Out.outP(var.MLG + "Z:");
|
||||
var.zRange = Input_CLI.getInt("Z:");
|
||||
var.args = new String[] { String.valueOf(var.xRange), String.valueOf(var.zRange) };
|
||||
|
||||
}
|
||||
|
||||
if (var.args[0].equalsIgnoreCase("-version") || var.args[0].equalsIgnoreCase("-help")
|
||||
|| var.args[0].equals("/?")) {
|
||||
|
||||
Readme_and_HelpInfo.showHelp(true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// =====================================================================
|
||||
// STARTUP AND CONFIG
|
||||
// =====================================================================
|
||||
|
||||
// the arguments are apparently okay so far. parse the conf file.
|
||||
if (var.args[0].equalsIgnoreCase("-conf")) {
|
||||
|
||||
if (var.args.length == 2) {
|
||||
if (var.args[1].equalsIgnoreCase("download")) {
|
||||
final boolean fileSuccess =
|
||||
DownloadFile.downloadFile(var.github_MLG_Conf_URL, var.testing);
|
||||
if (fileSuccess) {
|
||||
Out.out(var.MinecraftLandGeneratorConf + " file downloaded.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FileWrite.saveConf(true); //new conf file
|
||||
return true;
|
||||
|
||||
} else if (var.args[0].equalsIgnoreCase("-ps")
|
||||
|| var.args[0].equalsIgnoreCase("-printspawn")) {
|
||||
// okay, sorry, this is an ugly hack, but it's just a last-minute feature.
|
||||
Misc.printSpawn();
|
||||
Time.waitTenSec(false);
|
||||
return true;
|
||||
} else if (var.args[0].equalsIgnoreCase("-build")) {
|
||||
Update.buildID(false);
|
||||
return true;
|
||||
} else if (var.args[0].equalsIgnoreCase("-update")) {
|
||||
Update.updateMLG();
|
||||
Time.waitTenSec(false);
|
||||
return true;
|
||||
} else if (var.args[0].equalsIgnoreCase("-readme")) {
|
||||
|
||||
if (var.args.length == 2) {
|
||||
Readme_and_HelpInfo.readMe(var.args[1]);
|
||||
} else {
|
||||
Readme_and_HelpInfo.readMe(null);
|
||||
}
|
||||
return true;
|
||||
} else if (var.args[0].equalsIgnoreCase("-downloadfile")) {
|
||||
if (var.args.length == 2) {
|
||||
DownloadFile.downloadFile(var.args[1], true);
|
||||
} else {
|
||||
Out.out("No File to Download!");
|
||||
Time.waitTenSec(false);
|
||||
}
|
||||
return true;
|
||||
|
||||
} else if (var.args[0].equalsIgnoreCase("-downloadlist")) {
|
||||
|
||||
if (var.args.length == 2) {
|
||||
String origMD5 = "";
|
||||
String recheckMD5 = "";
|
||||
|
||||
try {
|
||||
final File config = new File(var.args[1]);
|
||||
try {
|
||||
origMD5 = MD5.fileMD5(config.toString());
|
||||
} catch (final NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
final BufferedReader in = new BufferedReader(new FileReader(config));
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
if (line.contains("###RECHECK###")) {
|
||||
var.recheckFlag = !var.recheckFlag;
|
||||
} else {
|
||||
DownloadFile.downloadFile(line, true);
|
||||
}
|
||||
}
|
||||
in.close();
|
||||
|
||||
if (var.recheckFlag == true) { // the first line is always the location of this file. the second is the recheck flag, if we want to.
|
||||
try {
|
||||
recheckMD5 = MD5.fileMD5(config.toString());
|
||||
} catch (final NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (!origMD5.contentEquals(recheckMD5)) {
|
||||
final BufferedReader in_recheck =
|
||||
new BufferedReader(new FileReader(config));
|
||||
String line_recheck;
|
||||
while ((line_recheck = in_recheck.readLine()) != null) {
|
||||
if (line_recheck.contains("###RECHECK###")) {
|
||||
var.recheckFlag = !var.recheckFlag;
|
||||
} else {
|
||||
DownloadFile.downloadFile(line_recheck, true);
|
||||
}
|
||||
}
|
||||
in_recheck.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} catch (final FileNotFoundException ex) {
|
||||
System.err.println(var.args[1] + " - File not found");
|
||||
Time.waitTenSec(false);
|
||||
return true;
|
||||
} catch (final IOException ex) {
|
||||
System.err.println(var.args[1] + " - Could not read file.");
|
||||
Time.waitTenSec(false);
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
Out.out("No File with links!");
|
||||
Time.waitTenSec(false);
|
||||
}
|
||||
return true;
|
||||
|
||||
} else if (var.args.length == 1) {
|
||||
Out.out("For help, use java -jar " + var.MLGFileNameShort + " -help");
|
||||
Time.waitTenSec(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
// ARGUMENTS
|
||||
try {
|
||||
var.xRange = Integer.parseInt(var.args[0]);
|
||||
var.zRange = Integer.parseInt(var.args[1]);
|
||||
|
||||
if ((var.xRange < 1000) && (var.xRange != 0)) {
|
||||
var.xRange = 1000; //if less than 1000, (and not 0) set to 1000 (Calculations don't work well on very small maps)
|
||||
Out.err("X size too small - Changing X to 1000");
|
||||
}
|
||||
if ((var.zRange < 1000) && (var.zRange != 0)) {
|
||||
var.zRange = 1000;
|
||||
Out.err("Z size too small - Changing Z to 1000");
|
||||
}
|
||||
|
||||
} catch (final NumberFormatException ex) {
|
||||
Out.err("Invalid X or Z argument.");
|
||||
Out.err("Please Enter the size of world you want. Example: X:1000 Z:1000");
|
||||
var.xRange = Input_CLI.getInt("X:");
|
||||
var.zRange = Input_CLI.getInt("Z:");
|
||||
|
||||
//return;
|
||||
}
|
||||
|
||||
// This is embarrassing. Don't look.
|
||||
try {
|
||||
for (int i = 0; i < (var.args.length - 2); i++) {
|
||||
final String nextSwitch = var.args[i + 2].toLowerCase();
|
||||
if (nextSwitch.equals("-verbose") || nextSwitch.equals("-v")) {
|
||||
var.verbose = true;
|
||||
Out.out("Notice: Verbose Mode");
|
||||
|
||||
} else if (nextSwitch.startsWith("-i")) {
|
||||
var.increment = Integer.parseInt(var.args[i + 2].substring(2));
|
||||
Out.out("Notice: Non-Default Increment: " + var.increment);
|
||||
|
||||
} else if (nextSwitch.startsWith("-w")) {
|
||||
var.ignoreWarnings = true;
|
||||
Out.out("Notice: Warnings from Server are Ignored");
|
||||
|
||||
} else if (nextSwitch.equals("-alt") || nextSwitch.equals("-a")) {
|
||||
var.alternate = true;
|
||||
Out.out("Notice: Using Alternate Launching");
|
||||
|
||||
} else if (nextSwitch.startsWith("-x")) {
|
||||
var.xOffset = Integer.valueOf(var.args[i + 2].substring(2));
|
||||
Out.out("Notice: X Offset: " + var.xOffset);
|
||||
|
||||
} else if (nextSwitch.startsWith("-y") || nextSwitch.startsWith("-z")) { //NOTE: "-y" is just here for backwards compatibility
|
||||
var.zOffset = Integer.valueOf(var.args[i + 2].substring(2));
|
||||
Out.out("Notice: Z Offset: " + var.zOffset);
|
||||
if (nextSwitch.startsWith("-y")) {
|
||||
Out.out("Notice: MLG now uses Z instead of Y. Please use the -z switch instead");
|
||||
Time.waitTenSec(false);
|
||||
}
|
||||
|
||||
} else {
|
||||
var.serverPath = var.args[i + 2];
|
||||
Out.out("Notice: Attempting to use Alternate Server:" + var.serverPath);
|
||||
}
|
||||
}
|
||||
} catch (final NumberFormatException ex) {
|
||||
Out.err("Invalid switch value.");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false; // success!
|
||||
}
|
||||
|
||||
public static boolean confFile() {
|
||||
FileRead.readConf();
|
||||
|
||||
boolean oldConf = false; // This next section checks to see if we have a old configuration file (or none!)
|
||||
|
||||
if ((var.serverPath == null) || (var.javaLine == null)) { // MLG 1.2 Check for a valid .conf file.
|
||||
Out.err(var.MinecraftLandGeneratorConf
|
||||
+ " does not contain all required properties. Making New File!"); // Please recreate it by running this application with -conf.
|
||||
|
||||
// return;
|
||||
|
||||
// We no longer quit. We generate a new one with defaults.
|
||||
|
||||
var.javaLine = var.defaultJavaLine;
|
||||
var.serverPath = ".";
|
||||
oldConf = true;
|
||||
}
|
||||
|
||||
if (var.doneText == null) { // MLG 1.4.0
|
||||
oldConf = true;
|
||||
} else if (var.preparingText == null) { // MLG 1.4.0
|
||||
oldConf = true;
|
||||
} else if (var.preparingLevel == null) { // MLG 1.4.5 / 1.5.0
|
||||
oldConf = true;
|
||||
} else if (var.level_1 == null) { // MLG 1.4.5 / 1.5.0
|
||||
oldConf = true;
|
||||
} else if (var.level_0 == null) { // MLG 1.5.1 / 1.6.0
|
||||
oldConf = true;
|
||||
}
|
||||
|
||||
if (oldConf) {
|
||||
Out.err("Old Version of " + var.MinecraftLandGeneratorConf + " found. Updating...");
|
||||
|
||||
FileWrite.saveConf(false); //old conf
|
||||
|
||||
Time.waitTenSec(false);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
return false; // success!
|
||||
}
|
||||
|
||||
}
|
@ -33,6 +33,9 @@ public class var {
|
||||
/** Authors */
|
||||
public static final String AUTHORS = "Corrodias, Morlok8k, pr0f1x, jaseg";
|
||||
|
||||
/** Website */
|
||||
public static final String WEBSITE = "https://sites.google.com/site/minecraftlandgenerator/";
|
||||
|
||||
//
|
||||
// Operating System Info:
|
||||
/** "/" or "\" depending on system */
|
||||
@ -254,4 +257,22 @@ public class var {
|
||||
|
||||
/** output GUI stuff when using GUI mode, or dont. */
|
||||
public static boolean UsingGUI = false;
|
||||
|
||||
/** Range of X to generate */
|
||||
public static int xRange = 0;
|
||||
|
||||
/** Range of Z to generate */
|
||||
public static int zRange = 0;
|
||||
|
||||
/** X Offset (Either spawnpoint or specified) */
|
||||
public static Integer xOffset = null;
|
||||
|
||||
/** Z Offset (Either spawnpoint or specified) */
|
||||
public static Integer zOffset = null;
|
||||
|
||||
/** args */
|
||||
public static String[] args;
|
||||
|
||||
/** Chunks or Regions? */
|
||||
public static boolean useChunks = true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user