entityhider: add blacklist for hiding dead npcs. (#2231)

This commit is contained in:
Ganom
2020-01-16 09:01:32 -05:00
committed by Kyle
parent 8545e7f161
commit 7e1c211005
6 changed files with 64 additions and 8 deletions

View File

@@ -235,10 +235,24 @@ public interface EntityHiderConfig extends Config
}
@ConfigItem(
position = 18,
keyName = "hidePets",
name = "Hide Pets",
description = "Configures whether or not other player pets are hidden"
position = 18,
keyName = "blacklistDeadNpcs",
name = "Hide on Death Blacklist",
description = "Configures which NPCs NOT to hide when they die",
titleSection = "npcsTitle",
hidden = true,
unhide = "hideDeadNPCs"
)
default String blacklistDeadNpcs()
{
return "";
}
@ConfigItem(
position = 19,
keyName = "hidePets",
name = "Hide Pets",
description = "Configures whether or not other player pets are hidden"
)
default boolean hidePets()
{
@@ -249,7 +263,7 @@ public interface EntityHiderConfig extends Config
keyName = "miscTitle",
name = "Miscellaneous",
description = "",
position = 19
position = 20
)
default Title miscTitle()
{
@@ -257,7 +271,7 @@ public interface EntityHiderConfig extends Config
}
@ConfigItem(
position = 20,
position = 21,
keyName = "hideProjectiles",
name = "Hide Projectiles",
description = "Configures whether or not projectiles are hidden",

View File

@@ -28,7 +28,9 @@ package net.runelite.client.plugins.entityhider;
import com.google.inject.Provides;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import javax.inject.Inject;
import javax.inject.Singleton;
@@ -83,6 +85,22 @@ public class EntityHiderPlugin extends Plugin
{
updateConfig();
final Set<Integer> blacklist = new HashSet<>();
for (String s : Text.COMMA_SPLITTER.split(config.blacklistDeadNpcs()))
{
try
{
blacklist.add(Integer.parseInt(s));
}
catch (NumberFormatException ignored)
{
}
}
client.setBlacklistDeadNpcs(blacklist);
if (event.getOldValue() == null || event.getNewValue() == null)
{
return;