Updated mongodb driver to 3.7.0

This commit is contained in:
simon
2018-05-11 21:06:18 -04:00
parent e98575b23f
commit 854863ede9
57 changed files with 383 additions and 383 deletions

View File

@@ -1,5 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration />
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
@@ -17,14 +22,14 @@
<orderEntry type="module" module-name="Server" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-text:1.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.7" level="project" />
<orderEntry type="library" name="Maven: org.mongodb:mongo-java-driver:2.10.1" level="project" />
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-core:5.0.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.0.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.0.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.0.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.0.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.0.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.0.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.mongodb:mongo-java-driver:3.7.0" level="project" />
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-core:5.0.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: com.sparkjava:spark-core:2.7.2" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.13" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-server:9.4.8.v20171121" level="project" />

View File

@@ -1,7 +1,5 @@
package net.simon987.npcplugin;
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import net.simon987.server.GameServer;
import net.simon987.server.assembly.Util;
import net.simon987.server.game.Attackable;
@@ -9,6 +7,7 @@ import net.simon987.server.game.GameObject;
import net.simon987.server.game.Rechargeable;
import net.simon987.server.game.Updatable;
import net.simon987.server.logging.LogManager;
import org.bson.Document;
import org.json.simple.JSONObject;
import java.util.ArrayList;
@@ -150,8 +149,8 @@ public class ElectricBox extends GameObject implements Updatable, Attackable {
}
@Override
public BasicDBObject mongoSerialise() {
BasicDBObject dbObject = new BasicDBObject();
public Document mongoSerialise() {
Document dbObject = new Document();
dbObject.put("i", getObjectId());
dbObject.put("x", getX());
@@ -162,7 +161,7 @@ public class ElectricBox extends GameObject implements Updatable, Attackable {
return dbObject;
}
public static ElectricBox deserialize(DBObject obj) {
public static ElectricBox deserialize(Document obj) {
ElectricBox electricBox = new ElectricBox();
electricBox.setHp((int) obj.get("hp"));

View File

@@ -1,15 +1,14 @@
package net.simon987.npcplugin;
import com.mongodb.BasicDBList;
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import net.simon987.server.GameServer;
import net.simon987.server.game.GameObject;
import net.simon987.server.game.Updatable;
import org.bson.Document;
import org.json.simple.JSONObject;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
/**
* Game objects that regularly creates NonPlayerCharacters
@@ -133,15 +132,15 @@ public class Factory extends GameObject implements Updatable {
}
@Override
public BasicDBObject mongoSerialise() {
BasicDBObject dbObject = new BasicDBObject();
public Document mongoSerialise() {
Document dbObject = new Document();
dbObject.put("i", getObjectId());
dbObject.put("x", getX());
dbObject.put("y", getY());
dbObject.put("t", ID);
BasicDBList tmpNpcArray = new BasicDBList();
List<Long> tmpNpcArray = new ArrayList<>(npcs.size());
for (NonPlayerCharacter npc : npcs) {
tmpNpcArray.add(npc.getObjectId());
@@ -152,14 +151,14 @@ public class Factory extends GameObject implements Updatable {
return dbObject;
}
public static Factory deserialise(DBObject obj) {
public static Factory deserialise(Document obj) {
Factory factory = new Factory();
factory.setObjectId((long) obj.get("i"));
factory.setX((int) obj.get("x"));
factory.setY((int) obj.get("y"));
factory.tmpNpcArray = ((BasicDBList) obj.get("tmpNpcArray")).toArray();
factory.tmpNpcArray = ((ArrayList) obj.get("tmpNpcArray")).toArray();
return factory;
}

View File

@@ -1,10 +1,9 @@
package net.simon987.npcplugin;
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import net.simon987.server.GameServer;
import net.simon987.server.event.ObjectDeathEvent;
import net.simon987.server.game.Direction;
import org.bson.Document;
import org.json.simple.JSONObject;
@@ -80,8 +79,8 @@ public class HarvesterNPC extends NonPlayerCharacter {
}
@Override
public BasicDBObject mongoSerialise() {
BasicDBObject dbObject = new BasicDBObject();
public Document mongoSerialise() {
Document dbObject = new Document();
dbObject.put("i", getObjectId());
dbObject.put("x", getX());
@@ -94,7 +93,7 @@ public class HarvesterNPC extends NonPlayerCharacter {
return dbObject;
}
public static HarvesterNPC deserialize(DBObject obj) {
public static HarvesterNPC deserialize(Document obj) {
HarvesterNPC npc = new HarvesterNPC();
npc.setObjectId((long) obj.get("i"));

View File

@@ -1,6 +1,5 @@
package net.simon987.npcplugin;
import com.mongodb.DBObject;
import net.simon987.npcplugin.event.CpuInitialisationListener;
import net.simon987.npcplugin.event.VaultWorldUpdateListener;
import net.simon987.npcplugin.event.WorldCreationListener;
@@ -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;
import java.util.ArrayList;
@@ -34,7 +34,7 @@ public class NpcPlugin extends ServerPlugin implements GameObjectDeserializer, C
}
@Override
public GameObject deserializeObject(DBObject obj) {
public GameObject deserializeObject(Document obj) {
int objType = (int) obj.get("t");
@@ -60,7 +60,7 @@ public class NpcPlugin extends ServerPlugin implements GameObjectDeserializer, C
}
@Override
public CpuHardware deserializeHardware(DBObject obj) {
public CpuHardware deserializeHardware(Document obj) {
int hwid = (int) obj.get("hwid");
switch (hwid) {

View File

@@ -1,9 +1,8 @@
package net.simon987.npcplugin;
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import net.simon987.server.game.Attackable;
import net.simon987.server.game.GameObject;
import org.bson.Document;
import org.json.simple.JSONObject;
/**
@@ -89,8 +88,8 @@ public class Obstacle extends GameObject implements Attackable {
}
@Override
public BasicDBObject mongoSerialise() {
BasicDBObject dbObject = new BasicDBObject();
public Document mongoSerialise() {
Document dbObject = new Document();
dbObject.put("i", getObjectId());
dbObject.put("x", getX());
@@ -116,7 +115,7 @@ public class Obstacle extends GameObject implements Attackable {
return json;
}
public static Obstacle deserialize(DBObject obj) {
public static Obstacle deserialize(Document obj) {
Obstacle obstacle = new Obstacle((int) obj.get("hp"));
obstacle.setObjectId((long) obj.get("i"));

View File

@@ -1,9 +1,8 @@
package net.simon987.npcplugin;
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import net.simon987.server.GameServer;
import net.simon987.server.game.*;
import org.bson.Document;
import org.json.simple.JSONObject;
public class Portal extends GameObject implements Enterable {
@@ -48,8 +47,8 @@ public class Portal extends GameObject implements Enterable {
}
@Override
public BasicDBObject mongoSerialise() {
BasicDBObject dbObject = new BasicDBObject();
public Document mongoSerialise() {
Document dbObject = new Document();
dbObject.put("i", getObjectId());
dbObject.put("x", getX());
@@ -64,7 +63,7 @@ public class Portal extends GameObject implements Enterable {
return dbObject;
}
public static Portal deserialize(DBObject obj) {
public static Portal deserialize(Document obj) {
Portal portal = new Portal();

View File

@@ -1,13 +1,12 @@
package net.simon987.npcplugin;
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.assembly.Util;
import net.simon987.server.game.Action;
import net.simon987.server.game.ControllableUnit;
import org.bson.Document;
import java.util.ArrayList;
@@ -67,9 +66,9 @@ public class RadioReceiverHardware 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());
@@ -77,7 +76,7 @@ public class RadioReceiverHardware extends CpuHardware {
return dbObject;
}
public static RadioReceiverHardware deserialize(DBObject obj) {
public static RadioReceiverHardware deserialize(Document obj) {
return new RadioReceiverHardware((ControllableUnit) GameServer.INSTANCE.getGameUniverse().getObject((long) obj.get("cubot")));
}
}

View File

@@ -1,10 +1,9 @@
package net.simon987.npcplugin;
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import net.simon987.server.game.GameObject;
import net.simon987.server.game.Programmable;
import net.simon987.server.game.Updatable;
import org.bson.Document;
import org.json.simple.JSONObject;
import java.util.ArrayList;
@@ -66,8 +65,8 @@ public class RadioTower extends GameObject implements Programmable, Updatable {
}
@Override
public BasicDBObject mongoSerialise() {
BasicDBObject dbObject = new BasicDBObject();
public Document mongoSerialise() {
Document dbObject = new Document();
dbObject.put("i", getObjectId());
dbObject.put("x", getX());
@@ -77,7 +76,7 @@ public class RadioTower extends GameObject implements Programmable, Updatable {
return dbObject;
}
public static RadioTower deserialize(DBObject obj) {
public static RadioTower deserialize(Document obj) {
RadioTower tower = new RadioTower();
tower.setObjectId((long) obj.get("i"));

View File

@@ -1,11 +1,10 @@
package net.simon987.npcplugin;
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import net.simon987.server.GameServer;
import net.simon987.server.crypto.RandomStringGenerator;
import net.simon987.server.game.*;
import net.simon987.server.logging.LogManager;
import org.bson.Document;
import org.json.simple.JSONObject;
import java.util.Arrays;
@@ -124,8 +123,8 @@ public class VaultDoor extends GameObject implements Programmable, Enterable, Up
}
@Override
public BasicDBObject mongoSerialise() {
BasicDBObject dbObject = new BasicDBObject();
public Document mongoSerialise() {
Document dbObject = new Document();
dbObject.put("i", getObjectId());
dbObject.put("x", getX());
@@ -152,7 +151,7 @@ public class VaultDoor extends GameObject implements Programmable, Enterable, Up
return json;
}
public static VaultDoor deserialize(DBObject obj) {
public static VaultDoor deserialize(Document obj) {
VaultDoor vaultDoor = new VaultDoor(0); //cypherId ?
vaultDoor.setX((int) obj.get("x"));
@@ -160,7 +159,7 @@ public class VaultDoor extends GameObject implements Programmable, Enterable, Up
vaultDoor.setObjectId((long) obj.get("i"));
if (obj.containsField("homeX") && obj.containsField("homeY")) {
if (obj.containsKey("homeX") && obj.containsKey("homeY")) {
vaultDoor.setHomeX((int) obj.get("homeX"));
vaultDoor.setHomeY((int) obj.get("homeY"));
}

View File

@@ -1,11 +1,10 @@
package net.simon987.npcplugin;
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import net.simon987.server.game.ControllableUnit;
import net.simon987.server.game.GameObject;
import net.simon987.server.game.Location;
import net.simon987.server.logging.LogManager;
import org.bson.Document;
/**
* Final exit portal located in the 'last' World of a Vault dimension
@@ -15,8 +14,8 @@ public class VaultExitPortal extends Portal {
public static final int ID = 9;
@Override
public BasicDBObject mongoSerialise() {
BasicDBObject dbObject = new BasicDBObject();
public Document mongoSerialise() {
Document dbObject = new Document();
dbObject.put("i", getObjectId());
dbObject.put("x", getX());
@@ -44,7 +43,7 @@ public class VaultExitPortal extends Portal {
return super.enter(object);
}
public static Portal deserialize(DBObject obj) {
public static Portal deserialize(Document obj) {
VaultExitPortal portal = new VaultExitPortal();