mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-12-13 14:49:03 +00:00
JSONSerialisable objects now have a debug function #156
This commit is contained in:
@@ -75,6 +75,15 @@ public class HarvesterNPC extends NonPlayerCharacter {
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject debugJsonSerialise() {
|
||||
JSONObject json = jsonSerialise();
|
||||
|
||||
json.put("taskCompleted", getTask().checkCompleted());
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Document mongoSerialise() {
|
||||
Document dbObject = super.mongoSerialise();
|
||||
|
||||
@@ -5,6 +5,8 @@ import net.simon987.server.game.objects.MessageReceiver;
|
||||
import net.simon987.server.game.objects.Structure;
|
||||
import net.simon987.server.game.objects.Updatable;
|
||||
import org.bson.Document;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -61,4 +63,18 @@ public class RadioTower extends Structure implements MessageReceiver, Updatable
|
||||
return lastMessages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject debugJsonSerialise() {
|
||||
JSONObject json = super.debugJsonSerialise();
|
||||
|
||||
JSONArray messages = new JSONArray();
|
||||
|
||||
for (char[] message : this.messages) {
|
||||
messages.add(new String(message));
|
||||
}
|
||||
|
||||
json.put("messages", messages);
|
||||
|
||||
return json;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user