split server
This commit is contained in:
parent
b0dc368ef7
commit
3ab017888b
25 changed files with 458 additions and 482 deletions
|
@ -18,17 +18,14 @@ public class GuiLoading extends Gui {
|
|||
private Bar progressBar1;
|
||||
private Bar progressBar2;
|
||||
|
||||
public static GuiLoading makeLoadTask(final ServerProcess server, final String user, final byte[] key) {
|
||||
return new GuiLoading("Lade Welt ...", new Callback() {
|
||||
public static GuiLoading makeLoadTask(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(null);
|
||||
gm.debugWorld = server.getFolder() == null;
|
||||
gm.connect(null, gm.port, user, "", "", key);
|
||||
// return;
|
||||
gm.displayGuiScreen(GuiMenu.INSTANCE);
|
||||
}
|
||||
int progress = server.getProgress();
|
||||
if(progress < 0) {
|
||||
|
@ -43,26 +40,6 @@ public class GuiLoading extends Gui {
|
|||
});
|
||||
}
|
||||
|
||||
public static GuiLoading makeIntermittentTask(final ServerProcess server) {
|
||||
return new GuiLoading("Lade Welt ...", new Callback() {
|
||||
public void poll(Game gm, GuiLoading gui) {
|
||||
int progress = server.getProgress();
|
||||
// if(progress == -2) {
|
||||
// gm.displayGuiScreen(null);
|
||||
// return;
|
||||
// }
|
||||
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 makeSaveTask(final ServerProcess server) {
|
||||
return new GuiLoading("Speichere Welt ...", new Callback() {
|
||||
public void poll(Game gm, GuiLoading gui) {
|
||||
|
@ -83,6 +60,29 @@ public class GuiLoading extends Gui {
|
|||
});
|
||||
}
|
||||
|
||||
public static GuiLoading makeServerTask(String message) {
|
||||
return new GuiLoading(message, new Callback() {
|
||||
public void poll(Game gm, GuiLoading gui) {
|
||||
int progress = gm.progress;
|
||||
if(progress < 0) {
|
||||
gui.resetBar();
|
||||
}
|
||||
else {
|
||||
gui.setBar(null, "Chunks", Math.max(1, gm.total));
|
||||
gui.setProgress(progress);
|
||||
}
|
||||
gui.setTask(gm.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static GuiLoading makeWaitTask(String message) {
|
||||
return new GuiLoading(message, new Callback() {
|
||||
public void poll(Game gm, GuiLoading gui) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public GuiLoading(String message, Callback callback) {
|
||||
this.message = message;
|
||||
this.callback = callback;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue