mirror of
https://github.com/ProjectSWGCore/Holocore.git
synced 2026-10-06 21:13:37 -04:00
Changed SWGObject's getTemplateAttribute to getDataAttribute
This commit is contained in:
@@ -78,14 +78,14 @@ public abstract class SWGObject implements Serializable, Comparable<SWGObject> {
|
||||
private final HashMap <String, SWGObject> slots; // HashMap used for null value support
|
||||
private final Map<Long, SWGObject> containedObjects;
|
||||
private final Map <String, String> attributes;
|
||||
private final Map <ObjectDataAttribute, Object> templateAttributes;
|
||||
private final Map <ObjectDataAttribute, Object> dataAttributes;
|
||||
private final BaselineType objectType;
|
||||
private ContainerPermissions containerPermissions;
|
||||
private transient Set <SWGObject> objectsAware;
|
||||
private transient BuildoutArea buildoutArea;
|
||||
private transient Player owner;
|
||||
private List <List <String>> arrangement;
|
||||
|
||||
private Player owner = null;
|
||||
private SWGObject parent = null;
|
||||
private StringId stringId = new StringId("", "");
|
||||
private StringId detailStringId = new StringId("", "");
|
||||
@@ -112,7 +112,7 @@ public abstract class SWGObject implements Serializable, Comparable<SWGObject> {
|
||||
this.slots = new HashMap<>();
|
||||
this.containedObjects = Collections.synchronizedMap(new HashMap<Long, SWGObject>());
|
||||
this.attributes = new LinkedHashMap<>();
|
||||
this.templateAttributes = new Hashtable<>();
|
||||
this.dataAttributes = new Hashtable<>();
|
||||
this.containerPermissions = new DefaultPermissions();
|
||||
this.objectType = objectType;
|
||||
}
|
||||
@@ -122,6 +122,7 @@ public abstract class SWGObject implements Serializable, Comparable<SWGObject> {
|
||||
ois.defaultReadObject();
|
||||
objectsAware = new HashSet<SWGObject>();
|
||||
buildoutArea = null;
|
||||
owner = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -177,14 +178,17 @@ public abstract class SWGObject implements Serializable, Comparable<SWGObject> {
|
||||
* @return {@link ContainerResult}
|
||||
*/
|
||||
public ContainerResult moveToContainer(SWGObject requester, SWGObject container) {
|
||||
if (!container.hasPermission(requester, ContainerPermissions.Permission.MOVE))
|
||||
if (!container.hasPermission(requester, ContainerPermissions.Permission.MOVE)) {
|
||||
Log.w("SWGObject", "No permission 'MOVE' for requestor %s with object %s", requester, this);
|
||||
return ContainerResult.NO_PERMISSION;
|
||||
}
|
||||
|
||||
// Check if object can fit into container or slots
|
||||
int arrangementId = container.getArrangementId(this);
|
||||
if (arrangementId == -1) {
|
||||
// Item is going to go into the container, so check to see if it'll fit
|
||||
if (container.getMaxContainerSize() <= container.getContainedObjects().size()) {
|
||||
Log.w("SWGObject", "Unable to add object to container! Container Full");
|
||||
return ContainerResult.CONTAINER_FULL;
|
||||
}
|
||||
}
|
||||
@@ -505,12 +509,12 @@ public abstract class SWGObject implements Serializable, Comparable<SWGObject> {
|
||||
return areaId;
|
||||
}
|
||||
|
||||
public Object getTemplateAttribute(ObjectDataAttribute key) {
|
||||
return templateAttributes.get(key);
|
||||
public Object getDataAttribute(ObjectDataAttribute key) {
|
||||
return dataAttributes.get(key);
|
||||
}
|
||||
|
||||
public void setTemplateAttribute(ObjectDataAttribute key, Object value) {
|
||||
templateAttributes.put(key, value);
|
||||
public void setDataAttribute(ObjectDataAttribute key, Object value) {
|
||||
dataAttributes.put(key, value);
|
||||
}
|
||||
|
||||
public List<List<String>> getArrangement() {
|
||||
@@ -542,14 +546,12 @@ public abstract class SWGObject implements Serializable, Comparable<SWGObject> {
|
||||
}
|
||||
|
||||
public int getMaxContainerSize() {
|
||||
Object volume = templateAttributes.get(ObjectDataAttribute.CONTAINER_VOLUME_LIMIT);
|
||||
if (volume == null)
|
||||
return 0;
|
||||
try {
|
||||
return Integer.parseInt(volume.toString());
|
||||
} catch (NumberFormatException e) {
|
||||
Object volume = dataAttributes.get(ObjectDataAttribute.CONTAINER_VOLUME_LIMIT);
|
||||
if (volume == null) {
|
||||
Log.w("SWGObject", "Volume is null!");
|
||||
return 0;
|
||||
}
|
||||
return (Integer) volume;
|
||||
}
|
||||
|
||||
public void setBuildout(boolean buildout) {
|
||||
|
||||
Reference in New Issue
Block a user