diff --git a/src/com/massivecraft/mcore/MCoreConf.java b/src/com/massivecraft/mcore/MCoreConf.java index 14765ffa..8a0063a4 100644 --- a/src/com/massivecraft/mcore/MCoreConf.java +++ b/src/com/massivecraft/mcore/MCoreConf.java @@ -10,6 +10,7 @@ import org.bukkit.permissions.Permissible; import com.massivecraft.mcore.store.Entity; import com.massivecraft.mcore.util.MUtil; import com.massivecraft.mcore.util.PermUtil; +import com.massivecraft.mcore.xlib.mongodb.WriteConcern; public class MCoreConf extends Entity { @@ -61,6 +62,11 @@ public class MCoreConf extends Entity public List getDeleteFiles() { return this.deleteFiles == null ? new ArrayList() : new ArrayList(this.deleteFiles); } public void setDeleteFiles(List deleteFiles) { this.deleteFiles = deleteFiles == null ? new ArrayList() : new ArrayList(deleteFiles); this.changed(); } + // Used in the MongoDB mstore driver. + private WriteConcern mongoDbWriteConcern = WriteConcern.ACKNOWLEDGED; + public WriteConcern getMongoDbWriteConcern() { return this.mongoDbWriteConcern; } + public void setMongoDbWriteConcern(WriteConcern mongoDbWriteConcern) { this.mongoDbWriteConcern = mongoDbWriteConcern; this.changed(); } + // -------------------------------------------- // // HELP ACCESS // -------------------------------------------- // diff --git a/src/com/massivecraft/mcore/store/DriverMongo.java b/src/com/massivecraft/mcore/store/DriverMongo.java index 51e7131c..7aad2fa0 100644 --- a/src/com/massivecraft/mcore/store/DriverMongo.java +++ b/src/com/massivecraft/mcore/store/DriverMongo.java @@ -9,6 +9,7 @@ import java.util.Set; import java.util.AbstractMap.SimpleEntry; import java.util.Map.Entry; +import com.massivecraft.mcore.MCoreConf; import com.massivecraft.mcore.xlib.gson.JsonElement; import com.massivecraft.mcore.xlib.mongodb.BasicDBObject; import com.massivecraft.mcore.xlib.mongodb.DB; @@ -168,7 +169,7 @@ public class DriverMongo extends DriverAbstract GsonMongoConverter.gson2MongoObject(data, dbo); - dbcoll.save(dbo); + dbcoll.save(dbo, MCoreConf.get().getMongoDbWriteConcern()); return mtime; } @@ -176,7 +177,8 @@ public class DriverMongo extends DriverAbstract @Override public void delete(Coll coll, String id) { - fixColl(coll).remove(new BasicDBObject(ID_FIELD, id)); + DBCollection dbcoll = fixColl(coll); + dbcoll.remove(new BasicDBObject(ID_FIELD, id), MCoreConf.get().getMongoDbWriteConcern()); } //----------------------------------------------//