pre remove ipc
This commit is contained in:
parent
7cdff9220a
commit
63591fcb6f
4 changed files with 6 additions and 98 deletions
|
@ -2353,57 +2353,10 @@ public class Game implements IThreadListener {
|
||||||
if(this.getNetHandler() != null)
|
if(this.getNetHandler() != null)
|
||||||
this.getNetHandler().getNetworkManager().closeChannel("Quitting");
|
this.getNetHandler().getNetworkManager().closeChannel("Quitting");
|
||||||
this.unloadWorld();
|
this.unloadWorld();
|
||||||
// if(server != null)
|
|
||||||
// server.shutdown();
|
|
||||||
}
|
}
|
||||||
this.displayGuiScreen(GuiMenu.INSTANCE);
|
this.displayGuiScreen(GuiMenu.INSTANCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public void startServer(File dir) {
|
|
||||||
// if(this.server != null)
|
|
||||||
// return;
|
|
||||||
// server = new ServerProcess(this, dir, 1024, 4096, this.port);
|
|
||||||
// server.start();
|
|
||||||
// this.displayGuiScreen(GuiLoading.makeStartTask(server));
|
|
||||||
//// while(server != null && !server.isStarted()) {
|
|
||||||
//// try {
|
|
||||||
//// Thread.sleep(10L);
|
|
||||||
//// }
|
|
||||||
//// catch(InterruptedException e) {
|
|
||||||
//// }
|
|
||||||
//// }
|
|
||||||
//// if(server != null) {
|
|
||||||
//// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void stopServer(boolean display) {
|
|
||||||
// if(server != null) {
|
|
||||||
// server.shutdown();
|
|
||||||
// if(display) {
|
|
||||||
// this.displayGuiScreen(GuiLoading.makeStopTask(server));
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// while(!server.isStopped()) {
|
|
||||||
// try {
|
|
||||||
// Thread.sleep(10L);
|
|
||||||
// }
|
|
||||||
// catch(InterruptedException e) {
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// server = null;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public boolean isServerRunning() {
|
|
||||||
// return this.server != null;
|
|
||||||
// }
|
|
||||||
|
|
||||||
public void waitForServer() {
|
|
||||||
// if(this.server != null)
|
|
||||||
this.displayGuiScreen(GuiLoading.makeWaitTask("Lade Welt ..."));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void startSound(boolean load) {
|
private void startSound(boolean load) {
|
||||||
if(load)
|
if(load)
|
||||||
SoundEvent.loadSounds();
|
SoundEvent.loadSounds();
|
||||||
|
|
|
@ -10,13 +10,14 @@ import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.OutputStreamWriter;
|
import java.io.OutputStreamWriter;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import game.log.Log;
|
import game.log.Log;
|
||||||
import game.util.Tuple;
|
import game.util.Tuple;
|
||||||
import game.util.Util;
|
import game.util.Util;
|
||||||
|
|
||||||
public class ServerProcess {
|
public class ServerProcess {
|
||||||
private final Game monitor;
|
private final Consumer<String> monitor;
|
||||||
private final ProcessBuilder builder;
|
private final ProcessBuilder builder;
|
||||||
|
|
||||||
private Process process;
|
private Process process;
|
||||||
|
@ -27,7 +28,7 @@ public class ServerProcess {
|
||||||
private int progress = -1;
|
private int progress = -1;
|
||||||
private int lastTick;
|
private int lastTick;
|
||||||
|
|
||||||
public ServerProcess(Game monitor, File dir, int minMem, int maxMem, int port) {
|
public ServerProcess(Consumer<String> monitor, File dir, int minMem, int maxMem, int port) {
|
||||||
this.monitor = monitor;
|
this.monitor = monitor;
|
||||||
File jar = new File("game.jar");
|
File jar = new File("game.jar");
|
||||||
String path;
|
String path;
|
||||||
|
@ -90,11 +91,7 @@ public class ServerProcess {
|
||||||
else if(data.first.equals("tick"))
|
else if(data.first.equals("tick"))
|
||||||
ServerProcess.this.lastTick = Integer.parseInt(data.second);
|
ServerProcess.this.lastTick = Integer.parseInt(data.second);
|
||||||
else if(data.first.equals("console"))
|
else if(data.first.equals("console"))
|
||||||
ServerProcess.this.monitor.schedule(new Runnable() {
|
ServerProcess.this.monitor.accept(data.second);
|
||||||
public void run() {
|
|
||||||
ServerProcess.this.monitor.logConsole(data.second);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Log.SYSTEM.trace("server cmd %s -- %s", data.first, data.second);
|
Log.SYSTEM.trace("server cmd %s -- %s", data.first, data.second);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package game.gui;
|
package game.gui;
|
||||||
|
|
||||||
import game.Game;
|
import game.Game;
|
||||||
import game.ServerProcess;
|
|
||||||
import game.gui.element.Bar;
|
import game.gui.element.Bar;
|
||||||
import game.gui.element.Label;
|
import game.gui.element.Label;
|
||||||
|
|
||||||
|
@ -18,48 +17,6 @@ public class GuiLoading extends Gui {
|
||||||
private Bar progressBar1;
|
private Bar progressBar1;
|
||||||
private Bar progressBar2;
|
private Bar progressBar2;
|
||||||
|
|
||||||
public static GuiLoading makeStartTask(final ServerProcess server) {
|
|
||||||
return new GuiLoading("Starte Server ...", new Callback() {
|
|
||||||
boolean started = false;
|
|
||||||
|
|
||||||
public void poll(Game gm, GuiLoading gui) {
|
|
||||||
if(!this.started && server.isStarted()) {
|
|
||||||
this.started = true;
|
|
||||||
gm.displayGuiScreen(GuiMenu.INSTANCE);
|
|
||||||
}
|
|
||||||
int progress = server.getProgress();
|
|
||||||
if(progress < 0) {
|
|
||||||
gui.resetBar();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
gui.setBar(null, "Chunks", Math.max(1, server.getTotal()));
|
|
||||||
gui.setProgress(progress);
|
|
||||||
}
|
|
||||||
gui.setTask(server.getMessage());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GuiLoading makeStopTask(final ServerProcess server) {
|
|
||||||
return new GuiLoading("Beende Server ...", new Callback() {
|
|
||||||
public void poll(Game gm, GuiLoading gui) {
|
|
||||||
if(server.isStopped()) {
|
|
||||||
gm.displayGuiScreen(GuiMenu.INSTANCE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int progress = server.getProgress();
|
|
||||||
if(progress < 0) {
|
|
||||||
gui.resetBar();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
gui.setBar(null, "Dimensionen", Math.max(1, server.getTotal()));
|
|
||||||
gui.setProgress(progress);
|
|
||||||
}
|
|
||||||
gui.setTask(server.getMessage());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GuiLoading makeServerTask(String message) {
|
public static GuiLoading makeServerTask(String message) {
|
||||||
return new GuiLoading(message, new Callback() {
|
return new GuiLoading(message, new Callback() {
|
||||||
public void poll(Game gm, GuiLoading gui) {
|
public void poll(Game gm, GuiLoading gui) {
|
||||||
|
|
|
@ -24,6 +24,7 @@ import game.entity.npc.EntityHuman;
|
||||||
import game.entity.npc.EntityNPC;
|
import game.entity.npc.EntityNPC;
|
||||||
import game.entity.npc.SpeciesInfo;
|
import game.entity.npc.SpeciesInfo;
|
||||||
import game.entity.types.EntityLiving;
|
import game.entity.types.EntityLiving;
|
||||||
|
import game.gui.GuiLoading;
|
||||||
import game.gui.element.ActButton;
|
import game.gui.element.ActButton;
|
||||||
import game.gui.element.ActButton.Mode;
|
import game.gui.element.ActButton.Mode;
|
||||||
import game.gui.element.Element;
|
import game.gui.element.Element;
|
||||||
|
@ -366,7 +367,7 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
||||||
this.add(new ActButton(width - 198, height - 28, 194, 24, new ActButton.Callback() {
|
this.add(new ActButton(width - 198, height - 28, 194, 24, new ActButton.Callback() {
|
||||||
public void use(ActButton elem, Mode action) {
|
public void use(ActButton elem, Mode action) {
|
||||||
if(GuiChar.this.gm.thePlayer != null) {
|
if(GuiChar.this.gm.thePlayer != null) {
|
||||||
GuiChar.this.gm.waitForServer();
|
GuiChar.this.gm.displayGuiScreen(GuiLoading.makeWaitTask("Lade Welt ..."));
|
||||||
Dimension dim = UniverseRegistry.getBaseDimensions().get(GuiChar.this.dimension);
|
Dimension dim = UniverseRegistry.getBaseDimensions().get(GuiChar.this.dimension);
|
||||||
GuiChar.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketMessage(CPacketMessage.Type.INFO, descField.getText()));
|
GuiChar.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketMessage(CPacketMessage.Type.INFO, descField.getText()));
|
||||||
GuiChar.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.CLOSE_EDITOR, dim.getDimensionId()));
|
GuiChar.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.CLOSE_EDITOR, dim.getDimensionId()));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue