Added character deletion

This commit is contained in:
Obique
2015-01-13 02:00:33 -06:00
committed by Obique
parent 1a0e2a604b
commit b08ffda0b6
3 changed files with 44 additions and 2 deletions
+18
View File
@@ -137,6 +137,24 @@ public class ObjectManager extends Manager {
}
}
public SWGObject deleteObject(long objId) {
synchronized (objects) {
SWGObject obj = objects.remove(objId);
if (obj == null)
return null;
Location loc = obj.getLocation();
if (loc != null && loc.getTerrain() != null)
quadTree.get(loc.getTerrain()).remove(loc.getX(), loc.getZ(), obj);
for (SWGObject child : obj.getChildren())
if (child != null)
deleteObject(child.getObjectId());
for (SWGObject slot : obj.getSlots().values())
if (slot != null)
deleteObject(slot.getObjectId());
return obj;
}
}
public SWGObject createObject(String template) {
return createObject(template, null);
}