diff options
author | icelimetea <fr3shtea@outlook.com> | 2022-04-24 15:10:35 +0100 |
---|---|---|
committer | icelimetea <fr3shtea@outlook.com> | 2022-04-24 15:10:35 +0100 |
commit | b0a469baab54c38a80607a4567b4c0f6eb825245 (patch) | |
tree | 0166bfd23aac49de35ead0206cb6099377d7933a /libraries/launcher/org/multimc/onesix | |
parent | c968c1be7892fbc1ba0571d30a03b20e3f8a5abc (diff) | |
download | PrismLauncher-b0a469baab54c38a80607a4567b4c0f6eb825245.tar.gz PrismLauncher-b0a469baab54c38a80607a4567b4c0f6eb825245.tar.bz2 PrismLauncher-b0a469baab54c38a80607a4567b4c0f6eb825245.zip |
Use java.util.logging instead of custom logging
Diffstat (limited to 'libraries/launcher/org/multimc/onesix')
-rw-r--r-- | libraries/launcher/org/multimc/onesix/OneSixLauncher.java | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/libraries/launcher/org/multimc/onesix/OneSixLauncher.java b/libraries/launcher/org/multimc/onesix/OneSixLauncher.java index ea445995..0058bd43 100644 --- a/libraries/launcher/org/multimc/onesix/OneSixLauncher.java +++ b/libraries/launcher/org/multimc/onesix/OneSixLauncher.java @@ -19,14 +19,18 @@ import org.multimc.*; import java.applet.Applet; import java.io.File; -import java.io.IOException; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; public class OneSixLauncher implements Launcher { + + private static final Logger LOGGER = Logger.getLogger("OneSixLauncher"); + // parameters, separated from ParamBucket private List<String> libraries; private List<String> mcparams; @@ -104,7 +108,7 @@ public class OneSixLauncher implements Launcher if (f == null) { - System.err.println("Could not find Minecraft path field."); + LOGGER.warning("Could not find Minecraft path field."); } else { @@ -113,8 +117,12 @@ public class OneSixLauncher implements Launcher } } catch (Exception e) { - System.err.println("Could not set base folder. Failed to find/access Minecraft main class:"); - e.printStackTrace(System.err); + LOGGER.log( + Level.SEVERE, + "Could not set base folder. Failed to find/access Minecraft main class:", + e + ); + return -1; } @@ -122,7 +130,7 @@ public class OneSixLauncher implements Launcher if(!traits.contains("noapplet")) { - Utils.log("Launching with applet wrapper..."); + LOGGER.info("Launching with applet wrapper..."); try { Class<?> MCAppletClass = cl.loadClass(appletClass); @@ -132,10 +140,9 @@ public class OneSixLauncher implements Launcher return 0; } catch (Exception e) { - Utils.log("Applet wrapper failed:", "Error"); - e.printStackTrace(System.err); - Utils.log(); - Utils.log("Falling back to using main class."); + LOGGER.log(Level.SEVERE, "Applet wrapper failed:", e); + + LOGGER.warning("Falling back to using main class."); } } @@ -147,8 +154,8 @@ public class OneSixLauncher implements Launcher return 0; } catch (Exception e) { - Utils.log("Failed to invoke the Minecraft main class:", "Fatal"); - e.printStackTrace(System.err); + LOGGER.log(Level.SEVERE, "Failed to invoke the Minecraft main class:", e); + return -1; } } @@ -185,8 +192,8 @@ public class OneSixLauncher implements Launcher mc = cl.loadClass(mainClass); } catch (ClassNotFoundException e) { - System.err.println("Failed to find Minecraft main class:"); - e.printStackTrace(System.err); + LOGGER.log(Level.SEVERE, "Failed to find Minecraft main class:", e); + return -1; } @@ -197,8 +204,8 @@ public class OneSixLauncher implements Launcher meth = mc.getMethod("main", String[].class); } catch (NoSuchMethodException e) { - System.err.println("Failed to acquire the main method:"); - e.printStackTrace(System.err); + LOGGER.log(Level.SEVERE, "Failed to acquire the main method:", e); + return -1; } @@ -210,8 +217,8 @@ public class OneSixLauncher implements Launcher meth.invoke(null, (Object) paramsArray); } catch (Exception e) { - System.err.println("Failed to start Minecraft:"); - e.printStackTrace(System.err); + LOGGER.log(Level.SEVERE, "Failed to start Minecraft:", e); + return -1; } return 0; @@ -226,8 +233,8 @@ public class OneSixLauncher implements Launcher processParams(params); } catch (NotFoundException e) { - System.err.println("Not enough arguments."); - e.printStackTrace(System.err); + LOGGER.log(Level.SEVERE, "Not enough arguments!"); + return -1; } @@ -245,4 +252,5 @@ public class OneSixLauncher implements Launcher return launchWithMainClass(); } } + } |