timers plugin: Use constants for checked strings

This commit is contained in:
Jordan Atwood
2018-07-17 10:19:07 -07:00
parent aede77f7e5
commit 39e56151b7

View File

@@ -99,6 +99,31 @@ import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
)
public class TimersPlugin extends Plugin
{
private static final String ANTIFIRE_DRINK_MESSAGE = "You drink some of your antifire potion.";
private static final String ANTIFIRE_EXPIRED_MESSAGE = "<col=7f007f>Your antifire potion has expired.</col>";
private static final String ANTIVENOM_DRINK_MESSAGE = "You drink some of your antivenom potion";
private static final String CANNON_FURNACE_MESSAGE = "You add the furnace.";
private static final String CANNON_PICKUP_MESSAGE = "You pick up the cannon. It's really heavy.";
private static final String CANNON_REPAIR_MESSAGE = "You repair your cannon, restoring it to working order.";
private static final String CHARGE_EXPIRED_MESSAGE = "<col=ef1020>Your magical charge fades away.</col>";
private static final String CHARGE_MESSAGE = "<col=ef1020>You feel charged with magic power.</col>";
private static final String EXTENDED_ANTIFIRE_DRINK_MESSAGE = "You drink some of your extended antifire potion.";
private static final String EXTENDED_SUPER_ANTIFIRE_DRINK_MESSAGE = "You drink some of your extended super antifire potion.";
private static final String FULL_TELEBLOCK_MESSAGE = "<col=4f006f>A teleblock spell has been cast on you. It will expire in 5 minutes, 0 seconds.</col>";
private static final String GOD_WARS_ALTAR_MESSAGE = "you recharge your prayer.";
private static final String HALF_TELEBLOCK_MESSAGE = "<col=4f006f>A teleblock spell has been cast on you. It will expire in 2 minutes, 30 seconds.</col>";
private static final String IMBUED_HEART_READY_MESSAGE = "<col=ef1020>Your imbued heart has regained its magical power.</col>";
private static final String MAGIC_IMBUE_EXPIRED_MESSAGE = "Your Magic Imbue charge has ended.";
private static final String MAGIC_IMBUE_MESSAGE = "You are charged to combine runes!";
private static final String SANFEW_SERUM_DRINK_MESSAGE = "You drink some of your Sanfew Serum.";
private static final String STAFF_OF_THE_DEAD_SPEC_EXPIRED_MESSAGE = "Your protection fades away";
private static final String STAFF_OF_THE_DEAD_SPEC_MESSAGE = "Spirits of deceased evildoers offer you their protection";
private static final String STAMINA_DRINK_MESSAGE = "You drink some of your stamina potion.";
private static final String STAMINA_EXPIRED_MESSAGE = "<col=8f4808>Your stamina potion has expired.</col>";
private static final String SUPER_ANTIFIRE_DRINK_MESSAGE = "You drink some of your super antifire potion";
private static final String SUPER_ANTIFIRE_EXPIRED_MESSAGE = "<col=7f007f>Your super antifire potion has expired.</col>";
private static final String SUPER_ANTIVENOM_DRINK_MESSAGE = "You drink some of your super antivenom potion";
private int lastRaidVarb;
@Inject
@@ -324,37 +349,37 @@ public class TimersPlugin extends Plugin
return;
}
if (config.showStamina() && event.getMessage().equals("You drink some of your stamina potion."))
if (config.showStamina() && event.getMessage().equals(STAMINA_DRINK_MESSAGE))
{
createGameTimer(STAMINA);
}
if (event.getMessage().equals("<col=8f4808>Your stamina potion has expired.</col>"))
if (event.getMessage().equals(STAMINA_EXPIRED_MESSAGE))
{
removeGameTimer(STAMINA);
}
if (config.showAntiFire() && event.getMessage().equals("You drink some of your antifire potion."))
if (config.showAntiFire() && event.getMessage().equals(ANTIFIRE_DRINK_MESSAGE))
{
createGameTimer(ANTIFIRE);
}
if (config.showExAntiFire() && event.getMessage().equals("You drink some of your extended antifire potion."))
if (config.showExAntiFire() && event.getMessage().equals(EXTENDED_ANTIFIRE_DRINK_MESSAGE))
{
createGameTimer(EXANTIFIRE);
}
if (config.showGodWarsAltar() && event.getMessage().equalsIgnoreCase("you recharge your prayer."))//Normal altars are "You recharge your Prayer points." while gwd is "You recharge your Prayer."
if (config.showGodWarsAltar() && event.getMessage().equalsIgnoreCase(GOD_WARS_ALTAR_MESSAGE))//Normal altars are "You recharge your Prayer points." while gwd is "You recharge your Prayer."
{
createGameTimer(GOD_WARS_ALTAR);
}
if (config.showExSuperAntifire() && event.getMessage().equals("You drink some of your extended super antifire potion."))
if (config.showExSuperAntifire() && event.getMessage().equals(EXTENDED_SUPER_ANTIFIRE_DRINK_MESSAGE))
{
createGameTimer(EXSUPERANTIFIRE);
}
if (event.getMessage().equals("<col=7f007f>Your antifire potion has expired.</col>"))
if (event.getMessage().equals(ANTIFIRE_EXPIRED_MESSAGE))
{
//they have the same expired message
removeGameTimer(ANTIFIRE);
@@ -374,62 +399,62 @@ public class TimersPlugin extends Plugin
}
if (config.showCannon() && (event.getMessage().equals("You add the furnace.") || event.getMessage().contains("You repair your cannon, restoring it to working order.")))
if (config.showCannon() && (event.getMessage().equals(CANNON_FURNACE_MESSAGE) || event.getMessage().contains(CANNON_REPAIR_MESSAGE)))
{
createGameTimer(CANNON);
}
if (event.getMessage().equals("You pick up the cannon. It's really heavy."))
if (event.getMessage().equals(CANNON_PICKUP_MESSAGE))
{
removeGameTimer(CANNON);
}
if (config.showAntiVenomPlus() && event.getMessage().contains("You drink some of your super antivenom potion"))
if (config.showAntiVenomPlus() && event.getMessage().contains(SUPER_ANTIVENOM_DRINK_MESSAGE))
{
createGameTimer(ANTIVENOMPLUS);
}
if (config.showMagicImbue() && event.getMessage().equals("You are charged to combine runes!"))
if (config.showMagicImbue() && event.getMessage().equals(MAGIC_IMBUE_MESSAGE))
{
createGameTimer(MAGICIMBUE);
}
if (event.getMessage().equals("Your Magic Imbue charge has ended."))
if (event.getMessage().equals(MAGIC_IMBUE_EXPIRED_MESSAGE))
{
removeGameTimer(MAGICIMBUE);
}
if (config.showTeleblock() && event.getMessage().equals("<col=4f006f>A teleblock spell has been cast on you. It will expire in 5 minutes, 0 seconds.</col>"))
if (config.showTeleblock() && event.getMessage().equals(FULL_TELEBLOCK_MESSAGE))
{
createGameTimer(FULLTB);
}
if (config.showTeleblock() && event.getMessage().equals("<col=4f006f>A teleblock spell has been cast on you. It will expire in 2 minutes, 30 seconds.</col>"))
if (config.showTeleblock() && event.getMessage().equals(HALF_TELEBLOCK_MESSAGE))
{
createGameTimer(HALFTB);
}
if (config.showSuperAntiFire() && event.getMessage().contains("You drink some of your super antifire potion"))
if (config.showSuperAntiFire() && event.getMessage().contains(SUPER_ANTIFIRE_DRINK_MESSAGE))
{
createGameTimer(SUPERANTIFIRE);
}
if (event.getMessage().equals("<col=7f007f>Your super antifire potion has expired.</col>"))
if (event.getMessage().equals(SUPER_ANTIFIRE_EXPIRED_MESSAGE))
{
removeGameTimer(SUPERANTIFIRE);
}
if (event.getMessage().equals("<col=ef1020>Your imbued heart has regained its magical power.</col>"))
if (event.getMessage().equals(IMBUED_HEART_READY_MESSAGE))
{
removeGameTimer(IMBUEDHEART);
}
if (config.showAntiVenom() && event.getMessage().contains("You drink some of your antivenom potion"))
if (config.showAntiVenom() && event.getMessage().contains(ANTIVENOM_DRINK_MESSAGE))
{
createGameTimer(ANTIVENOM);
}
if (config.showSanfew() && event.getMessage().contains("You drink some of your Sanfew Serum."))
if (config.showSanfew() && event.getMessage().contains(SANFEW_SERUM_DRINK_MESSAGE))
{
createGameTimer(SANFEW);
}
@@ -439,22 +464,22 @@ public class TimersPlugin extends Plugin
createGameTimer(PRAYER_ENHANCE);
}
if (config.showCharge() && event.getMessage().equals("<col=ef1020>You feel charged with magic power.</col>"))
if (config.showCharge() && event.getMessage().equals(CHARGE_MESSAGE))
{
createGameTimer(CHARGE);
}
if (config.showCharge() && event.getMessage().equals("<col=ef1020>Your magical charge fades away.</col>"))
if (config.showCharge() && event.getMessage().equals(CHARGE_EXPIRED_MESSAGE))
{
removeGameTimer(CHARGE);
}
if (config.showStaffOfTheDead() && event.getMessage().contains("Spirits of deceased evildoers offer you their protection"))
if (config.showStaffOfTheDead() && event.getMessage().contains(STAFF_OF_THE_DEAD_SPEC_MESSAGE))
{
createGameTimer(STAFF_OF_THE_DEAD);
}
if (config.showStaffOfTheDead() && event.getMessage().contains("Your protection fades away"))
if (config.showStaffOfTheDead() && event.getMessage().contains(STAFF_OF_THE_DEAD_SPEC_EXPIRED_MESSAGE))
{
removeGameTimer(STAFF_OF_THE_DEAD);
}
@@ -618,7 +643,7 @@ public class TimersPlugin extends Plugin
case ItemID.TOXIC_STAFF_OF_THE_DEAD:
case ItemID.STAFF_OF_LIGHT:
case ItemID.TOXIC_STAFF_UNCHARGED:
// don't reset timer if still weilding staff
// don't reset timer if still wielding staff
return;
default:
removeGameTimer(STAFF_OF_THE_DEAD);