load spells only once per rebuild instead of before adding a new spell

This commit is contained in:
Lucas
2019-04-30 23:51:39 +02:00
parent cd9e34f46c
commit 0a173d13dc
2 changed files with 848 additions and 841 deletions

View File

@@ -201,14 +201,16 @@ public class SpellbookPlugin extends Plugin
String[] sStack = client.getStringStack();
int sStackSize = client.getStringStackSize();
if ("shouldFilterSpell".equals(event.getEventName()))
if ("startSpellRedraw".equals(event.getEventName()))
{
spellbook = Spellbook.getByID(client.getVar(Varbits.SPELLBOOK));
loadSpells();
}
else if ("shouldFilterSpell".equals(event.getEventName()))
{
String spell = sStack[sStackSize - 1].toLowerCase();
int widget = iStack[iStackSize - 1];
spellbook = Spellbook.getByID(client.getVar(Varbits.SPELLBOOK));
loadSpells();
// Add the spell to spells
if (!spells.containsKey(widget))
{
@@ -341,13 +343,16 @@ public class SpellbookPlugin extends Plugin
{
return;
}
spells.clear();
String cfg = configManager.getConfiguration("spellbook", spellbook.getConfigKey());
if (Strings.isNullOrEmpty(cfg))
{
return;
}
// CHECKSTYLE:OFF
Collection<Spell> gson = GSON.fromJson(cfg, new TypeToken<List<Spell>>(){}.getType());
// CHECKSTYLE:ON

File diff suppressed because it is too large Load Diff