diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java
index 34fd1de61a..71d3b67e95 100644
--- a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java
+++ b/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java
@@ -104,12 +104,12 @@ public class TimersPlugin extends Plugin
private static final String STAMINA_EXPIRED_MESSAGE = "
Your stamina potion has expired.";
private static final String SUPER_ANTIFIRE_DRINK_MESSAGE = "You drink some of your super antifire potion";
private static final String SUPER_ANTIFIRE_EXPIRED_MESSAGE = "Your super antifire potion has expired.";
- private static final String KILLED_TELEBLOCK_OPPONENT_TEXT = "Your Tele Block has been removed because you killed ";
+ private static final String KILLED_TELEBLOCK_OPPONENT_TEXT = "Your Tele Block has been removed because you killed ";
private static final String PRAYER_ENHANCE_EXPIRED = "Your prayer enhance effect has worn off.";
- private static final Pattern DEADMAN_HALF_TELEBLOCK_PATTERN = Pattern.compile("A Tele Block spell has been cast on you by (.+)\\. It will expire in 1 minute, 15 seconds\\.");
- private static final Pattern FULL_TELEBLOCK_PATTERN = Pattern.compile("A Tele Block spell has been cast on you by (.+)\\. It will expire in 5 minutes\\.");
- private static final Pattern HALF_TELEBLOCK_PATTERN = Pattern.compile("A Tele Block spell has been cast on you by (.+)\\. It will expire in 2 minutes, 30 seconds\\.");
+ private static final Pattern DEADMAN_HALF_TELEBLOCK_PATTERN = Pattern.compile("A Tele Block spell has been cast on you by (.+)\\. It will expire in 1 minute, 15 seconds\\.");
+ private static final Pattern FULL_TELEBLOCK_PATTERN = Pattern.compile("A Tele Block spell has been cast on you by (.+)\\. It will expire in 5 minutes\\.");
+ private static final Pattern HALF_TELEBLOCK_PATTERN = Pattern.compile("A Tele Block spell has been cast on you by (.+)\\. It will expire in 2 minutes, 30 seconds\\.");
private static final Pattern DIVINE_POTION_PATTERN = Pattern.compile("You drink some of your divine (.+) potion\\.");
private static final int VENOM_VALUE_CUTOFF = -40; // Antivenom < -40 <= Antipoison < 0
private static final int POISON_TICK_LENGTH = 30;
@@ -528,7 +528,7 @@ public class TimersPlugin extends Plugin
{
createGameTimer(DMM_HALFTB);
}
- else if (event.getMessage().startsWith(KILLED_TELEBLOCK_OPPONENT_TEXT))
+ else if (event.getMessage().contains(KILLED_TELEBLOCK_OPPONENT_TEXT))
{
removeTbTimers();
}
diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/timers/TimersPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/timers/TimersPluginTest.java
index 3531a82c29..ea51b20747 100644
--- a/runelite-client/src/test/java/net/runelite/client/plugins/timers/TimersPluginTest.java
+++ b/runelite-client/src/test/java/net/runelite/client/plugins/timers/TimersPluginTest.java
@@ -42,7 +42,9 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
+import static org.mockito.ArgumentMatchers.any;
import org.mockito.Mock;
+import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import org.mockito.junit.MockitoJUnitRunner;
@@ -53,6 +55,8 @@ public class TimersPluginTest
private static final String DMM_HALF_TELEBLOCK_MESSAGE = "A Tele Block spell has been cast on you by Runelite. It will expire in 1 minute, 15 seconds.";
private static final String FULL_TELEBLOCK_MESSAGE = "A Tele Block spell has been cast on you by Runelite. It will expire in 5 minutes.";
private static final String HALF_TELEBLOCK_MESSAGE = "A Tele Block spell has been cast on you by Runelite. It will expire in 2 minutes, 30 seconds.";
+ private static final String TRANSPARENT_CHATBOX_FULL_TELEBLOCK_MESSAGE = "A Tele Block spell has been cast on you by Alexsuperfly. It will expire in 5 minutes.";
+ private static final String TRANSPARENT_CHATBOX_TELEBLOCK_REMOVED_MESSAGE = "Your Tele Block has been removed because you killed Alexsuperfly.";
@Inject
private TimersPlugin timersPlugin;
@@ -162,4 +166,27 @@ public class TimersPluginTest
TimerTimer infoBox = (TimerTimer) captor.getValue();
assertEquals(GameTimer.DIVINE_BATTLEMAGE, infoBox.getTimer());
}
+
+ @Test
+ public void testTransparentChatboxTb()
+ {
+ when(timersConfig.showTeleblock()).thenReturn(true);
+ ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", TRANSPARENT_CHATBOX_FULL_TELEBLOCK_MESSAGE, "", 0);
+ timersPlugin.onChatMessage(chatMessage);
+
+ ArgumentCaptor captor = ArgumentCaptor.forClass(InfoBox.class);
+ verify(infoBoxManager).addInfoBox(captor.capture());
+ TimerTimer infoBox = (TimerTimer) captor.getValue();
+ assertEquals(GameTimer.FULLTB, infoBox.getTimer());
+ }
+
+ @Test
+ public void testTransparentChatboxTbRemoved()
+ {
+ when(timersConfig.showTeleblock()).thenReturn(true);
+ ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", TRANSPARENT_CHATBOX_TELEBLOCK_REMOVED_MESSAGE, "", 0);
+ timersPlugin.onChatMessage(chatMessage);
+
+ verify(infoBoxManager, atLeastOnce()).removeIf(any());
+ }
}
\ No newline at end of file