Bugfixes
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user