mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-04-10 06:16:45 +00:00
Added debug command to save the game
This commit is contained in:
parent
e97ecbe380
commit
9c41c16079
@ -42,5 +42,4 @@ public class HealObjCommandListener implements GameEventListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,27 @@
|
||||
package net.simon987.server.game.debug;
|
||||
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.event.DebugCommandEvent;
|
||||
import net.simon987.server.event.GameEvent;
|
||||
import net.simon987.server.event.GameEventListener;
|
||||
|
||||
public class SaveGameCommandListener implements GameEventListener {
|
||||
|
||||
@Override
|
||||
public Class getListenedEventType() {
|
||||
return DebugCommandEvent.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(GameEvent event) {
|
||||
|
||||
DebugCommandEvent e = (DebugCommandEvent) event;
|
||||
|
||||
if (e.getName().equals("saveGame")) {
|
||||
|
||||
GameServer.INSTANCE.save();
|
||||
e.reply("Saved the game");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -34,6 +34,8 @@ public class MessageDispatcher {
|
||||
handler.handle(user, json);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalStateException e) {
|
||||
//Socket is closed
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -13,7 +13,7 @@ public class ObjectsRequestHandler implements MessageHandler {
|
||||
|
||||
|
||||
@Override
|
||||
public void handle(OnlineUser user, JSONObject json) throws IOException {
|
||||
public void handle(OnlineUser user, JSONObject json) throws IllegalStateException, IOException {
|
||||
if (json.get("t").equals("object")) {
|
||||
// LogManager.LOGGER.fine("(WS) Objects request from " + user.getUser().getUsername());
|
||||
|
||||
|
@ -253,6 +253,8 @@ var WorldIndicator = (function (_super) {
|
||||
};
|
||||
return WorldIndicator;
|
||||
}(DebugMessage));
|
||||
{
|
||||
}
|
||||
var RENDERER_WIDTH = document.getElementById("game").clientWidth * window.devicePixelRatio;
|
||||
var RENDERER_HEIGHT = (window.innerHeight / 1.40) * window.devicePixelRatio;
|
||||
var DEBUG = true;
|
||||
@ -437,6 +439,9 @@ var Debug = (function () {
|
||||
Debug.setEnergy = function (objectId, amount) {
|
||||
mar.client.sendDebugCommand({ t: "debug", command: "setEnergy", objectId: objectId, amount: amount });
|
||||
};
|
||||
Debug.saveGame = function () {
|
||||
mar.client.sendDebugCommand({t: "debug", command: "saveGame"});
|
||||
};
|
||||
return Debug;
|
||||
}());
|
||||
DEBUG = false;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// Typescript V2.4.1
|
||||
{
|
||||
}// Typescript V2.4.1
|
||||
|
||||
let RENDERER_WIDTH = document.getElementById("game").clientWidth * window.devicePixelRatio;
|
||||
let RENDERER_HEIGHT = (window.innerHeight / 1.40) * window.devicePixelRatio;
|
||||
@ -215,6 +216,10 @@ class Debug {
|
||||
mar.client.sendDebugCommand({t: "debug", command: "setEnergy", objectId: objectId, amount: amount});
|
||||
}
|
||||
|
||||
public static saveGame() {
|
||||
mar.client.sendDebugCommand({t: "debug", command: "saveGame"});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user