From 4a378817fd9462708e8a954ec2ed63fa11a25c65 Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Sat, 14 Mar 2020 15:07:26 +0000 Subject: [PATCH] ground items: move repeated notify code into notifyHighlightedItem --- .../grounditems/GroundItemsPlugin.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsPlugin.java index 2ee7db3816..df4baeb09b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsPlugin.java @@ -242,12 +242,7 @@ public class GroundItemsPlugin extends Plugin // The spawn time remains set at the oldest spawn } - boolean shouldNotify = !config.onlyShowLoot() && config.highlightedColor().equals(getHighlighted( - new NamedQuantity(groundItem), - groundItem.getGePrice(), - groundItem.getHaPrice())); - - if (config.notifyHighlightedDrops() && shouldNotify) + if (!config.onlyShowLoot()) { notifyHighlightedItem(groundItem); } @@ -370,12 +365,7 @@ public class GroundItemsPlugin extends Plugin { groundItem.setLootType(lootType); - boolean shouldNotify = config.onlyShowLoot() && config.highlightedColor().equals(getHighlighted( - new NamedQuantity(groundItem), - groundItem.getGePrice(), - groundItem.getHaPrice())); - - if (config.notifyHighlightedDrops() && shouldNotify) + if (config.onlyShowLoot()) { notifyHighlightedItem(groundItem); } @@ -645,6 +635,16 @@ public class GroundItemsPlugin extends Plugin private void notifyHighlightedItem(GroundItem item) { + boolean shouldNotifyHighlighted = config.highlightedColor().equals(getHighlighted( + new NamedQuantity(item), + item.getGePrice(), + item.getHaPrice())); + + if (!config.notifyHighlightedDrops() || !shouldNotifyHighlighted) + { + return; + } + final Player local = client.getLocalPlayer(); final StringBuilder notificationStringBuilder = new StringBuilder() .append("[")