Merge pull request #3811 from deathbeam/ground-items-right-click-menu

Optional support for recoloring right-click menu
This commit is contained in:
Adam
2018-06-19 09:21:34 -04:00
committed by GitHub
2 changed files with 30 additions and 18 deletions

View File

@@ -109,11 +109,22 @@ public interface GroundItemsConfig extends Config
return true; return true;
} }
@ConfigItem(
keyName = "recolorMenuHiddenItems",
name = "Recolor Menu Hidden Items",
description = "Configures whether or not hidden items in right click menu will be recolored",
position = 5
)
default boolean recolorMenuHiddenItems()
{
return false;
}
@ConfigItem( @ConfigItem(
keyName = "priceDisplayMode", keyName = "priceDisplayMode",
name = "Price Display Mode", name = "Price Display Mode",
description = "Configures what price types are shown alongside of ground item name", description = "Configures what price types are shown alongside of ground item name",
position = 5 position = 6
) )
default PriceDisplayMode priceDisplayMode() default PriceDisplayMode priceDisplayMode()
{ {
@@ -124,7 +135,7 @@ public interface GroundItemsConfig extends Config
keyName = "itemHighlightMode", keyName = "itemHighlightMode",
name = "Item Highlight Mode", name = "Item Highlight Mode",
description = "Configures how ground items will be highlighted", description = "Configures how ground items will be highlighted",
position = 6 position = 7
) )
default ItemHighlightMode itemHighlightMode() default ItemHighlightMode itemHighlightMode()
{ {
@@ -135,7 +146,7 @@ public interface GroundItemsConfig extends Config
keyName = "menuHighlightMode", keyName = "menuHighlightMode",
name = "Menu Highlight Mode", name = "Menu Highlight Mode",
description = "Configures what to highlight in right-click menu", description = "Configures what to highlight in right-click menu",
position = 7 position = 8
) )
default MenuHighlightMode menuHighlightMode() default MenuHighlightMode menuHighlightMode()
{ {
@@ -146,7 +157,7 @@ public interface GroundItemsConfig extends Config
keyName = "highlightOverValue2", keyName = "highlightOverValue2",
name = "Highlight > Value", name = "Highlight > Value",
description = "Configures highlighted ground items over either GE or HA value", description = "Configures highlighted ground items over either GE or HA value",
position = 8 position = 9
) )
default int getHighlightOverValue() default int getHighlightOverValue()
{ {
@@ -157,7 +168,7 @@ public interface GroundItemsConfig extends Config
keyName = "hideUnderValue", keyName = "hideUnderValue",
name = "Hide < Value", name = "Hide < Value",
description = "Configures hidden ground items under both GE and HA value", description = "Configures hidden ground items under both GE and HA value",
position = 9 position = 10
) )
default int getHideUnderValue() default int getHideUnderValue()
{ {
@@ -168,7 +179,7 @@ public interface GroundItemsConfig extends Config
keyName = "defaultColor", keyName = "defaultColor",
name = "Default items color", name = "Default items color",
description = "Configures the color for default, non-highlighted items", description = "Configures the color for default, non-highlighted items",
position = 10 position = 11
) )
default Color defaultColor() default Color defaultColor()
{ {
@@ -179,7 +190,7 @@ public interface GroundItemsConfig extends Config
keyName = "highlightedColor", keyName = "highlightedColor",
name = "Highlighted items color", name = "Highlighted items color",
description = "Configures the color for highlighted items", description = "Configures the color for highlighted items",
position = 11 position = 12
) )
default Color highlightedColor() default Color highlightedColor()
{ {
@@ -189,8 +200,8 @@ public interface GroundItemsConfig extends Config
@ConfigItem( @ConfigItem(
keyName = "hiddenColor", keyName = "hiddenColor",
name = "Hidden items color", name = "Hidden items color",
description = "Configures the color for hidden items when holding ALT", description = "Configures the color for hidden items in right-click menu and when holding ALT",
position = 12 position = 13
) )
default Color hiddenColor() default Color hiddenColor()
{ {
@@ -201,7 +212,7 @@ public interface GroundItemsConfig extends Config
keyName = "lowValueColor", keyName = "lowValueColor",
name = "Low value items color", name = "Low value items color",
description = "Configures the color for low value items", description = "Configures the color for low value items",
position = 13 position = 14
) )
default Color lowValueColor() default Color lowValueColor()
{ {
@@ -212,7 +223,7 @@ public interface GroundItemsConfig extends Config
keyName = "lowValuePrice", keyName = "lowValuePrice",
name = "Low value price", name = "Low value price",
description = "Configures the start price for low value items", description = "Configures the start price for low value items",
position = 14 position = 15
) )
default int lowValuePrice() default int lowValuePrice()
{ {
@@ -223,7 +234,7 @@ public interface GroundItemsConfig extends Config
keyName = "mediumValueColor", keyName = "mediumValueColor",
name = "Medium value items color", name = "Medium value items color",
description = "Configures the color for medium value items", description = "Configures the color for medium value items",
position = 15 position = 16
) )
default Color mediumValueColor() default Color mediumValueColor()
{ {
@@ -234,7 +245,7 @@ public interface GroundItemsConfig extends Config
keyName = "mediumValuePrice", keyName = "mediumValuePrice",
name = "Medium value price", name = "Medium value price",
description = "Configures the start price for medium value items", description = "Configures the start price for medium value items",
position = 16 position = 17
) )
default int mediumValuePrice() default int mediumValuePrice()
{ {
@@ -245,7 +256,7 @@ public interface GroundItemsConfig extends Config
keyName = "highValueColor", keyName = "highValueColor",
name = "High value items color", name = "High value items color",
description = "Configures the color for high value items", description = "Configures the color for high value items",
position = 17 position = 18
) )
default Color highValueColor() default Color highValueColor()
{ {
@@ -256,7 +267,7 @@ public interface GroundItemsConfig extends Config
keyName = "highValuePrice", keyName = "highValuePrice",
name = "High value price", name = "High value price",
description = "Configures the start price for high value items", description = "Configures the start price for high value items",
position = 18 position = 19
) )
default int highValuePrice() default int highValuePrice()
{ {
@@ -267,7 +278,7 @@ public interface GroundItemsConfig extends Config
keyName = "insaneValueColor", keyName = "insaneValueColor",
name = "Insane value items color", name = "Insane value items color",
description = "Configures the color for insane value items", description = "Configures the color for insane value items",
position = 19 position = 20
) )
default Color insaneValueColor() default Color insaneValueColor()
{ {
@@ -278,7 +289,7 @@ public interface GroundItemsConfig extends Config
keyName = "insaneValuePrice", keyName = "insaneValuePrice",
name = "Insane value price", name = "Insane value price",
description = "Configures the start price for insane value items", description = "Configures the start price for insane value items",
position = 20 position = 21
) )
default int insaneValuePrice() default int insaneValuePrice()
{ {

View File

@@ -410,8 +410,9 @@ public class GroundItemsPlugin extends Plugin
final Color hidden = getHidden(itemComposition.getName(), gePrice, haPrice, itemComposition.isTradeable()); final Color hidden = getHidden(itemComposition.getName(), gePrice, haPrice, itemComposition.isTradeable());
final Color highlighted = getHighlighted(itemComposition.getName(), gePrice, haPrice); final Color highlighted = getHighlighted(itemComposition.getName(), gePrice, haPrice);
final Color color = getItemColor(highlighted, hidden); final Color color = getItemColor(highlighted, hidden);
final boolean canBeRecolored = highlighted != null || (hidden != null && config.recolorMenuHiddenItems());
if (color != null && hidden == null && !color.equals(config.defaultColor())) if (color != null && canBeRecolored && !color.equals(config.defaultColor()))
{ {
String hexColor = Integer.toHexString(color.getRGB() & 0xFFFFFF); String hexColor = Integer.toHexString(color.getRGB() & 0xFFFFFF);
String colTag = "<col=" + hexColor + ">"; String colTag = "<col=" + hexColor + ">";