Fixed world data not loading on mobile servers

This commit is contained in:
Anuken
2018-11-03 09:00:21 -04:00
parent 8ac079fb72
commit e30347a11f
3 changed files with 9 additions and 12 deletions

View File

@@ -18,7 +18,6 @@ import io.anuke.ucore.scene.ui.layout.Cell;
import io.anuke.ucore.scene.ui.layout.Table;
import io.anuke.ucore.scene.utils.UIUtils;
import io.anuke.ucore.util.Bundles;
import io.anuke.ucore.util.Log;
import io.anuke.ucore.util.Strings;
import static io.anuke.mindustry.Vars.*;
@@ -252,10 +251,7 @@ public class JoinDialog extends FloatingDialog{
local.clear();
local.background((Drawable)null);
local.table("button", t -> {
t.label(() -> "[accent]" + Bundles.get("text.hosts.discovering") + Strings.animated(4, 10f, ".")).pad(10f);
}).growX();
Log.info("begin of discover");
local.table("button", t -> t.label(() -> "[accent]" + Bundles.get("text.hosts.discovering") + Strings.animated(4, 10f, ".")).pad(10f)).growX();
Net.discoverServers(this::addLocalHost, this::finishLocalHosts);
}

View File

@@ -1,6 +1,5 @@
package io.anuke.kryonet;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.Array;
import com.dosse.upnp.UPnP;
import com.esotericsoftware.kryonet.Connection;
@@ -28,6 +27,8 @@ import java.nio.channels.ClosedSelectorException;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CopyOnWriteArraySet;
import static io.anuke.mindustry.Vars.threads;
public class KryoServer implements ServerProvider {
final boolean tcpOnly = System.getProperty("java.version") == null;
final Server server;
@@ -65,7 +66,7 @@ public class KryoServer implements ServerProvider {
Log.info("&bRecieved connection: {0} / {1}. Kryonet ID: {2}", c.id, c.addressTCP, connection.getID());
connections.add(kn);
Gdx.app.postRunnable(() -> Net.handleServerReceived(kn.id, c));
threads.runDelay(() -> Net.handleServerReceived(kn.id, c));
}
@Override
@@ -79,7 +80,7 @@ public class KryoServer implements ServerProvider {
Log.info("&bLost connection: {0}", k.id);
Gdx.app.postRunnable(() -> {
threads.runDelay(() -> {
Net.handleServerReceived(k.id, c);
connections.remove(k);
});
@@ -90,7 +91,7 @@ public class KryoServer implements ServerProvider {
KryoConnection k = getByKryoID(connection.getID());
if(object instanceof FrameworkMessage || k == null) return;
Gdx.app.postRunnable(() -> {
threads.runDelay(() -> {
try{
Net.handleServerReceived(k.id, object);
}catch (Exception e){

View File

@@ -10,7 +10,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -30,7 +30,7 @@ public class BundleLauncher {
Log.info("Parsing bundle: {0}", child);
OrderedMap<String, String> other = new OrderedMap<>();
PropertiesUtils.load(other, Files.newBufferedReader(child, Charset.forName("UTF-8")));
PropertiesUtils.load(other, Files.newBufferedReader(child, StandardCharsets.UTF_8));
removals.clear();
for(String key : other.orderedKeys()){
@@ -63,7 +63,7 @@ public class BundleLauncher {
result.append((e.key + " = " + e.value).replace("\\", "\\\\").replace("\n", "\\n"));
result.append("\n");
}
Files.write(child, result.toString().getBytes("UTF-8"));
Files.write(child, result.toString().getBytes(StandardCharsets.UTF_8));
}catch (IOException e){
throw new RuntimeException(e);