Skip to content
Snippets Groups Projects
Commit 856f603e authored by Zoey76's avatar Zoey76
Browse files

Minor toArray() cleanup

Read https://shipilev.net/blog/2016/arrays-wisdom-ancients/ if you are
in for some arcane magic.
parent 33fa1afd
No related branches found
No related tags found
No related merge requests found
Showing
with 22 additions and 22 deletions
......@@ -91,7 +91,7 @@ public class Area implements ITargetTypeHandler {
return EMPTY_TARGET_LIST;
}
return targetList.toArray(new L2Character[targetList.size()]);
return targetList.toArray(EMPTY_TARGET_LIST);
}
@Override
......
......@@ -68,7 +68,7 @@ public class AreaCorpseMob implements ITargetTypeHandler {
if (targetList.isEmpty()) {
return EMPTY_TARGET_LIST;
}
return targetList.toArray(new L2Character[targetList.size()]);
return targetList.toArray(EMPTY_TARGET_LIST);
}
@Override
......
......@@ -87,7 +87,7 @@ public class AreaFriendly implements ITargetTypeHandler {
if (targetList.isEmpty()) {
return EMPTY_TARGET_LIST;
}
return targetList.toArray(new L2Character[targetList.size()]);
return targetList.toArray(EMPTY_TARGET_LIST);
}
private boolean checkTarget(L2PcInstance activeChar, L2Character target) {
......
......@@ -80,7 +80,7 @@ public class AreaSummon implements ITargetTypeHandler {
return EMPTY_TARGET_LIST;
}
return targetList.toArray(new L2Character[targetList.size()]);
return targetList.toArray(EMPTY_TARGET_LIST);
}
@Override
......
......@@ -65,7 +65,7 @@ public class Aura implements ITargetTypeHandler {
targetList.add(obj);
}
}
return targetList.toArray(new L2Character[targetList.size()]);
return targetList.toArray(EMPTY_TARGET_LIST);
}
@Override
......
......@@ -53,7 +53,7 @@ public class AuraCorpseMob implements ITargetTypeHandler {
targetList.add(obj);
}
}
return targetList.toArray(new L2Character[targetList.size()]);
return targetList.toArray(EMPTY_TARGET_LIST);
}
@Override
......
......@@ -57,7 +57,7 @@ public class AuraFriendly implements ITargetTypeHandler {
return EMPTY_TARGET_LIST;
}
return targetList.toArray(new L2Character[targetList.size()]);
return targetList.toArray(EMPTY_TARGET_LIST);
}
private boolean checkTarget(L2PcInstance activeChar, L2Character target) {
......
......@@ -52,7 +52,7 @@ public class AuraUndeadEnemy implements ITargetTypeHandler {
targetList.add(obj);
}
}
return targetList.toArray(new L2Character[targetList.size()]);
return targetList.toArray(EMPTY_TARGET_LIST);
}
@Override
......
......@@ -95,7 +95,7 @@ public class BehindArea implements ITargetTypeHandler {
return EMPTY_TARGET_LIST;
}
return targetList.toArray(new L2Character[targetList.size()]);
return targetList.toArray(EMPTY_TARGET_LIST);
}
@Override
......
......@@ -63,7 +63,7 @@ public class BehindAura implements ITargetTypeHandler {
targetList.add(obj);
}
}
return targetList.toArray(new L2Character[targetList.size()]);
return targetList.toArray(EMPTY_TARGET_LIST);
}
@Override
......
......@@ -142,7 +142,7 @@ public class Clan implements ITargetTypeHandler {
}
}
return targetList.toArray(new L2Character[targetList.size()]);
return targetList.toArray(EMPTY_TARGET_LIST);
}
@Override
......
......@@ -64,7 +64,7 @@ public class ClanMember implements ITargetTypeHandler {
} else {
return EMPTY_TARGET_LIST;
}
return targetList.toArray(new L2Character[targetList.size()]);
return targetList.toArray(EMPTY_TARGET_LIST);
}
@Override
......
......@@ -53,7 +53,7 @@ public class CommandChannel implements ITargetTypeHandler {
// if player in not in party
if (party == null) {
return targetList.toArray(new L2Character[targetList.size()]);
return targetList.toArray(EMPTY_TARGET_LIST);
}
// Get all visible objects in a spherical area near the L2Character
......@@ -73,7 +73,7 @@ public class CommandChannel implements ITargetTypeHandler {
}
}
return targetList.toArray(new L2Character[targetList.size()]);
return targetList.toArray(EMPTY_TARGET_LIST);
}
@Override
......
......@@ -95,7 +95,7 @@ public class FrontArea implements ITargetTypeHandler {
return EMPTY_TARGET_LIST;
}
return targetList.toArray(new L2Character[targetList.size()]);
return targetList.toArray(EMPTY_TARGET_LIST);
}
@Override
......
......@@ -63,7 +63,7 @@ public class FrontAura implements ITargetTypeHandler {
targetList.add(obj);
}
}
return targetList.toArray(new L2Character[targetList.size()]);
return targetList.toArray(EMPTY_TARGET_LIST);
}
@Override
......
......@@ -63,7 +63,7 @@ public class Ground implements ITargetTypeHandler {
targetList.add(activeChar);
}
}
return targetList.isEmpty() ? EMPTY_TARGET_LIST : targetList.toArray(new L2Character[targetList.size()]);
return targetList.toArray(EMPTY_TARGET_LIST);
}
@Override
......
......@@ -71,7 +71,7 @@ public class Party implements ITargetTypeHandler {
}
}
}
return targetList.toArray(new L2Character[targetList.size()]);
return targetList.toArray(EMPTY_TARGET_LIST);
}
@Override
......
......@@ -61,7 +61,7 @@ public class PartyClan implements ITargetTypeHandler {
// if player in clan and not in party
if (!(hasClan || hasParty)) {
return targetList.toArray(new L2Character[targetList.size()]);
return targetList.toArray(EMPTY_TARGET_LIST);
}
// Get all visible objects in a spherical area near the L2Character
......@@ -129,7 +129,7 @@ public class PartyClan implements ITargetTypeHandler {
targetList.add(obj);
}
return targetList.toArray(new L2Character[targetList.size()]);
return targetList.toArray(EMPTY_TARGET_LIST);
}
@Override
......
......@@ -58,7 +58,7 @@ public class PartyNotMe implements ITargetTypeHandler {
}
}
}
return targetList.toArray(new L2Character[targetList.size()]);
return targetList.toArray(EMPTY_TARGET_LIST);
}
@Override
......
......@@ -63,7 +63,7 @@ public class TargetParty implements ITargetTypeHandler {
} else {
targetList.add(target);
}
return targetList.toArray(new L2Character[targetList.size()]);
return targetList.toArray(EMPTY_TARGET_LIST);
}
@Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment