Java 类net.minecraft.server.dedicated.DedicatedServer 实例源码

项目:DecompiledMinecraft    文件:MinecraftServerGui.java   
public MinecraftServerGui(DedicatedServer serverIn)
{
    this.server = serverIn;
    this.setPreferredSize(new Dimension(854, 480));
    this.setLayout(new BorderLayout());

    try
    {
        this.add(this.getLogComponent(), "Center");
        this.add(this.getStatsComponent(), "West");
    }
    catch (Exception exception)
    {
        LOGGER.error((String)"Couldn\'t build server GUI", (Throwable)exception);
    }
}
项目:World-Border    文件:WBCommand.java   
@Override
public boolean checkPermission(MinecraftServer server, ICommandSender sender) {
    if (sender instanceof DedicatedServer)
        return true;

    EntityPlayerMP   player  = (EntityPlayerMP) sender;
    GameProfile      profile = player.getGameProfile();
    UserListOpsEntry opEntry = (UserListOpsEntry) WorldBorder.SERVER
        .getPlayerList()
        .getOppedPlayers()
        .getEntry(profile);

    // Level 2 (out of 4) have general access to game-changing commands
    // TODO: Make this a configuration option
    return opEntry != null && opEntry.getPermissionLevel() > 2;
}
项目:CustomWorldGen    文件:MinecraftServerGui.java   
public MinecraftServerGui(DedicatedServer serverIn)
{
    this.server = serverIn;
    this.setPreferredSize(new Dimension(854, 480));
    this.setLayout(new BorderLayout());

    try
    {
        this.add(this.getLogComponent(), "Center");
        this.add(this.getStatsComponent(), "West");
    }
    catch (Exception exception)
    {
        LOGGER.error((String)"Couldn\'t build server GUI", (Throwable)exception);
    }
}
项目:WorldBorder-Forge    文件:WBCommand.java   
@Override
public boolean canCommandSenderUseCommand(ICommandSender sender)
{
    if (sender instanceof DedicatedServer)
        return true;

    EntityPlayerMP   player  = (EntityPlayerMP) sender;
    GameProfile      profile = player.getGameProfile();
    UserListOpsEntry opEntry = (UserListOpsEntry) WorldBorder.SERVER
        .getConfigurationManager()
        .func_152603_m()
        .func_152683_b(profile);

    // Level 2 (out of 4) have general access to game-changing commands
    // TODO: Make this a configuration option
    return opEntry != null && opEntry.func_152644_a() > 2;
}
项目:Cauldron    文件:MinecraftServerGui.java   
public MinecraftServerGui(DedicatedServer p_i2362_1_)
{
    this.field_120021_b = p_i2362_1_;
    this.setPreferredSize(new Dimension(854, 480));
    this.setLayout(new BorderLayout());

    try
    {
        this.add(this.getLogComponent(), "Center");
        this.add(this.getStatsComponent(), "West");
    }
    catch (Exception exception)
    {
        field_164248_b.error("Couldn\'t build server GUI", exception);
    }
}
项目:Cauldron    文件:MinecraftServerGui.java   
public MinecraftServerGui(DedicatedServer p_i2362_1_)
{
    this.field_120021_b = p_i2362_1_;
    this.setPreferredSize(new Dimension(854, 480));
    this.setLayout(new BorderLayout());

    try
    {
        this.add(this.getLogComponent(), "Center");
        this.add(this.getStatsComponent(), "West");
    }
    catch (Exception exception)
    {
        field_164248_b.error("Couldn\'t build server GUI", exception);
    }
}
项目:RuneCraftery    文件:DedicatedPlayerList.java   
public DedicatedPlayerList(DedicatedServer p_i1503_1_) {
   super(p_i1503_1_);
   this.field_72423_e = p_i1503_1_.func_71209_f("ops.txt");
   this.field_72422_f = p_i1503_1_.func_71209_f("white-list.txt");
   this.field_72402_d = p_i1503_1_.func_71327_a("view-distance", 10);
   this.field_72405_c = p_i1503_1_.func_71327_a("max-players", 20);
   this.func_72371_a(p_i1503_1_.func_71332_a("white-list", false));
   if(!p_i1503_1_.func_71264_H()) {
      this.func_72390_e().func_73708_a(true);
      this.func_72363_f().func_73708_a(true);
   }

   this.func_72390_e().func_73707_e();
   this.func_72390_e().func_73711_f();
   this.func_72363_f().func_73707_e();
   this.func_72363_f().func_73711_f();
   this.func_72417_t();
   this.func_72418_v();
   this.func_72419_u();
   if(!this.field_72422_f.exists()) {
      this.func_72421_w();
   }

}
项目:RuneCraftery    文件:MinecraftServerGui.java   
public static void func_120016_a(DedicatedServer p_120016_0_) {
   try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (Exception var3) {
      ;
   }

   MinecraftServerGui var1 = new MinecraftServerGui(p_120016_0_);
   field_120022_a = true;
   JFrame var2 = new JFrame("Minecraft server");
   var2.add(var1);
   var2.pack();
   var2.setLocationRelativeTo((Component)null);
   var2.setVisible(true);
   var2.addWindowListener(new MinecraftServerGuiINNER1(p_120016_0_));
}
项目:RuneCraftery    文件:MinecraftServerGui.java   
public static void func_120016_a(DedicatedServer par0DedicatedServer)
{
    try
    {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    }
    catch (Exception exception)
    {
        ;
    }

    MinecraftServerGui minecraftservergui = new MinecraftServerGui(par0DedicatedServer);
    field_120022_a = true;
    JFrame jframe = new JFrame("Minecraft server");
    jframe.add(minecraftservergui);
    jframe.pack();
    jframe.setLocationRelativeTo((Component)null);
    jframe.setVisible(true);
    jframe.addWindowListener(new MinecraftServerGuiINNER1(par0DedicatedServer));
}
项目:RuneCraftery    文件:MinecraftServerGui.java   
public MinecraftServerGui(DedicatedServer par1DedicatedServer)
{
    this.field_120021_b = par1DedicatedServer;
    this.setPreferredSize(new Dimension(854, 480));
    this.setLayout(new BorderLayout());

    try
    {
        this.add(this.func_120018_d(), "Center");
        this.add(this.func_120019_b(), "West");
    }
    catch (Exception exception)
    {
        exception.printStackTrace();
    }
}
项目:BetterNutritionMod    文件:MinecraftServerGui.java   
public static void func_120016_a(DedicatedServer par0DedicatedServer)
{
    try
    {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    }
    catch (Exception exception)
    {
        ;
    }

    MinecraftServerGui minecraftservergui = new MinecraftServerGui(par0DedicatedServer);
    field_120022_a = true;
    JFrame jframe = new JFrame("Minecraft server");
    jframe.add(minecraftservergui);
    jframe.pack();
    jframe.setLocationRelativeTo((Component)null);
    jframe.setVisible(true);
    jframe.addWindowListener(new MinecraftServerGuiINNER1(par0DedicatedServer));
}
项目:BetterNutritionMod    文件:MinecraftServerGui.java   
public MinecraftServerGui(DedicatedServer par1DedicatedServer)
{
    this.field_120021_b = par1DedicatedServer;
    this.setPreferredSize(new Dimension(854, 480));
    this.setLayout(new BorderLayout());

    try
    {
        this.add(this.func_120018_d(), "Center");
        this.add(this.func_120019_b(), "West");
    }
    catch (Exception exception)
    {
        exception.printStackTrace();
    }
}
项目:CreeperHostGui    文件:ServerProxy.java   
@Override
public void resuscitateWatchdog()
{
    DedicatedServer server = (DedicatedServer) instance().getMinecraftServerInstance();
    if (server.getMaxTickTime() > 0L)
    {
        Thread thread1 = new Thread(new ServerHangWatchdog(server));
        thread1.setName("Server Watchdog");
        thread1.setDaemon(true);
        thread1.start();
        CreeperHostServer.logger.info("Performing CPR. Server Watchdog is alive again!");
    }
}
项目:DecompiledMinecraft    文件:MinecraftServerGui.java   
/**
 * Creates the server GUI and sets it visible for the user.
 */
public static void createServerGui(final DedicatedServer serverIn)
{
    try
    {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    }
    catch (Exception var3)
    {
        ;
    }

    MinecraftServerGui minecraftservergui = new MinecraftServerGui(serverIn);
    JFrame jframe = new JFrame("Minecraft server");
    jframe.add(minecraftservergui);
    jframe.pack();
    jframe.setLocationRelativeTo((Component)null);
    jframe.setVisible(true);
    jframe.addWindowListener(new WindowAdapter()
    {
        public void windowClosing(WindowEvent p_windowClosing_1_)
        {
            serverIn.initiateShutdown();

            while (!serverIn.isServerStopped())
            {
                try
                {
                    Thread.sleep(100L);
                }
                catch (InterruptedException interruptedexception)
                {
                    interruptedexception.printStackTrace();
                }
            }

            System.exit(0);
        }
    });
}
项目:World-Border    文件:Util.java   
/**
 * Sends an automatically translated and formatted message to a command sender
 * @param sender Target to send message to
 * @param msg String or language key to broadcast
 */
public static void chat(ICommandSender sender, String msg, Object... parts)
{
    String translated = translate(msg);

    // Consoles require ANSI coloring for formatting
    if (sender instanceof DedicatedServer)
        Log.info( removeFormatting(translated), parts );
    else
    {
        translated = String.format(translated, parts);
        sender.addChatMessage( new TextComponentString(translated) );
    }
}
项目:CustomWorldGen    文件:FMLServerHandler.java   
@Override
public void queryUser(StartupQuery query) throws InterruptedException
{
    if (query.getResult() == null)
    {
        FMLLog.warning("%s", query.getText());
        query.finish();
    }
    else
    {
        String text = query.getText() +
                "\n\nRun the command /fml confirm or or /fml cancel to proceed." +
                "\nAlternatively start the server with -Dfml.queryResult=confirm or -Dfml.queryResult=cancel to preselect the answer.";
        FMLLog.warning("%s", text);

        if (!query.isSynchronous()) return; // no-op until mc does commands in another thread (if ever)

        boolean done = false;

        while (!done && server.isServerRunning())
        {
            if (Thread.interrupted()) throw new InterruptedException();

            DedicatedServer dedServer = (DedicatedServer) server;

            // rudimentary command processing, check for fml confirm/cancel and stop commands
            synchronized (dedServer.pendingCommandList)
            {
                for (Iterator<PendingCommand> it = GenericIterableFactory.newCastingIterable(dedServer.pendingCommandList, PendingCommand.class).iterator(); it.hasNext(); )
                {
                    String cmd = it.next().command.trim().toLowerCase();

                    if (cmd.equals("/fml confirm"))
                    {
                        FMLLog.info("confirmed");
                        query.setResult(true);
                        done = true;
                        it.remove();
                    }
                    else if (cmd.equals("/fml cancel"))
                    {
                        FMLLog.info("cancelled");
                        query.setResult(false);
                        done = true;
                        it.remove();
                    }
                    else if (cmd.equals("/stop"))
                    {
                        StartupQuery.abort();
                    }
                }
            }

            Thread.sleep(10L);
        }

        query.finish();
    }
}
项目:Basin    文件:SinkActivator.java   
@Nonnull
private DedicatedServer constructServerInstance(@Nonnull BundleContext ctx) {
  logger.info("Initializing Minecraft %s", FaucetVersion.API_VERSION);
  Bootstrap.register(); // apparently this is how the registries work ... don't question it

  // log some environment information
  logger.info("Running on Java v%s supplied by %s", System.getProperty("java.version", "Unknown"),
      System.getProperty("java.vendor"));

  // TODO: Integrate with plugins here?
  YggdrasilAuthenticationService var15 = new YggdrasilAuthenticationService(Proxy.NO_PROXY,
      UUID.randomUUID().toString());
  MinecraftSessionService var16 = var15.createMinecraftSessionService();
  GameProfileRepository var17 = var15.createProfileRepository();
  PlayerProfileCache var18 = new PlayerProfileCache(var17, new File(".", "usercache.json"));

  DedicatedServer server = new DedicatedServer(new File("."), DataFixesManager.createFixer(),
      var15, var16, var17, var18);

  // TODO: Re-introduce configuration

  if (!GraphicsEnvironment.isHeadless()) {
    logger.info("Server GUI has been disabled or is unavailable in this environment");
    // TODO: Custom GUI
  } else {
    logger
        .info("Server GUI has been disabled or is not available within the current environment");
  }

  return server;
}
项目:Basin    文件:SinkServer.java   
@SuppressWarnings("ThisEscapedInObjectConstruction")
SinkServer(@Nonnull BundleContext ctx, @Nonnull DedicatedServer server) {
  this.ctx = ctx;
  this.server = server;

  this.injector = Guice.createInjector(Peaberry.osgiModule(ctx), this);

  this.injector.injectMembers(this);
  logger.debug("Faucet services are ready for consumption");
}
项目:Sink    文件:SinkActivator.java   
@Nonnull
private DedicatedServer constructServerInstance(@Nonnull BundleContext ctx) {
  logger.info("Initializing Minecraft %s", FaucetVersion.API_VERSION);
  Bootstrap.register(); // apparently this is how the registries work ... don't question it

  // log some environment information
  logger.info("Running on Java v%s supplied by %s", System.getProperty("java.version", "Unknown"),
      System.getProperty("java.vendor"));

  // TODO: Integrate with plugins here?
  YggdrasilAuthenticationService var15 = new YggdrasilAuthenticationService(Proxy.NO_PROXY,
      UUID.randomUUID().toString());
  MinecraftSessionService var16 = var15.createMinecraftSessionService();
  GameProfileRepository var17 = var15.createProfileRepository();
  PlayerProfileCache var18 = new PlayerProfileCache(var17, new File(".", "usercache.json"));

  DedicatedServer server = new DedicatedServer(new File("."), DataFixesManager.createFixer(),
      var15, var16, var17, var18);

  // TODO: Re-introduce configuration

  if (!GraphicsEnvironment.isHeadless()) {
    logger.info("Server GUI has been disabled or is unavailable in this environment");
    // TODO: Custom GUI
  } else {
    logger
        .info("Server GUI has been disabled or is not available within the current environment");
  }

  return server;
}
项目:Sink    文件:SinkServer.java   
@SuppressWarnings("ThisEscapedInObjectConstruction")
SinkServer(@Nonnull BundleContext ctx, @Nonnull DedicatedServer server) {
  this.ctx = ctx;
  this.server = server;

  this.injector = Guice.createInjector(Peaberry.osgiModule(ctx), this);

  this.injector.injectMembers(this);
  logger.debug("Faucet services are ready for consumption");
}
项目:WorldBorder-Forge    文件:Util.java   
/**
 * Sends an automatically translated and formatted message to a command sender
 * @param sender Target to send message to
 * @param msg String or language key to broadcast
 */
public static void chat(ICommandSender sender, String msg, Object... parts)
{
    String translated = translate(msg);

    // Consoles require ANSI coloring for formatting
    if (sender instanceof DedicatedServer)
        Log.info( removeFormatting(translated), parts );
    else
    {
        translated = String.format(translated, parts);
        sender.addChatMessage( new ChatComponentText(translated) );
    }
}
项目:morecommands    文件:PatchEntityPlayerMP.java   
@Override
public <T extends FMLStateEvent> boolean applyStateEventPatch(T e) {
    FMLServerAboutToStartEvent event = (FMLServerAboutToStartEvent) e;

    try {
        Constructor<PlayerList> ctor;

        if (event.getServer().isDedicatedServer())
            ctor = (Constructor<PlayerList>) (Constructor<?>) DedicatedPlayerList.class.getDeclaredConstructor(DedicatedServer.class);
        else
            ctor = (Constructor<PlayerList>) (Constructor<?>) IntegratedPlayerList.class.getDeclaredConstructor(IntegratedServer.class);

        ctor.setAccessible(true);

        if (event.getServer().isDedicatedServer())
            event.getServer().setPlayerList(ctor.newInstance((DedicatedServer) event.getServer()));
        else
            event.getServer().setPlayerList(ctor.newInstance((IntegratedServer) event.getServer()));

        PatchManager.instance().getGlobalAppliedPatches().setPatchSuccessfullyApplied(this.displayName, true);
        return true;
    }
    catch (Exception ex) {
        PatchManager.instance().getGlobalAppliedPatches().setPatchSuccessfullyApplied(this.displayName, false);
        return false;
    }
}
项目:morecommands    文件:CommandWorld.java   
private void loadWorld(DedicatedServer server, AnvilSaveConverter saveLoader, String world, long seed, WorldType type, String genSettings) {
    if (this.loadWorlds != null) {
        try {
            server.getPlayerList().saveAllPlayerData();
            this.loadWorlds.invoke(server, world, world, seed, type == null ? WorldType.DEFAULT : type, genSettings);
            server.setFolderName(world);

            for (EntityPlayerMP player : server.getPlayerList().getPlayers()) {
                transferPlayer(server, player);
            }
        }
        catch (Exception ex) {ex.printStackTrace(); return;}
    }
}
项目:nailed    文件:NailedPlatform.java   
public void preLoad(DedicatedServer server){
    CommandBase.setAdminCommander(null); //Don't spam my log with stupid messages

    TileEntity.addMapping(TileEntityStatEmitter.class, "Nailed:StatEmitter");
    TileEntity.addMapping(OldStatEmitterConverter.class, "nailed.stat");

    pluginsDir.mkdir();
    NailedPluginManager.instance().loadPlugins(pluginsDir);

    NailedEventFactory.fireEvent(new RegisterMappacksEvent(NailedMappackRegistry.instance(), NailedMapLoader.instance()));
    NailedCommandManager.registerPluginCommands();
}
项目:RuneCraftery    文件:MinecraftServerGui.java   
public MinecraftServerGui(DedicatedServer p_i2362_1_) {
   this.field_120021_b = p_i2362_1_;
   this.setPreferredSize(new Dimension(854, 480));
   this.setLayout(new BorderLayout());

   try {
      this.add(this.func_120018_d(), "Center");
      this.add(this.func_120019_b(), "West");
   } catch (Exception var3) {
      var3.printStackTrace();
   }

}
项目:CreeperHostGui    文件:ServerProxy.java   
@Override
public boolean needsToBeKilled()
{
    return ((DedicatedServer) instance().getMinecraftServerInstance()).getMaxTickTime() > 0;
}
项目:CustomWorldGen    文件:FMLServerHandler.java   
@Override
public boolean shouldAllowPlayerLogins()
{
    return DedicatedServer.allowPlayerLogins;
}
项目:CustomWorldGen    文件:FMLServerHandler.java   
@Override
public void allowLogins() {
    DedicatedServer.allowPlayerLogins = true;
}
项目:CustomWorldGen    文件:TerminalHandler.java   
public static boolean handleCommands(DedicatedServer server)
{
    final ConsoleReader reader = TerminalConsoleAppender.getReader();
    if (reader != null)
    {
        TerminalConsoleAppender.setFormatter(new ConsoleFormatter());
        reader.addCompleter(new ConsoleCommandCompleter(server));

        String line;
        while (!server.isServerStopped() && server.isServerRunning())
        {
            try
            {
                line = reader.readLine("> ");
                if (line == null)
                {
                    break;
                }

                line = line.trim();
                if (!line.isEmpty())
                {
                    server.addPendingCommand(line, server);
                }
            }
            catch (IOException e)
            {
                logger.error("Exception handling console input", e);
            }
        }

        return true;
    }
    else
    {
        TerminalConsoleAppender.setFormatter(new Function<String, String>() {

            @Override
            public String apply(String text)
            {
                return TextFormatting.getTextWithoutFormattingCodes(text);
            }

        });
        return false;
    }
}
项目:CustomWorldGen    文件:ConsoleCommandCompleter.java   
public ConsoleCommandCompleter(DedicatedServer server)
{
    this.server = checkNotNull(server, "server");
}
项目:CustomWorldGen    文件:MinecraftServerGui.java   
/**
 * Creates the server GUI and sets it visible for the user.
 */
public static void createServerGui(final DedicatedServer serverIn)
{
    try
    {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    }
    catch (Exception var3)
    {
        ;
    }

    MinecraftServerGui minecraftservergui = new MinecraftServerGui(serverIn);
    JFrame jframe = new JFrame("Minecraft server");
    jframe.add(minecraftservergui);
    jframe.pack();
    jframe.setLocationRelativeTo((Component)null);
    jframe.setVisible(true);
    jframe.addWindowListener(new WindowAdapter()
    {
        public void windowClosing(WindowEvent p_windowClosing_1_)
        {
            serverIn.initiateShutdown();

            while (!serverIn.isServerStopped())
            {
                try
                {
                    Thread.sleep(100L);
                }
                catch (InterruptedException interruptedexception)
                {
                    interruptedexception.printStackTrace();
                }
            }

            System.exit(0);
        }
    });
    minecraftservergui.latch.countDown();
}
项目:TRHS_Club_Mod_2016    文件:FMLServerHandler.java   
@Override
public void queryUser(StartupQuery query) throws InterruptedException
{
    if (query.getResult() == null)
    {
        FMLLog.warning("%s", query.getText());
        query.finish();
    }
    else
    {
        String text = query.getText() +
                "\n\nRun the command /fml confirm or or /fml cancel to proceed." +
                "\nAlternatively start the server with -Dfml.queryResult=confirm or -Dfml.queryResult=cancel to preselect the answer.";
        FMLLog.warning("%s", text);

        if (!query.isSynchronous()) return; // no-op until mc does commands in another thread (if ever)

        boolean done = false;

        while (!done && server.func_71278_l())
        {
            if (Thread.interrupted()) throw new InterruptedException();

            DedicatedServer dedServer = (DedicatedServer) server;

            // rudimentary command processing, check for fml confirm/cancel and stop commands
            synchronized (dedServer.field_71341_l)
            {
                for (Iterator<ServerCommand> it = GenericIterableFactory.newCastingIterable(dedServer.field_71341_l, ServerCommand.class).iterator(); it.hasNext(); )
                {
                    String cmd = it.next().field_73702_a.trim().toLowerCase();

                    if (cmd.equals("/fml confirm"))
                    {
                        FMLLog.info("confirmed");
                        query.setResult(true);
                        done = true;
                        it.remove();
                    }
                    else if (cmd.equals("/fml cancel"))
                    {
                        FMLLog.info("cancelled");
                        query.setResult(false);
                        done = true;
                        it.remove();
                    }
                    else if (cmd.equals("/stop"))
                    {
                        StartupQuery.abort();
                    }
                }
            }

            Thread.sleep(10L);
        }

        query.finish();
    }
}
项目:TRHS_Club_Mod_2016    文件:FMLServerHandler.java   
@Override
public boolean shouldAllowPlayerLogins()
{
    return DedicatedServer.allowPlayerLogins;
}
项目:TRHS_Club_Mod_2016    文件:FMLServerHandler.java   
@Override
public void allowLogins() {
    DedicatedServer.allowPlayerLogins = true;
}
项目:Basin    文件:SinkServer.java   
/**
 * {@inheritDoc}
 */
@Nonnull
@Override
public DedicatedServer getHandle() {
  return server;
}
项目:Sink    文件:SinkServer.java   
/**
 * {@inheritDoc}
 */
@Nonnull
@Override
public DedicatedServer getHandle() {
  return server;
}
项目:CauldronGit    文件:FMLServerHandler.java   
@Override
public void queryUser(StartupQuery query) throws InterruptedException
{
    if (query.getResult() == null)
    {
        FMLLog.warning("%s", query.getText());
        query.finish();
    }
    else
    {
        String text = query.getText() +
                "\n\nRun the command /fml confirm or or /fml cancel to proceed." +
                "\nAlternatively start the server with -Dfml.queryResult=confirm or -Dfml.queryResult=cancel to preselect the answer.";
        FMLLog.warning("%s", text);

        if (!query.isSynchronous()) return; // no-op until mc does commands in another thread (if ever)

        boolean done = false;

        while (!done && server.isServerRunning())
        {
            if (Thread.interrupted()) throw new InterruptedException();

            DedicatedServer dedServer = (DedicatedServer) server;

            // rudimentary command processing, check for fml confirm/cancel and stop commands
            synchronized (dedServer.pendingCommandList)
            {
                for (Iterator<ServerCommand> it = GenericIterableFactory.newCastingIterable(dedServer.pendingCommandList, ServerCommand.class).iterator(); it.hasNext(); )
                {
                    String cmd = it.next().command.trim().toLowerCase();

                    if (cmd.equals("/fml confirm"))
                    {
                        FMLLog.info("confirmed");
                        query.setResult(true);
                        done = true;
                        it.remove();
                    }
                    else if (cmd.equals("/fml cancel"))
                    {
                        FMLLog.info("cancelled");
                        query.setResult(false);
                        done = true;
                        it.remove();
                    }
                    else if (cmd.equals("/stop"))
                    {
                        StartupQuery.abort();
                    }
                }
            }

            Thread.sleep(10L);
        }

        query.finish();
    }
}
项目:CauldronGit    文件:FMLServerHandler.java   
@Override
public boolean shouldAllowPlayerLogins()
{
    return DedicatedServer.allowPlayerLogins;
}
项目:morecommands    文件:PatchEntityPlayerMP.java   
DedicatedPlayerList(DedicatedServer server) {
    super(server);
}
项目:Cauldron    文件:FMLServerHandler.java   
@Override
public void queryUser(StartupQuery query) throws InterruptedException
{
    if (query.getResult() == null)
    {
        FMLLog.warning("%s", query.getText());
        query.finish();
    }
    else
    {
        String text = query.getText() +
                "\n\nRun the command /fml confirm or or /fml cancel to proceed." +
                "\nAlternatively start the server with -Dfml.queryResult=confirm or -Dfml.queryResult=cancel to preselect the answer.";
        FMLLog.warning("%s", text);

        if (!query.isSynchronous()) return; // no-op until mc does commands in another thread (if ever)

        boolean done = false;

        while (!done && server.isServerRunning())
        {
            if (Thread.interrupted()) throw new InterruptedException();

            DedicatedServer dedServer = (DedicatedServer) server;

            // rudimentary command processing, check for fml confirm/cancel and stop commands
            synchronized (dedServer.pendingCommandList)
            {
                for (Iterator<ServerCommand> it = GenericIterableFactory.newCastingIterable(dedServer.pendingCommandList, ServerCommand.class).iterator(); it.hasNext(); )
                {
                    String cmd = it.next().command.trim().toLowerCase();

                    if (cmd.equals("/fml confirm"))
                    {
                        FMLLog.info("confirmed");
                        query.setResult(true);
                        done = true;
                        it.remove();
                    }
                    else if (cmd.equals("/fml cancel"))
                    {
                        FMLLog.info("cancelled");
                        query.setResult(false);
                        done = true;
                        it.remove();
                    }
                    else if (cmd.equals("/stop"))
                    {
                        StartupQuery.abort();
                    }
                }
            }

            Thread.sleep(10L);
        }

        query.finish();
    }
}