add server

This commit is contained in:
Sen 2025-05-01 15:13:38 +02:00
parent d5269922b9
commit 76ecfb39ab
25 changed files with 603 additions and 520 deletions

View file

@ -8,7 +8,6 @@ import game.gui.element.ActButton.Mode;
import game.gui.element.Label;
import game.gui.element.NavButton;
import game.gui.element.Textbox;
import game.gui.element.Textbox.Action;
import game.gui.options.GuiOptions;
import game.gui.server.GuiConnect;
import game.gui.world.GuiWorlds;
@ -114,32 +113,6 @@ public class GuiMenu extends Gui {
this.add(new NavButton(0, 28, this.gm.charEditor ? 400 : 198, 24, GuiOptions.getPage(), "Einstellungen"));
if(!this.gm.charEditor)
this.add(new NavButton(202, 28, 198, 24, GuiCharacters.INSTANCE, "Charakter"));
if(!this.gm.isRemote() && !this.gm.debugWorld) {
final Textbox portBox = this.add(new Textbox(0, 56, 96, 24, 5, true, new Textbox.Callback() {
public void use(Textbox elem, Action value) {
if(value == Action.SEND || value == Action.UNFOCUS) {
int port = -1;
try {
port = Integer.parseInt(elem.getText());
}
catch(NumberFormatException e) {
}
if(port < 0 || port > 65535)
elem.setText("" + GuiMenu.this.gm.port);
else
GuiMenu.this.gm.port = port;
}
}
}, "" + this.gm.port)); // "srv_port"
portBox.enabled = this.gm.bind == -1;
this.add(new ActButton(100, 56, 300, 24, new ActButton.Callback() {
public void use(ActButton elem, ActButton.Mode action) {
GuiMenu.this.gm.bind(GuiMenu.this.gm.bind = (GuiMenu.this.gm.bind != -1 ? -1 : GuiMenu.this.gm.port));
elem.setText(GuiMenu.this.gm.bind != -1 ? "LAN-Welt schließen" : "LAN-Welt öffnen");
portBox.enabled = GuiMenu.this.gm.bind == -1;
}
}, this.gm.bind != -1 ? "LAN-Welt schließen" : "LAN-Welt öffnen"));
}
this.add(new ActButton(0, 102, 400, 24, new ActButton.Callback() {
public void use(ActButton elem, ActButton.Mode action) {
GuiMenu.this.gm.unload(true);