diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/CompostTracker.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/CompostTracker.java index b5066658f6..b590599f81 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/CompostTracker.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/CompostTracker.java @@ -76,7 +76,7 @@ public class CompostTracker private static final Pattern COMPOST_USED_ON_PATCH = Pattern.compile( "You treat the .+ with (?ultra|super|)compost\\."); private static final Pattern FERTILE_SOIL_CAST = Pattern.compile( - "The .+ has been treated with (?ultra|super|)compost\\."); + "^The .+ has been treated with (?ultra|super|)compost"); private static final Pattern ALREADY_TREATED = Pattern.compile( "This .+ has already been (treated|fertilised) with (?ultra|super|)compost(?: - the spell can't make it any more fertile)?\\."); private static final Pattern INSPECT_PATCH = Pattern.compile( @@ -271,7 +271,7 @@ public class CompostTracker Matcher matcher; if ((matcher = COMPOST_USED_ON_PATCH.matcher(chatMessage)).matches() || - (matcher = FERTILE_SOIL_CAST.matcher(chatMessage)).matches() || + (matcher = FERTILE_SOIL_CAST.matcher(chatMessage)).find() || (matcher = ALREADY_TREATED.matcher(chatMessage)).matches() || (matcher = INSPECT_PATCH.matcher(chatMessage)).matches()) { diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/timetracking/farming/CompostTrackerTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/timetracking/farming/CompostTrackerTest.java index 42dba61b5d..2d96d2e757 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/timetracking/farming/CompostTrackerTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/timetracking/farming/CompostTrackerTest.java @@ -320,4 +320,16 @@ public class CompostTrackerTest verify(configManager).setRSProfileConfiguration("timetracking", "MOCK.compost", CompostState.SUPERCOMPOST); } + @Test + public void onChatMessage_volcanicAsh() + { + ChatMessage chatEvent = mock(ChatMessage.class); + when(chatEvent.getType()).thenReturn(ChatMessageType.SPAM); + when(chatEvent.getMessage()).thenReturn("The fruit tree patch has been treated with ultracompost consuming 2 of your volcanic ash."); + + compostTracker.pendingCompostActions.put(farmingPatch, new CompostTracker.PendingCompost(Instant.MAX, worldPoint, farmingPatch)); + compostTracker.onChatMessage(chatEvent); + + verify(configManager).setRSProfileConfiguration("timetracking", "MOCK.compost", CompostState.ULTRACOMPOST); + } }