Merge pull request #155 from Lucwousin/harry_potter_shit
load spells only once per rebuild instead of before adding a new spell
This commit is contained in:
@@ -201,14 +201,16 @@ public class SpellbookPlugin extends Plugin
|
|||||||
String[] sStack = client.getStringStack();
|
String[] sStack = client.getStringStack();
|
||||||
int sStackSize = client.getStringStackSize();
|
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();
|
String spell = sStack[sStackSize - 1].toLowerCase();
|
||||||
int widget = iStack[iStackSize - 1];
|
int widget = iStack[iStackSize - 1];
|
||||||
|
|
||||||
spellbook = Spellbook.getByID(client.getVar(Varbits.SPELLBOOK));
|
|
||||||
loadSpells();
|
|
||||||
|
|
||||||
// Add the spell to spells
|
// Add the spell to spells
|
||||||
if (!spells.containsKey(widget))
|
if (!spells.containsKey(widget))
|
||||||
{
|
{
|
||||||
@@ -341,13 +343,16 @@ public class SpellbookPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
spells.clear();
|
spells.clear();
|
||||||
|
|
||||||
String cfg = configManager.getConfiguration("spellbook", spellbook.getConfigKey());
|
String cfg = configManager.getConfiguration("spellbook", spellbook.getConfigKey());
|
||||||
|
|
||||||
if (Strings.isNullOrEmpty(cfg))
|
if (Strings.isNullOrEmpty(cfg))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECKSTYLE:OFF
|
// CHECKSTYLE:OFF
|
||||||
Collection<Spell> gson = GSON.fromJson(cfg, new TypeToken<List<Spell>>(){}.getType());
|
Collection<Spell> gson = GSON.fromJson(cfg, new TypeToken<List<Spell>>(){}.getType());
|
||||||
// CHECKSTYLE:ON
|
// CHECKSTYLE:ON
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
.string_stack_count 2
|
.string_stack_count 2
|
||||||
.int_var_count 30
|
.int_var_count 30
|
||||||
.string_var_count 2
|
.string_var_count 2
|
||||||
|
sconst "startSpellRedraw"
|
||||||
|
runelite_callback
|
||||||
iconst 190
|
iconst 190
|
||||||
istore 11
|
istore 11
|
||||||
iconst 261
|
iconst 261
|
||||||
|
|||||||
Reference in New Issue
Block a user