nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: pajlads/DinkPlugin
Pull request #239 (2023-05-20 05:19:21)

fix: avoid combat level notifications with notifier disabled
If level notifier was disabled (but levelNotifyCombat was enabled), combat level increases could still trigger a notification



Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5bc2373..0615d45 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,7 @@
 - Minor: Track points progress towards next combat achievement tier rewards unlock. (#236)
 - Minor: Add combat achievement points as rich embed field. (#235)
 - Minor: Use item image as rich embed thumbnail for loot notifications. (#234)
+- Bugfix: Prevent combat level notifications when the notifier is disabled. (#239)
 - Dev: Redefine account type enum to workaround upstream deprecation. (#238)
 
 ## 1.5.0
diff --git a/src/main/java/dinkplugin/notifiers/LevelNotifier.java b/src/main/java/dinkplugin/notifiers/LevelNotifier.java
index ee96cb6..f582dfe 100644
--- a/src/main/java/dinkplugin/notifiers/LevelNotifier.java
+++ b/src/main/java/dinkplugin/notifiers/LevelNotifier.java
@@ -109,7 +109,7 @@ public class LevelNotifier extends BaseNotifier {
         if (COMBAT_COMPONENTS.contains(skill)) {
             int combatLevel = calculateCombatLevel();
             Integer previousCombatLevel = currentLevels.put(COMBAT_NAME, combatLevel);
-            checkLevelUp(config.levelNotifyCombat(), COMBAT_NAME, previousCombatLevel, combatLevel);
+            checkLevelUp(config.notifyLevel() && config.levelNotifyCombat(), COMBAT_NAME, previousCombatLevel, combatLevel);
         }
     }
 


Test patch:
diff --git a/src/test/java/dinkplugin/notifiers/LevelNotifierTest.java b/src/test/java/dinkplugin/notifiers/LevelNotifierTest.java
index 62c5711..257efa6 100644
--- a/src/test/java/dinkplugin/notifiers/LevelNotifierTest.java
+++ b/src/test/java/dinkplugin/notifiers/LevelNotifierTest.java
@@ -207,6 +207,27 @@ class LevelNotifierTest extends MockedNotifierTest {
         );
     }
 
+    @Test
+    void testNotifyCombatDisabledLevelNotifier() {
+        // The combat level notification shouldn't fire when notifyLevel is disabled
+
+        // update config mocks
+        when(config.notifyLevel()).thenReturn(false);
+        when(config.levelInterval())
+            .thenReturn(
+                18); // won't trigger on hp @ 13, will trigger on combat level @ 36
+
+        // fire skill event
+        when(client.getRealSkillLevel(Skill.HITPOINTS)).thenReturn(13);
+        plugin.onStatChanged(new StatChanged(Skill.HITPOINTS, 2000, 13, 13));
+
+        // let ticks pass
+        IntStream.range(0, 4).forEach(i -> notifier.onTick());
+
+        // ensure no notification occurred
+        verify(messageHandler, never()).createMessage(any(), anyBoolean(), any());
+    }
+
     @Test
     void testIgnoreInterval() {
         // fire skill event
Repository: pajlads/DinkPlugin
Pull request #382 (2023-11-30 15:43:58)

fix: respect min difficulty config for diary notifier
Closes #381 

Couple of extra notes:
- The provided gradle wrapper doesn't build for me unless I change `rootProject.name = "DinkPlugin"` i.e. camel case, I've not included that as apart of the PR as it's not relevant but just wondering if this is a "me" issue.
- Although just semantics, `checkDifficulty` maybe not the best name for this method - perhaps `passesDifficulty` or similar maybe better... Not important for now though 🙂 


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 48464c3..1bab629 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,6 @@
 ## Unreleased
 
+- Bugfix: Ensure diary notifications below the configured minimum difficulty are not sent. (#382)
 - Bugfix: Update set of items that are never kept on dangerous deaths. (#364)
 - Bugfix: Don't report inaccurate completed collections count, when character summary tab was not selected. (#374)
 - Bugfix: Avoid undercounting diary completions for notifications that occur shortly after a teleport. (#373)
diff --git a/src/main/java/dinkplugin/notifiers/DiaryNotifier.java b/src/main/java/dinkplugin/notifiers/DiaryNotifier.java
index 55e6fd6..a15c001 100644
--- a/src/main/java/dinkplugin/notifiers/DiaryNotifier.java
+++ b/src/main/java/dinkplugin/notifiers/DiaryNotifier.java
@@ -119,6 +119,8 @@ public class DiaryNotifier extends BaseNotifier {
                 } else {
                     diaryCompletionById.put(varbitId, 2);
                 }
+                if (!checkDifficulty(difficulty)) return;
+
                 clientThread.invokeLater(() -> handle(diary)); // 20ms delay to run scripts cleanly
             } else {
                 log.warn("Failed to match diary area: {}", area);


Test patch:
diff --git a/src/test/java/dinkplugin/notifiers/DiaryNotifierTest.java b/src/test/java/dinkplugin/notifiers/DiaryNotifierTest.java
index 96e9388..bede6fb 100644
--- a/src/test/java/dinkplugin/notifiers/DiaryNotifierTest.java
+++ b/src/test/java/dinkplugin/notifiers/DiaryNotifierTest.java
@@ -143,6 +143,21 @@ class DiaryNotifierTest extends MockedNotifierTest {
         );
     }
 
+    @Test
+    void testDontNotifyKaramjaMessageBox() {
+        // initially many diary completions
+        when(client.getVarbitValue(anyInt())).thenReturn(1);
+
+        // perform enough ticks to trigger diary initialization
+        IntStream.range(0, 16).forEach(i -> notifier.onTick());
+
+        // trigger diary completion
+        notifier.onMessageBox("Congratulations! You have completed all of the easy tasks in the Karamja area. Speak to Pirate Jackie the Fruit to claim your reward.");
+
+        // verify no notification message
+        verify(messageHandler, never()).createMessage(any(), anyBoolean(), any());
+    }
+
     @Test
     void testNotifyWesternMessageBox() {
         // initially many diary completions