item identification: clean up config enabled checks
This commit is contained in:
@@ -26,6 +26,8 @@ package net.runelite.client.plugins.itemidentification;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.runelite.api.ItemID;
|
||||
|
||||
enum ItemIdentification
|
||||
@@ -419,21 +421,24 @@ enum ItemIdentification
|
||||
return itemIdentifications.get(id);
|
||||
}
|
||||
|
||||
@AllArgsConstructor
|
||||
enum Type
|
||||
{
|
||||
SEED,
|
||||
SACK,
|
||||
HERB,
|
||||
LOGS,
|
||||
PLANK,
|
||||
SAPLING,
|
||||
COMPOST,
|
||||
ORE,
|
||||
BAR,
|
||||
GEM,
|
||||
POTION,
|
||||
IMPLING_JAR,
|
||||
TABLET,
|
||||
SCROLL
|
||||
SEED(ItemIdentificationConfig::showSeeds),
|
||||
SACK(ItemIdentificationConfig::showSacks),
|
||||
HERB(ItemIdentificationConfig::showHerbs),
|
||||
LOGS(ItemIdentificationConfig::showLogs),
|
||||
PLANK(ItemIdentificationConfig::showPlanks),
|
||||
SAPLING(ItemIdentificationConfig::showSaplings),
|
||||
COMPOST(ItemIdentificationConfig::showComposts),
|
||||
ORE(ItemIdentificationConfig::showOres),
|
||||
BAR(ItemIdentificationConfig::showBars),
|
||||
GEM(ItemIdentificationConfig::showGems),
|
||||
POTION(ItemIdentificationConfig::showPotions),
|
||||
IMPLING_JAR(ItemIdentificationConfig::showImplingJars),
|
||||
TABLET(ItemIdentificationConfig::showTablets),
|
||||
SCROLL(ItemIdentificationConfig::showTeleportScrolls);
|
||||
|
||||
final Predicate<ItemIdentificationConfig> enabled;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,99 +58,11 @@ class ItemIdentificationOverlay extends WidgetItemOverlay
|
||||
public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem widgetItem)
|
||||
{
|
||||
ItemIdentification iden = findItemIdentification(itemId);
|
||||
if (iden == null)
|
||||
if (iden == null || !iden.type.enabled.test(config))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (iden.type)
|
||||
{
|
||||
case SEED:
|
||||
if (!config.showSeeds())
|
||||
{
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case SACK:
|
||||
if (!config.showSacks())
|
||||
{
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case HERB:
|
||||
if (!config.showHerbs())
|
||||
{
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case LOGS:
|
||||
if (!config.showLogs())
|
||||
{
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case PLANK:
|
||||
if (!config.showPlanks())
|
||||
{
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case SAPLING:
|
||||
if (!config.showSaplings())
|
||||
{
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case COMPOST:
|
||||
if (!config.showComposts())
|
||||
{
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case ORE:
|
||||
if (!config.showOres())
|
||||
{
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case BAR:
|
||||
if (!config.showBars())
|
||||
{
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case GEM:
|
||||
if (!config.showGems())
|
||||
{
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case POTION:
|
||||
if (!config.showPotions())
|
||||
{
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case IMPLING_JAR:
|
||||
if (!config.showImplingJars())
|
||||
{
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case TABLET:
|
||||
if (!config.showTablets())
|
||||
{
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case SCROLL:
|
||||
if (!config.showTeleportScrolls())
|
||||
{
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
graphics.setFont(FontManager.getRunescapeSmallFont());
|
||||
renderText(graphics, widgetItem.getCanvasBounds(), iden);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user