From a327cc2a420915a24189047f8ef74998f9eb905f Mon Sep 17 00:00:00 2001 From: sdburns1998 <49877861+sdburns1998@users.noreply.github.com> Date: Mon, 20 May 2019 22:13:00 +0200 Subject: [PATCH] Config options (#327) * Fix duplicate options when using groups * Add some examples of the new config options Check style --- .../plugins/aoewarnings/AoeWarningConfig.java | 108 ++++++++++++------ .../client/plugins/config/ConfigPanel.java | 7 +- .../plugins/easyscape/EasyscapeConfig.java | 108 +++++++++++++----- 3 files changed, 160 insertions(+), 63 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningConfig.java index d48e83e13f..ab310ba876 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningConfig.java @@ -29,38 +29,75 @@ package net.runelite.client.plugins.aoewarnings; import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; +import net.runelite.client.config.Stub; @ConfigGroup("aoe") public interface AoeWarningConfig extends Config { + @ConfigItem( + keyName = "overlayStub", + name = "Overlay", + description = "", + position = 1 + ) + default Stub overlayStub() + { + return new Stub(); + } @ConfigItem( keyName = "outline", name = "Display Outline", description = "Configures whether or not AoE Projectile Warnings have an outline", - position = 1 + parent = "overlayStub", + position = 2 ) default boolean isOutlineEnabled() { return true; } + @ConfigItem( + keyName = "delay", + name = "Fade delay", + description = "Configures the amount of time in milliseconds that the warning lingers for after the projectile has touched the ground", + parent = "overlayStub", + position = 3 + ) + default int delay() + { + return 300; + } + @ConfigItem( keyName = "fade", name = "Fade Warnings", description = "Configures whether or not AoE Projectile Warnings fade over time", - position = 2 + parent = "overlayStub", + position = 4 ) default boolean isFadeEnabled() { return true; } + @ConfigItem( + keyName = "npcStub", + name = "NPC's", + description = "", + position = 5 + ) + default Stub npcStub() + { + return new Stub(); + } + @ConfigItem( keyName = "lizardmanaoe", name = "Lizardman Shamans", description = "Configures whether or not AoE Projectile Warnings for Lizardman Shamans is displayed", - position = 3 + parent = "npcStub", + position = 6 ) default boolean isShamansEnabled() { @@ -71,7 +108,8 @@ public interface AoeWarningConfig extends Config keyName = "archaeologistaoe", name = "Crazy Archaeologist", description = "Configures whether or not AoE Projectile Warnings for Archaeologist is displayed", - position = 4 + parent = "npcStub", + position = 7 ) default boolean isArchaeologistEnabled() { @@ -82,7 +120,8 @@ public interface AoeWarningConfig extends Config keyName = "icedemon", name = "Ice Demon", description = "Configures whether or not AoE Projectile Warnings for Ice Demon is displayed", - position = 5 + parent = "npcStub", + position = 8 ) default boolean isIceDemonEnabled() { @@ -93,7 +132,8 @@ public interface AoeWarningConfig extends Config keyName = "vasa", name = "Vasa", description = "Configures whether or not AoE Projectile Warnings for Vasa is displayed", - position = 6 + parent = "npcStub", + position = 9 ) default boolean isVasaEnabled() { @@ -104,7 +144,8 @@ public interface AoeWarningConfig extends Config keyName = "tekton", name = "Tekton", description = "Configures whether or not AoE Projectile Warnings for Tekton is displayed", - position = 7 + parent = "npcStub", + position = 10 ) default boolean isTektonEnabled() { @@ -115,7 +156,8 @@ public interface AoeWarningConfig extends Config keyName = "vorkath", name = "Vorkath", description = "Configures whether or not AoE Projectile Warnings for Vorkath are displayed", - position = 7 + parent = "npcStub", + position = 11 ) default boolean isVorkathEnabled() { @@ -126,7 +168,8 @@ public interface AoeWarningConfig extends Config keyName = "galvek", name = "Galvek", description = "Configures whether or not AoE Projectile Warnings for Galvek are displayed", - position = 8 + parent = "npcStub", + position = 12 ) default boolean isGalvekEnabled() { @@ -137,7 +180,8 @@ public interface AoeWarningConfig extends Config keyName = "gargboss", name = "Gargoyle Boss", description = "Configs whether or not AoE Projectile Warnings for Dawn/Dusk are displayed", - position = 9 + parent = "npcStub", + position = 13 ) default boolean isGargBossEnabled() { @@ -148,7 +192,8 @@ public interface AoeWarningConfig extends Config keyName = "vetion", name = "Vet'ion", description = "Configures whether or not AoE Projectile Warnings for Vet'ion are displayed", - position = 10 + parent = "npcStub", + position = 14 ) default boolean isVetionEnabled() { @@ -159,7 +204,8 @@ public interface AoeWarningConfig extends Config keyName = "chaosfanatic", name = "Chaos Fanatic", description = "Configures whether or not AoE Projectile Warnings for Chaos Fanatic are displayed", - position = 11 + parent = "npcStub", + position = 15 ) default boolean isChaosFanaticEnabled() { @@ -170,7 +216,8 @@ public interface AoeWarningConfig extends Config keyName = "olm", name = "Olm", description = "Configures whether or not AoE Projectile Warnings for The Great Olm are displayed", - position = 12 + parent = "npcStub", + position = 16 ) default boolean isOlmEnabled() { @@ -181,7 +228,8 @@ public interface AoeWarningConfig extends Config keyName = "bombDisplay", name = "Olm Bombs", description = "Display a timer and colour-coded AoE for Olm's crystal-phase bombs.", - position = 13 + parent = "npcStub", + position = 17 ) default boolean bombDisplay() { @@ -192,7 +240,8 @@ public interface AoeWarningConfig extends Config keyName = "corp", name = "Corporeal Beast", description = "Configures whether or not AoE Projectile Warnings for the Corporeal Beast are displayed", - position = 14 + parent = "npcStub", + position = 18 ) default boolean isCorpEnabled() { @@ -203,7 +252,8 @@ public interface AoeWarningConfig extends Config keyName = "wintertodt", name = "Wintertodt Snow Fall", description = "Configures whether or not AOE Projectile Warnings for the Wintertodt snow fall are displayed", - position = 15 + parent = "npcStub", + position = 19 ) default boolean isWintertodtEnabled() { @@ -214,7 +264,8 @@ public interface AoeWarningConfig extends Config keyName = "isXarpusEnabled", name = "Xarpus", description = "Configures whether or not AOE Projectile Warnings for Xarpus are displayed", - position = 16 + parent = "npcStub", + position = 20 ) default boolean isXarpusEnabled() { @@ -225,7 +276,8 @@ public interface AoeWarningConfig extends Config keyName = "lightning", name = "Olm Lightning Trails", description = "Show Lightning Trails", - position = 17 + parent = "npcStub", + position = 21 ) default boolean LightningTrail() { @@ -236,7 +288,8 @@ public interface AoeWarningConfig extends Config keyName = "addyDrags", name = "Addy Drags", description = "Show Bad Areas", - position = 18 + parent = "npcStub", + position = 22 ) default boolean addyDrags() { @@ -246,7 +299,8 @@ public interface AoeWarningConfig extends Config @ConfigItem( keyName = "drake", name = "Drakes Breath", description = "Configures if Drakes Breath tile markers are displayed", - position = 19 + parent = "npcStub", + position = 23 ) default boolean isDrakeEnabled() { @@ -257,21 +311,11 @@ public interface AoeWarningConfig extends Config keyName = "cerbFire", name = "Cerberus Fire", description = "Configures if Cerberus fire tile markers are displayed", - position = 20 + parent = "npcStub", + position = 24 ) default boolean isCerbFireEnabled() { return true; } - - @ConfigItem( - keyName = "delay", - name = "Fade delay", - description = "Configures the amount of time in milliseconds that the warning lingers for after the projectile has touched the ground", - position = 21 - ) - default int delay() - { - return 300; - } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java index b7ee7d790a..ed5c2cbea8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java @@ -421,12 +421,11 @@ public class ConfigPanel extends PluginPanel title.setToolTipText("" + name + ":
" + listItem.getDescription() + ""); topPanel.add(title); - ConfigPanelItem mainParent = new ConfigPanelItem(null, null); - List parents = new ArrayList<>(); - List allItems = new ArrayList<>(); - for (ConfigItemsGroup cig : cd.getItemGroups()) { + ConfigPanelItem mainParent = new ConfigPanelItem(null, null); + List allItems = new ArrayList<>(); + boolean collapsed = false; if (!cig.getGroup().equals("")) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/easyscape/EasyscapeConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/easyscape/EasyscapeConfig.java index 5bf434e88a..415213c765 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/easyscape/EasyscapeConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/easyscape/EasyscapeConfig.java @@ -62,7 +62,9 @@ public interface EasyscapeConfig extends Config name = "Items", description = "", position = 1, - group = "Banking" + group = "Banking", + hidden = true, + unhide = "withdrawOne" ) default String getWithdrawOneItems() { @@ -86,7 +88,9 @@ public interface EasyscapeConfig extends Config name = "Items", description = "", position = 3, - group = "Banking" + group = "Banking", + hidden = true, + unhide = "withdrawFive" ) default String getWithdrawFiveItems() { @@ -110,7 +114,9 @@ public interface EasyscapeConfig extends Config name = "Items", description = "", position = 5, - group = "Banking" + group = "Banking", + hidden = true, + unhide = "withdrawTen" ) default String getWithdrawTenItems() { @@ -134,7 +140,9 @@ public interface EasyscapeConfig extends Config name = "Amount", description = "", position = 7, - group = "Banking" + group = "Banking", + hidden = true, + unhide = "withdrawX" ) default String getWithdrawXAmount() { @@ -146,7 +154,9 @@ public interface EasyscapeConfig extends Config name = "Items", description = "", position = 8, - group = "Banking" + group = "Banking", + hidden = true, + unhide = "withdrawX" ) default String getWithdrawXItems() { @@ -170,7 +180,9 @@ public interface EasyscapeConfig extends Config name = "Items", description = "", position = 10, - group = "Banking" + group = "Banking", + hidden = true, + unhide = "withdrawAll" ) default String getWithdrawAllItems() { @@ -196,7 +208,9 @@ public interface EasyscapeConfig extends Config name = "Objects", description = "Objects listed here will have all interaction be removed.", position = 13, - group = "Miscellaneous easyscape" + group = "Miscellaneous easyscape", + hidden = true, + unhide = "removeObjects" ) default String getRemovedObjects() { @@ -222,7 +236,9 @@ public interface EasyscapeConfig extends Config name = "Items", description = "", position = 15, - group = "Shop / stores" + group = "Shop / stores", + hidden = true, + unhide = "swapBuyOne" ) default String getBuyOneItems() { @@ -246,7 +262,9 @@ public interface EasyscapeConfig extends Config name = "Items", description = "", position = 17, - group = "Shop / stores" + group = "Shop / stores", + hidden = true, + unhide = "swapBuyFive" ) default String getBuyFiveItems() { @@ -270,7 +288,9 @@ public interface EasyscapeConfig extends Config name = "Items", description = "", position = 19, - group = "Shop / stores" + group = "Shop / stores", + hidden = true, + unhide = "swapBuyTen" ) default String getBuyTenItems() { @@ -294,7 +314,9 @@ public interface EasyscapeConfig extends Config name = "Items", description = "", position = 21, - group = "Shop / stores" + group = "Shop / stores", + hidden = true, + unhide = "swapBuyFifty" ) default String getBuyFiftyItems() { @@ -318,7 +340,9 @@ public interface EasyscapeConfig extends Config name = "Items", description = "", position = 23, - group = "Shop / stores" + group = "Shop / stores", + hidden = true, + unhide = "swapSellOne" ) default String getSellOneItems() { @@ -342,7 +366,9 @@ public interface EasyscapeConfig extends Config name = "Items", description = "", position = 25, - group = "Shop / stores" + group = "Shop / stores", + hidden = true, + unhide = "swapSellFive" ) default String getSellFiveItems() { @@ -366,7 +392,9 @@ public interface EasyscapeConfig extends Config name = "Items", description = "", position = 27, - group = "Shop / stores" + group = "Shop / stores", + hidden = true, + unhide = "swapSellTen" ) default String getSellTenItems() { @@ -390,7 +418,9 @@ public interface EasyscapeConfig extends Config name = "Items", description = "", position = 29, - group = "Shop / stores" + group = "Shop / stores", + hidden = true, + unhide = "swapSellFifty" ) default String getSellFiftyItems() { @@ -416,7 +446,9 @@ public interface EasyscapeConfig extends Config name = "Construction Items", description = "Items listed here will have the default option set to \"Removed\" in build mode.", position = 31, - group = "Miscellaneous swapper" + group = "Miscellaneous swapper", + hidden = true, + unhide = "easyConstruction" ) default String getConstructionItems() { @@ -503,7 +535,9 @@ public interface EasyscapeConfig extends Config name = "Mode", description = "", position = 38, - group = "Jewellery swapper" + group = "Jewellery swapper", + hidden = true, + unhide = "swapGamesNecklace" ) default GamesNecklaceMode getGamesNecklaceMode() { @@ -527,7 +561,9 @@ public interface EasyscapeConfig extends Config name = "Mode", description = "", position = 40, - group = "Jewellery swapper" + group = "Jewellery swapper", + hidden = true, + unhide = "swapDuelingRing" ) default DuelingRingMode getDuelingRingMode() { @@ -551,7 +587,9 @@ public interface EasyscapeConfig extends Config name = "Mode", description = "", position = 42, - group = "Jewellery swapper" + group = "Jewellery swapper", + hidden = true, + unhide = "swapGlory" ) default GloryMode getGloryMode() { @@ -575,7 +613,9 @@ public interface EasyscapeConfig extends Config name = "Mode", description = "", position = 44, - group = "Jewellery swapper" + group = "Jewellery swapper", + hidden = true, + unhide = "swapSkill" ) default SkillsNecklaceMode getSkillsNecklaceMode() { @@ -599,7 +639,9 @@ public interface EasyscapeConfig extends Config name = "Mode", description = "", position = 46, - group = "Jewellery swapper" + group = "Jewellery swapper", + hidden = true, + unhide = "swapPassage" ) default NecklaceOfPassageMode getNecklaceofPassageMode() { @@ -623,7 +665,9 @@ public interface EasyscapeConfig extends Config name = "Mode", description = "", position = 48, - group = "Jewellery swapper" + group = "Jewellery swapper", + hidden = true, + unhide = "swapDigsite" ) default DigsitePendantMode getDigsitePendantMode() { @@ -647,7 +691,9 @@ public interface EasyscapeConfig extends Config name = "Mode", description = "", position = 50, - group = "Jewellery swapper" + group = "Jewellery swapper", + hidden = true, + unhide = "swapCombat" ) default CombatBraceletMode getCombatBraceletMode() { @@ -671,7 +717,9 @@ public interface EasyscapeConfig extends Config name = "Mode", description = "", position = 52, - group = "Jewellery swapper" + group = "Jewellery swapper", + hidden = true, + unhide = "swapslayer" ) default SlayerRingMode getSlayerRingMode() { @@ -695,7 +743,9 @@ public interface EasyscapeConfig extends Config name = "Mode", description = "", position = 54, - group = "Jewellery swapper" + group = "Jewellery swapper", + hidden = true, + unhide = "swapburning" ) default BurningAmuletMode getBurningAmuletMode() { @@ -719,7 +769,9 @@ public interface EasyscapeConfig extends Config name = "Mode", description = "", position = 56, - group = "Jewellery swapper" + group = "Jewellery swapper", + hidden = true, + unhide = "swapxeric" ) default XericsTalismanMode getXericsTalismanMode() { @@ -743,7 +795,9 @@ public interface EasyscapeConfig extends Config name = "Mode", description = "", position = 58, - group = "Jewellery swapper" + group = "Jewellery swapper", + hidden = true, + unhide = "swapwealth" ) default RingOfWealthMode getRingofWealthMode() {