change port, config and version mechanisms
This commit is contained in:
parent
f879b060e8
commit
adc81d56d2
14 changed files with 122 additions and 74 deletions
|
@ -100,6 +100,7 @@ import client.window.Window;
|
|||
import client.window.WindowEvent;
|
||||
import client.world.ChunkClient;
|
||||
import client.world.WorldClient;
|
||||
import common.Version;
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.collect.Lists;
|
||||
|
@ -116,7 +117,6 @@ import common.future.ListenableFutureTask;
|
|||
import common.future.ThreadFactoryBuilder;
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.init.EntityRegistry;
|
||||
import common.init.ItemRegistry;
|
||||
import common.init.Items;
|
||||
|
@ -259,7 +259,8 @@ public class Client implements IThreadListener {
|
|||
this.help = help;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static final String VERSION = Version.NAME + " Client " + Util.VERSION;
|
||||
public static final int LOG_BUFFER = 32768;
|
||||
private static final LazyLoadBase<NioEventLoopGroup> CLIENT_NIO_EVENTLOOP = new LazyLoadBase<NioEventLoopGroup>()
|
||||
{
|
||||
|
@ -520,7 +521,7 @@ public class Client implements IThreadListener {
|
|||
{
|
||||
connection = createNetworkManagerAndConnect(address == null ? InetAddress.getLoopbackAddress() : InetAddress.getByName(IDN.toASCII(address)), port);
|
||||
connection.setNetHandler(new ClientLoginHandler(connection, this, user, access, pass));
|
||||
connection.sendPacket(new HPacketHandshake(Config.PROTOCOL), new GenericFutureListener<Future<? super Void>>() {
|
||||
connection.sendPacket(new HPacketHandshake(Util.PROTOCOL), new GenericFutureListener<Future<? super Void>>() {
|
||||
public void operationComplete(Future<? super Void> u) throws Exception {
|
||||
connection.setConnectionState(PacketRegistry.LOGIN);
|
||||
}
|
||||
|
@ -1248,14 +1249,14 @@ public class Client implements IThreadListener {
|
|||
// SKC.setGuiMenu();
|
||||
// else
|
||||
// SKC.setGuiAny();
|
||||
Window.setTitle(String.format("%s - %s", Config.CLIENT_VERSION, gui.getTitle()));
|
||||
Window.setTitle(String.format("%s - %s", VERSION, gui.getTitle()));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.menu(false);
|
||||
this.leftClickCounter = 10000;
|
||||
Bind.disableMouse();
|
||||
Window.setTitle(String.format("%s - %s%s", Config.CLIENT_VERSION, "Welt / Render", this.nograb ? "" : " (Maus gefangen)"));
|
||||
Window.setTitle(String.format("%s - %s%s", VERSION, "Welt / Render", this.nograb ? "" : " (Maus gefangen)"));
|
||||
// SKC.setGuiNone();
|
||||
}
|
||||
}
|
||||
|
@ -2173,8 +2174,8 @@ public class Client implements IThreadListener {
|
|||
|
||||
public void run() {
|
||||
Log.SYSTEM.info("Java " + System.getProperty("java.version"));
|
||||
Log.SYSTEM.info(Config.CLIENT_VERSION);
|
||||
if(!Window.createWindow(Config.CLIENT_VERSION, System.getProperty("opengl.debug") != null))
|
||||
Log.SYSTEM.info(VERSION + " (Protokoll #" + Util.PROTOCOL + ")");
|
||||
if(!Window.createWindow(VERSION, System.getProperty("opengl.debug") != null))
|
||||
System.exit(1);
|
||||
Log.SYSTEM.info("OpenGL %s", GL11.glGetString(GL11.GL_VERSION));
|
||||
Log.SYSTEM.info("GL_VENDOR: %s", GL11.glGetString(GL11.GL_VENDOR));
|
||||
|
@ -2972,7 +2973,7 @@ public class Client implements IThreadListener {
|
|||
}
|
||||
|
||||
public void reset() {
|
||||
this.buffer = TextColor.NEON + "*** " + Config.CLIENT_VERSION + " ***";
|
||||
this.buffer = TextColor.NEON + "*** " + VERSION + " ***";
|
||||
this.console.clear();
|
||||
this.chat.clear();
|
||||
this.feed.clear();
|
||||
|
|
|
@ -14,7 +14,6 @@ import client.gui.element.PressType;
|
|||
import client.renderer.Drawing;
|
||||
import client.util.FileUtils;
|
||||
import common.color.TextColor;
|
||||
import common.init.Config;
|
||||
import common.log.Log;
|
||||
import common.network.IPlayer;
|
||||
import common.util.Tuple;
|
||||
|
@ -133,7 +132,7 @@ public class GuiConnect extends GuiList<GuiConnect.ServerInfo> implements Button
|
|||
for(int z = 0; z <= lines.length; z++) {
|
||||
String line = z == lines.length ? null : lines[z];
|
||||
if(line == null || (line.startsWith("[") && line.endsWith("]"))) {
|
||||
if(!name.isEmpty() && !address.isEmpty() && !user.isEmpty() && user.length() < IPlayer.MAX_USER_LENGTH && IPlayer.isValidUser(user) && password.length() < IPlayer.MAX_PASS_LENGTH && access.length() < IPlayer.MAX_PASS_LENGTH && address.length() < 128 && name.length() < 128 && port >= 0 && port < 65536)
|
||||
if(!name.isEmpty() && !address.isEmpty() && !user.isEmpty() && user.length() < IPlayer.MAX_USER_LENGTH && IPlayer.isValidUser(user) && password.length() < IPlayer.MAX_PASS_LENGTH && access.length() < IPlayer.MAX_PASS_LENGTH && address.length() < 128 && name.length() < 128 && port >= 1024 && port <= 32767)
|
||||
this.elements.add(new ServerInfo(name, address, port, user, password, access, time));
|
||||
if(line != null) {
|
||||
address = "";
|
||||
|
@ -250,7 +249,7 @@ public class GuiConnect extends GuiList<GuiConnect.ServerInfo> implements Button
|
|||
}
|
||||
else if(button == this.createButton) {
|
||||
this.setSelected(-1);
|
||||
this.gm.displayGuiScreen(new GuiServer(new ServerInfo("", "", Config.PORT, "", "", "", -1L)));
|
||||
this.gm.displayGuiScreen(new GuiServer(new ServerInfo("", "", -1, "", "", "", -1L)));
|
||||
}
|
||||
else if(button == this.editButton) {
|
||||
ServerInfo server = this.getSelected();
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
package client.gui;
|
||||
|
||||
import client.Client;
|
||||
import client.gui.element.NavButton;
|
||||
import client.gui.element.TransparentArea;
|
||||
import common.Version;
|
||||
import common.color.TextColor;
|
||||
import common.init.Config;
|
||||
import common.log.Log;
|
||||
import common.util.Util;
|
||||
|
||||
public class GuiInfo extends Gui {
|
||||
private static final String VER =
|
||||
TextColor.GREEN + "" + TextColor.BUG + "" + TextColor.BUG + "" + TextColor.BUG + " " + TextColor.VIOLET + "" + Config.CLIENT_VERSION + "" +
|
||||
TextColor.GREEN + " " + TextColor.BUG + "" + TextColor.BUG + "" + TextColor.BUG;
|
||||
TextColor.GREEN + "" + Util.repeatString(TextColor.BUG, Version.RELEASE.getId()) + TextColor.DVIOLET + "|-| " + TextColor.VIOLET + Client.VERSION + TextColor.DVIOLET + " |-|" +
|
||||
TextColor.GREEN + Util.repeatString(TextColor.BUG, Version.RELEASE.getId());
|
||||
|
||||
private static final String INFO = "Ein Spiel zur Simulation, zum Testen, für Rollenspiele, Mehrspieler und vieles mehr." + "\n" +
|
||||
"Optimiert für Geschwindigkeit, Stabilität und" + TextColor.UNKNOWN + "" + TextColor.UNKNOWN + " [Speicherzugriffsfehler]";
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package client.gui;
|
||||
|
||||
import client.Client;
|
||||
import client.gui.character.GuiChar;
|
||||
import client.gui.character.GuiCharacters;
|
||||
import client.gui.element.ActButton;
|
||||
|
@ -11,7 +12,6 @@ import client.gui.options.GuiOptions;
|
|||
import client.renderer.Drawing;
|
||||
import client.window.Keysym;
|
||||
import common.color.TextColor;
|
||||
import common.init.Config;
|
||||
import common.rng.Random;
|
||||
import common.util.ExtMath;
|
||||
|
||||
|
@ -100,7 +100,7 @@ public class GuiMenu extends Gui {
|
|||
}
|
||||
}, "Client schließen"));
|
||||
this.shift();
|
||||
this.add(new Label(4, /* this.gm.fb_y - 2 */ 0, 200, 20, TextColor.VIOLET + Config.CLIENT_VERSION, true));
|
||||
this.add(new Label(4, /* this.gm.fb_y - 2 */ 0, 200, 20, TextColor.VIOLET + Client.VERSION, true));
|
||||
this.splashLabel = this.add(new Label(0, 160, width, 24, ""));
|
||||
this.pickSplash();
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import client.gui.element.FieldCallback;
|
|||
import client.vars.CVarCategory;
|
||||
import client.vars.Variable;
|
||||
import common.color.TextColor;
|
||||
import common.init.Config;
|
||||
import common.network.IPlayer;
|
||||
|
||||
public class GuiServer extends Gui implements FieldCallback {
|
||||
|
@ -29,6 +28,7 @@ public class GuiServer extends Gui implements FieldCallback {
|
|||
private Label nameLabel;
|
||||
private Label addrLabel;
|
||||
private Label portLabel;
|
||||
private Label rangeLabel;
|
||||
private Label userLabel;
|
||||
private Label passLabel;
|
||||
private Label accLabel;
|
||||
|
@ -39,8 +39,8 @@ public class GuiServer extends Gui implements FieldCallback {
|
|||
|
||||
@Variable(name = "srv_last_address", category = CVarCategory.SYSTEM, min = 1, max = 128, display = "Letzte Server-Adresse")
|
||||
private String lastAddr = "";
|
||||
@Variable(name = "srv_last_port", category = CVarCategory.SYSTEM, min = 0, max = 65535, display = "Letzter Server-Port")
|
||||
private int lastPort = Config.PORT;
|
||||
@Variable(name = "srv_last_port", category = CVarCategory.SYSTEM, min = 1024, max = 32767, display = "Letzter Server-Port")
|
||||
private int lastPort = -1;
|
||||
@Variable(name = "srv_last_user", category = CVarCategory.SYSTEM, max = IPlayer.MAX_USER_LENGTH, display = "Letzter Server-Nutzer", validator = IPlayer.UserValidator.class)
|
||||
private String lastUser = "";
|
||||
@Variable(name = "srv_last_password", category = CVarCategory.SYSTEM, max = IPlayer.MAX_PASS_LENGTH, display = "Letztes Server-Passwort")
|
||||
|
@ -52,7 +52,8 @@ public class GuiServer extends Gui implements FieldCallback {
|
|||
if(this.server != null)
|
||||
this.nameBox = this.add(new Field(0, -50, 400, 24, 128, this, this.server.getName()));
|
||||
this.addrBox = this.add(new Field(0, 20, 400, 24, 128, this, this.server == null ? this.lastAddr : this.server.getAddress()));
|
||||
this.portBox = this.add(new Field(404, 20, 76, 24, 5, this, "" + (this.server == null ? this.lastPort : this.server.getPort())));
|
||||
int port = this.server == null ? this.lastPort : this.server.getPort();
|
||||
this.portBox = this.add(new Field(404, 20, 76, 24, 5, this, port < 0 ? "" : "" + port));
|
||||
this.userBox = this.add(new Field(0, 70, 220, 24, IPlayer.MAX_USER_LENGTH, this, IPlayer.VALID_USER, this.server == null ? this.lastUser : this.server.getUser()));
|
||||
this.passBox = this.add(new Field(0, 120, 480, 24, IPlayer.MAX_PASS_LENGTH, this, this.server == null ? this.lastPass : this.server.getPassword()));
|
||||
this.accBox = this.add(new Field(0, 170, 480, 24, IPlayer.MAX_PASS_LENGTH, this, this.server == null ? this.lastAcc : this.server.getAccess()));
|
||||
|
@ -65,7 +66,8 @@ public class GuiServer extends Gui implements FieldCallback {
|
|||
if(this.server != null)
|
||||
this.nameLabel = this.add(new Label(0, -70, 410, 20, "Name", true));
|
||||
this.addrLabel = this.add(new Label(0, 0, 410, 20, "Adresse", true));
|
||||
this.portLabel = this.add(new Label(414, 0, 66, 20, "Port", true));
|
||||
this.portLabel = this.add(new Label(404, 0, 76, 20, "Port", true));
|
||||
this.rangeLabel = this.add(new Label(370, 44, 110, 20, "[1024..32767]", true));
|
||||
this.userLabel = this.add(new Label(0, 50, 220, 20, "Nutzer", true));
|
||||
this.passLabel = this.add(new Label(0, 100, 480, 20, "Passwort", true));
|
||||
this.accLabel = this.add(new Label(0, 150, 480, 20, "Zugang", true));
|
||||
|
@ -102,9 +104,11 @@ public class GuiServer extends Gui implements FieldCallback {
|
|||
port = Integer.parseInt(this.portBox.getText());
|
||||
}
|
||||
catch(NumberFormatException e) {
|
||||
this.rangeLabel.setText("[" + TextColor.RED + "1024..32767" + TextColor.RESET + "]");
|
||||
return;
|
||||
}
|
||||
if(port < 0 || port > 65535) {
|
||||
this.portLabel.setText(TextColor.RED + "Port");
|
||||
if(port < 1024 || port > 32767) {
|
||||
this.rangeLabel.setText("[" + (port < 1024 ? TextColor.RED + "1024" + TextColor.RESET + "..32767" : "1024.." + TextColor.RED + "32767" + TextColor.RESET) + "]");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -138,8 +142,10 @@ public class GuiServer extends Gui implements FieldCallback {
|
|||
else if(value == FieldAction.FOCUS) {
|
||||
if(elem == this.addrBox)
|
||||
this.addrLabel.setText("Adresse");
|
||||
else if(elem == this.portBox)
|
||||
else if(elem == this.portBox) {
|
||||
this.portLabel.setText("Port");
|
||||
this.rangeLabel.setText("[1024..32767]");
|
||||
}
|
||||
else if(elem == this.userBox)
|
||||
this.userLabel.setText("Nutzer");
|
||||
else if(this.server != null && elem == this.nameBox)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue