From 95f890988857a90cf968a6bd11be80d56021031f Mon Sep 17 00:00:00 2001 From: Piegames <14054505+piegamesde@users.noreply.github.com> Date: Tue, 13 Nov 2018 20:01:30 +0100 Subject: [PATCH] Delete more unused stuff --- .../MinecraftLandGenerator/FileRead.java | 54 --- .../MinecraftLandGenerator/FileWrite.java | 147 -------- .../morlok8k/MinecraftLandGenerator/var.java | 313 ------------------ 3 files changed, 514 deletions(-) delete mode 100644 src/main/java/morlok8k/MinecraftLandGenerator/FileRead.java delete mode 100644 src/main/java/morlok8k/MinecraftLandGenerator/FileWrite.java delete mode 100644 src/main/java/morlok8k/MinecraftLandGenerator/var.java diff --git a/src/main/java/morlok8k/MinecraftLandGenerator/FileRead.java b/src/main/java/morlok8k/MinecraftLandGenerator/FileRead.java deleted file mode 100644 index 44f7a67..0000000 --- a/src/main/java/morlok8k/MinecraftLandGenerator/FileRead.java +++ /dev/null @@ -1,54 +0,0 @@ -/* -####################################################################### -# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE # -# Version 2, December 2004 # -# # -# Copyright (C) 2004 Sam Hocevar # -# # -# Everyone is permitted to copy and distribute verbatim or modified # -# copies of this license document, and changing it is allowed as long # -# as the name is changed. # -# # -# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE # -# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION # -# # -# 0. You just DO WHAT THE FUCK YOU WANT TO. # -# # -####################################################################### -*/ - -package morlok8k.MinecraftLandGenerator; - -import org.joml.Vector3i; - -/** - * @author morlok8k - */ -@Deprecated -public class FileRead { - - public static Vector3i parseString(String StringOfCoords) { - StringOfCoords = StringOfCoords.trim(); - - int start = StringOfCoords.indexOf("["); - int end = StringOfCoords.indexOf("]"); - - String[] coordlong = StringOfCoords.substring(start, end).split(","); - if ((start == -1) || (end == -1)) { - - start = StringOfCoords.indexOf("("); - end = StringOfCoords.indexOf(")"); - String[] coordshort = StringOfCoords.substring(start, end).split(","); - if ((start != -1) && (end != -1)) { - return new Vector3i(Integer.valueOf(coordshort[0]), 64, - Integer.valueOf(coordshort[2])); - } else { - return new Vector3i(0, 0, 0); - } - } else { - - return new Vector3i(Integer.valueOf(coordlong[0]), Integer.valueOf(coordlong[1]), - Integer.valueOf(coordlong[2])); - } - } -} diff --git a/src/main/java/morlok8k/MinecraftLandGenerator/FileWrite.java b/src/main/java/morlok8k/MinecraftLandGenerator/FileWrite.java deleted file mode 100644 index e0e6503..0000000 --- a/src/main/java/morlok8k/MinecraftLandGenerator/FileWrite.java +++ /dev/null @@ -1,147 +0,0 @@ -/* -####################################################################### -# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE # -# Version 2, December 2004 # -# # -# Copyright (C) 2004 Sam Hocevar # -# # -# Everyone is permitted to copy and distribute verbatim or modified # -# copies of this license document, and changing it is allowed as long # -# as the name is changed. # -# # -# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE # -# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION # -# # -# 0. You just DO WHAT THE FUCK YOU WANT TO. # -# # -####################################################################### -*/ - -package morlok8k.MinecraftLandGenerator; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; - -/** - * - * @author morlok8k - */ -public class FileWrite { - - private static Log log = LogFactory.getLog(Main.class); - - /** - * http://www.roseindia.net/java/example/java/io/java-append-to-file.shtml
- * Append To File - Java Tutorial - * - * @param file - * @param appendTxt - */ - public static void AppendTxtFile(final String file, final String appendTxt) { - try { - // Create file - final FileWriter fstream = new FileWriter(file, true); - final BufferedWriter out = new BufferedWriter(fstream); - - out.write(appendTxt); - //Close the output stream - out.close(); - } catch (final Exception e) {//Catch exception if any - System.err.println("Error: " + e.getMessage()); - } - } - - /** - * Generates a Config File. - * - * @param newConf - * true: Uses Default values. false: uses existing values - * @author Morlok8k - */ - public static void saveConf(final boolean newConf) { - - String jL = null; //javaLine - String sP = null; //serverPath - - if (newConf) { - jL = var.defaultJavaLine; // reads the default from a constant, makes it easier! - sP = "."; // - } else { - jL = var.javaLine; // we read these values from an existing Conf File. - sP = var.serverPath; // - } - - String txt = null; - //@formatter:off - txt = "#" + var.PROG_NAME + " Configuration File: Version: " + var.VERSION + var.newLine - + "#Authors: " + var.AUTHORS + var.newLine - + "#Auto-Generated: " + var.dateFormat.format(var.date) + var.newLine - + var.newLine - + "#Line to run server:" + var.newLine - + "Java=" + jL // reads the default from a constant, makes it easier! - + var.newLine - + var.newLine - + "#Location of server. use \".\" for the same folder as MLG" + var.newLine - + "ServerPath=" + sP - + var.newLine - + var.newLine - + "#Strings read from the server" + var.newLine - + "Done_Text=Done" + var.newLine - + "Preparing_Text=Preparing spawn area:" + var.newLine - + "Preparing_Level=Preparing start region for" + var.newLine - + "Level-0=Overworld" + var.newLine - + "Level-1=Nether" + var.newLine - + "Level-2=The End" + var.newLine - + "Level-3=Level 3 (Future Level)" + var.newLine - + "Level-4=Level 4 (Future Level)" + var.newLine - + "Level-5=Level 5 (Future Level)" + var.newLine - + "Level-6=Level 6 (Future Level)" + var.newLine - + "Level-7=Level 7 (Future Level)" + var.newLine - + "Level-8=Level 8 (Future Level)" + var.newLine - + "Level-9=Level 9 (Future Level)" + var.newLine - + var.newLine - + "#Optional: Wait a few seconds after saving." + var.newLine - + "WaitSave=false" + var.newLine - + "webLaunch=true"; - //@formatter:on - - writeTxtFile(var.MinecraftLandGeneratorConf, txt); - - return; - - } - - /** - * @param file - * @param txt - */ - public static void writeTxtFile(final String file, final String txt) { - //TODO: element comment - - /* - * NOTE: I don't include a generic readTxtFile method, as that code depends on what I'm reading. - * For things like that I make a special method for it, if its used in more than one place. - * Like reading the config file. - */ - - try { - final File oFile = new File(file); - final BufferedWriter outFile = new BufferedWriter(new FileWriter(oFile)); - outFile.write(txt); - outFile.newLine(); - outFile.close(); - log.info(file + " file created."); - return; - } catch (final IOException ex) { - log.error("Could not create " + var.MinecraftLandGeneratorConf + "."); - ex.printStackTrace(); - return; - } - - } -} diff --git a/src/main/java/morlok8k/MinecraftLandGenerator/var.java b/src/main/java/morlok8k/MinecraftLandGenerator/var.java deleted file mode 100644 index 3bf9a61..0000000 --- a/src/main/java/morlok8k/MinecraftLandGenerator/var.java +++ /dev/null @@ -1,313 +0,0 @@ -/* -####################################################################### -# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE # -# Version 2, December 2004 # -# # -# Copyright (C) 2004 Sam Hocevar # -# # -# Everyone is permitted to copy and distribute verbatim or modified # -# copies of this license document, and changing it is allowed as long # -# as the name is changed. # -# # -# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE # -# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION # -# # -# 0. You just DO WHAT THE FUCK YOU WANT TO. # -# # -####################################################################### -*/ - -package morlok8k.MinecraftLandGenerator; - -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.Locale; -import java.util.Scanner; - -/** - * - * This holds all the major variables that different sections of MLG uses... - * - * @author morlok8k - */ -public class var { - - // - // Program Info: - - /** display more output when debugging */ - public static boolean testing = false; - - /** display more output */ - public static boolean verbose = false; - - /** Program Name */ - public static final String PROG_NAME = "Minecraft Land Generator"; - - /** Version Number! */ - public static final String VERSION = "1.7.7"; - - /** Authors */ - public static final String AUTHORS = "Corrodias, Morlok8k, pr0f1x, jaseg, Gallion"; - - /** Website */ - public static final String WEBSITE = "https://sites.google.com/site/minecraftlandgenerator/"; - - // - // Operating System Info: - /** "/" or "\" depending on system */ - 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"); - - // - // Commonly Used Strings: - /** "[MLG] " */ - public static final String MLG = "[MLG] "; - - /** "[MLG-ERROR] " */ - public static final String MLGe = "[MLG-ERROR] "; - - // - // Date & Build-ID stuff: - /** Style: "January 1, 1970" */ - 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; - - /** - * Lets get a nice Date format for display
- * Style: "Sunday, September 16, 2012 at 5:12 PM, Pacific Daylight Time" - */ - public static final DateFormat dateFormat = new SimpleDateFormat( - "EEEE, MMMM d, yyyy 'at' h:mm a, zzzz", Locale.ENGLISH); - - /** a date */ - public static Date date = null; - - /** last modified date stored as a Long */ - public static Long MLG_Last_Modified_Long = 0L; - - /** File: "MLG-BuildID" */ - public static String buildIDFile = "MLG-BuildID"; - - // - // Filenames: - /** "MinecraftLandGenerator.jar" by default. This actually tracks the current filename for the jar. */ - public static String MLGFileNameShort = null; - - /** "MinecraftLandGenerator.conf" */ - public static final String MinecraftLandGeneratorConf = "MinecraftLandGenerator.conf"; - - /** "_MLG_Readme.txt" */ - public static final String defaultReadmeFile = "_MLG_Readme.txt"; - - /** "MinecraftLandGenerator.jar" */ - public static final String MLG_JarFile = "MinecraftLandGenerator.jar"; - - /** entire path of currently running .jar file */ - public static String MLGFileName = null; - - // - // Text Input - /** Command line input scanner */ - public static Scanner sc = new Scanner(System.in); - - // - // MinecraftLandGenerator.conf Stuff: - /** Server Output: "[INFO] Done" */ - public static String doneText = null; - - /** Server Output: "[INFO] Preparing spawn area:" */ - public static String preparingText = null; - - /** Server Output: "[INFO] Preparing start region for" */ - public static String preparingLevel = null; - - /** The Overworld */ - public static String level_0 = null; - - /** The Nether */ - public static String level_1 = null; - - /** The End */ - public static String level_2 = null; - - /** Future World (Level 3) */ - public static String level_3 = null; - - /** Future World (Level 4) */ - public static String level_4 = null; - - /** Future World (Level 5) */ - public static String level_5 = null; - - /** Future World (Level 6) */ - public static String level_6 = null; - - /** Future World (Level 7) */ - public static String level_7 = null; - - /** Future World (Level 8) */ - public static String level_8 = null; - - /** Future World (Level 9) */ - public static String level_9 = null; - - /** MLG's recommended default instead of "java -jar minecraft_server.jar" */ - public static final String defaultJavaLine = - "java -Djava.awt.headless=true -Djline.terminal=jline.UnsupportedTerminal -Duser.language=en" - + " -Xms1024m -Xmx1024m -Xincgc -jar minecraft_server.jar nogui"; - - /** "." for current folder, else exact path. */ - public static String serverPath = null; - - /** the folder the game save is in... */ - public static String worldPath = null; - - // - //Server Launching: - /** the minecraft server */ - public static ProcessBuilder minecraft = null; - - /** the info from "java=" in the conf file. */ - public static String javaLine = null; - - // - //Server Launching: - /** the name of the world. usually "world", unless its been changed... */ - public static String worldName = null; - - /** Beta 1.9 glitch workaround. (not needed unless using beta 1.9) */ - public static boolean waitSave = false; - - /** Ignores Warnings from the server. Used for compatibility and special cases */ - public static boolean ignoreWarnings = false; - - /** the worlds seed */ - public static Long randomSeed = (long) 0; - - // - // Update URLs: - /** just removing some redundancy */ - public static final String github_URL = - "https://raw.github.com/Morlok8k/MinecraftLandGenerator/master/bin/"; - - /** URL to conf file */ - 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; - - /** URL to .jar file */ - public static final String github_MLG_jar_URL = github_URL + MLG_JarFile; - - // - // Update Stuff: - /** The running Main.class */ - public static final Class cls = Main.class; - - /** For bad compiling... */ - public static final String rsrcError = "rsrcERROR"; - - /** is running code a .jar file? */ - public static boolean isCompiledAsJar = false; - - /** current hash */ - 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; - - /** we downloaded a copy of the BuildID... */ - public static boolean flag_downloadedBuildID = false; - - /** a list of timestamps */ - public static ArrayList timeStamps = new ArrayList<>(); - - // - // Resume Data & Log Files - /** resume data for X, if needed. */ - public static int resumeX = 0; - - /** resume data for Z, if needed. */ - public static int resumeZ = 0; - - /** a saved copy of the original args given */ - public static String[] originalArgs = {}; - - /** which version of the server? oh yeah! */ - public static String MC_Server_Version = ""; - - // - // Misc: - /** 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; - - /** alternate / compatibility mode */ - 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. - - /** standard server creates 625 chunks in a square around spawn. */ - //Alpha, and early beta uses 441 chunks. (or 485 for early Alpha) - public static int MinecraftServerChunkPlayerCacheAlpha = 441; //alpha servers (and beta 1.0 only) - - /** these 441 chunks create a 320x320 block square */ - public static long incrementFullAlpha = - (int) (Math.sqrt(MinecraftServerChunkPlayerCacheAlpha) * 16); // 400, the length of a fresh (no players have ever logged in) server map. - - /** these 625 chunks create a 400x400 block square */ - public static long 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 long 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; - - /** when the program started */ - public static long startTime = 0L; - - /** recheck toggle! */ - public static Boolean recheckFlag = false; - - /** output GUI stuff when using GUI mode, or don't. */ - 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 = false; //default to using regions - - /** Log File */ - public static String logFile = "MinecraftLandGenerator.log"; - - /** has GUI-mode's Start button been pushed? */ - public static boolean runningServerGUI = false; - - /** has GUI-mode's Stop button been pushed? */ - public static boolean stoppingServerGUI = false; - -}