From 3a7a442f9319554ddd62896c89f28a7cb52f2251 Mon Sep 17 00:00:00 2001 From: AhDoozy <90292189+AhDoozy@users.noreply.github.com> Date: Wed, 10 Sep 2025 11:57:53 -0400 Subject: [PATCH 1/6] feat: allow custom pet lines --- README.md | 1 + .../java/com/pettheanimals/PetResponses.java | 20 ++++++++++++++++++- .../pettheanimals/PetTheAnimalsConfig.java | 11 ++++++++++ .../pettheanimals/PetTheAnimalsPlugin.java | 2 +- .../com/pettheanimals/PetResponsesTest.java | 17 ++++++++++++++++ 5 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 src/test/java/com/pettheanimals/PetResponsesTest.java diff --git a/README.md b/README.md index f76209d..30623b4 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ The plugin exposes several options in the RuneLite configuration panel: | Enable Overhead Text | Show message over your player. | | Max Distance | Maximum number of tiles you can be from the NPC (default 2). | | Additional NPCs | Extra comma-separated NPC names that are allowed to be petted. | +| Custom Pet Lines | Comma-separated messages that replace the built-in flavour text. | ## Building This is a standard RuneLite plugin and can be built with `./gradlew build`. diff --git a/src/main/java/com/pettheanimals/PetResponses.java b/src/main/java/com/pettheanimals/PetResponses.java index 0dfd75e..dbc9976 100644 --- a/src/main/java/com/pettheanimals/PetResponses.java +++ b/src/main/java/com/pettheanimals/PetResponses.java @@ -118,10 +118,28 @@ public final class PetResponses private PetResponses() { } - public static String buildLine(String npcName) + public static String buildLine(String npcName, String customLines) { final String name = npcName == null ? "creature" : npcName; final String key = name.toLowerCase(Locale.ROOT); + + if (customLines != null && !customLines.trim().isEmpty()) + { + java.util.List userLines = new java.util.ArrayList<>(); + for (String line : customLines.split("[\\n,]")) + { + String trimmed = line.trim(); + if (!trimmed.isEmpty()) + { + userLines.add(trimmed); + } + } + if (!userLines.isEmpty()) + { + return userLines.get(new java.util.Random().nextInt(userLines.size())); + } + } + for (Map.Entry> e : RESPONSES.entrySet()) { if (key.contains(e.getKey())) diff --git a/src/main/java/com/pettheanimals/PetTheAnimalsConfig.java b/src/main/java/com/pettheanimals/PetTheAnimalsConfig.java index 55ffedf..63e4419 100644 --- a/src/main/java/com/pettheanimals/PetTheAnimalsConfig.java +++ b/src/main/java/com/pettheanimals/PetTheAnimalsConfig.java @@ -46,4 +46,15 @@ default String additionalNpcNames() { return ""; } + + @ConfigItem( + keyName = "customPetLines", + name = "Custom Pet Lines", + description = "Comma-separated messages used when petting. Overrides built-in lines.", + position = 99 + ) + default String customPetLines() + { + return ""; + } } diff --git a/src/main/java/com/pettheanimals/PetTheAnimalsPlugin.java b/src/main/java/com/pettheanimals/PetTheAnimalsPlugin.java index 55d5436..24206f4 100644 --- a/src/main/java/com/pettheanimals/PetTheAnimalsPlugin.java +++ b/src/main/java/com/pettheanimals/PetTheAnimalsPlugin.java @@ -452,7 +452,7 @@ public void onMenuOptionClicked(MenuOptionClicked event) } } - final String line = PetResponses.buildLine(rawName); + final String line = PetResponses.buildLine(rawName, config.customPetLines()); // Show overhead text and optional chat message if (config.enableOverheadText() && client.getLocalPlayer() != null) diff --git a/src/test/java/com/pettheanimals/PetResponsesTest.java b/src/test/java/com/pettheanimals/PetResponsesTest.java new file mode 100644 index 0000000..05e692b --- /dev/null +++ b/src/test/java/com/pettheanimals/PetResponsesTest.java @@ -0,0 +1,17 @@ +package com.pettheanimals; + +import org.junit.Test; + +import static org.junit.Assert.*; + +public class PetResponsesTest +{ + @Test + public void testCustomLineOverridesDefault() + { + String custom = "Custom line"; + String result = PetResponses.buildLine("dog", custom); + assertEquals("Custom line", result); + } +} + From c517a2eb2a18110c2fc557ba9a54e3ebd6267366 Mon Sep 17 00:00:00 2001 From: AhDoozy <90292189+AhDoozy@users.noreply.github.com> Date: Wed, 10 Sep 2025 13:31:57 -0400 Subject: [PATCH 2/6] feat: configure pet lines individually --- README.md | 4 +- .../java/com/pettheanimals/PetResponses.java | 18 +- .../pettheanimals/PetTheAnimalsConfig.java | 159 ++++++++++++------ .../pettheanimals/PetTheAnimalsPlugin.java | 42 ++--- .../com/pettheanimals/PetResponsesTest.java | 2 +- 5 files changed, 138 insertions(+), 87 deletions(-) diff --git a/README.md b/README.md index 30623b4..e124b27 100644 --- a/README.md +++ b/README.md @@ -16,10 +16,10 @@ The plugin exposes several options in the RuneLite configuration panel: | Option | Description | | --- | --- | | Enable Chat Message | Send pet message to chatbox. | -| Enable Overhead Text | Show message over your player. | +| Enable Overhead Text | Show message over the pet. | | Max Distance | Maximum number of tiles you can be from the NPC (default 2). | | Additional NPCs | Extra comma-separated NPC names that are allowed to be petted. | -| Custom Pet Lines | Comma-separated messages that replace the built-in flavour text. | +| Custom Pet Lines | Up to five messages that replace the built-in flavour text (found under a collapsible section). | ## Building This is a standard RuneLite plugin and can be built with `./gradlew build`. diff --git a/src/main/java/com/pettheanimals/PetResponses.java b/src/main/java/com/pettheanimals/PetResponses.java index dbc9976..0f26d7d 100644 --- a/src/main/java/com/pettheanimals/PetResponses.java +++ b/src/main/java/com/pettheanimals/PetResponses.java @@ -118,26 +118,14 @@ public final class PetResponses private PetResponses() { } - public static String buildLine(String npcName, String customLines) + public static String buildLine(String npcName, java.util.List customLines) { final String name = npcName == null ? "creature" : npcName; final String key = name.toLowerCase(Locale.ROOT); - if (customLines != null && !customLines.trim().isEmpty()) + if (customLines != null && !customLines.isEmpty()) { - java.util.List userLines = new java.util.ArrayList<>(); - for (String line : customLines.split("[\\n,]")) - { - String trimmed = line.trim(); - if (!trimmed.isEmpty()) - { - userLines.add(trimmed); - } - } - if (!userLines.isEmpty()) - { - return userLines.get(new java.util.Random().nextInt(userLines.size())); - } + return customLines.get(new java.util.Random().nextInt(customLines.size())); } for (Map.Entry> e : RESPONSES.entrySet()) diff --git a/src/main/java/com/pettheanimals/PetTheAnimalsConfig.java b/src/main/java/com/pettheanimals/PetTheAnimalsConfig.java index 63e4419..023b837 100644 --- a/src/main/java/com/pettheanimals/PetTheAnimalsConfig.java +++ b/src/main/java/com/pettheanimals/PetTheAnimalsConfig.java @@ -3,58 +3,117 @@ import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; +import net.runelite.client.config.ConfigSection; @ConfigGroup("pettheanimals") public interface PetTheAnimalsConfig extends Config { - @ConfigItem( - keyName = "enableChatMessage", - name = "Enable Chat Message", - description = "Also send the pet message to the chatbox." - ) - default boolean enableChatMessage() - { - return true; - } - - @ConfigItem( - keyName = "enableOverheadText", - name = "Enable Overhead Text", - description = "Show the pet message above your player." - ) - default boolean enableOverheadText() - { - return true; - } - - @ConfigItem( - keyName = "petDistance", - name = "Max Distance", - description = "Maximum tiles away you can be to pet an NPC." - ) - default int petDistance() - { - return 2; - } - - @ConfigItem( - keyName = "additionalNpcNames", - name = "Additional NPCs", - description = "Comma-separated list of extra NPC names that can be petted." - ) - default String additionalNpcNames() - { - return ""; - } - - @ConfigItem( - keyName = "customPetLines", - name = "Custom Pet Lines", - description = "Comma-separated messages used when petting. Overrides built-in lines.", - position = 99 - ) - default String customPetLines() - { - return ""; - } + @ConfigItem( + keyName = "enableChatMessage", + name = "Enable Chat Message", + description = "Also send the pet message to the chatbox." + ) + default boolean enableChatMessage() + { + return true; + } + + @ConfigItem( + keyName = "enableOverheadText", + name = "Enable Overhead Text", + description = "Show the pet message above the pet." + ) + default boolean enableOverheadText() + { + return true; + } + + @ConfigItem( + keyName = "petDistance", + name = "Max Distance", + description = "Maximum tiles away you can be to pet an NPC." + ) + default int petDistance() + { + return 2; + } + + @ConfigItem( + keyName = "additionalNpcNames", + name = "Additional NPCs", + description = "Comma-separated list of extra NPC names that can be petted." + ) + default String additionalNpcNames() + { + return ""; + } + + @ConfigSection( + name = "Custom Pet Lines", + description = "Messages that replace the built-in flavour text.", + position = 98, + closedByDefault = true + ) + String customLinesSection = "customLinesSection"; + + @ConfigItem( + keyName = "customLine1", + name = "Line 1", + description = "Custom message used when petting.", + section = customLinesSection, + position = 0 + ) + default String customLine1() + { + return ""; + } + + @ConfigItem( + keyName = "customLine2", + name = "Line 2", + description = "Custom message used when petting.", + section = customLinesSection, + position = 1 + ) + default String customLine2() + { + return ""; + } + + @ConfigItem( + keyName = "customLine3", + name = "Line 3", + description = "Custom message used when petting.", + section = customLinesSection, + position = 2 + ) + default String customLine3() + { + return ""; + } + + @ConfigItem( + keyName = "customLine4", + name = "Line 4", + description = "Custom message used when petting.", + section = customLinesSection, + position = 3 + ) + default String customLine4() + { + return ""; + } + + @ConfigItem( + keyName = "customLine5", + name = "Line 5", + description = "Custom message used when petting.", + section = customLinesSection, + position = 4 + ) + default String customLine5() + { + return ""; + } } + diff --git a/src/main/java/com/pettheanimals/PetTheAnimalsPlugin.java b/src/main/java/com/pettheanimals/PetTheAnimalsPlugin.java index 24206f4..a252646 100644 --- a/src/main/java/com/pettheanimals/PetTheAnimalsPlugin.java +++ b/src/main/java/com/pettheanimals/PetTheAnimalsPlugin.java @@ -23,6 +23,8 @@ import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; +import java.util.ArrayList; +import java.util.List; @Slf4j @PluginDescriptor( @@ -435,37 +437,39 @@ public void onMenuOptionClicked(MenuOptionClicked event) return; } + NPC npc = getNpcByIndex(event.getId()); + // Require player to be within 2 tiles of the target NPC - if (client.getLocalPlayer() != null) + if (client.getLocalPlayer() != null && npc != null) { - NPC npc = getNpcByIndex(event.getId()); - if (npc != null) + WorldPoint me = client.getLocalPlayer().getWorldLocation(); + WorldPoint them = npc.getWorldLocation(); + if (!withinTiles(me, them, config.petDistance())) { - WorldPoint me = client.getLocalPlayer().getWorldLocation(); - WorldPoint them = npc.getWorldLocation(); - if (!withinTiles(me, them, config.petDistance())) - { - client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "You need to be closer to do that.", null); - event.consume(); - return; - } + client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "You need to be closer to do that.", null); + event.consume(); + return; } } - final String line = PetResponses.buildLine(rawName, config.customPetLines()); + List customLines = new ArrayList<>(); + if (!config.customLine1().trim().isEmpty()) { customLines.add(config.customLine1().trim()); } + if (!config.customLine2().trim().isEmpty()) { customLines.add(config.customLine2().trim()); } + if (!config.customLine3().trim().isEmpty()) { customLines.add(config.customLine3().trim()); } + if (!config.customLine4().trim().isEmpty()) { customLines.add(config.customLine4().trim()); } + if (!config.customLine5().trim().isEmpty()) { customLines.add(config.customLine5().trim()); } + + final String line = PetResponses.buildLine(rawName, customLines); // Show overhead text and optional chat message - if (config.enableOverheadText() && client.getLocalPlayer() != null) + if (config.enableOverheadText() && npc != null) { - client.getLocalPlayer().setOverheadText(line); + npc.setOverheadText(line); if (clearOverheadTask != null && !clearOverheadTask.isDone()) { clearOverheadTask.cancel(true); } - clearOverheadTask = scheduler.schedule(() -> { - if (client.getLocalPlayer() != null) { - client.getLocalPlayer().setOverheadText(null); - } - }, OVERHEAD_TEXT_DURATION_MS, TimeUnit.MILLISECONDS); + final NPC npcToClear = npc; + clearOverheadTask = scheduler.schedule(() -> npcToClear.setOverheadText(null), OVERHEAD_TEXT_DURATION_MS, TimeUnit.MILLISECONDS); } if (config.enableChatMessage()) diff --git a/src/test/java/com/pettheanimals/PetResponsesTest.java b/src/test/java/com/pettheanimals/PetResponsesTest.java index 05e692b..862ae45 100644 --- a/src/test/java/com/pettheanimals/PetResponsesTest.java +++ b/src/test/java/com/pettheanimals/PetResponsesTest.java @@ -9,7 +9,7 @@ public class PetResponsesTest @Test public void testCustomLineOverridesDefault() { - String custom = "Custom line"; + java.util.List custom = java.util.Collections.singletonList("Custom line"); String result = PetResponses.buildLine("dog", custom); assertEquals("Custom line", result); } From 1d96440e0cbcff6407f95d391d546f12f9678207 Mon Sep 17 00:00:00 2001 From: AhDoozy <90292189+AhDoozy@users.noreply.github.com> Date: Wed, 10 Sep 2025 13:32:02 -0400 Subject: [PATCH 3/6] feat: popup editor for pet lines --- README.md | 2 +- .../java/com/pettheanimals/PetResponses.java | 12 +- .../pettheanimals/PetTheAnimalsConfig.java | 66 +++------- .../pettheanimals/PetTheAnimalsPlugin.java | 119 ++++++++++++++++-- .../net/runelite/client/config/Button.java | 9 ++ .../client/events/ConfigButtonClicked.java | 27 ++++ 6 files changed, 174 insertions(+), 61 deletions(-) create mode 100644 src/main/java/net/runelite/client/config/Button.java create mode 100644 src/main/java/net/runelite/client/events/ConfigButtonClicked.java diff --git a/README.md b/README.md index e124b27..151030a 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ The plugin exposes several options in the RuneLite configuration panel: | Enable Overhead Text | Show message over the pet. | | Max Distance | Maximum number of tiles you can be from the NPC (default 2). | | Additional NPCs | Extra comma-separated NPC names that are allowed to be petted. | -| Custom Pet Lines | Up to five messages that replace the built-in flavour text (found under a collapsible section). | +| Pet Responses | Collapsible section with a summary and a popup editor for per-animal lines. | ## Building This is a standard RuneLite plugin and can be built with `./gradlew build`. diff --git a/src/main/java/com/pettheanimals/PetResponses.java b/src/main/java/com/pettheanimals/PetResponses.java index 0f26d7d..7b791b0 100644 --- a/src/main/java/com/pettheanimals/PetResponses.java +++ b/src/main/java/com/pettheanimals/PetResponses.java @@ -29,7 +29,7 @@ public final class PetResponses "Seagull" )); - private static final Map> RESPONSES; + static final Map> RESPONSES; static { Map> m = new HashMap<>(); @@ -140,4 +140,14 @@ public static String buildLine(String npcName, java.util.List customLine } return "You gently pet the " + name.toLowerCase(Locale.ROOT) + "."; } + + public static java.util.Set getAnimals() + { + return RESPONSES.keySet(); + } + + public static java.util.List getDefaults(String key) + { + return RESPONSES.getOrDefault(key, java.util.Collections.emptyList()); + } } diff --git a/src/main/java/com/pettheanimals/PetTheAnimalsConfig.java b/src/main/java/com/pettheanimals/PetTheAnimalsConfig.java index 023b837..f5365be 100644 --- a/src/main/java/com/pettheanimals/PetTheAnimalsConfig.java +++ b/src/main/java/com/pettheanimals/PetTheAnimalsConfig.java @@ -49,71 +49,35 @@ default String additionalNpcNames() } @ConfigSection( - name = "Custom Pet Lines", - description = "Messages that replace the built-in flavour text.", + name = "Pet Responses", + description = "Customize animal dialogue.", position = 98, closedByDefault = true ) - String customLinesSection = "customLinesSection"; + String petLinesSection = "petLinesSection"; @ConfigItem( - keyName = "customLine1", - name = "Line 1", - description = "Custom message used when petting.", - section = customLinesSection, + keyName = "linesSummary", + name = "Summary", + description = "Overview of customised animals.", + section = petLinesSection, position = 0 ) - default String customLine1() + default String linesSummary() { - return ""; + return "Using defaults"; } @ConfigItem( - keyName = "customLine2", - name = "Line 2", - description = "Custom message used when petting.", - section = customLinesSection, + keyName = "editPetLines", + name = "Edit Responses", + description = "Open a popup to edit pet lines.", + section = petLinesSection, position = 1 ) - default String customLine2() - { - return ""; - } - - @ConfigItem( - keyName = "customLine3", - name = "Line 3", - description = "Custom message used when petting.", - section = customLinesSection, - position = 2 - ) - default String customLine3() - { - return ""; - } - - @ConfigItem( - keyName = "customLine4", - name = "Line 4", - description = "Custom message used when petting.", - section = customLinesSection, - position = 3 - ) - default String customLine4() - { - return ""; - } - - @ConfigItem( - keyName = "customLine5", - name = "Line 5", - description = "Custom message used when petting.", - section = customLinesSection, - position = 4 - ) - default String customLine5() + default net.runelite.client.config.Button editPetLines() { - return ""; + return new net.runelite.client.config.Button(); } } diff --git a/src/main/java/com/pettheanimals/PetTheAnimalsPlugin.java b/src/main/java/com/pettheanimals/PetTheAnimalsPlugin.java index a252646..5c7208b 100644 --- a/src/main/java/com/pettheanimals/PetTheAnimalsPlugin.java +++ b/src/main/java/com/pettheanimals/PetTheAnimalsPlugin.java @@ -13,18 +13,23 @@ import net.runelite.api.events.MenuEntryAdded; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.events.ConfigButtonClicked; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.menus.MenuManager; import net.runelite.client.util.Text; +import javax.swing.*; +import java.awt.BorderLayout; import java.lang.reflect.Method; import java.util.function.Predicate; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; -import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import java.util.Locale; +import java.util.stream.Collectors; @Slf4j @PluginDescriptor( @@ -56,6 +61,7 @@ public class PetTheAnimalsPlugin extends Plugin protected void startUp() throws Exception { registerPetMenu(); + updateSummary(); log.info("Pet the Animals started"); } @@ -452,13 +458,7 @@ public void onMenuOptionClicked(MenuOptionClicked event) } } - List customLines = new ArrayList<>(); - if (!config.customLine1().trim().isEmpty()) { customLines.add(config.customLine1().trim()); } - if (!config.customLine2().trim().isEmpty()) { customLines.add(config.customLine2().trim()); } - if (!config.customLine3().trim().isEmpty()) { customLines.add(config.customLine3().trim()); } - if (!config.customLine4().trim().isEmpty()) { customLines.add(config.customLine4().trim()); } - if (!config.customLine5().trim().isEmpty()) { customLines.add(config.customLine5().trim()); } - + List customLines = getCustomLinesFor(rawName); final String line = PetResponses.buildLine(rawName, customLines); // Show overhead text and optional chat message @@ -486,4 +486,107 @@ PetTheAnimalsConfig provideConfig(ConfigManager configManager) { return configManager.getConfig(PetTheAnimalsConfig.class); } + + @Subscribe + public void onConfigButtonClicked(ConfigButtonClicked event) + { + if (!"pettheanimals".equals(event.getGroup()) || !"editPetLines".equals(event.getKey())) + { + return; + } + + SwingUtilities.invokeLater(this::openEditor); + } + + private void openEditor() + { + JDialog dialog = new JDialog(); + dialog.setTitle("Pet Responses"); + + String[] keys = PetResponses.getAnimals().stream().sorted().toArray(String[]::new); + JComboBox combo = new JComboBox<>(keys); + JTextArea area = new JTextArea(5, 20); + + combo.addActionListener(e -> { + String sel = (String) combo.getSelectedItem(); + String stored = configManager.getConfiguration("pettheanimals", "line." + sel); + if (stored == null || stored.isEmpty()) + { + area.setText(String.join("\n", PetResponses.getDefaults(sel))); + } + else + { + area.setText(stored.replace('|', '\n')); + } + }); + + JButton save = new JButton("Save"); + save.addActionListener(e -> { + String sel = (String) combo.getSelectedItem(); + String text = Arrays.stream(area.getText().split("\n")) + .map(String::trim) + .filter(s -> !s.isEmpty()) + .collect(Collectors.joining("|")); + configManager.setConfiguration("pettheanimals", "line." + sel, text); + updateSummary(); + }); + + JButton close = new JButton("Close"); + close.addActionListener(e -> dialog.dispose()); + + JPanel buttons = new JPanel(); + buttons.add(save); + buttons.add(close); + + JPanel panel = new JPanel(new BorderLayout(5, 5)); + panel.add(combo, BorderLayout.NORTH); + panel.add(new JScrollPane(area), BorderLayout.CENTER); + panel.add(buttons, BorderLayout.SOUTH); + + dialog.getContentPane().add(panel); + combo.setSelectedIndex(0); + dialog.pack(); + dialog.setLocationRelativeTo(null); + dialog.setVisible(true); + } + + private List getCustomLinesFor(String npcName) + { + if (npcName == null) + { + return java.util.Collections.emptyList(); + } + + String key = npcName.toLowerCase(Locale.ROOT); + for (String k : PetResponses.getAnimals()) + { + if (key.contains(k)) + { + String stored = configManager.getConfiguration("pettheanimals", "line." + k); + if (stored != null && !stored.trim().isEmpty()) + { + return Arrays.stream(stored.split("\\|")) + .map(String::trim) + .filter(s -> !s.isEmpty()) + .collect(Collectors.toList()); + } + } + } + return java.util.Collections.emptyList(); + } + + private void updateSummary() + { + int count = 0; + for (String k : PetResponses.getAnimals()) + { + String stored = configManager.getConfiguration("pettheanimals", "line." + k); + if (stored != null && !stored.trim().isEmpty()) + { + count++; + } + } + String summary = count == 0 ? "Using defaults" : count + " customised"; + configManager.setConfiguration("pettheanimals", "linesSummary", summary); + } } diff --git a/src/main/java/net/runelite/client/config/Button.java b/src/main/java/net/runelite/client/config/Button.java new file mode 100644 index 0000000..b2bc9cf --- /dev/null +++ b/src/main/java/net/runelite/client/config/Button.java @@ -0,0 +1,9 @@ +package net.runelite.client.config; + +/** + * Minimal stub of RuneLite's Button config item for compilation in tests. + */ +public class Button +{ +} + diff --git a/src/main/java/net/runelite/client/events/ConfigButtonClicked.java b/src/main/java/net/runelite/client/events/ConfigButtonClicked.java new file mode 100644 index 0000000..6db2dca --- /dev/null +++ b/src/main/java/net/runelite/client/events/ConfigButtonClicked.java @@ -0,0 +1,27 @@ +package net.runelite.client.events; + +/** + * Minimal stub event used for tests. + */ +public class ConfigButtonClicked +{ + private final String group; + private final String key; + + public ConfigButtonClicked(String group, String key) + { + this.group = group; + this.key = key; + } + + public String getGroup() + { + return group; + } + + public String getKey() + { + return key; + } +} + From f632a2cc58b5f7b615cd4e5c4f13e144ee7d7119 Mon Sep 17 00:00:00 2001 From: AhDoozy <90292189+AhDoozy@users.noreply.github.com> Date: Wed, 10 Sep 2025 22:36:24 -0400 Subject: [PATCH 4/6] fix: remove stub runelite classes --- .../pettheanimals/PetTheAnimalsConfig.java | 5 ++-- .../net/runelite/client/config/Button.java | 9 ------- .../client/events/ConfigButtonClicked.java | 27 ------------------- 3 files changed, 3 insertions(+), 38 deletions(-) delete mode 100644 src/main/java/net/runelite/client/config/Button.java delete mode 100644 src/main/java/net/runelite/client/events/ConfigButtonClicked.java diff --git a/src/main/java/com/pettheanimals/PetTheAnimalsConfig.java b/src/main/java/com/pettheanimals/PetTheAnimalsConfig.java index f5365be..2f64480 100644 --- a/src/main/java/com/pettheanimals/PetTheAnimalsConfig.java +++ b/src/main/java/com/pettheanimals/PetTheAnimalsConfig.java @@ -1,5 +1,6 @@ package com.pettheanimals; +import net.runelite.client.config.Button; import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; @@ -75,9 +76,9 @@ default String linesSummary() section = petLinesSection, position = 1 ) - default net.runelite.client.config.Button editPetLines() + default Button editPetLines() { - return new net.runelite.client.config.Button(); + return new Button(); } } diff --git a/src/main/java/net/runelite/client/config/Button.java b/src/main/java/net/runelite/client/config/Button.java deleted file mode 100644 index b2bc9cf..0000000 --- a/src/main/java/net/runelite/client/config/Button.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.runelite.client.config; - -/** - * Minimal stub of RuneLite's Button config item for compilation in tests. - */ -public class Button -{ -} - diff --git a/src/main/java/net/runelite/client/events/ConfigButtonClicked.java b/src/main/java/net/runelite/client/events/ConfigButtonClicked.java deleted file mode 100644 index 6db2dca..0000000 --- a/src/main/java/net/runelite/client/events/ConfigButtonClicked.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.runelite.client.events; - -/** - * Minimal stub event used for tests. - */ -public class ConfigButtonClicked -{ - private final String group; - private final String key; - - public ConfigButtonClicked(String group, String key) - { - this.group = group; - this.key = key; - } - - public String getGroup() - { - return group; - } - - public String getKey() - { - return key; - } -} - From f05706ccc3f54d945a7ad6b9a73109f55fa1d2c4 Mon Sep 17 00:00:00 2001 From: AhDoozy <90292189+AhDoozy@users.noreply.github.com> Date: Wed, 10 Sep 2025 22:40:53 -0400 Subject: [PATCH 5/6] fix: add stubs for config button support --- .../net/runelite/client/config/Button.java | 10 ++++++ .../client/events/ConfigButtonClicked.java | 33 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 src/main/java/net/runelite/client/config/Button.java create mode 100644 src/main/java/net/runelite/client/events/ConfigButtonClicked.java diff --git a/src/main/java/net/runelite/client/config/Button.java b/src/main/java/net/runelite/client/config/Button.java new file mode 100644 index 0000000..362673a --- /dev/null +++ b/src/main/java/net/runelite/client/config/Button.java @@ -0,0 +1,10 @@ +package net.runelite.client.config; + +/** + * Minimal stub of RuneLite's Button config item to allow compilation + * in environments where the real client classes are unavailable. + */ +public class Button +{ + // Placeholder class with no behaviour +} diff --git a/src/main/java/net/runelite/client/events/ConfigButtonClicked.java b/src/main/java/net/runelite/client/events/ConfigButtonClicked.java new file mode 100644 index 0000000..55fc95c --- /dev/null +++ b/src/main/java/net/runelite/client/events/ConfigButtonClicked.java @@ -0,0 +1,33 @@ +package net.runelite.client.events; + +/** + * Minimal stub of RuneLite's ConfigButtonClicked event. + */ +public class ConfigButtonClicked +{ + private final String group; + private final String key; + private final Object config; + + public ConfigButtonClicked(Object config, String group, String key) + { + this.config = config; + this.group = group; + this.key = key; + } + + public Object getConfig() + { + return config; + } + + public String getGroup() + { + return group; + } + + public String getKey() + { + return key; + } +} From 516b43af3cd7dc9e00bd7f9ce96d5677f02bd637 Mon Sep 17 00:00:00 2001 From: AhDoozy <90292189+AhDoozy@users.noreply.github.com> Date: Wed, 10 Sep 2025 22:46:37 -0400 Subject: [PATCH 6/6] chore: remove runelite stubs --- .../net/runelite/client/config/Button.java | 10 ------ .../client/events/ConfigButtonClicked.java | 33 ------------------- 2 files changed, 43 deletions(-) delete mode 100644 src/main/java/net/runelite/client/config/Button.java delete mode 100644 src/main/java/net/runelite/client/events/ConfigButtonClicked.java diff --git a/src/main/java/net/runelite/client/config/Button.java b/src/main/java/net/runelite/client/config/Button.java deleted file mode 100644 index 362673a..0000000 --- a/src/main/java/net/runelite/client/config/Button.java +++ /dev/null @@ -1,10 +0,0 @@ -package net.runelite.client.config; - -/** - * Minimal stub of RuneLite's Button config item to allow compilation - * in environments where the real client classes are unavailable. - */ -public class Button -{ - // Placeholder class with no behaviour -} diff --git a/src/main/java/net/runelite/client/events/ConfigButtonClicked.java b/src/main/java/net/runelite/client/events/ConfigButtonClicked.java deleted file mode 100644 index 55fc95c..0000000 --- a/src/main/java/net/runelite/client/events/ConfigButtonClicked.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.runelite.client.events; - -/** - * Minimal stub of RuneLite's ConfigButtonClicked event. - */ -public class ConfigButtonClicked -{ - private final String group; - private final String key; - private final Object config; - - public ConfigButtonClicked(Object config, String group, String key) - { - this.config = config; - this.group = group; - this.key = key; - } - - public Object getConfig() - { - return config; - } - - public String getGroup() - { - return group; - } - - public String getKey() - { - return key; - } -}