diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java index 9f24c06faa..4259d0ee75 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java @@ -303,13 +303,7 @@ public class ChatCommandsPlugin extends Plugin setKc(boss, kc); if (lastPb > -1) { - // lastPb contains the last raid duration and not the personal best, because the raid - // complete message does not include the pb. We have to check if it is a new pb: - int currentPb = getPb(boss); - if (currentPb <= 0 || lastPb < currentPb) - { - setPb(boss, lastPb); - } + setPb(boss, lastPb); lastPb = -1; } lastBossKill = boss; diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java index 72a9855bd7..9df5ff5891 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java @@ -59,14 +59,11 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; -import static org.mockito.ArgumentMatchers.eq; import org.mockito.Mock; import static org.mockito.Mockito.any; -import static org.mockito.Mockito.anyInt; import static org.mockito.Mockito.anyString; import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; @@ -166,7 +163,7 @@ public class ChatCommandsPluginTest } @Test - public void testTheatreOfBloodUnknownPB() + public void testTheatreOfBloodNoPb() { ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Wave 'The Final Challenge' complete! Duration: 5:04
Theatre of Blood wave completion time: 38:17
Personal best: 37:04", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); @@ -178,21 +175,6 @@ public class ChatCommandsPluginTest verify(configManager).setRSProfileConfiguration("personalbest", "theatre of blood", 37 * 60 + 4); } - @Test - public void testTheatreOfBloodNoPB() - { - when(configManager.getRSProfileConfiguration("personalbest", "theatre of blood", int.class)).thenReturn(37 * 60 + 4); // 37:04 - - ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Wave 'The Final Challenge' complete! Duration: 5:04
Theatre of Blood wave completion time: 38:17
Personal best: 37:10", null, 0); - chatCommandsPlugin.onChatMessage(chatMessage); - - ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", "Your completed Theatre of Blood count is: 73.", null, 0); - chatCommandsPlugin.onChatMessage(chatMessageEvent); - - verify(configManager).setRSProfileConfiguration("killcount", "theatre of blood", 73); - verify(configManager, never()).setRSProfileConfiguration(eq("personalbest"), eq("theatre of blood"), anyInt()); - } - @Test public void testWintertodt() { @@ -428,10 +410,8 @@ public class ChatCommandsPluginTest } @Test - public void testCoXKillUnknownPb() + public void testCoXKillNoPb() { - when(configManager.getRSProfileConfiguration("personalbest", "chambers of xeric", int.class)).thenReturn(25 * 60 + 14); - ChatMessage chatMessage = new ChatMessage(null, FRIENDSCHATNOTIFICATION, "", "Congratulations - your raid is complete!
Team size: 11-15 players Duration: 23:25 Personal best: 20:19", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); @@ -442,21 +422,6 @@ public class ChatCommandsPluginTest verify(configManager).setRSProfileConfiguration("personalbest", "chambers of xeric", 20 * 60 + 19); } - @Test - public void testCoXKillNoPb() - { - when(configManager.getRSProfileConfiguration(anyString(), anyString(), any(Class.class))).thenReturn(2224); - - ChatMessage chatMessage = new ChatMessage(null, FRIENDSCHATNOTIFICATION, "", "Congratulations - your raid is complete!
Team size: 3 players Duration: 37:10 (new personal best)", null, 0); - chatCommandsPlugin.onChatMessage(chatMessage); - - chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your completed Chambers of Xeric count is: 52.", null, 0); - chatCommandsPlugin.onChatMessage(chatMessage); - - verify(configManager).setRSProfileConfiguration("killcount", "chambers of xeric", 52); - verify(configManager, never()).setRSProfileConfiguration(eq("personalbest"), eq("chambers of xeric"), anyInt()); - } - @Test public void testAdventureLogCountersPage() {