Repository: runelite/runelite
Pull request #18570 (2024-11-28 16:54:29)

Update woodcutting leprechaun event to use new notification system
I wanted to customize this event's notification, but I couldn't without the change in this PR. 😄


Patch:
diff --git a/runelite-api/src/main/java/net/runelite/api/AnimationID.java b/runelite-api/src/main/java/net/runelite/api/AnimationID.java
index 8091a1ea1..4d71df539 100644
--- a/runelite-api/src/main/java/net/runelite/api/AnimationID.java
+++ b/runelite-api/src/main/java/net/runelite/api/AnimationID.java
@@ -105,11 +105,9 @@ public final class AnimationID
 	public static final int COOKING_WINE = 7529;
 	public static final int FLETCHING_BOW_CUTTING = 1248;
 	public static final int HUNTER_LAY_BOXTRAP_BIRDSNARE = 5208; //same for laying bird snares and box traps
-	public static final int HUNTER_LAY_DEADFALLTRAP = 5212; //setting up deadfall trap
 	public static final int HUNTER_LAY_NETTRAP = 5215; //setting up net trap
 	public static final int HUNTER_LAY_MANIACAL_MONKEY_BOULDER_TRAP = 7259; // setting up maniacal monkey boulder trap
 	public static final int HUNTER_CHECK_BIRD_SNARE = 5207;
-	public static final int HUNTER_CHECK_BOX_TRAP = 5212;
 	public static final int HERBLORE_MAKE_TAR = 5249;
 	public static final int FLETCHING_STRING_NORMAL_SHORTBOW = 6678;
 	public static final int FLETCHING_STRING_NORMAL_LONGBOW = 6684;
@@ -149,7 +147,7 @@ public final class AnimationID
 	public static final int CRAFTING_LOOM = 2270;
 	public static final int CRAFTING_CRUSH_BLESSED_BONES = 11099;
 	public static final int SMITHING_SMELTING = 899;
-	public static final int SMITHING_CANNONBALL = 827; //cball smithing uses this and SMITHING_SMELTING
+	public static final int SMITHING_CANNONBALL = 827; // same as BURYING_BONES
 	public static final int SMITHING_ANVIL = 898;
 	public static final int SMITHING_IMCANDO_HAMMER = 8911;
 	public static final int FISHING_BIG_NET = 620;
@@ -255,8 +253,6 @@ public final class AnimationID
 	public static final int DEMONIC_GORILLA_MAGIC_ATTACK = 7225;
 	public static final int DEMONIC_GORILLA_MELEE_ATTACK = 7226;
 	public static final int DEMONIC_GORILLA_RANGED_ATTACK = 7227;
-	public static final int DEMONIC_GORILLA_AOE_ATTACK = 7228;
-	public static final int DEMONIC_GORILLA_PRAYER_SWITCH = 7228;
 	public static final int DEMONIC_GORILLA_DEFEND = 7224;
 	public static final int BOOK_HOME_TELEPORT_1 = 4847;
 	public static final int BOOK_HOME_TELEPORT_2 = 4850;
@@ -321,13 +317,12 @@ public final class AnimationID
 	public static final int FARMING_PLANT_SEED = 2291;
 	public static final int FARMING_HARVEST_FLOWER = 2292;
 	public static final int FARMING_MIX_ULTRACOMPOST = 7699;
-	public static final int FARMING_HARVEST_ALLOTMENT = 830;
+	public static final int FARMING_HARVEST_ALLOTMENT = 830; // same as DIG
 
 	// Lunar spellbook
 	public static final int ENERGY_TRANSFER_VENGEANCE_OTHER = 4411;
 	public static final int MAGIC_LUNAR_SHARED = 4413; // Utilized by Fertile Soil, Boost/Stat Potion Share, NPC Contact, Bake Pie
 	public static final int MAGIC_LUNAR_CURE_PLANT = 4432;
-	public static final int MAGIC_LUNAR_GEOMANCY = 7118;
 	public static final int MAGIC_LUNAR_PLANK_MAKE = 6298;
 	public static final int MAGIC_LUNAR_STRING_JEWELRY = 4412;
 
diff --git a/runelite-api/src/main/java/net/runelite/api/SpriteID.java b/runelite-api/src/main/java/net/runelite/api/SpriteID.java
index 1e1b4cfc4..a5c7146aa 100644
--- a/runelite-api/src/main/java/net/runelite/api/SpriteID.java
+++ b/runelite-api/src/main/java/net/runelite/api/SpriteID.java
@@ -773,7 +773,6 @@ public final class SpriteID
 	public static final int TAB_QUESTS = 776;
 	public static final int RS2_TAB_INVENTORY = 777;
 	public static final int RS2_TAB_EQUIPMENT = 778;
-	public static final int RS2_TAB_PRAYER = 779;
 	public static final int TAB_PRAYER = 779;
 	public static final int TAB_MAGIC = 780;
 	public static final int RS2_TAB_FRIENDS_CHAT = 781;
diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/twitch/TwitchConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/twitch/TwitchConfig.java
index 8e4bce352..75e455326 100644
--- a/runelite-client/src/main/java/net/runelite/client/plugins/twitch/TwitchConfig.java
+++ b/runelite-client/src/main/java/net/runelite/client/plugins/twitch/TwitchConfig.java
@@ -42,7 +42,7 @@ public interface TwitchConfig extends Config
 	@ConfigItem(
 		keyName = "oauth",
 		name = "OAuth token",
-		description = "Enter your OAuth token here. This can be found at http://www.twitchapps.com/tmi/",
+		description = "Enter your OAuth token here.",
 		secret = true,
 		position = 1
 	)
diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/WoodcuttingConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/WoodcuttingConfig.java
index baebd1576..3ce3f6eb0 100644
--- a/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/WoodcuttingConfig.java
+++ b/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/WoodcuttingConfig.java
@@ -116,9 +116,9 @@ public interface WoodcuttingConfig extends Config
 		description = "Configures whether to notify you of a Leprechaun event",
 		section = forestrySection
 	)
-	default boolean forestryLeprechaunNotification()
+	default Notification forestryLeprechaunNotification()
 	{
-		return true;
+		return Notification.ON;
 	}
 
 	@ConfigItem(
diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/WoodcuttingPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/WoodcuttingPlugin.java
index c1371b50e..8b031537c 100644
--- a/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/WoodcuttingPlugin.java
+++ b/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/WoodcuttingPlugin.java
@@ -645,9 +645,9 @@ public class WoodcuttingPlugin extends Plugin
 
 			flowers.add(npc);
 		}
-		else if (id == NpcID.WOODCUTTING_LEPRECHAUN && config.forestryLeprechaunNotification())
+		else if (id == NpcID.WOODCUTTING_LEPRECHAUN)
 		{
-			notifier.notify("A Leprechaun event spawned!");
+			notifier.notify(config.forestryLeprechaunNotification(), "A Leprechaun event spawned!");
 		}
 		else if ((id == NpcID.FRIGHTENED_FOX || id == NpcID.FRIGHTENED_FOX_12560))
 		{


Test patch:
diff --git a/runelite-api/src/test/java/net/runelite/api/DistinctIdTest.java b/runelite-api/src/test/java/net/runelite/api/DistinctIdTest.java
new file mode 100644
index 000000000..9274228b3
--- /dev/null
+++ b/runelite-api/src/test/java/net/runelite/api/DistinctIdTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2024, Adam <Adam@sigterm.info>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ *    list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package net.runelite.api;
+
+import java.lang.reflect.Field;
+import java.util.HashSet;
+import java.util.Set;
+import lombok.SneakyThrows;
+import net.runelite.api.clan.ClanID;
+import static org.junit.Assert.fail;
+import org.junit.Test;
+
+public class DistinctIdTest
+{
+	@Test
+	public void testUnique()
+	{
+		duplicateCheck(
+			// disabled as a few plugins rely on the dups
+			//AnimationID.class,
+			ClanID.class,
+			EnumID.class,
+			FontID.class,
+			GraphicID.class,
+			HitsplatID.class,
+			KeyCode.class,
+			ParamID.class,
+			ScriptID.class,
+			SettingID.class,
+			SkullIcon.class,
+			SoundEffectID.class,
+			SpriteID.class,
+			StructID.class,
+			VarClientInt.class,
+			VarClientStr.class,
+			VarPlayer.class,
+			Varbits.class
+		);
+	}
+
+	@SneakyThrows
+	private void duplicateCheck(Class<?>... classes)
+	{
+		for (Class<?> clazz : classes)
+		{
+			Set<Integer> seen = new HashSet<>();
+			for (Field f : clazz.getDeclaredFields())
+			{
+				if (!seen.add(f.getInt(null)))
+				{
+					fail("field with duplicate value: " + clazz.getSimpleName() + "." + f.getName());
+				}
+			}
+		}
+	}
+}
\ No newline at end of file