Move private methods at bottom of NPC plugin

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
Tomas Slusny
2018-05-07 16:03:26 +02:00
parent 822bceacd7
commit 404cdddebd

View File

@@ -113,7 +113,7 @@ public class NpcIndicatorsPlugin extends Plugin
{
keyManager.registerKeyListener(inputListener);
highlights = getHighlights();
rebuildNpcs();
rebuildAllNpcs();
}
@Override
@@ -133,52 +133,7 @@ public class NpcIndicatorsPlugin extends Plugin
}
highlights = getHighlights();
rebuildNpcs();
}
private List<String> getHighlights()
{
final String configNpcs = config.getNpcToHighlight().toLowerCase();
if (configNpcs.isEmpty())
{
return Collections.emptyList();
}
return COMMA_SPLITTER.splitToList(configNpcs);
}
/**
* Rebuild highlighted npcs
*/
private void rebuildNpcs()
{
highlightedNpcs.clear();
for (NPC npc : client.getNpcs())
{
String npcName = npc.getName();
if (npcName == null)
{
continue;
}
if (npcTags.contains(npc.getIndex()))
{
highlightedNpcs.add(npc);
continue;
}
for (String highlight : highlights)
{
if (WildcardMatcher.matches(highlight, npcName))
{
highlightedNpcs.add(npc);
break;
}
}
}
rebuildAllNpcs();
}
@Subscribe
@@ -271,4 +226,47 @@ public class NpcIndicatorsPlugin extends Plugin
hotKeyPressed = pressed;
}
private List<String> getHighlights()
{
final String configNpcs = config.getNpcToHighlight().toLowerCase();
if (configNpcs.isEmpty())
{
return Collections.emptyList();
}
return COMMA_SPLITTER.splitToList(configNpcs);
}
private void rebuildAllNpcs()
{
highlightedNpcs.clear();
for (NPC npc : client.getNpcs())
{
String npcName = npc.getName();
if (npcName == null)
{
continue;
}
if (npcTags.contains(npc.getIndex()))
{
highlightedNpcs.add(npc);
continue;
}
for (String highlight : highlights)
{
if (WildcardMatcher.matches(highlight, npcName))
{
highlightedNpcs.add(npc);
break;
}
}
}
}
}