Refactored ClientFactory to be used statically

This commit is contained in:
Waverunner
2015-06-05 10:37:04 -04:00
parent 0d61bcfb65
commit c58df94b3c
8 changed files with 43 additions and 49 deletions
+4 -6
View File
@@ -50,9 +50,7 @@ import resources.objects.waypoint.WaypointObject;
import resources.objects.weapon.WeaponObject;
public final class ObjectCreator {
private static final ClientFactory clientFac = new ClientFactory();
public static final SWGObject createObjectFromTemplate(long objectId, String template) {
if (!template.startsWith("object/"))
return null;
@@ -93,7 +91,7 @@ public final class ObjectCreator {
}
private static void addObjectAttributes(SWGObject obj, String template) {
ObjectData attributes = (ObjectData) clientFac.getInfoFromFile(ClientFactory.formatToSharedFile(template));
ObjectData attributes = (ObjectData) ClientFactory.getInfoFromFile(ClientFactory.formatToSharedFile(template));
String stf = (String) attributes.getAttribute(ObjectData.OBJ_STF);
String detailStf = (String) attributes.getAttribute(ObjectData.DETAIL_STF);
@@ -122,7 +120,7 @@ public final class ObjectCreator {
private static void createObjectSlots(SWGObject object) {
if (object.getTemplateAttribute(ObjectData.SLOT_DESCRIPTOR) != null) {
// These are the slots that the object *HAS*
SlotDescriptorData descriptor = (SlotDescriptorData) clientFac.getInfoFromFile((String) object.getTemplateAttribute(ObjectData.SLOT_DESCRIPTOR));
SlotDescriptorData descriptor = (SlotDescriptorData) ClientFactory.getInfoFromFile((String) object.getTemplateAttribute(ObjectData.SLOT_DESCRIPTOR));
for (String slotName : descriptor.getSlots()) {
object.getSlots().put(slotName, null);
@@ -131,7 +129,7 @@ public final class ObjectCreator {
if (object.getTemplateAttribute(ObjectData.ARRANGEMENT_FILE) != null) {
// This is what slots the created object is able to go into/use
SlotArrangementData arrangementData = (SlotArrangementData) clientFac.getInfoFromFile((String) object.getTemplateAttribute(ObjectData.ARRANGEMENT_FILE));
SlotArrangementData arrangementData = (SlotArrangementData) ClientFactory.getInfoFromFile((String) object.getTemplateAttribute(ObjectData.ARRANGEMENT_FILE));
object.setArrangement(arrangementData.getArrangement());
}
}