@Override public void queryUser(StartupQuery query) throws InterruptedException { if (query.getResult() == null) { client.func_147108_a(new GuiNotification(query)); } else { client.func_147108_a(new GuiConfirmation(query)); } if (query.isSynchronous()) { while (client.field_71462_r instanceof GuiNotification) { if (Thread.interrupted()) throw new InterruptedException(); client.field_71461_s.func_73719_c(""); Thread.sleep(50); } client.field_71461_s.func_73719_c(""); // make sure the blank screen is being drawn at the end } }
@Override public void queryUser(StartupQuery query) throws InterruptedException { if (query.getResult() == null) { client.displayGuiScreen(new GuiNotification(query)); } else { client.displayGuiScreen(new GuiConfirmation(query)); } if (query.isSynchronous()) { while (client.currentScreen instanceof GuiNotification) { if (Thread.interrupted()) throw new InterruptedException(); client.loadingScreen.resetProgresAndWorkingMessage(""); Thread.sleep(50); } client.loadingScreen.resetProgresAndWorkingMessage(""); // make sure the blank screen is being drawn at the end } }
public void startServerThread() { StartupQuery.reset(); (new Thread("Server thread") { private static final String __OBFID = "CL_00001418"; public void run() { MinecraftServer.this.run(); } }).start(); }
public GuiConfirmation(StartupQuery query) { super(query); }
public GuiNotification(StartupQuery query) { this.query = query; }
@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(); } }
@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(); } }
public void launchIntegratedServer(String p_71371_1_, String p_71371_2_, WorldSettings p_71371_3_) { FMLClientHandler.instance().startIntegratedServer(p_71371_1_, p_71371_2_, p_71371_3_); this.loadWorld((WorldClient)null); System.gc(); ISaveHandler isavehandler = this.saveLoader.getSaveLoader(p_71371_1_, false); WorldInfo worldinfo = isavehandler.loadWorldInfo(); if (worldinfo == null && p_71371_3_ != null) { worldinfo = new WorldInfo(p_71371_3_, p_71371_1_); isavehandler.saveWorldInfo(worldinfo); } if (p_71371_3_ == null) { p_71371_3_ = new WorldSettings(worldinfo); } try { this.theIntegratedServer = new IntegratedServer(this, p_71371_1_, p_71371_2_, p_71371_3_); this.theIntegratedServer.startServerThread(); this.integratedServerIsRunning = true; } catch (Throwable throwable) { CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Starting integrated server"); CrashReportCategory crashreportcategory = crashreport.makeCategory("Starting integrated server"); crashreportcategory.addCrashSection("Level ID", p_71371_1_); crashreportcategory.addCrashSection("Level Name", p_71371_2_); throw new ReportedException(crashreport); } this.loadingScreen.displayProgressMessage(I18n.format("menu.loadingLevel", new Object[0])); while (!this.theIntegratedServer.serverIsInRunLoop()) { if (!StartupQuery.check()) { loadWorld(null); displayGuiScreen(null); return; } String s2 = this.theIntegratedServer.getUserMessage(); if (s2 != null) { this.loadingScreen.resetProgresAndWorkingMessage(I18n.format(s2, new Object[0])); } else { this.loadingScreen.resetProgresAndWorkingMessage(""); } try { Thread.sleep(200L); } catch (InterruptedException interruptedexception) { ; } } this.displayGuiScreen((GuiScreen)null); SocketAddress socketaddress = this.theIntegratedServer.func_147137_ag().addLocalEndpoint(); NetworkManager networkmanager = NetworkManager.provideLocalClient(socketaddress); networkmanager.setNetHandler(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null)); networkmanager.scheduleOutboundPacket(new C00Handshake(5, socketaddress.toString(), 0, EnumConnectionState.LOGIN), new GenericFutureListener[0]); networkmanager.scheduleOutboundPacket(new C00PacketLoginStart(this.getSession().func_148256_e()), new GenericFutureListener[0]); this.myNetworkManager = networkmanager; }