@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(); } }
public Iterable<I> typeSafeIterable() { return GenericIterableFactory.newCastingIterable(super.iterator(), superType); }
@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 Iterable<I> typeSafeIterable() { Iterable<?> self = this; return GenericIterableFactory.newCastingIterable(self, superType); }