/LiteLoader/tags/1.6.4_02/debug/com/mumfrey/liteloader/debug/Start.java

https://gitlab.com/LiteLoader/LiteLoaderMirror · Java · 65 lines · 42 code · 12 blank · 11 comment · 2 complexity · 242f693bb9473af968d88a1ed76c8223 MD5 · raw file

  1. package com.mumfrey.liteloader.debug;
  2. import java.io.File;
  3. import java.util.logging.ConsoleHandler;
  4. import java.util.logging.Handler;
  5. import java.util.logging.Logger;
  6. import net.minecraft.launchwrapper.Launch;
  7. import com.mumfrey.liteloader.launch.LiteLoaderTweaker;
  8. import com.mumfrey.liteloader.util.log.LiteLoaderLogFormatter;
  9. /**
  10. * Wrapper class for LaunchWrapper Main class, which logs into minecraft.net first so that online shizzle can be tested
  11. *
  12. * @author Adam Mummery-Smith
  13. * @version 0.6
  14. */
  15. public abstract class Start
  16. {
  17. private static Logger logger = Logger.getLogger("liteloader");
  18. /**
  19. * Entry point.
  20. *
  21. * @param args
  22. */
  23. public static void main(String[] args)
  24. {
  25. Start.prepareLogger();
  26. String usernameFromCmdLine = (args.length > 0) ? args[0] : null;
  27. String passwordFromCmdLine = (args.length > 1) ? args[1] : null;
  28. File loginJson = new File(new File(System.getProperty("user.dir")), ".auth.json");
  29. LoginManager loginManager = new LoginManager(loginJson);
  30. loginManager.login(usernameFromCmdLine, passwordFromCmdLine, 5);
  31. Start.logger.info(String.format("Launching game as %s", loginManager.getProfileName()));
  32. File gameDir = new File(System.getProperty("user.dir"));
  33. File assetsDir = new File(gameDir, "assets");
  34. args = new String[] {
  35. "--tweakClass", LiteLoaderTweaker.class.getName(),
  36. "--username", loginManager.getProfileName(),
  37. "--session", loginManager.getAuthenticatedToken(),
  38. "--version", "mcp",
  39. "--gameDir", gameDir.getAbsolutePath(),
  40. "--assetsDir", assetsDir.getAbsolutePath()
  41. };
  42. Launch.main(args);
  43. }
  44. private static void prepareLogger()
  45. {
  46. System.setProperty("liteloaderFormatLog", "true");
  47. for (Handler handler : Start.logger.getParent().getHandlers())
  48. {
  49. if (handler instanceof ConsoleHandler)
  50. handler.setFormatter(new LiteLoaderLogFormatter(false));
  51. }
  52. }
  53. }