rename refactorings

master
Stefan Dollase 2016-11-20 23:48:53 +01:00
parent 97b6296880
commit dc1a6fdfb3
43 changed files with 203 additions and 211 deletions

View File

@ -17,8 +17,8 @@ import amidst.documentation.CalledByAny;
import amidst.documentation.CalledOnlyBy;
import amidst.documentation.NotThreadSafe;
import amidst.gui.crash.CrashWindow;
import amidst.logging.AmidstLogger;
import amidst.logging.FileLogger;
import amidst.logging.Log;
import amidst.mojangapi.file.DotMinecraftDirectoryNotFoundException;
import amidst.util.OperatingSystemDetector;
@ -76,7 +76,7 @@ public class Amidst {
} else if (parameters.printVersion) {
System.out.println(versionString);
} else {
Log.i(versionString);
AmidstLogger.info(versionString);
logTimeAndProperties();
enableGraphicsAcceleration();
startApplication(parameters, metadata, createSettings());
@ -85,19 +85,19 @@ public class Amidst {
private static void initFileLogger(String filename) {
if (filename != null) {
Log.i("using log file: '" + filename + "'");
Log.addListener("file", new FileLogger(new File(filename)));
AmidstLogger.info("using log file: '" + filename + "'");
AmidstLogger.addListener("file", new FileLogger(new File(filename)));
}
}
private static void logTimeAndProperties() {
Log.i("Current system time: " + getCurrentTimeStamp());
Log.i(createPropertyString("os.name"));
Log.i(createPropertyString("os.version"));
Log.i(createPropertyString("os.arch"));
Log.i(createPropertyString("java.version"));
Log.i(createPropertyString("java.vendor"));
Log.i(createPropertyString("sun.arch.data.model"));
AmidstLogger.info("Current system time: " + getCurrentTimeStamp());
AmidstLogger.info(createPropertyString("os.name"));
AmidstLogger.info(createPropertyString("os.version"));
AmidstLogger.info(createPropertyString("os.arch"));
AmidstLogger.info(createPropertyString("java.version"));
AmidstLogger.info(createPropertyString("java.vendor"));
AmidstLogger.info(createPropertyString("sun.arch.data.model"));
}
private static String getCurrentTimeStamp() {
@ -144,10 +144,10 @@ public class Amidst {
*/
private static void enableOpenGLIfNecessary() {
if (OperatingSystemDetector.isMac()) {
Log.i("Enabling OpenGL.");
AmidstLogger.info("Enabling OpenGL.");
System.setProperty("sun.java2d.opengl", "True");
} else {
Log.i("Not using OpenGL.");
AmidstLogger.info("Not using OpenGL.");
}
}
@ -170,7 +170,7 @@ public class Amidst {
try {
new Application(parameters, metadata, settings).run();
} catch (DotMinecraftDirectoryNotFoundException e) {
Log.w(e.getMessage());
AmidstLogger.warn(e.getMessage());
e.printStackTrace();
JOptionPane.showMessageDialog(
null,
@ -186,8 +186,8 @@ public class Amidst {
private static void handleCrash(Throwable e, Thread thread) {
String message = "Amidst has encounted an uncaught exception on the thread " + thread;
try {
Log.crash(e, message);
displayCrashWindow(message, Log.getAllMessages());
AmidstLogger.crash(e, message);
displayCrashWindow(message, AmidstLogger.getAllMessages());
} catch (Throwable t) {
System.err.println("Amidst crashed!");
System.err.println(message);

View File

@ -17,7 +17,7 @@ import amidst.clazz.symbolic.SymbolicClasses;
import amidst.clazz.symbolic.declaration.SymbolicClassDeclaration;
import amidst.clazz.translator.ClassTranslator;
import amidst.documentation.Immutable;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
@Immutable
public enum Classes {
@ -31,39 +31,38 @@ public enum Classes {
JarFileParsingException,
SymbolicClassGraphCreationException,
ClassNotFoundException {
Log.i("Reading " + jarFile.getName());
AmidstLogger.info("Reading " + jarFile.getName());
List<RealClass> realClasses = RealClasses.fromJarFile(jarFile);
Log.i("Jar load complete.");
Log.i("Searching for classes...");
AmidstLogger.info("Jar load complete.");
AmidstLogger.info("Searching for classes...");
Map<SymbolicClassDeclaration, String> realClassNamesBySymbolicClassDeclaration = translator
.translate(realClasses);
Log.i("Class search complete.");
Log.i("Loading classes...");
AmidstLogger.info("Class search complete.");
AmidstLogger.info("Loading classes...");
Map<String, SymbolicClass> result = SymbolicClasses.from(realClassNamesBySymbolicClassDeclaration, classLoader);
Log.i("Classes loaded.");
AmidstLogger.info("Classes loaded.");
return result;
}
public static Map<SymbolicClassDeclaration, Integer> countMatches(File jarFile, ClassTranslator translator)
throws FileNotFoundException,
JarFileParsingException {
Log.i("Checking " + jarFile.getName());
AmidstLogger.info("Checking " + jarFile.getName());
List<RealClass> realClasses = RealClasses.fromJarFile(jarFile);
Map<SymbolicClassDeclaration, List<RealClass>> map = translator.translateToAllMatching(realClasses);
Map<SymbolicClassDeclaration, Integer> result = new HashMap<>();
for (Entry<SymbolicClassDeclaration, List<RealClass>> entry : map.entrySet()) {
result.put(entry.getKey(), entry.getValue().size());
if (entry.getValue().isEmpty()) {
Log.w(entry.getKey().getSymbolicClassName() + " has no matching class");
AmidstLogger.warn(entry.getKey().getSymbolicClassName() + " has no matching class");
} else if (entry.getValue().size() > 1) {
StringBuilder builder = new StringBuilder();
for (RealClass realClass : entry.getValue()) {
builder.append(", ").append(realClass.getRealClassName());
}
Log
.w(
entry.getKey().getSymbolicClassName() + " has multiple matching classes: "
+ builder.toString().substring(2));
AmidstLogger.warn(
entry.getKey().getSymbolicClassName() + " has multiple matching classes: "
+ builder.toString().substring(2));
}
}
return result;

View File

@ -5,7 +5,7 @@ import java.util.List;
import amidst.clazz.symbolic.SymbolicClassGraphCreationException;
import amidst.documentation.Immutable;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
@Immutable
public class SymbolicClassDeclaration {
@ -49,16 +49,17 @@ public class SymbolicClassDeclaration {
}
public void handleMultipleMatches(String firstRealClassName, String otherRealClassName) {
Log.w("Found class " + symbolicClassName + " again: " + firstRealClassName + ", " + otherRealClassName);
AmidstLogger
.warn("Found class " + symbolicClassName + " again: " + firstRealClassName + ", " + otherRealClassName);
}
public void handleMatch(String realClassName) {
Log.i("Found class " + symbolicClassName + ": " + realClassName);
AmidstLogger.info("Found class " + symbolicClassName + ": " + realClassName);
}
public void handleNoMatch() throws ClassNotFoundException {
if (isOptional) {
Log.i("Missing class " + symbolicClassName);
AmidstLogger.info("Missing class " + symbolicClassName);
} else {
throw new ClassNotFoundException(
"cannot find a real class matching the symbolic class " + symbolicClassName);
@ -69,7 +70,7 @@ public class SymbolicClassDeclaration {
throws SymbolicClassGraphCreationException {
String message = "unable to find the real class " + realClassName + " -> " + symbolicClassName;
if (isOptional) {
Log.i(message);
AmidstLogger.info(message);
} else {
throw new SymbolicClassGraphCreationException(message, e);
}

View File

@ -2,7 +2,7 @@ package amidst.clazz.symbolic.declaration;
import amidst.clazz.symbolic.SymbolicClassGraphCreationException;
import amidst.documentation.Immutable;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
@Immutable
public class SymbolicConstructorDeclaration {
@ -36,7 +36,7 @@ public class SymbolicConstructorDeclaration {
String message = "unable to find the real class constructor " + realClassName + ".<init>"
+ parameters.getParameterString() + " -> " + symbolicClassName + "." + symbolicName;
if (isOptional) {
Log.i(message);
AmidstLogger.info(message);
} else {
throw new SymbolicClassGraphCreationException(message, e);
}

View File

@ -2,7 +2,7 @@ package amidst.clazz.symbolic.declaration;
import amidst.clazz.symbolic.SymbolicClassGraphCreationException;
import amidst.documentation.Immutable;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
@Immutable
public class SymbolicFieldDeclaration {
@ -33,7 +33,7 @@ public class SymbolicFieldDeclaration {
String message = "unable to find the real class field " + realClassName + "." + realName + " -> "
+ symbolicClassName + "." + symbolicName;
if (isOptional) {
Log.i(message);
AmidstLogger.info(message);
} else {
throw new SymbolicClassGraphCreationException(message, e);
}

View File

@ -2,7 +2,7 @@ package amidst.clazz.symbolic.declaration;
import amidst.clazz.symbolic.SymbolicClassGraphCreationException;
import amidst.documentation.Immutable;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
@Immutable
public class SymbolicMethodDeclaration {
@ -43,7 +43,7 @@ public class SymbolicMethodDeclaration {
String message = "unable to find the real class method " + realClassName + "." + realName
+ parameters.getParameterString() + " -> " + symbolicClassName + "." + symbolicName;
if (isOptional) {
Log.i(message);
AmidstLogger.info(message);
} else {
throw new SymbolicClassGraphCreationException(message, e);
}

View File

@ -8,7 +8,7 @@ import amidst.documentation.AmidstThread;
import amidst.documentation.CalledOnlyBy;
import amidst.documentation.ThreadSafe;
import amidst.fragment.constructor.FragmentConstructor;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
@ThreadSafe
public class FragmentCache {
@ -36,12 +36,11 @@ public class FragmentCache {
@CalledOnlyBy(AmidstThread.EDT)
public synchronized void increaseSize() {
Log
.i(
"increasing fragment cache size from " + cache.size() + " to "
+ (cache.size() + NEW_FRAGMENTS_PER_REQUEST));
AmidstLogger.info(
"increasing fragment cache size from " + cache.size() + " to "
+ (cache.size() + NEW_FRAGMENTS_PER_REQUEST));
requestNewFragments();
Log.i("fragment cache size increased to " + cache.size());
AmidstLogger.info("fragment cache size increased to " + cache.size());
}
@CalledOnlyBy(AmidstThread.EDT)

View File

@ -2,7 +2,7 @@ package amidst.fragment.colorprovider;
import amidst.documentation.ThreadSafe;
import amidst.fragment.Fragment;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
import amidst.mojangapi.world.Dimension;
import amidst.mojangapi.world.biome.BiomeColor;
@ -23,7 +23,7 @@ public class BackgroundColorProvider implements ColorProvider {
} else if (dimension.equals(Dimension.END)) {
return theEndColorProvider.getColorAt(dimension, fragment, cornerX, cornerY, x, y);
} else {
Log.w("unsupported dimension");
AmidstLogger.warn("unsupported dimension");
return BiomeColor.unknown().getRGB();
}
}

View File

@ -4,7 +4,7 @@ import java.io.IOException;
import amidst.ResourceLoader;
import amidst.documentation.Immutable;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
@Immutable
public class License {
@ -20,7 +20,7 @@ public class License {
try {
return ResourceLoader.getResourceAsString(path);
} catch (IOException e) {
Log.w("Unable to read license for '" + name + "' at '" + path + "'.");
AmidstLogger.warn("Unable to read license for '" + name + "' at '" + path + "'.");
e.printStackTrace();
return "License text is missing.";
}

View File

@ -18,7 +18,7 @@ import amidst.documentation.CalledOnlyBy;
import amidst.documentation.NotThreadSafe;
import amidst.gui.main.menu.MovePlayerPopupMenu;
import amidst.gui.main.viewer.ViewerFacade;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
import amidst.mojangapi.world.WorldSeed;
import amidst.mojangapi.world.WorldType;
import amidst.mojangapi.world.coordinates.CoordinatesInWorld;
@ -110,7 +110,7 @@ public class Actions {
if (coordinates != null) {
viewerFacade.centerOn(coordinates);
} else {
Log.w("Invalid location entered, ignoring.");
AmidstLogger.warn("Invalid location entered, ignoring.");
mainWindow.displayError("You entered an invalid location.");
}
}

View File

@ -16,7 +16,7 @@ import amidst.documentation.AmidstThread;
import amidst.documentation.CalledOnlyBy;
import amidst.documentation.NotNull;
import amidst.documentation.NotThreadSafe;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
import amidst.threading.WorkerExecutor;
@NotThreadSafe
@ -120,7 +120,7 @@ public class UpdatePrompt {
@CalledOnlyBy(AmidstThread.EDT)
private void onCheckFailed(Exception e) {
Log.w("unable to check for updates");
AmidstLogger.warn("unable to check for updates");
displayError(e);
}

View File

@ -11,7 +11,7 @@ import javax.swing.KeyStroke;
import amidst.documentation.NotThreadSafe;
import amidst.gui.main.Actions;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
import amidst.settings.biomeprofile.BiomeProfile;
import amidst.settings.biomeprofile.BiomeProfileDirectory;
import amidst.settings.biomeprofile.BiomeProfileVisitor;
@ -76,7 +76,7 @@ public class BiomeProfileMenuFactory {
if (accelerator != null) {
checkBox.setAccelerator(accelerator);
} else {
Log.i("Unable to create keyboard shortcut from: " + shortcut);
AmidstLogger.info("Unable to create keyboard shortcut from: " + shortcut);
}
}
}
@ -125,7 +125,7 @@ public class BiomeProfileMenuFactory {
this.reloadText = reloadText;
this.reloadMnemonic = reloadMnemonic;
this.reloadAccelerator = reloadAccelerator;
Log.i("Checking for additional biome profiles.");
AmidstLogger.info("Checking for additional biome profiles.");
initParentMenu();
}
@ -140,7 +140,7 @@ public class BiomeProfileMenuFactory {
}
private void doReload() {
Log.i("Reloading additional biome profiles.");
AmidstLogger.info("Reloading additional biome profiles.");
initParentMenu();
}
}

View File

@ -10,7 +10,7 @@ import amidst.documentation.NotThreadSafe;
import amidst.fragment.Fragment;
import amidst.fragment.FragmentGraph;
import amidst.gui.main.viewer.FragmentGraphToScreenTranslator;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
import amidst.mojangapi.world.Dimension;
import amidst.mojangapi.world.biome.Biome;
import amidst.mojangapi.world.biome.UnknownBiomeIndexException;
@ -59,7 +59,7 @@ public class CursorInformationWidget extends TextWidget {
} else if (dimension.equals(Dimension.END)) {
return Biome.theEnd.getName();
} else {
Log.w("unsupported dimension");
AmidstLogger.warn("unsupported dimension");
return UNKNOWN_BIOME_NAME;
}
}
@ -74,7 +74,7 @@ public class CursorInformationWidget extends TextWidget {
try {
return Biome.getByIndex(biome).getName();
} catch (UnknownBiomeIndexException e) {
Log.e(e.getMessage());
AmidstLogger.error(e.getMessage());
e.printStackTrace();
return UNKNOWN_BIOME_NAME;
}

View File

@ -8,7 +8,7 @@ import amidst.Application;
import amidst.documentation.AmidstThread;
import amidst.documentation.CalledOnlyBy;
import amidst.documentation.NotThreadSafe;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
import amidst.mojangapi.MojangApi;
import amidst.mojangapi.file.directory.ProfileDirectory;
import amidst.mojangapi.file.directory.VersionDirectory;
@ -58,7 +58,7 @@ public class LocalProfileComponent extends ProfileComponent {
versionDirectory = profile.createValidVersionDirectory(mojangApi);
return true;
} catch (FileNotFoundException e) {
Log.w(e.getMessage());
AmidstLogger.warn(e.getMessage());
return false;
}
}
@ -82,23 +82,21 @@ public class LocalProfileComponent extends ProfileComponent {
private boolean tryLoad() {
// TODO: Replace with proper handling for modded profiles.
try {
Log
.i(
"using minecraft launcher profile '" + getProfileName() + "' with versionId '"
+ getVersionName() + "'");
AmidstLogger.info(
"using minecraft launcher profile '" + getProfileName() + "' with versionId '" + getVersionName()
+ "'");
String possibleModProfiles = ".*(optifine|forge).*";
if (Pattern.matches(possibleModProfiles, getVersionName().toLowerCase(Locale.ENGLISH))) {
Log
.e(
"Amidst does not support modded Minecraft profiles! Please select or create an unmodded Minecraft profile via the Minecraft Launcher.");
AmidstLogger.error(
"Amidst does not support modded Minecraft profiles! Please select or create an unmodded Minecraft profile via the Minecraft Launcher.");
return false;
}
mojangApi.set(getProfileName(), profileDirectory, versionDirectory);
return true;
} catch (LocalMinecraftInterfaceCreationException e) {
Log.e(e.getMessage());
AmidstLogger.error(e.getMessage());
e.printStackTrace();
return false;
}

View File

@ -17,7 +17,7 @@ import amidst.Application;
import amidst.documentation.AmidstThread;
import amidst.documentation.CalledOnlyBy;
import amidst.documentation.NotThreadSafe;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
import amidst.mojangapi.MojangApi;
import amidst.mojangapi.file.MojangApiParsingException;
import amidst.mojangapi.file.json.launcherprofiles.LauncherProfileJson;
@ -112,9 +112,9 @@ public class ProfileSelectWindow {
@CalledOnlyBy(AmidstThread.WORKER)
private LauncherProfilesJson scanAndLoadProfiles() throws MojangApiParsingException, IOException {
Log.i("Scanning for profiles.");
AmidstLogger.info("Scanning for profiles.");
LauncherProfilesJson launcherProfile = mojangApi.getDotMinecraftDirectory().readLauncherProfilesJson();
Log.i("Successfully loaded profile list.");
AmidstLogger.info("Successfully loaded profile list.");
return launcherProfile;
}
@ -128,7 +128,7 @@ public class ProfileSelectWindow {
@CalledOnlyBy(AmidstThread.EDT)
private void createProfileComponentsIfNecessary(LauncherProfilesJson launcherProfile) {
if (launcherProfile.getProfiles().isEmpty()) {
Log.w("No profiles found in launcher_profiles.json");
AmidstLogger.warn("No profiles found in launcher_profiles.json");
profileSelectPanel.setEmptyMessage("No profiles found");
} else {
createProfileComponents(launcherProfile);
@ -154,7 +154,7 @@ public class ProfileSelectWindow {
@CalledOnlyBy(AmidstThread.EDT)
private void scanAndLoadProfilesFailed(Exception e) {
Log.e("Error reading launcher_profiles.json");
AmidstLogger.error("Error reading launcher_profiles.json");
e.printStackTrace();
profileSelectPanel.setEmptyMessage("Failed loading");
}

View File

@ -11,7 +11,7 @@ import amidst.documentation.ThreadSafe;
// TODO: switch to standard logging framework like slf4j + log4j?
@ThreadSafe
public class Log {
public class AmidstLogger {
private static final ConsoleLogger CONSOLE_LOGGER = new ConsoleLogger();
private static final InMemoryLogger IN_MEMORY_LOGGER = new InMemoryLogger();
@ -26,9 +26,9 @@ public class Log {
addListener("master", IN_MEMORY_LOGGER);
}
public static void addListener(String name, Logger l) {
public static void addListener(String name, Logger logger) {
synchronized (LOG_LOCK) {
LOGGER.put(name, l);
LOGGER.put(name, logger);
}
}
@ -38,7 +38,7 @@ public class Log {
}
}
public static void i(Object... messages) {
public static void info(Object... messages) {
synchronized (LOG_LOCK) {
for (Logger listener : LOGGER.values()) {
listener.info(messages);
@ -56,7 +56,7 @@ public class Log {
}
}
public static void w(Object... messages) {
public static void warn(Object... messages) {
synchronized (LOG_LOCK) {
for (Logger listener : LOGGER.values()) {
listener.warning(messages);
@ -64,7 +64,7 @@ public class Log {
}
}
public static void e(Object... messages) {
public static void error(Object... messages) {
synchronized (LOG_LOCK) {
if (IS_USING_ALERTS) {
JOptionPane.showMessageDialog(null, messages, "Error", JOptionPane.ERROR_MESSAGE);
@ -99,7 +99,7 @@ public class Log {
}
public static void printTraceStack(Throwable e) {
w(getStackTraceAsString(e));
warn(getStackTraceAsString(e));
}
private static String getStackTraceAsString(Throwable e) {

View File

@ -65,18 +65,19 @@ public class FileLogger implements Logger {
@CalledOnlyBy(AmidstThread.STARTUP)
private void disableBecauseFileCreationFailed() {
Log.w("Unable to create new file at: " + file + " disabling logging to file. (No exception thrown)");
AmidstLogger
.warn("Unable to create new file at: " + file + " disabling logging to file. (No exception thrown)");
}
@CalledOnlyBy(AmidstThread.STARTUP)
private void disableBecauseFileCreationThrowsException(IOException e) {
Log.w("Unable to create new file at: " + file + " disabling logging to file.");
AmidstLogger.warn("Unable to create new file at: " + file + " disabling logging to file.");
e.printStackTrace();
}
@CalledOnlyBy(AmidstThread.STARTUP)
private void disableBecauseFileIsDirectory() {
Log.w("Unable to log at path: " + file + " because location is a directory.");
AmidstLogger.warn("Unable to log at path: " + file + " because location is a directory.");
}
@CalledOnlyBy(AmidstThread.STARTUP)
@ -116,7 +117,7 @@ public class FileLogger implements Logger {
try (FileWriter writer = new FileWriter(file, true)) {
writer.append(logMessage);
} catch (IOException e) {
Log.w("Unable to write to log file.");
AmidstLogger.warn("Unable to write to log file.");
e.printStackTrace();
}
}

View File

@ -5,7 +5,7 @@ import java.io.File;
import amidst.CommandLineParameters;
import amidst.documentation.Immutable;
import amidst.documentation.NotNull;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
import amidst.mojangapi.file.DotMinecraftDirectoryFinder;
import amidst.mojangapi.file.DotMinecraftDirectoryNotFoundException;
import amidst.mojangapi.file.directory.DotMinecraftDirectory;
@ -29,10 +29,9 @@ public class MojangApiBuilder {
LocalMinecraftInterfaceCreationException {
DotMinecraftDirectory dotMinecraftDirectory = createDotMinecraftDirectory();
if (dotMinecraftDirectory.isValid()) {
Log
.i(
"using '.minecraft' directory at: '" + dotMinecraftDirectory.getRoot() + "', libraries: '"
+ dotMinecraftDirectory.getLibraries() + "'");
AmidstLogger.info(
"using '.minecraft' directory at: '" + dotMinecraftDirectory.getRoot() + "', libraries: '"
+ dotMinecraftDirectory.getLibraries() + "'");
} else {
throw new DotMinecraftDirectoryNotFoundException(
"invalid '.minecraft' directory at: '" + dotMinecraftDirectory.getRoot() + "', libraries: '"
@ -59,18 +58,14 @@ public class MojangApiBuilder {
File json = new File(parameters.minecraftJsonFile);
VersionDirectory result = mojangApi.createVersionDirectory(jar, json);
if (result.isValid()) {
Log
.i(
"using minecraft version directory. versionId: '" + result.getVersionId()
+ "', jar file: '" + result.getJar() + "', json file: '" + result.getJson()
+ "'");
AmidstLogger.info(
"using minecraft version directory. versionId: '" + result.getVersionId() + "', jar file: '"
+ result.getJar() + "', json file: '" + result.getJson() + "'");
return result;
} else {
Log
.w(
"invalid minecraft version directory. versionId: '" + result.getVersionId()
+ "', jar file: '" + result.getJar() + "', json file: '" + result.getJson()
+ "'");
AmidstLogger.warn(
"invalid minecraft version directory. versionId: '" + result.getVersionId() + "', jar file: '"
+ result.getJar() + "', json file: '" + result.getJson() + "'");
}
}
return null;

View File

@ -4,7 +4,7 @@ import java.io.File;
import amidst.documentation.Immutable;
import amidst.documentation.NotNull;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
import amidst.util.OperatingSystemDetector;
@Immutable
@ -18,10 +18,9 @@ public enum DotMinecraftDirectoryFinder {
if (result.isDirectory()) {
return result;
} else {
Log
.w(
"Unable to set Minecraft directory to: " + result
+ " as that location does not exist or is not a folder.");
AmidstLogger.warn(
"Unable to set Minecraft directory to: " + result
+ " as that location does not exist or is not a folder.");
}
}
return getMinecraftDirectory();

View File

@ -8,7 +8,7 @@ import java.util.List;
import amidst.documentation.Immutable;
import amidst.documentation.NotNull;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
import amidst.mojangapi.file.json.version.LibraryJson;
import amidst.util.OperatingSystemDetector;
@ -24,13 +24,13 @@ public enum LibraryFinder {
if (libraryFile != null) {
try {
result.add(libraryFile.toURI().toURL());
Log.i("Found library: " + libraryFile);
AmidstLogger.info("Found library: " + libraryFile);
} catch (MalformedURLException e) {
Log.w("Unable to convert library file to URL: " + libraryFile);
AmidstLogger.warn("Unable to convert library file to URL: " + libraryFile);
e.printStackTrace();
}
} else {
Log.i("Skipping library: " + library.getName());
AmidstLogger.info("Skipping library: " + library.getName());
}
}
return result;
@ -74,11 +74,12 @@ public enum LibraryFinder {
if (result != null && result.exists()) {
return result;
} else {
Log.w("Attempted to search for file at path: " + librarySearchPath + " but found nothing. Skipping.");
AmidstLogger.warn(
"Attempted to search for file at path: " + librarySearchPath + " but found nothing. Skipping.");
return null;
}
} else {
Log.w("Failed attempt to load library at: " + librarySearchPath);
AmidstLogger.warn("Failed attempt to load library at: " + librarySearchPath);
return null;
}
}

View File

@ -11,7 +11,7 @@ import org.jnbt.CompoundTag;
import amidst.documentation.Immutable;
import amidst.documentation.NotNull;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
import amidst.mojangapi.file.MojangApiParsingException;
import amidst.mojangapi.file.nbt.LevelDatNbt;
import amidst.mojangapi.file.nbt.NBTUtils;
@ -163,7 +163,7 @@ public class SaveDirectory {
}
}
if (!result.isEmpty()) {
Log.i("using players from the playerdata directory");
AmidstLogger.info("using players from the playerdata directory");
return result;
}
for (File playersFile : getPlayersFiles()) {
@ -172,10 +172,10 @@ public class SaveDirectory {
}
}
if (!result.isEmpty()) {
Log.i("using players from the players directory");
AmidstLogger.info("using players from the players directory");
return result;
}
Log.i("no multiplayer players found");
AmidstLogger.info("no multiplayer players found");
return result;
}
@ -193,7 +193,7 @@ public class SaveDirectory {
*/
@NotNull
public List<PlayerNbt> createSingleplayerPlayerNbts() {
Log.i("using player from level.dat");
AmidstLogger.info("using player from level.dat");
return Arrays.asList(createLevelDatPlayerNbt());
}

View File

@ -10,7 +10,7 @@ import java.util.List;
import amidst.documentation.Immutable;
import amidst.documentation.NotNull;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
import amidst.mojangapi.file.MojangApiParsingException;
import amidst.mojangapi.file.json.JsonReader;
import amidst.mojangapi.file.json.version.VersionJson;
@ -60,10 +60,10 @@ public class VersionDirectory {
@NotNull
public URLClassLoader createClassLoader() throws MalformedURLException {
if (json.isFile()) {
Log.i("Loading libraries.");
AmidstLogger.info("Loading libraries.");
return doCreateClassLoader(getJarFileUrl(), getAllLibraryUrls());
} else {
Log.i("Unable to find Minecraft library JSON at: " + json + ". Skipping.");
AmidstLogger.info("Unable to find Minecraft library JSON at: " + json + ". Skipping.");
return doCreateClassLoader(getJarFileUrl());
}
}
@ -78,7 +78,7 @@ public class VersionDirectory {
try {
return readVersionJson().getLibraryUrls(dotMinecraftDirectory.getLibraries());
} catch (IOException | MojangApiParsingException e) {
Log.w("Invalid jar profile loaded. Library loading will be skipped. (Path: " + json + ")");
AmidstLogger.warn("Invalid jar profile loaded. Library loading will be skipped. (Path: " + json + ")");
return new ArrayList<>();
}
}

View File

@ -13,7 +13,7 @@ import com.google.gson.JsonSyntaxException;
import amidst.ResourceLoader;
import amidst.documentation.Immutable;
import amidst.documentation.NotNull;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
import amidst.mojangapi.file.MojangApiParsingException;
import amidst.mojangapi.file.URIUtils;
import amidst.mojangapi.file.json.launcherprofiles.LauncherProfilesJson;
@ -42,34 +42,34 @@ public enum JsonReader {
@NotNull
public static VersionListJson readRemoteOrLocalVersionList() throws FileNotFoundException {
Log.i("Beginning latest version list load.");
Log.i("Attempting to download remote version list...");
AmidstLogger.info("Beginning latest version list load.");
AmidstLogger.info("Attempting to download remote version list...");
VersionListJson remote = null;
try {
remote = readRemoteVersionList();
} catch (IOException | MojangApiParsingException e) {
Log.w("Unable to read remote version list.");
Log.printTraceStack(e);
Log.w("Aborting version list load. URL: " + REMOTE_VERSION_LIST);
AmidstLogger.warn("Unable to read remote version list.");
AmidstLogger.printTraceStack(e);
AmidstLogger.warn("Aborting version list load. URL: " + REMOTE_VERSION_LIST);
}
if (remote != null) {
Log.i("Successfully loaded version list. URL: " + REMOTE_VERSION_LIST);
AmidstLogger.info("Successfully loaded version list. URL: " + REMOTE_VERSION_LIST);
return remote;
}
Log.i("Attempting to load local version list...");
AmidstLogger.info("Attempting to load local version list...");
VersionListJson local = null;
try {
local = readLocalVersionListFromResource();
} catch (IOException | MojangApiParsingException e) {
Log.w("Unable to read local version list.");
Log.printTraceStack(e);
Log.w("Aborting version list load. URL: " + LOCAL_VERSION_LIST);
AmidstLogger.warn("Unable to read local version list.");
AmidstLogger.printTraceStack(e);
AmidstLogger.warn("Aborting version list load. URL: " + LOCAL_VERSION_LIST);
}
if (local != null) {
Log.i("Successfully loaded version list. URL: " + LOCAL_VERSION_LIST);
AmidstLogger.info("Successfully loaded version list. URL: " + LOCAL_VERSION_LIST);
return local;
}
Log.w("Failed to load both remote and local version list.");
AmidstLogger.warn("Failed to load both remote and local version list.");
throw new FileNotFoundException("unable to read version list");
}

View File

@ -9,7 +9,7 @@ import java.net.URL;
import javax.imageio.ImageIO;
import amidst.documentation.Immutable;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
import amidst.mojangapi.file.MojangApiParsingException;
import amidst.mojangapi.file.json.player.PlayerJson;
@ -23,7 +23,7 @@ public enum PlayerInformationRetriever {
try {
return getPlayerJsonByName(name);
} catch (IOException | MojangApiParsingException | NullPointerException e) {
Log.w("unable to load player information by name: " + name);
AmidstLogger.warn("unable to load player information by name: " + name);
return null;
}
}
@ -32,7 +32,7 @@ public enum PlayerInformationRetriever {
try {
return getPlayerJsonByUUID(uuid);
} catch (IOException | MojangApiParsingException | NullPointerException e) {
Log.w("unable to load player information by uuid: " + uuid);
AmidstLogger.warn("unable to load player information by uuid: " + uuid);
return null;
}
}
@ -41,7 +41,7 @@ public enum PlayerInformationRetriever {
try {
return getPlayerHeadByName(name);
} catch (IOException | NullPointerException e) {
Log.w("unable to load player head by name: " + name);
AmidstLogger.warn("unable to load player head by name: " + name);
return null;
}
}
@ -50,7 +50,7 @@ public enum PlayerInformationRetriever {
try {
return getPlayerHeadBySkinUrl(skinUrl);
} catch (IOException | NullPointerException e) {
Log.w("unable to load player head by skin url: " + skinUrl);
AmidstLogger.warn("unable to load player head by skin url: " + skinUrl);
return null;
}
}

View File

@ -11,7 +11,7 @@ import com.google.gson.JsonSyntaxException;
import amidst.documentation.GsonConstructor;
import amidst.documentation.Immutable;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
import amidst.mojangapi.world.filter.WorldFilter;
import amidst.mojangapi.world.filter.WorldFilter_MatchAll;
@ -56,7 +56,7 @@ public class WorldFilterJson_MatchAll {
return Optional.of(createWorldFilter());
} else {
// TODO: use error messages
Log.debug(getValidationMessages());
AmidstLogger.debug(getValidationMessages());
return Optional.empty();
}
}

View File

@ -4,7 +4,7 @@ import java.io.IOException;
import amidst.documentation.GsonConstructor;
import amidst.documentation.Immutable;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
import amidst.mojangapi.MojangApi;
import amidst.mojangapi.file.FilenameFactory;
import amidst.mojangapi.file.URIUtils;
@ -78,7 +78,7 @@ public class VersionListEntryJson {
downloadServer(prefix);
return true;
} catch (IOException e) {
Log.w("unable to download server: " + id);
AmidstLogger.warn("unable to download server: " + id);
e.printStackTrace();
}
return false;
@ -89,7 +89,7 @@ public class VersionListEntryJson {
downloadClient(prefix);
return true;
} catch (IOException e) {
Log.w("unable to download client: " + id);
AmidstLogger.warn("unable to download client: " + id);
e.printStackTrace();
}
return false;

View File

@ -8,7 +8,7 @@ import java.util.Objects;
import amidst.documentation.Immutable;
import amidst.documentation.NotNull;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
/**
* Information about what each supported version is
@ -170,7 +170,7 @@ public enum RecognisedVersion {
return recognisedVersion;
}
}
Log.i("Unable to recognise Minecraft Version with the magic string \"" + magicString + "\".");
AmidstLogger.info("Unable to recognise Minecraft Version with the magic string \"" + magicString + "\".");
return RecognisedVersion.UNKNOWN;
}
@ -182,15 +182,14 @@ public enum RecognisedVersion {
return recognisedVersion;
}
}
Log.i("Unable to recognise Minecraft Version with the name \"" + name + "\".");
AmidstLogger.info("Unable to recognise Minecraft Version with the name \"" + name + "\".");
return RecognisedVersion.UNKNOWN;
}
private static void logFound(RecognisedVersion recognisedVersion) {
Log
.i(
"Recognised Minecraft Version " + recognisedVersion.name + " with the magic string \""
+ recognisedVersion.magicString + "\".");
AmidstLogger.info(
"Recognised Minecraft Version " + recognisedVersion.name + " with the magic string \""
+ recognisedVersion.magicString + "\".");
}
public static boolean isNewerOrEqualTo(RecognisedVersion version1, RecognisedVersion version2) {

View File

@ -5,7 +5,7 @@ import java.lang.reflect.InvocationTargetException;
import amidst.clazz.symbolic.SymbolicClass;
import amidst.clazz.symbolic.SymbolicObject;
import amidst.documentation.ThreadSafe;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
import amidst.mojangapi.minecraftinterface.MinecraftInterface;
import amidst.mojangapi.minecraftinterface.MinecraftInterfaceException;
import amidst.mojangapi.minecraftinterface.RecognisedVersion;
@ -75,8 +75,8 @@ public class LocalMinecraftInterface implements MinecraftInterface {
public synchronized void createWorld(long seed, WorldType worldType, String generatorOptions)
throws MinecraftInterfaceException {
try {
Log.i("Creating world with seed '" + seed + "' and type '" + worldType.getName() + "'");
Log.i("Using the following generator options: " + generatorOptions);
AmidstLogger.info("Creating world with seed '" + seed + "' and type '" + worldType.getName() + "'");
AmidstLogger.info("Using the following generator options: " + generatorOptions);
initializeBlock();
Object[] genLayers = getGenLayers(seed, worldType, generatorOptions);
quarterResolutionBiomeGenerator = new SymbolicObject(genLayerClass, genLayers[0]);

View File

@ -12,7 +12,7 @@ import amidst.clazz.symbolic.SymbolicClassGraphCreationException;
import amidst.clazz.translator.ClassTranslator;
import amidst.documentation.Immutable;
import amidst.documentation.NotNull;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
import amidst.mojangapi.file.directory.VersionDirectory;
import amidst.mojangapi.minecraftinterface.MinecraftInterface;
import amidst.mojangapi.minecraftinterface.RecognisedVersion;
@ -33,7 +33,7 @@ public class LocalMinecraftInterfaceBuilder {
RecognisedVersion recognisedVersion = RecognisedVersion.from(classLoader);
Map<String, SymbolicClass> symbolicClassMap = Classes
.createSymbolicClassMap(versionDirectory.getJar(), classLoader, translator);
Log.i("Minecraft load complete.");
AmidstLogger.info("Minecraft load complete.");
return new LocalMinecraftInterface(
symbolicClassMap.get(SymbolicNames.CLASS_INT_CACHE),
symbolicClassMap.get(SymbolicNames.CLASS_BLOCK_INIT),

View File

@ -1,7 +1,7 @@
package amidst.mojangapi.world;
import amidst.documentation.Immutable;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
import amidst.mojangapi.world.coordinates.Resolution;
@Immutable
@ -20,7 +20,7 @@ public enum Dimension {
} else if (id == END.getId()) {
return END;
} else {
Log.w("Unsupported dimension id: " + id + ". Falling back to Overworld.");
AmidstLogger.warn("Unsupported dimension id: " + id + ". Falling back to Overworld.");
return OVERWORLD;
}
}

View File

@ -10,14 +10,14 @@ import java.util.Objects;
import amidst.documentation.NotNull;
import amidst.documentation.ThreadSafe;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
import amidst.mojangapi.minecraftinterface.RecognisedVersion;
@ThreadSafe
public class SeedHistoryLogger {
public static SeedHistoryLogger from(String filename) {
if (filename != null) {
Log.i("using seed history file: '" + filename + "'");
AmidstLogger.info("using seed history file: '" + filename + "'");
return new SeedHistoryLogger(new File(filename), true, true);
} else {
return new SeedHistoryLogger(new File(HISTORY_TXT), false, true);
@ -54,7 +54,7 @@ public class SeedHistoryLogger {
if (file.isFile()) {
writeLine(createLine(recognisedVersion, worldSeed));
} else {
Log.i("Not writing to seed history file, because it does not exist: " + file);
AmidstLogger.info("Not writing to seed history file, because it does not exist: " + file);
}
}
@ -82,7 +82,7 @@ public class SeedHistoryLogger {
try {
file.createNewFile();
} catch (IOException e) {
Log.w("Unable to create seed history file: " + file);
AmidstLogger.warn("Unable to create seed history file: " + file);
e.printStackTrace();
}
}
@ -91,7 +91,7 @@ public class SeedHistoryLogger {
try (PrintStream stream = new PrintStream(new FileOutputStream(file, true))) {
stream.println(line);
} catch (IOException e) {
Log.w("Unable to write to seed history file: " + file);
AmidstLogger.warn("Unable to write to seed history file: " + file);
e.printStackTrace();
}
}

View File

@ -4,7 +4,7 @@ import java.util.Arrays;
import java.util.List;
import amidst.documentation.Immutable;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
import amidst.mojangapi.minecraftinterface.local.SymbolicNames;
@Immutable
@ -51,7 +51,8 @@ public enum WorldType {
if (result != null) {
return result;
} else {
Log.e("Unable to find World Type: " + nameOrSymbolicFieldName + ". Falling back to default world type.");
AmidstLogger.error(
"Unable to find World Type: " + nameOrSymbolicFieldName + ". Falling back to default world type.");
return DEFAULT;
}
}

View File

@ -4,7 +4,7 @@ import java.util.Arrays;
import java.util.List;
import amidst.documentation.ThreadSafe;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
import amidst.mojangapi.world.Dimension;
import amidst.mojangapi.world.coordinates.CoordinatesInWorld;
import amidst.mojangapi.world.icon.WorldIcon;
@ -30,7 +30,7 @@ public class SpawnProducer extends CachedWorldIconProducer {
return createWorldIcon(spawnLocation);
} else {
CoordinatesInWorld origin = CoordinatesInWorld.origin();
Log.i("Unable to find spawn biome. Falling back to " + origin.toString() + ".");
AmidstLogger.info("Unable to find spawn biome. Falling back to " + origin.toString() + ".");
return createWorldIcon(origin);
}
}

View File

@ -1,7 +1,7 @@
package amidst.mojangapi.world.icon.type;
import amidst.documentation.ThreadSafe;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
import amidst.mojangapi.minecraftinterface.MinecraftInterfaceException;
import amidst.mojangapi.world.biome.Biome;
import amidst.mojangapi.world.biome.UnknownBiomeIndexException;
@ -28,15 +28,15 @@ public class TempleWorldIconTypeProvider implements WorldIconTypeProvider<Void>
} else if (biome == Biome.icePlains || biome == Biome.coldTaiga) {
return DefaultWorldIconTypes.IGLOO;
} else {
Log.e("No known structure for this biome type: " + biome.getName());
AmidstLogger.error("No known structure for this biome type: " + biome.getName());
return null;
}
} catch (UnknownBiomeIndexException e) {
Log.e(e.getMessage());
AmidstLogger.error(e.getMessage());
e.printStackTrace();
return null;
} catch (MinecraftInterfaceException e) {
Log.e(e.getMessage());
AmidstLogger.error(e.getMessage());
e.printStackTrace();
return null;
}

View File

@ -4,7 +4,7 @@ import java.util.List;
import java.util.Random;
import amidst.documentation.ThreadSafe;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
import amidst.mojangapi.minecraftinterface.MinecraftInterface;
import amidst.mojangapi.minecraftinterface.MinecraftInterfaceException;
import amidst.mojangapi.world.biome.Biome;
@ -30,7 +30,7 @@ public class BiomeDataOracle {
try {
copyToResult(result, width, height, getBiomeData(left, top, width, height, useQuarterResolution));
} catch (MinecraftInterfaceException e) {
Log.e(e.getMessage());
AmidstLogger.error(e.getMessage());
e.printStackTrace();
}
}
@ -56,11 +56,11 @@ public class BiomeDataOracle {
try {
return validBiomes.contains(getBiomeAt(x, y));
} catch (UnknownBiomeIndexException e) {
Log.e(e.getMessage());
AmidstLogger.error(e.getMessage());
e.printStackTrace();
return false;
} catch (MinecraftInterfaceException e) {
Log.e(e.getMessage());
AmidstLogger.error(e.getMessage());
e.printStackTrace();
return false;
}
@ -86,11 +86,11 @@ public class BiomeDataOracle {
}
return true;
} catch (UnknownBiomeIndexException e) {
Log.e(e.getMessage());
AmidstLogger.error(e.getMessage());
e.printStackTrace();
return false;
} catch (MinecraftInterfaceException e) {
Log.e(e.getMessage());
AmidstLogger.error(e.getMessage());
e.printStackTrace();
return false;
}
@ -126,11 +126,11 @@ public class BiomeDataOracle {
}
return result;
} catch (UnknownBiomeIndexException e) {
Log.e(e.getMessage());
AmidstLogger.error(e.getMessage());
e.printStackTrace();
return null;
} catch (MinecraftInterfaceException e) {
Log.e(e.getMessage());
AmidstLogger.error(e.getMessage());
e.printStackTrace();
return null;
}

View File

@ -6,7 +6,7 @@ import java.util.concurrent.ConcurrentLinkedQueue;
import amidst.documentation.AmidstThread;
import amidst.documentation.CalledOnlyBy;
import amidst.documentation.ThreadSafe;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
import amidst.mojangapi.file.directory.SaveDirectory;
import amidst.mojangapi.file.nbt.player.PlayerNbt;
import amidst.threading.WorkerExecutor;
@ -51,7 +51,7 @@ public class MovablePlayerList implements Iterable<Player> {
public void load(WorkerExecutor workerExecutor, Runnable onPlayerFinishedLoading) {
if (saveDirectory != null) {
Log.i("loading player locations");
AmidstLogger.info("loading player locations");
ConcurrentLinkedQueue<Player> players = new ConcurrentLinkedQueue<>();
this.players = players;
loadPlayersLater(players, workerExecutor, onPlayerFinishedLoading);
@ -89,12 +89,12 @@ public class MovablePlayerList implements Iterable<Player> {
public void save() {
if (isSaveEnabled) {
Log.i("saving player locations");
AmidstLogger.info("saving player locations");
for (Player player : players) {
player.trySaveLocation();
}
} else {
Log.i("not saving player locations, because it is disabled for this version");
AmidstLogger.info("not saving player locations, because it is disabled for this version");
}
}

View File

@ -3,7 +3,7 @@ package amidst.mojangapi.world.player;
import java.io.IOException;
import amidst.documentation.ThreadSafe;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
import amidst.mojangapi.file.MojangApiParsingException;
import amidst.mojangapi.file.nbt.player.PlayerNbt;
import amidst.mojangapi.world.Dimension;
@ -43,14 +43,13 @@ public class Player {
if (saveLocation()) {
return true;
} else {
Log
.w(
"skipping to save player location, because the backup file cannot be created for player: "
+ getPlayerName());
AmidstLogger.warn(
"skipping to save player location, because the backup file cannot be created for player: "
+ getPlayerName());
return false;
}
} catch (MojangApiParsingException e) {
Log.w("error while writing player location for player: " + getPlayerName());
AmidstLogger.warn("error while writing player location for player: " + getPlayerName());
e.printStackTrace();
return false;
}
@ -79,7 +78,7 @@ public class Player {
loadLocation();
return true;
} catch (IOException | MojangApiParsingException e) {
Log.w("error while reading player location for player: " + getPlayerName());
AmidstLogger.warn("error while reading player location for player: " + getPlayerName());
e.printStackTrace();
return false;
}

View File

@ -5,7 +5,7 @@ import java.util.concurrent.ConcurrentHashMap;
import amidst.documentation.NotNull;
import amidst.documentation.ThreadSafe;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
/**
* Even though this class is thread-safe, it is possible that the same player
@ -27,7 +27,7 @@ public class PlayerInformationCacheImpl implements PlayerInformationCache {
if (result != null) {
return result;
} else {
Log.i("requesting player information for uuid: " + cleanUUID);
AmidstLogger.info("requesting player information for uuid: " + cleanUUID);
result = PlayerInformation.fromUUID(cleanUUID);
put(result);
return result;
@ -41,7 +41,7 @@ public class PlayerInformationCacheImpl implements PlayerInformationCache {
if (result != null) {
return result;
} else {
Log.i("requesting player information for name: " + name);
AmidstLogger.info("requesting player information for name: " + name);
result = PlayerInformation.fromName(name);
put(result);
return result;

View File

@ -13,7 +13,7 @@ import java.util.TreeMap;
import amidst.documentation.GsonConstructor;
import amidst.documentation.Immutable;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
import amidst.mojangapi.world.biome.Biome;
import amidst.mojangapi.world.biome.BiomeColor;
@ -58,7 +58,7 @@ public class BiomeProfile {
public void validate() {
for (String biomeName : colorMap.keySet()) {
if (!Biome.exists(biomeName)) {
Log.i("Failed to find biome for: " + biomeName + " in profile: " + name);
AmidstLogger.info("Failed to find biome for: " + biomeName + " in profile: " + name);
}
}
}

View File

@ -10,13 +10,13 @@ import com.google.gson.JsonIOException;
import com.google.gson.JsonSyntaxException;
import amidst.documentation.Immutable;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
@Immutable
public class BiomeProfileDirectory {
public static BiomeProfileDirectory create(String root) {
BiomeProfileDirectory result = new BiomeProfileDirectory(getRoot(root));
Log.i("using biome profiles at: '" + result.getRoot() + "'");
AmidstLogger.info("using biome profiles at: '" + result.getRoot() + "'");
return result;
}
@ -53,15 +53,15 @@ public class BiomeProfileDirectory {
public void saveDefaultProfileIfNecessary() {
if (!isValid()) {
Log.i("Unable to find biome profile directory.");
AmidstLogger.info("Unable to find biome profile directory.");
} else {
Log.i("Found biome profile directory.");
AmidstLogger.info("Found biome profile directory.");
if (defaultProfile.isFile()) {
Log.i("Found default biome profile.");
AmidstLogger.info("Found default biome profile.");
} else if (BiomeProfile.getDefaultProfile().save(defaultProfile)) {
Log.i("Saved default biome profile.");
AmidstLogger.info("Saved default biome profile.");
} else {
Log.i("Attempted to save default biome profile, but encountered an error.");
AmidstLogger.info("Attempted to save default biome profile, but encountered an error.");
}
}
}
@ -101,7 +101,7 @@ public class BiomeProfileDirectory {
}
profile.validate();
} catch (JsonSyntaxException | JsonIOException | IOException | NullPointerException e) {
Log.w("Unable to load file: " + file);
AmidstLogger.warn("Unable to load file: " + file);
e.printStackTrace();
}
}

View File

@ -1,7 +1,7 @@
package amidst.settings.biomeprofile;
import amidst.documentation.ThreadSafe;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
import amidst.mojangapi.world.biome.BiomeColor;
import amidst.mojangapi.world.biome.UnknownBiomeIndexException;
@ -17,7 +17,7 @@ public class BiomeProfileSelection {
try {
return getBiomeColor(index);
} catch (UnknownBiomeIndexException e) {
Log.e(e.getMessage());
AmidstLogger.error(e.getMessage());
e.printStackTrace();
return BiomeColor.unknown();
}
@ -34,6 +34,6 @@ public class BiomeProfileSelection {
public void set(BiomeProfile biomeProfile) {
this.biomeColors = biomeProfile.createBiomeColorArray();
Log.i("Biome profile activated: " + biomeProfile.getName());
AmidstLogger.info("Biome profile activated: " + biomeProfile.getName());
}
}

View File

@ -7,7 +7,7 @@ import java.util.LinkedList;
import java.util.List;
import amidst.devtools.utils.RecognisedVersionEnumBuilder;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
import amidst.mojangapi.file.FilenameFactory;
import amidst.mojangapi.file.directory.DotMinecraftDirectory;
import amidst.mojangapi.file.directory.VersionDirectory;
@ -58,7 +58,7 @@ public class GenerateRecognisedVersionList {
}
private void process(String versionId) throws MalformedURLException, ClassNotFoundException {
Log.i("version " + versionId);
AmidstLogger.info("version " + versionId);
VersionDirectory versionDirectory = createVersionDirectory(versionId);
URLClassLoader classLoader = versionDirectory.createClassLoader();
String magicString = RecognisedVersion.generateMagicString(classLoader);

View File

@ -7,7 +7,7 @@ import java.util.function.Function;
import amidst.documentation.GsonConstructor;
import amidst.documentation.Immutable;
import amidst.logging.Log;
import amidst.logging.AmidstLogger;
import amidst.mojangapi.mocking.FragmentCornerWalker;
import amidst.mojangapi.world.World;
import amidst.mojangapi.world.coordinates.CoordinatesInWorld;
@ -38,7 +38,7 @@ public class CoordinatesCollectionJson {
corner -> producer.produce(corner, consumer, additionalDataFactory.apply(corner)));
SortedSet<CoordinatesInWorld> coordinates = createSortedSet(consumer.get());
if (coordinates.size() < minimalNumberOfCoordinates) {
Log.e("not enough coordinates for '" + name + "'");
AmidstLogger.error("not enough coordinates for '" + name + "'");
}
return new CoordinatesCollectionJson(coordinates);
}