Exemplo n.º 1
0
  public MinecraftServer(OptionSet options, Proxy proxy, File file1) {
    io.netty.util.ResourceLeakDetector.setEnabled(false); // Spigot - disable
    this.d = proxy;
    MinecraftServer.k = this;
    // this.universe = file; // CraftBukkit
    // this.q = new ServerConnection(this); // Spigot
    this.Z = new UserCache(this, file1);
    this.p = this.h();
    // this.convertable = new WorldLoaderServer(file); // CraftBukkit - moved to
    // DedicatedServer.init
    this.V = new YggdrasilAuthenticationService(proxy, UUID.randomUUID().toString());
    this.W = this.V.createMinecraftSessionService();
    this.Y = this.V.createProfileRepository();
    // CraftBukkit start
    this.options = options;
    // Try to see if we're actually running in a terminal, disable jline if not
    if (System.console() == null) {
      System.setProperty("jline.terminal", "jline.UnsupportedTerminal");
      Main.useJline = false;
    }

    try {
      reader = new ConsoleReader(System.in, System.out);
      reader.setExpandEvents(
          false); // Avoid parsing exceptions for uncommonly used event designators
    } catch (Throwable e) {
      try {
        // Try again with jline disabled for Windows users without C++ 2008 Redistributable
        System.setProperty("jline.terminal", "jline.UnsupportedTerminal");
        System.setProperty("user.language", "en");
        Main.useJline = false;
        reader = new ConsoleReader(System.in, System.out);
        reader.setExpandEvents(false);
      } catch (IOException ex) {
        LOGGER.warn((String) null, ex);
      }
    }
    Runtime.getRuntime()
        .addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));

    this.serverThread = primaryThread = new Thread(this, "Server thread"); // Moved from main
  }
 static {
   // Disable resource leak detection for performance reasons by default
   ResourceLeakDetector.setEnabled(false);
 }