mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-12-13 14:49:03 +00:00
Updated mongodb driver to 3.7.0
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
package net.simon987.cubotplugin;
|
||||
|
||||
import com.mongodb.BasicDBObject;
|
||||
import com.mongodb.DBObject;
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.ServerConfiguration;
|
||||
import net.simon987.server.assembly.Memory;
|
||||
import net.simon987.server.game.*;
|
||||
import net.simon987.server.logging.LogManager;
|
||||
import net.simon987.server.user.User;
|
||||
import org.bson.Document;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import java.awt.*;
|
||||
@@ -251,8 +250,8 @@ public class Cubot extends GameObject implements Updatable, ControllableUnit, Pr
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasicDBObject mongoSerialise() {
|
||||
BasicDBObject dbObject = new BasicDBObject();
|
||||
public Document mongoSerialise() {
|
||||
Document dbObject = new Document();
|
||||
|
||||
dbObject.put("i", getObjectId());
|
||||
dbObject.put("t", ID);
|
||||
@@ -276,7 +275,7 @@ public class Cubot extends GameObject implements Updatable, ControllableUnit, Pr
|
||||
return dbObject;
|
||||
}
|
||||
|
||||
public static Cubot deserialize(DBObject obj) {
|
||||
public static Cubot deserialize(Document obj) {
|
||||
|
||||
Cubot cubot = new Cubot();
|
||||
cubot.setObjectId((long) obj.get("i"));
|
||||
@@ -294,7 +293,6 @@ public class Cubot extends GameObject implements Updatable, ControllableUnit, Pr
|
||||
cubot.maxShield = config.getInt("cubot_max_shield");
|
||||
|
||||
return cubot;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package net.simon987.cubotplugin;
|
||||
|
||||
import com.mongodb.BasicDBObject;
|
||||
import com.mongodb.DBObject;
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.assembly.CpuHardware;
|
||||
import net.simon987.server.assembly.Status;
|
||||
import org.bson.Document;
|
||||
|
||||
public class CubotBattery extends CpuHardware {
|
||||
|
||||
@@ -45,9 +44,9 @@ public class CubotBattery extends CpuHardware {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasicDBObject mongoSerialise() {
|
||||
public Document mongoSerialise() {
|
||||
|
||||
BasicDBObject dbObject = new BasicDBObject();
|
||||
Document dbObject = new Document();
|
||||
|
||||
dbObject.put("hwid", (int) HWID);
|
||||
dbObject.put("cubot", cubot.getObjectId());
|
||||
@@ -56,7 +55,7 @@ public class CubotBattery extends CpuHardware {
|
||||
}
|
||||
|
||||
|
||||
public static CubotBattery deserialize(DBObject obj) {
|
||||
public static CubotBattery deserialize(Document obj) {
|
||||
return new CubotBattery((Cubot) GameServer.INSTANCE.getGameUniverse().getObject((long) obj.get("cubot")));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package net.simon987.cubotplugin;
|
||||
|
||||
import com.mongodb.BasicDBObject;
|
||||
import com.mongodb.DBObject;
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.assembly.CpuHardware;
|
||||
import net.simon987.server.assembly.Status;
|
||||
import net.simon987.server.game.GameObject;
|
||||
import net.simon987.server.game.Programmable;
|
||||
import org.bson.Document;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
@@ -128,9 +127,9 @@ public class CubotComPort extends CpuHardware {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasicDBObject mongoSerialise() {
|
||||
public Document mongoSerialise() {
|
||||
|
||||
BasicDBObject dbObject = new BasicDBObject();
|
||||
Document dbObject = new Document();
|
||||
|
||||
dbObject.put("hwid", (int) HWID);
|
||||
dbObject.put("cubot", cubot.getObjectId());
|
||||
@@ -138,7 +137,7 @@ public class CubotComPort extends CpuHardware {
|
||||
return dbObject;
|
||||
}
|
||||
|
||||
public static CubotComPort deserialize(DBObject obj) {
|
||||
public static CubotComPort deserialize(Document obj) {
|
||||
return new CubotComPort((Cubot) GameServer.INSTANCE.getGameUniverse().getObject((long) obj.get("cubot")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package net.simon987.cubotplugin;
|
||||
|
||||
import com.mongodb.BasicDBObject;
|
||||
import com.mongodb.DBObject;
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.assembly.CpuHardware;
|
||||
import net.simon987.server.assembly.Status;
|
||||
import org.bson.Document;
|
||||
|
||||
public class CubotCore extends CpuHardware {
|
||||
|
||||
@@ -42,9 +41,9 @@ public class CubotCore extends CpuHardware {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasicDBObject mongoSerialise() {
|
||||
public Document mongoSerialise() {
|
||||
|
||||
BasicDBObject dbObject = new BasicDBObject();
|
||||
Document dbObject = new Document();
|
||||
|
||||
dbObject.put("hwid", (int) HWID);
|
||||
dbObject.put("cubot", cubot.getObjectId());
|
||||
@@ -53,7 +52,7 @@ public class CubotCore extends CpuHardware {
|
||||
}
|
||||
|
||||
|
||||
public static CubotCore deserialize(DBObject obj) {
|
||||
public static CubotCore deserialize(Document obj) {
|
||||
return new CubotCore((Cubot) GameServer.INSTANCE.getGameUniverse().getObject((long) obj.get("cubot")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package net.simon987.cubotplugin;
|
||||
|
||||
import com.mongodb.BasicDBObject;
|
||||
import com.mongodb.DBObject;
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.assembly.CpuHardware;
|
||||
import net.simon987.server.assembly.Status;
|
||||
import net.simon987.server.game.Action;
|
||||
import net.simon987.server.game.TileMap;
|
||||
import org.bson.Document;
|
||||
|
||||
public class CubotDrill extends CpuHardware {
|
||||
|
||||
@@ -62,9 +61,9 @@ public class CubotDrill extends CpuHardware {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasicDBObject mongoSerialise() {
|
||||
public Document mongoSerialise() {
|
||||
|
||||
BasicDBObject dbObject = new BasicDBObject();
|
||||
Document dbObject = new Document();
|
||||
|
||||
dbObject.put("hwid", (int) HWID);
|
||||
dbObject.put("cubot", cubot.getObjectId());
|
||||
@@ -72,7 +71,7 @@ public class CubotDrill extends CpuHardware {
|
||||
return dbObject;
|
||||
}
|
||||
|
||||
public static CubotDrill deserialize(DBObject obj) {
|
||||
public static CubotDrill deserialize(Document obj) {
|
||||
return new CubotDrill((Cubot) GameServer.INSTANCE.getGameUniverse().getObject((long) obj.get("cubot")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package net.simon987.cubotplugin;
|
||||
|
||||
import com.mongodb.BasicDBObject;
|
||||
import com.mongodb.DBObject;
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.assembly.CpuHardware;
|
||||
import net.simon987.server.assembly.Status;
|
||||
import org.bson.Document;
|
||||
|
||||
public class CubotFloppyDrive extends CpuHardware {
|
||||
|
||||
@@ -79,9 +78,9 @@ public class CubotFloppyDrive extends CpuHardware {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasicDBObject mongoSerialise() {
|
||||
public Document mongoSerialise() {
|
||||
|
||||
BasicDBObject dbObject = new BasicDBObject();
|
||||
Document dbObject = new Document();
|
||||
|
||||
dbObject.put("hwid", (int) HWID);
|
||||
dbObject.put("cubot", cubot.getObjectId());
|
||||
@@ -93,12 +92,12 @@ public class CubotFloppyDrive extends CpuHardware {
|
||||
return dbObject;
|
||||
}
|
||||
|
||||
public static CubotFloppyDrive deserialize(DBObject obj) {
|
||||
public static CubotFloppyDrive deserialize(Document obj) {
|
||||
|
||||
CubotFloppyDrive drive = new CubotFloppyDrive((Cubot) GameServer.INSTANCE.getGameUniverse().getObject((long) obj.get("cubot")));
|
||||
|
||||
if (obj.containsField("floppy")) {
|
||||
drive.floppyDisk = FloppyDisk.deserialise((DBObject) obj.get("floppy"));
|
||||
if (obj.containsKey("floppy")) {
|
||||
drive.floppyDisk = FloppyDisk.deserialise((Document) obj.get("floppy"));
|
||||
}
|
||||
|
||||
return drive;
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package net.simon987.cubotplugin;
|
||||
|
||||
import com.mongodb.BasicDBObject;
|
||||
import com.mongodb.DBObject;
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.assembly.CpuHardware;
|
||||
import net.simon987.server.assembly.Status;
|
||||
import org.bson.Document;
|
||||
|
||||
public class CubotHologram extends CpuHardware {
|
||||
|
||||
@@ -83,14 +82,14 @@ public class CubotHologram extends CpuHardware {
|
||||
return HWID;
|
||||
}
|
||||
|
||||
public static CubotHologram deserialize(DBObject obj) {
|
||||
public static CubotHologram deserialize(Document obj) {
|
||||
return new CubotHologram((Cubot) GameServer.INSTANCE.getGameUniverse().getObject((long) obj.get("cubot")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasicDBObject mongoSerialise() {
|
||||
public Document mongoSerialise() {
|
||||
|
||||
BasicDBObject dbObject = new BasicDBObject();
|
||||
Document dbObject = new Document();
|
||||
|
||||
dbObject.put("hwid", (int) HWID);
|
||||
dbObject.put("cubot", cubot.getObjectId());
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package net.simon987.cubotplugin;
|
||||
|
||||
import com.mongodb.BasicDBObject;
|
||||
import com.mongodb.DBObject;
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.assembly.CpuHardware;
|
||||
import net.simon987.server.assembly.Status;
|
||||
import org.bson.Document;
|
||||
|
||||
public class CubotInventory extends CpuHardware {
|
||||
|
||||
@@ -52,9 +51,9 @@ public class CubotInventory extends CpuHardware {
|
||||
|
||||
|
||||
@Override
|
||||
public BasicDBObject mongoSerialise() {
|
||||
public Document mongoSerialise() {
|
||||
|
||||
BasicDBObject dbObject = new BasicDBObject();
|
||||
Document dbObject = new Document();
|
||||
|
||||
dbObject.put("hwid", (int) HWID);
|
||||
dbObject.put("cubot", cubot.getObjectId());
|
||||
@@ -62,7 +61,7 @@ public class CubotInventory extends CpuHardware {
|
||||
return dbObject;
|
||||
}
|
||||
|
||||
public static CubotInventory deserialize(DBObject obj) {
|
||||
public static CubotInventory deserialize(Document obj) {
|
||||
return new CubotInventory((Cubot) GameServer.INSTANCE.getGameUniverse().getObject((long) obj.get("cubot")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package net.simon987.cubotplugin;
|
||||
|
||||
import com.mongodb.BasicDBObject;
|
||||
import com.mongodb.DBObject;
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.assembly.CpuHardware;
|
||||
import net.simon987.server.assembly.Status;
|
||||
import org.bson.Document;
|
||||
|
||||
public class CubotKeyboard extends CpuHardware {
|
||||
|
||||
@@ -53,9 +52,9 @@ public class CubotKeyboard extends CpuHardware {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasicDBObject mongoSerialise() {
|
||||
public Document mongoSerialise() {
|
||||
|
||||
BasicDBObject dbObject = new BasicDBObject();
|
||||
Document dbObject = new Document();
|
||||
|
||||
dbObject.put("hwid", (int) HWID);
|
||||
dbObject.put("cubot", cubot.getObjectId());
|
||||
@@ -63,7 +62,7 @@ public class CubotKeyboard extends CpuHardware {
|
||||
return dbObject;
|
||||
}
|
||||
|
||||
public static CubotKeyboard deserialize(DBObject obj) {
|
||||
public static CubotKeyboard deserialize(Document obj) {
|
||||
return new CubotKeyboard((Cubot) GameServer.INSTANCE.getGameUniverse().getObject((long) obj.get("cubot")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package net.simon987.cubotplugin;
|
||||
|
||||
import com.mongodb.BasicDBObject;
|
||||
import com.mongodb.DBObject;
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.assembly.CpuHardware;
|
||||
import net.simon987.server.assembly.Status;
|
||||
@@ -9,6 +7,7 @@ import net.simon987.server.game.Action;
|
||||
import net.simon987.server.game.Attackable;
|
||||
import net.simon987.server.game.GameObject;
|
||||
import net.simon987.server.game.InventoryHolder;
|
||||
import org.bson.Document;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
@@ -93,9 +92,9 @@ public class CubotLaser extends CpuHardware {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasicDBObject mongoSerialise() {
|
||||
public Document mongoSerialise() {
|
||||
|
||||
BasicDBObject dbObject = new BasicDBObject();
|
||||
Document dbObject = new Document();
|
||||
|
||||
dbObject.put("hwid", (int) HWID);
|
||||
dbObject.put("cubot", cubot.getObjectId());
|
||||
@@ -103,7 +102,7 @@ public class CubotLaser extends CpuHardware {
|
||||
return dbObject;
|
||||
}
|
||||
|
||||
public static CubotLaser deserialize(DBObject obj) {
|
||||
public static CubotLaser deserialize(Document obj) {
|
||||
return new CubotLaser((Cubot) GameServer.INSTANCE.getGameUniverse().getObject((long) obj.get("cubot")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package net.simon987.cubotplugin;
|
||||
|
||||
import com.mongodb.BasicDBObject;
|
||||
import com.mongodb.DBObject;
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.assembly.CpuHardware;
|
||||
import net.simon987.server.assembly.Status;
|
||||
import net.simon987.server.game.Action;
|
||||
import net.simon987.server.game.Direction;
|
||||
import net.simon987.server.io.JSONSerialisable;
|
||||
import org.bson.Document;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
public class CubotLeg extends CpuHardware implements JSONSerialisable {
|
||||
@@ -86,9 +85,9 @@ public class CubotLeg extends CpuHardware implements JSONSerialisable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasicDBObject mongoSerialise() {
|
||||
public Document mongoSerialise() {
|
||||
|
||||
BasicDBObject dbObject = new BasicDBObject();
|
||||
Document dbObject = new Document();
|
||||
|
||||
dbObject.put("hwid", (int) HWID);
|
||||
dbObject.put("cubot", cubot.getObjectId());
|
||||
@@ -96,7 +95,7 @@ public class CubotLeg extends CpuHardware implements JSONSerialisable {
|
||||
return dbObject;
|
||||
}
|
||||
|
||||
public static CubotLeg deserialize(DBObject obj) {
|
||||
public static CubotLeg deserialize(Document obj) {
|
||||
return new CubotLeg((Cubot) GameServer.INSTANCE.getGameUniverse().getObject((long) obj.get("cubot")));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package net.simon987.cubotplugin;
|
||||
|
||||
import com.mongodb.BasicDBObject;
|
||||
import com.mongodb.DBObject;
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.assembly.CpuHardware;
|
||||
import net.simon987.server.assembly.Memory;
|
||||
@@ -10,6 +8,7 @@ import net.simon987.server.game.pathfinding.Node;
|
||||
import net.simon987.server.game.pathfinding.Pathfinder;
|
||||
import net.simon987.server.io.JSONSerialisable;
|
||||
import net.simon987.server.logging.LogManager;
|
||||
import org.bson.Document;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -150,9 +149,9 @@ public class CubotLidar extends CpuHardware implements JSONSerialisable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasicDBObject mongoSerialise() {
|
||||
public Document mongoSerialise() {
|
||||
|
||||
BasicDBObject dbObject = new BasicDBObject();
|
||||
Document dbObject = new Document();
|
||||
|
||||
dbObject.put("hwid", (int) HWID);
|
||||
dbObject.put("cubot", cubot.getObjectId());
|
||||
@@ -160,7 +159,7 @@ public class CubotLidar extends CpuHardware implements JSONSerialisable {
|
||||
return dbObject;
|
||||
}
|
||||
|
||||
public static CubotLidar deserialize(DBObject obj) {
|
||||
public static CubotLidar deserialize(Document obj) {
|
||||
return new CubotLidar((Cubot) GameServer.INSTANCE.getGameUniverse().getObject((long) obj.get("cubot")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package net.simon987.cubotplugin;
|
||||
|
||||
import com.mongodb.DBObject;
|
||||
import net.simon987.cubotplugin.event.ChargeShieldCommandListener;
|
||||
import net.simon987.cubotplugin.event.CpuInitialisationListener;
|
||||
import net.simon987.cubotplugin.event.UserCreationListener;
|
||||
@@ -11,6 +10,7 @@ import net.simon987.server.io.CpuHardwareDeserializer;
|
||||
import net.simon987.server.io.GameObjectDeserializer;
|
||||
import net.simon987.server.logging.LogManager;
|
||||
import net.simon987.server.plugin.ServerPlugin;
|
||||
import org.bson.Document;
|
||||
|
||||
public class CubotPlugin extends ServerPlugin implements GameObjectDeserializer, CpuHardwareDeserializer {
|
||||
|
||||
@@ -25,7 +25,7 @@ public class CubotPlugin extends ServerPlugin implements GameObjectDeserializer,
|
||||
}
|
||||
|
||||
@Override
|
||||
public GameObject deserializeObject(DBObject object) {
|
||||
public GameObject deserializeObject(Document object) {
|
||||
|
||||
int objType = (int) object.get("t");
|
||||
|
||||
@@ -38,7 +38,7 @@ public class CubotPlugin extends ServerPlugin implements GameObjectDeserializer,
|
||||
}
|
||||
|
||||
@Override
|
||||
public CpuHardware deserializeHardware(DBObject obj) {
|
||||
public CpuHardware deserializeHardware(Document obj) {
|
||||
int hwid = (int) obj.get("hwid");
|
||||
|
||||
switch (hwid) {
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package net.simon987.cubotplugin;
|
||||
|
||||
import com.mongodb.BasicDBObject;
|
||||
import com.mongodb.DBObject;
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.assembly.CpuHardware;
|
||||
import net.simon987.server.assembly.Status;
|
||||
import org.bson.Document;
|
||||
|
||||
public class CubotShield extends CpuHardware {
|
||||
|
||||
@@ -28,8 +27,8 @@ public class CubotShield extends CpuHardware {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasicDBObject mongoSerialise() {
|
||||
BasicDBObject dbObject = new BasicDBObject();
|
||||
public Document mongoSerialise() {
|
||||
Document dbObject = new Document();
|
||||
|
||||
dbObject.put("hwid", (int) HWID);
|
||||
dbObject.put("cubot", cubot.getObjectId());
|
||||
@@ -49,8 +48,8 @@ public class CubotShield extends CpuHardware {
|
||||
getCpu().getRegisterSet().getRegister("B").setValue(shield);
|
||||
}
|
||||
}
|
||||
|
||||
public static CubotShield deserialize(DBObject obj) {
|
||||
|
||||
public static CubotShield deserialize(Document obj) {
|
||||
return new CubotShield((Cubot) GameServer.INSTANCE.getGameUniverse().getObject((long) obj.get("cubot")));
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,16 @@
|
||||
package net.simon987.cubotplugin;
|
||||
|
||||
|
||||
import com.mongodb.BasicDBObject;
|
||||
import com.mongodb.DBObject;
|
||||
import net.simon987.server.assembly.Memory;
|
||||
import net.simon987.server.io.MongoSerialisable;
|
||||
import net.simon987.server.io.MongoSerializable;
|
||||
import org.bson.Document;
|
||||
|
||||
/**
|
||||
* Represents a floppy disk that is inside a floppy drive.
|
||||
* Floppies contains 80 tracks with 18 sectors per track.
|
||||
* That's 1440 sectors of 512 words. (total 1,474,560 bytes / 737,280 words / 1.44Mb)
|
||||
*/
|
||||
public class FloppyDisk implements MongoSerialisable {
|
||||
public class FloppyDisk implements MongoSerializable {
|
||||
|
||||
/**
|
||||
* Contents of the disk
|
||||
@@ -84,8 +83,8 @@ public class FloppyDisk implements MongoSerialisable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasicDBObject mongoSerialise() {
|
||||
BasicDBObject dbObject = new BasicDBObject();
|
||||
public Document mongoSerialise() {
|
||||
Document dbObject = new Document();
|
||||
|
||||
dbObject.put("rwHeadTrack", rwHeadTrack);
|
||||
dbObject.put("memory", memory.mongoSerialise());
|
||||
@@ -93,12 +92,12 @@ public class FloppyDisk implements MongoSerialisable {
|
||||
return dbObject;
|
||||
}
|
||||
|
||||
public static FloppyDisk deserialise(DBObject obj) {
|
||||
public static FloppyDisk deserialise(Document obj) {
|
||||
|
||||
FloppyDisk floppyDisk = new FloppyDisk();
|
||||
|
||||
floppyDisk.rwHeadTrack = (int) obj.get("rwHeadTrack");
|
||||
floppyDisk.memory = Memory.deserialize((DBObject) obj.get("memory"));
|
||||
floppyDisk.memory = Memory.deserialize((Document) obj.get("memory"));
|
||||
|
||||
return floppyDisk;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user