Cleanup
This commit is contained in:
@@ -14,7 +14,6 @@ import static mindustry.Vars.*;
|
||||
|
||||
public class HostDialog extends BaseDialog{
|
||||
float w = 300;
|
||||
TextField portField;
|
||||
|
||||
public HostDialog(){
|
||||
super("@hostserver");
|
||||
@@ -49,20 +48,15 @@ public class HostDialog extends BaseDialog{
|
||||
|
||||
cont.row();
|
||||
|
||||
TextField[] portField = {null};
|
||||
|
||||
cont.table(t -> {
|
||||
t.add("@server.port").padRight(10);
|
||||
portField = t.field(String.valueOf(Core.settings.getInt("port", port)), text -> {
|
||||
Core.settings.put("port", Integer.parseInt(text));
|
||||
}).pad(8).grow().get();
|
||||
portField.setMaxLength(5);
|
||||
portField.setValidator(text -> {
|
||||
try {
|
||||
int port = Integer.parseInt(text);
|
||||
return port >= 1 && port <= 65535;
|
||||
} catch(NumberFormatException e){
|
||||
return false;
|
||||
}
|
||||
});
|
||||
portField[0] = t.field(String.valueOf(Core.settings.getInt("port", port)), text -> Core.settings.put("port", Strings.parseInt(text, 6567)))
|
||||
.pad(8).grow().maxTextLength(5).valid(text -> {
|
||||
int port = Strings.parseInt(text);
|
||||
return port >= 1 && port <= 65535;
|
||||
}).get();
|
||||
}).width(w).height(70f).pad(4).colspan(3);
|
||||
|
||||
cont.row();
|
||||
@@ -76,7 +70,7 @@ public class HostDialog extends BaseDialog{
|
||||
}
|
||||
|
||||
runHost();
|
||||
}).width(w).height(70f).disabled(b -> !portField.isValid());
|
||||
}).width(w).height(70f).disabled(b -> !portField[0].isValid());
|
||||
|
||||
if(!steam){
|
||||
cont.button("?", () -> ui.showInfo("@host.info")).size(65f, 70f).padLeft(6f);
|
||||
|
||||
Reference in New Issue
Block a user