spec counter: add config option for infoboxes

This commit is contained in:
Adam
2022-06-10 15:47:45 -04:00
parent ceb1c96134
commit 05567739b9
3 changed files with 21 additions and 2 deletions

View File

@@ -66,6 +66,17 @@ public interface SpecialCounterConfig extends Config
return Color.WHITE; return Color.WHITE;
} }
@ConfigItem(
position = 3,
keyName = "infobox",
name = "Infobox",
description = "Adds an infobox counting special attacks"
)
default boolean infobox()
{
return true;
}
@ConfigItem( @ConfigItem(
position = 10, position = 10,
keyName = "dragonWarhammerThreshold", keyName = "dragonWarhammerThreshold",

View File

@@ -293,7 +293,10 @@ public class SpecialCounterPlugin extends Plugin
int hit = getHit(specialWeapon, hitsplat); int hit = getHit(specialWeapon, hitsplat);
int localPlayerId = client.getLocalPlayer().getId(); int localPlayerId = client.getLocalPlayer().getId();
updateCounter(specialWeapon, null, hit); if (config.infobox())
{
updateCounter(specialWeapon, null, hit);
}
if (!party.getMembers().isEmpty()) if (!party.getMembers().isEmpty())
{ {
@@ -359,7 +362,10 @@ public class SpecialCounterPlugin extends Plugin
// Otherwise we only add the count if it is against a npc we are already tracking // Otherwise we only add the count if it is against a npc we are already tracking
if (interactedNpcIds.contains(event.getNpcId())) if (interactedNpcIds.contains(event.getNpcId()))
{ {
updateCounter(event.getWeapon(), name, event.getHit()); if (config.infobox())
{
updateCounter(event.getWeapon(), name, event.getHit());
}
} }
if (event.getWorld() == client.getWorld()) if (event.getWorld() == client.getWorld())

View File

@@ -115,6 +115,8 @@ public class SpecialCounterPluginTest
{ {
Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this);
when(specialCounterConfig.infobox()).thenReturn(true);
// Set up spec weapon // Set up spec weapon
ItemContainer equipment = mock(ItemContainer.class); ItemContainer equipment = mock(ItemContainer.class);
when(equipment.getItem(EquipmentInventorySlot.WEAPON.getSlotIdx())).thenReturn(new Item(ItemID.BANDOS_GODSWORD, 1)); when(equipment.getItem(EquipmentInventorySlot.WEAPON.getSlotIdx())).thenReturn(new Item(ItemID.BANDOS_GODSWORD, 1));