Equipment list now uses ids instead of the referencing the object to avoid storing duplicate objects in the db

This commit is contained in:
Light2
2014-05-04 20:54:41 +02:00
parent 3c3155b8b2
commit db4a47b35a
8 changed files with 49 additions and 28 deletions
+7 -3
View File
@@ -608,7 +608,10 @@ public class PlayerService implements INetworkDispatch {
try
{
for (SWGObject equipment : new ArrayList<SWGObject>(creature.getEquipmentList())) {
for (Long equipmentId : new ArrayList<Long>(creature.getEquipmentList())) {
SWGObject equipment = core.objectService.getObject(equipmentId);
if (equipment == null) {
continue;
}
@@ -1270,8 +1273,9 @@ public class PlayerService implements INetworkDispatch {
actor.sendSystemMessage("@unity:decline", (byte) 0);
proposer.sendSystemMessage("@unity:declined", (byte) 0);
actor.setAttachment("proposer", null);
for(SWGObject obj : proposer.getEquipmentList()) {
if(obj.getAttachment("unity") != null) {
for(Long objId : proposer.getEquipmentList()) {
SWGObject obj = core.objectService.getObject(objId);
if(obj != null && obj.getAttachment("unity") != null) {
obj.setAttachment("unity", null);
break;
}