1.6.3 final 2 (really only code optimization)

This commit is contained in:
Morlok8k 2012-06-12 20:48:36 -07:00
parent f66041ccfe
commit 0d7bd225a7
9 changed files with 113 additions and 82 deletions

View File

@ -24,63 +24,63 @@ org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=warning
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=enabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=enabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning
org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled

2
README
View File

@ -1,7 +1,7 @@
Minecraft Land Generator version 1.6.3
Updated June 12, 2012
(BuildID: 1339493851000)
(BuildID: 1339559312000)
Original Code by Corrodias November 2010
Enhanced Code by Morlok8k Feb. 2011 to Now (or at least to June 12, 2012!)

View File

@ -54,3 +54,4 @@ F96F4F3862138D498B203C2848086289=1338535367000# MLG v1.6.3
6125D0807B8B68763C3B8BADD08ECC8C=1338894449000# MLG v1.6.3
F00F81A5C5833DBFF95E85EFD1B8460B=1338951984000# MLG v1.6.3
A28CD4B9DE8E3CB25AB56368A4C44A51=1339493851000# MLG v1.6.3
15241C4B45D9711F4AA4EF25004FEDA6=1339559312000# MLG v1.6.3

View File

@ -1,6 +1,6 @@
#Minecraft Land Generator Configuration File: Version: 1.6.3
#Authors: Corrodias, Morlok8k, pr0f1x
#Auto-Generated: Tuesday, June 12, 2012 at 2:37 AM Pacific Daylight Time
#Auto-Generated: Tuesday, June 12, 2012 at 8:48 PM Pacific Daylight Time
#Line to run server:
Java=java -Djava.awt.headless=true -Djline.terminal=jline.UnsupportedTerminal -Duser.language=en -Xms1024m -Xmx1024m -Xincgc -jar minecraft_server.jar nogui

Binary file not shown.

View File

@ -52,15 +52,35 @@ import org.jnbt.Tag;
*/
public class Main {
// Version Number!
public static final String PROG_NAME = "Minecraft Land Generator";
public static final String VERSION = "1.6.3";
public static final String AUTHORS = "Corrodias, Morlok8k, pr0f1x";
//
//
// Public Vars:
public static boolean testing = false; // display more output when debugging
public static final String PROG_NAME = "Minecraft Land Generator"; // Program Name
public static final String VERSION = "1.6.3"; // Version Number!
public static final String AUTHORS = "Corrodias, Morlok8k, pr0f1x"; // Authors
public static final String fileSeparator = System.getProperty("file.separator");
public static final String newLine = System.getProperty("line.separator");
private int increment = 380;
public static String MLG = "[MLG] ";
public static String MLGe = "[MLG-ERROR] ";
public static DateFormat dateFormat_MDY = new SimpleDateFormat("MMMM d, yyyy", Locale.ENGLISH);
public static Date MLG_Last_Modified_Date = null;
public static String MLGFileNameShort = null;
public static Scanner sc = new Scanner(System.in);
public static final String MinecraftLandGeneratorConf = "MinecraftLandGenerator.conf";
public static final String defaultReadmeFile = "_MLG_Readme.txt";
//
//
//Private Vars:
private static int MinecraftServerChunkPlayerCache = 625;
private static int increment = (int) (Math.sqrt(MinecraftServerChunkPlayerCache) * 16) - 20; //private int increment = 380;
private static ProcessBuilder minecraft = null;
private static String javaLine = null;
private static final String defaultJavaLine =
@ -96,36 +116,27 @@ public class Main {
private static boolean ignoreWarnings = false;
private static LongTag randomSeed = null;
public static String MLG = "[MLG] ";
public static String MLGe = "[MLG-ERROR] ";
private static DateFormat dateFormat = null;
//private static DateFormat dateFormatBuildID = null;
public static DateFormat dateFormat_MDY = null;
private static Date date = null;
public static Date MLG_Last_Modified_Date = null;
private static DateFormat dateFormat = new SimpleDateFormat( // Lets get a nice Date format for display
"EEEE, MMMM d, yyyy 'at' h:mm a zzzz", Locale.ENGLISH);
private static Date date = null; // date stuff
private static Long MLG_Last_Modified_Long = 0L;
private static final Class<?> cls = Main.class;
private static String MLGFileName = null;
public static String MLGFileNameShort = null;
private static final String rsrcError = "rsrcERROR";
private static String buildIDFile = "MLG-BuildID";
private static boolean isCompiledAsJar = false;
private static String MLG_Current_Hash = null;
private static int inf_loop_protect_BuildID = 0;
private static boolean flag_downloadedBuildID = false;
public static Scanner sc = new Scanner(System.in);
private static ArrayList<String> timeStamps = new ArrayList<String>();
public static final String MinecraftLandGeneratorConf = "MinecraftLandGenerator.conf";
public static final String defaultReadmeFile = "_MLG_Readme.txt";
private static final String MLG_JarFile = "MinecraftLandGenerator.jar";
private static final String github_URL =
"https://raw.github.com/Morlok8k/MinecraftLandGenerator/master/bin/"; // just removing some redundancy
private static final String github_MLG_Conf_URL = github_URL + MinecraftLandGeneratorConf;
private static final String github_MLG_BuildID_URL = github_URL + buildIDFile;
private static final String github_MLG_jar_URL = github_URL + MLG_JarFile;
@ -133,6 +144,7 @@ public class Main {
private static Boolean recheckFlag = false;
private static long startTime = 0L;
// RCON Stuff (not currently used yet...)
private static boolean useRCON = false; //use RCON to communicate with server. ***Experimental***
@SuppressWarnings("unused")
private static boolean rcon_Enabled = false; //is server is set to use RCON?
@ -142,15 +154,12 @@ public class Main {
private static boolean assertsEnabled = false; //future debugging use...
//////
public static final boolean testing = false; // display more output when debugging
//////
// REMINDER: because I always forget/mix up languages:
// "static" in java means "global"
// "final" means "constant"
//////////////////////////////////////////////////////////
// REMINDER: Because I always forget/mix up languages: //
// "static" in java means "global" to this class //
// "final" means "constant" //
// public/private shows/hides between classes //
//////////////////////////////////////////////////////////
/**
* @param args
@ -159,13 +168,18 @@ public class Main {
public static void main(String[] args) {
startTime = System.currentTimeMillis();
assert assertsEnabled = true; // Intentional side-effect!!! (This will cause a Warning, which is safe to ignore: "Possible accidental assignment in place of a comparison. A condition expression should not be reduced to an assignment")
// This is really just here for debugging...
// I plan on adding more asserts later, but for now, this will do.
assert assertsEnabled = true; // Intentional side-effect!!! (This may cause a Warning, which is safe to ignore: "Possible accidental assignment in place of a comparison. A condition expression should not be reduced to an assignment")
if (assertsEnabled) {
out("assertsEnabled: " + assertsEnabled);
verbose = true;
out("Verbose mode forced!");
testing = true;
out("Debug mode forced!");
}
// Finally, Lets Start MLG!
(new Main()).run(args); // Why? this avoids "static" compiling issues.
}
@ -178,11 +192,8 @@ public class Main {
*/
private void run(String[] args) {
// Lets get a nice Date format for display
dateFormat = new SimpleDateFormat("EEEE, MMMM d, yyyy 'at' h:mm a zzzz", Locale.ENGLISH);
dateFormat_MDY = new SimpleDateFormat("MMMM d, yyyy", Locale.ENGLISH);
// Lets get the date, and our BuildID
date = new Date();
readBuildID();
// The following displays no matter what happens, so we needed this date stuff to happen first.
@ -487,7 +498,7 @@ public class Main {
long generationStartTimeTracking = System.currentTimeMillis(); //Start of time remaining calculations.
runMinecraft(verbose, alternate);
runMinecraft(alternate);
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.
return;
@ -643,7 +654,7 @@ public class Main {
setSpawn(serverLevel, currentX + xOffset, 64, currentZ + zOffset);
// Launch the server
runMinecraft(verbose, alternate);
runMinecraft(alternate);
out("");
if (curZloops == 1) {
@ -797,17 +808,17 @@ public class Main {
* one is printed to the console when the Done! message is detected. If "verbose" is true, the process's output will also be printed to the console.
*
* @param minecraft
* @param verbose
*
* @throws IOException
* @author Corrodias
*/
protected static void runMinecraft(boolean verbose, boolean alternate) throws IOException {
protected static void runMinecraft(boolean alternate) throws IOException {
if (verbose) {
out("Starting server.");
}
boolean warning = false;
boolean cantKeepUp = false;
boolean warningsWeCanIgnore = false;
final boolean ignoreWarningsOriginal = ignoreWarnings;
// monitor output and print to console where required.
@ -999,8 +1010,20 @@ public class Main {
//Here we want to ignore the most common warning: "Can't keep up!"
if (line.contains("Can't keep up!")) { //TODO: add to .conf
cantKeepUp = true; //[WARNING] Can't keep up! Did the system time change, or is the server overloaded?
warningsWeCanIgnore = true; //[WARNING] Can't keep up! Did the system time change, or is the server overloaded?
ignoreWarnings = true;
} else if (line.contains("[WARNING] To start the server with more ram")) {
if (verbose == false) { // If verbose is true, we already displayed it.
outS(line);
}
warningsWeCanIgnore = true; //we can safely ignore this...
ignoreWarnings = true;
} else if (line.contains("Error occurred during initialization of VM")
|| line.contains("Could not reserve enough space for object heap")) {
if (verbose == false) { // If verbose is true, we already displayed it.
outP("[Java Error] " + line);
}
warning = true;
}
if (ignoreWarnings == false) {
@ -1045,7 +1068,7 @@ public class Main {
}
}
if (cantKeepUp) {
if (warningsWeCanIgnore) {
ignoreWarnings = ignoreWarningsOriginal;
}
}
@ -1094,7 +1117,7 @@ public class Main {
/**
* @return
*/
private boolean printSpawn() {
private static boolean printSpawn() {
// ugh, sorry, this is an ugly hack, but it's a last-minute feature. this is a lot of duplicated code.
// - Fixed by Morlok8k
@ -1186,14 +1209,15 @@ public class Main {
try {
MLG_Current_Hash = fileMD5(MLGFileName);
// out(hash + " " + MLGFileName);®
// out(hash + " " + MLGFileName);
} catch (Exception e) {
out("Error: MLG_MD5 from file failed");
e.printStackTrace();
}
}
Date time = null;
Date time = new Date(new Long(0));
try {
time = getCompileTimeStamp(cls);
} catch (Exception e) {
@ -1627,7 +1651,7 @@ public class Main {
}
}
private void readConf() {
private static void readConf() {
//TODO: element comment
//String errorMsg = "";
@ -1744,7 +1768,7 @@ public class Main {
* true: Uses Default values. false: uses existing values
* @author Morlok8k
*/
private void saveConf(boolean newConf) {
private static void saveConf(boolean newConf) {
String jL = null; //javaLine
String sP = null; //serverPath
@ -1795,7 +1819,7 @@ public class Main {
}
private void verifyWorld() {
private static void verifyWorld() {
//TODO: element comment
// verify that we ended up with a good server path, either from the file or from an argument.

View File

@ -215,9 +215,9 @@ public class MLG_Readme_and_HelpInfo {
NewLine = NewLine + Main.MLG;
}
String MLGFileNameShort = Main.MLGFileNameShort;
String MinecraftLandGeneratorConf = Main.MinecraftLandGeneratorConf;
String defaultReadmeFile = Main.defaultReadmeFile;
MLGFileNameShort = Main.MLGFileNameShort;
MinecraftLandGeneratorConf = Main.MinecraftLandGeneratorConf;
defaultReadmeFile = Main.defaultReadmeFile;
//@formatter:off
Str = "Usage: java -jar " + MLGFileNameShort + " x z [serverpath] [switches]" + NewLine
@ -287,13 +287,15 @@ public class MLG_Readme_and_HelpInfo {
+ " WaitSave : Optional: Wait before saving." + NewLine;
//@formatter:on
String returnString = null;
if (SysOut) {
Main.out(Str);
Main.out("");
return null;
} else {
return Str;
returnString = Str;
}
return returnString;
}
}

View File

@ -40,9 +40,8 @@ public class MLG_StringArrayParse {
}
return returnArray;
} else {
return array; //no changes have been done, return the original array
}
return array; //no changes have been done, return the original array
}

View File

@ -1,22 +1,27 @@
#!/bin/sh
## Minecraft Land Generator - GitHub Update Script
## Morlok8k - Updated 6/5/2012
## Morlok8k - Updated 6/12/2012
## add source files to .jar
zip -r ./bin/MinecraftLandGenerator.jar ./src/ ./scripts/ ./lib/jnbt-1.1-src.zip
## make .jar executable
cd ./bin/
chmod a+x ./MinecraftLandGenerator.jar
## generate new config file
java -jar ./MinecraftLandGenerator.jar -nowait -conf
## make new readme file
cd ..
java -jar ./bin/MinecraftLandGenerator.jar -nowait -readme README
## delete "unofficial" duplicate BuildID file (created by running/debugging MLG inside eclipse)
rm ./MLG-BuildID
## add files to git, and commit.
git add .
git commit -a
git push origin master