From c68d31b02d429b177fc0a86ad8ab85b102c4cfc5 Mon Sep 17 00:00:00 2001 From: Waverunner Date: Tue, 9 Jun 2015 13:16:24 -0400 Subject: [PATCH 1/2] Updated SWGList javadoc --- src/resources/collections/SWGList.java | 39 +++++++++++++++++--------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/src/resources/collections/SWGList.java b/src/resources/collections/SWGList.java index d9b350016..1474b2fc7 100644 --- a/src/resources/collections/SWGList.java +++ b/src/resources/collections/SWGList.java @@ -88,10 +88,9 @@ public class SWGList extends AbstractList implements Encodable { /** * Creates a new {@link SWGList} with the given StringType to encode in. Note that this constructor must be used if the elements within the list is a String. - * @param baseline - * @param view - * @param updateType - * @param strType + * @param baseline {@link BaselineType} for this list, should be the same as the parent class this list resides in + * @param view The baseline number this list resides in + * @param strType The {@link StringType} of the string, required only if the element in the list is a String as it's used for encoding either Unicode or ASCII characters */ public SWGList(BaselineType baseline, int view, int updateType, StringType strType) { this (baseline, view, updateType); @@ -100,11 +99,11 @@ public class SWGList extends AbstractList implements Encodable { /** * Creates a ew {@link SWGList} with delta sending either enabled or disabled - * @param baseline - * @param view - * @param updateType - * @param strType - * @param noUpdates + * @param baseline {@link BaselineType} for this list, should be the same as the parent class this list resides in + * @param view The baseline number this list resides in + * @param updateType The update variable used for sending a delta, it's the operand count that this list resides at within the baseline + * @param strType The {@link StringType} of the string, required only if the element in the list is a String as it's used for encoding either Unicode or ASCII characters + * @param noUpdates Determines if a delta should be sent when modifying the list (add/remove/set) */ public SWGList(BaselineType baseline, int view, int updateType, StringType strType, boolean noUpdates) { this (baseline, view, updateType, strType); @@ -113,7 +112,8 @@ public class SWGList extends AbstractList implements Encodable { /** * Appends the specified element to the end of this list if it doesn't already exist. Once added, the updateCount is incremented by one - * and data for the object is encoded. A add delta is then sent using {@link DeltaBuilder} if noUpdates = false (false by default) + * and data for the object is encoded. + *

An add delta is then sent using {@link DeltaBuilder} if noUpdates = false (false by default) * @param e element to be appended to this list * @return true if the element was added */ @@ -133,7 +133,7 @@ public class SWGList extends AbstractList implements Encodable { /** * Inserts the specified element at the specified position in this list. Shifts the element currently * at that position (if any) and any subsequent elements to the right (adds one to their indices). - * A add delta is then sent using {@link DeltaBuilder} if noUpdates = false (false by default) + *

An add delta is then sent using {@link DeltaBuilder} if noUpdates = false (false by default) * @param index index at which the specified element is to be inserted * @param e element to be inserted */ @@ -147,11 +147,11 @@ public class SWGList extends AbstractList implements Encodable { /** * Replaces the element at the specified position in this list with the specified element. - * A change delta is then sent using {@link DeltaBuilder} if noUpdates = false (false by default). Since this + *

A change delta is then sent using {@link DeltaBuilder} if noUpdates = false (false by default). Since this * sends a change delta, it should only be used for replacing an element, not for adding one. * @param index index of the element to replace * @param element - * @return + * @return The element that was replaced */ @Override public E set(int index, E element) { @@ -167,6 +167,12 @@ public class SWGList extends AbstractList implements Encodable { } + /** + * Removes the element at the specified position in this list. Shifts any subsequent elements to the left + * (subtracts one from their indices). Returns the element that was removed from the list. + * @param index + * @return + */ @Override public E remove(int index) { // Method is also called for remove(E element), just replaced by the index @@ -193,7 +199,12 @@ public class SWGList extends AbstractList implements Encodable { public int size() { return list.size(); } - + + /** + * Creates an array of bytes based off of the elements within this list. Elements that are not of a standard type + * handled by {@link Encoder} should implement the {@link Encodable} interface. + * @return + */ @Override public byte[] encode() { int size = list.size(); From eba3e24db630cb8fb1b03f497f7ac376b7932543 Mon Sep 17 00:00:00 2001 From: Obique PSWG Date: Wed, 10 Jun 2015 20:38:47 -0500 Subject: [PATCH 2/2] Added logging to ObjectManager in case the player is ever null --- src/services/objects/ObjectManager.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/services/objects/ObjectManager.java b/src/services/objects/ObjectManager.java index 5bdcf234e..6d4495334 100644 --- a/src/services/objects/ObjectManager.java +++ b/src/services/objects/ObjectManager.java @@ -334,8 +334,10 @@ public class ObjectManager extends Manager { private void zoneInCharacter(PlayerManager playerManager, String galaxy, long netId, long characterId) { Player player = playerManager.getPlayerFromNetworkId(netId); - if (player == null) + if (player == null) { + Log.e("ObjectManager", "Unable to zone in null player '%ld'", netId); return; + } SWGObject creatureObj = objects.get(characterId); if (creatureObj == null) { System.err.println("ObjectManager: Failed to start zone - CreatureObject could not be fetched from database [Character: " + characterId + " User: " + player.getUsername() + "]");