This commit is contained in:
Anuken
2019-12-28 18:22:20 -05:00
parent 497ae740aa
commit b01d56aae8
3 changed files with 10 additions and 10 deletions

View File

@ -1,5 +1,6 @@
package mindustry.net;
import mindustry.*;
import mindustry.game.*;
public class Host{
@ -11,7 +12,7 @@ public class Host{
public final int version;
public final String versionType;
public final Gamemode mode;
public int ping;
public int ping, port = Vars.port;
public Host(String name, String address, String mapname, int wave, int players, int version, String versionType, Gamemode mode, int playerLimit){
this.name = name;

View File

@ -288,13 +288,12 @@ public class JoinDialog extends FloatingDialog{
local.table(Tex.button, t -> t.label(() -> "[accent]" + Core.bundle.get("hosts.discovering.any") + Strings.animated(Time.time(), 4, 10f, ".")).pad(10f)).growX();
net.discoverServers(this::addLocalHost, this::finishLocalHosts);
for(String host : defaultServers){
String address = host;
int p = port;
if(host.contains(":")){
address = host.split(":")[0];
p = Strings.parseInt(host.split(":")[1]);
}
net.pingHost(address, p, this::addLocalHost, e -> {});
String resaddress = host.contains(":") ? host.split(":")[0] : host;
int resport = host.contains(":") ? Strings.parseInt(host.split(":")[1]) : port;
net.pingHost(resaddress, resport, res -> {
res.port = resport;
addLocalHost(res);
}, e -> {});
}
}
@ -320,7 +319,7 @@ public class JoinDialog extends FloatingDialog{
local.row();
TextButton button = local.addButton("", Styles.cleart, () -> safeConnect(host.address, port, host.version))
TextButton button = local.addButton("", Styles.cleart, () -> safeConnect(host.address, host.port, host.version))
.width(w).pad(5f).get();
button.clearChildren();
buildServer(host, button);

View File

@ -461,7 +461,7 @@ public class ServerControl implements ApplicationListener{
try{
Config c = Config.valueOf(arg[0]);
if(arg.length == 1){
Log.info("&lc'{0}'&lg is currently &lc{0}.", c.name(), c.get());
Log.info("&lc'{0}'&lg is currently &lc{1}.", c.name(), c.get());
}else{
if(c.isBool()){
c.set(arg[1].equals("on") || arg[1].equals("true"));