mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-03-15 11:20:39 -07:00
Changed stop() to dispose() on crash, fixed web key triggers
This commit is contained in:
parent
2172daf145
commit
10528b2f55
4 changed files with 20 additions and 9 deletions
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="io.anuke.mindustry"
|
||||
android:versionCode="58"
|
||||
android:versionName="3.3b9" >
|
||||
android:versionCode="59"
|
||||
android:versionName="3.3b10" >
|
||||
|
||||
<uses-permission android:name="com.android.vending.BILLING" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
|
|
|||
|
|
@ -136,8 +136,7 @@ public class DesktopLauncher {
|
|||
e.printStackTrace();
|
||||
|
||||
//attempt to close connections
|
||||
try{ Net.closeServer(); }catch (Exception p){}
|
||||
try{ Net.disconnect(); }catch (Exception p){}
|
||||
try{ Net.dispose(); }catch (Exception p){}
|
||||
|
||||
//don't create crash logs for me (anuke), as it's expected
|
||||
if(System.getProperty("user.name").equals("anuke")) return;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
<script type="text/javascript" src="html/html.nocache.js"></script>
|
||||
</body>
|
||||
<script>
|
||||
var keys = [27, 38, 37, 39, 40, 17, 9];
|
||||
|
||||
function handleMouseDown(evt) {
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
|
|
@ -28,8 +30,8 @@
|
|||
|
||||
|
||||
function preventUseOfDefaultKeys(event) {
|
||||
if (event.keyCode == 32 || event.keyCode == 27 || event.keyCode == 38 || event.keyCode == 37 || event.keyCode == 39 || event.keyCode == 40 || event.keyCode == 17){
|
||||
event.preventDefault();
|
||||
if (keys.indexOf(event.keyCode) != -1 || event.ctrlKey){
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import io.anuke.mindustry.net.Streamable.StreamChunk;
|
|||
import io.anuke.ucore.UCore;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import org.java_websocket.WebSocket;
|
||||
import org.java_websocket.exceptions.WebsocketNotConnectedException;
|
||||
import org.java_websocket.handshake.ClientHandshake;
|
||||
import org.java_websocket.server.WebSocketServer;
|
||||
|
||||
|
|
@ -259,7 +260,13 @@ public class KryoServer implements ServerProvider {
|
|||
public void dispose(){
|
||||
try {
|
||||
server.dispose();
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
UCore.log("Disposing web server...");
|
||||
|
||||
if(webServer != null) webServer.stop(1);
|
||||
//kill them all
|
||||
for(Thread thread : Thread.getAllStackTraces().keySet()){
|
||||
|
|
@ -269,7 +276,7 @@ public class KryoServer implements ServerProvider {
|
|||
}
|
||||
UCore.log("Killed web server.");
|
||||
}catch (Exception e){
|
||||
throw new RuntimeException(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -342,9 +349,12 @@ public class KryoServer implements ServerProvider {
|
|||
if(debug) UCore.log("Sending string: " + string);
|
||||
socket.send(string);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}catch (WebsocketNotConnectedException e){
|
||||
//don't log anything, it's not important
|
||||
connections.remove(this);
|
||||
}catch (Exception e){
|
||||
connections.remove(this);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}else if (connection != null) {
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue