banlist: add tob functionality, config options (#945)
* banlist add tob functionality, config options * Checkstyle Fixes * Widget Info * Various White spaces removed.
This commit is contained in:
committed by
Lucwousin
parent
b861ce4121
commit
aaaa7845ef
@@ -667,6 +667,7 @@ public class WidgetID
|
||||
|
||||
static class TheatreOfBlood
|
||||
{
|
||||
static final int RAIDING_PARTY = 9;
|
||||
static final int ORB_BOX = 10;
|
||||
static final int BOSS_HEALTH_BAR = 35;
|
||||
}
|
||||
|
||||
@@ -445,6 +445,7 @@ public enum WidgetInfo
|
||||
|
||||
THEATRE_OF_BLOOD_HEALTH_ORBS(WidgetID.THEATRE_OF_BLOOD_GROUP_ID, WidgetID.TheatreOfBlood.ORB_BOX),
|
||||
THEATRE_OF_BLOOD_BOSS_HEALTH(WidgetID.THEATRE_OF_BLOOD_GROUP_ID, WidgetID.TheatreOfBlood.BOSS_HEALTH_BAR),
|
||||
THEATRE_OF_BLOOD_RAIDING_PARTY(WidgetID.THEATRE_OF_BLOOD_GROUP_ID, WidgetID.TheatreOfBlood.RAIDING_PARTY),
|
||||
|
||||
BLAST_FURNACE_COFFER(WidgetID.BLAST_FURNACE_GROUP_ID, 2),
|
||||
|
||||
@@ -514,7 +515,7 @@ public enum WidgetInfo
|
||||
PVP_KILLDEATH_COUNTER(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.KILLDEATH_RATIO),
|
||||
|
||||
SPELLBOOK_FILTERED_BOUNDS(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.FILTERED_SPELLS_BOUNDS),
|
||||
|
||||
|
||||
/* STANDARD SPELL BOOK WIDGETS*/
|
||||
SPELL_LUMBRIDGE_HOME_TELEPORT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.LUMBRIDGE_HOME_TELEPORT),
|
||||
SPELL_WIND_STRIKE(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.WIND_STRIKE),
|
||||
@@ -530,7 +531,7 @@ public enum WidgetInfo
|
||||
SPELL_CURSE(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.CURSE),
|
||||
SPELL_BIND(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.BIND),
|
||||
SPELL_LOW_LEVEL_ALCHEMY(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.LOW_LEVEL_ALCHEMY),
|
||||
SPELL_WATER_BOLT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.WATER_BOLT),
|
||||
SPELL_WATER_BOLT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.WATER_BOLT),
|
||||
SPELL_VARROCK_TELEPORT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.VARROCK_TELEPORT),
|
||||
SPELL_LVL_2_ENCHANT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.LVL_2_ENCHANT),
|
||||
SPELL_EARTH_BOLT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.EARTH_BOLT),
|
||||
@@ -545,7 +546,7 @@ public enum WidgetInfo
|
||||
SPELL_CAMELOT_TELEPORT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.CAMELOT_TELEPORT),
|
||||
SPELL_WATER_BLAST(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.WATER_BLAST),
|
||||
SPELL_LVL_3_ENCHANT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.LVL_3_ENCHANT),
|
||||
SPELL_IBAN_BLAST(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.IBAN_BLAST),
|
||||
SPELL_IBAN_BLAST(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.IBAN_BLAST),
|
||||
SPELL_SNARE(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.SNARE),
|
||||
SPELL_MAGIC_DART(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.MAGIC_DART),
|
||||
SPELL_ARDOUGNE_TELEPORT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.ARDOUGNE_TELEPORT),
|
||||
@@ -562,7 +563,7 @@ public enum WidgetInfo
|
||||
SPELL_FLAMES_OF_ZAMORAK(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.FLAMES_OF_ZAMORAK),
|
||||
SPELL_TROLLHEIM_TELEPORT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.TROLLHEIM_TELEPORT),
|
||||
SPELL_WIND_WAVE(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.WIND_WAVE),
|
||||
SPELL_CHARGE_FIRE_ORB(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.CHARGE_FIRE_ORB),
|
||||
SPELL_CHARGE_FIRE_ORB(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.CHARGE_FIRE_ORB),
|
||||
SPELL_TELEPORT_TO_APE_ATOLL(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.TELEPORT_TO_APE_ATOLL),
|
||||
SPELL_WATER_WAVE(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.WATER_WAVE),
|
||||
SPELL_CHARGE_AIR_ORB(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.CHARGE_AIR_ORB),
|
||||
@@ -580,14 +581,14 @@ public enum WidgetInfo
|
||||
SPELL_TELEOTHER_FALADOR(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.TELEOTHER_FALADOR),
|
||||
SPELL_WATER_SURGE(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.WATER_SURGE),
|
||||
SPELL_TELE_BLOCK(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.TELE_BLOCK),
|
||||
SPELL_LVL_6_ENCHANT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.LVL_6_ENCHANT),
|
||||
SPELL_LVL_6_ENCHANT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.LVL_6_ENCHANT),
|
||||
SPELL_TELEOTHER_CAMELOT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.TELEOTHER_CAMELOT),
|
||||
SPELL_EARTH_SURGE(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.EARTH_SURGE),
|
||||
SPELL_LVL_7_ENCHANT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.LVL_7_ENCHANT),
|
||||
SPELL_FIRE_SURGE(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.FIRE_SURGE),
|
||||
SPELL_BOUNTY_TARGET_TELEPORT2(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.BOUNTY_TARGET_TELEPORT),
|
||||
/* END OF STANDARD SPELL BOOK WIDGETS*/
|
||||
|
||||
|
||||
/* ANCIENT SPELL BOOK WIDGETS*/
|
||||
SPELL_ICE_RUSH(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.ICE_RUSH),
|
||||
SPELL_ICE_BLITZ(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.ICE_BLITZ),
|
||||
@@ -688,7 +689,7 @@ public enum WidgetInfo
|
||||
QUESTLIST_FREE_CONTAINER(WidgetID.QUESTLIST_GROUP_ID, WidgetID.QuestList.FREE_CONTAINER),
|
||||
QUESTLIST_MEMBERS_CONTAINER(WidgetID.QUESTLIST_GROUP_ID, WidgetID.QuestList.MEMBERS_CONTAINER),
|
||||
QUESTLIST_MINIQUEST_CONTAINER(WidgetID.QUESTLIST_GROUP_ID, WidgetID.QuestList.MINIQUEST_CONTAINER),
|
||||
|
||||
|
||||
MUSICTAB_INTERFACE(WidgetID.MUSICTAB_GROUP_ID, 1),
|
||||
MUSICTAB_SONG_BOX(WidgetID.MUSICTAB_GROUP_ID, 2),
|
||||
MUSICTAB_ALL_SONGS(WidgetID.MUSICTAB_GROUP_ID, 3),
|
||||
|
||||
@@ -9,11 +9,10 @@ import net.runelite.client.config.ConfigItem;
|
||||
public interface BanListConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "bannedPlayers",
|
||||
name = "Manual Scammer List",
|
||||
description = "Players you add to this list will be shown when you join a clan.",
|
||||
position = 0
|
||||
|
||||
keyName = "bannedPlayers",
|
||||
name = "Manual Scammer List",
|
||||
description = "Manually add players seperated by commas that you wish to be warned about while in a clan/cox/tob party",
|
||||
position = 0
|
||||
)
|
||||
default String getBannedPlayers()
|
||||
{
|
||||
@@ -21,28 +20,39 @@ public interface BanListConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "bannedPlayers",
|
||||
name = "",
|
||||
description = ""
|
||||
keyName = "bannedPlayers",
|
||||
name = "",
|
||||
description = ""
|
||||
)
|
||||
void setBannedPlayers(String key);
|
||||
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
keyName = "enableWDR",
|
||||
name = "Enable WDR Scammer List",
|
||||
description = "Incorporate WDR Scammer list"
|
||||
position = 1,
|
||||
keyName = "enableWDRScam",
|
||||
name = "Enable WDR Scammer List",
|
||||
description = "Incorporate WDR Scammer list"
|
||||
)
|
||||
default boolean enableWDR()
|
||||
default boolean enableWDRScam()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "enableRuneWatch",
|
||||
name = "Enable RuneWatch Scammer List",
|
||||
description = "Incorporate RuneWatch Scammer list"
|
||||
position = 2,
|
||||
keyName = "enableWDRToxic",
|
||||
name = "Enable WDR Toxic List",
|
||||
description = "Incorporate WDR Toxic list"
|
||||
)
|
||||
default boolean enableWDRToxic()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
keyName = "enableRuneWatch",
|
||||
name = "Enable RuneWatch List",
|
||||
description = "Incorporate RuneWatch potential scammer list"
|
||||
)
|
||||
default boolean enableRuneWatch()
|
||||
{
|
||||
@@ -50,10 +60,10 @@ public interface BanListConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
keyName = "highlightInClan",
|
||||
name = "Highlight red in Clan Chat",
|
||||
description = "Highlights Scammer\'s name in your current clan chat."
|
||||
position = 4,
|
||||
keyName = "highlightInClan",
|
||||
name = "Highlight red in Clan Chat",
|
||||
description = "Highlights Scammer\'s name in your current clan chat."
|
||||
)
|
||||
default boolean highlightInClan()
|
||||
{
|
||||
@@ -61,14 +71,13 @@ public interface BanListConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "highlightInTrade",
|
||||
name = "Highlight red in trade screen",
|
||||
description = "Highlights Scammer\'s name in your trade window"
|
||||
position = 5,
|
||||
keyName = "highlightInTrade",
|
||||
name = "Highlight red in trade screen",
|
||||
description = "Highlights Scammer\'s name in your trade window"
|
||||
)
|
||||
default boolean highlightInTrade()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -41,8 +41,10 @@ import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.ClanMember;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.events.ClanMemberJoined;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.WidgetHiddenChanged;
|
||||
import net.runelite.api.events.WidgetLoaded;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
@@ -77,22 +79,24 @@ import okhttp3.Response;
|
||||
@Slf4j
|
||||
public class BanListPlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private ClientThread clientThread;
|
||||
|
||||
@Inject
|
||||
private BanListConfig config;
|
||||
|
||||
@Inject
|
||||
private ChatMessageManager chatMessageManager;
|
||||
|
||||
private final Set<String> wdrScamSet = new HashSet<>();
|
||||
private final Set<String> wdrToxicSet = new HashSet<>();
|
||||
private final Set<String> runeWatchSet = new HashSet<>();
|
||||
private final Set<String> manualBans = new HashSet<>();
|
||||
@Inject
|
||||
private Client client;
|
||||
@Inject
|
||||
private ClientThread clientThread;
|
||||
@Inject
|
||||
private BanListConfig config;
|
||||
@Inject
|
||||
private ChatMessageManager chatMessageManager;
|
||||
private String tobNames = "";
|
||||
private boolean enableWDRScam;
|
||||
private boolean enableWDRToxic;
|
||||
private boolean enableRuneWatch;
|
||||
private boolean highlightInClan;
|
||||
private boolean highlightInTrade;
|
||||
|
||||
@Provides
|
||||
BanListConfig getConfig(ConfigManager configManager)
|
||||
@@ -100,12 +104,6 @@ public class BanListPlugin extends Plugin
|
||||
return configManager.getConfig(BanListConfig.class);
|
||||
}
|
||||
|
||||
// save config values
|
||||
private boolean enableWDR;
|
||||
private boolean enableRuneWatch;
|
||||
private boolean highlightInClan;
|
||||
private boolean highlightInTrade;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
@@ -151,7 +149,8 @@ public class BanListPlugin extends Plugin
|
||||
|
||||
private void updateConfig()
|
||||
{
|
||||
this.enableWDR = config.enableWDR();
|
||||
this.enableWDRScam = config.enableWDRScam();
|
||||
this.enableWDRToxic = config.enableWDRToxic();
|
||||
this.enableRuneWatch = config.enableRuneWatch();
|
||||
this.highlightInClan = config.highlightInClan();
|
||||
this.highlightInTrade = config.highlightInTrade();
|
||||
@@ -234,12 +233,63 @@ public class BanListPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Subscribe
|
||||
public void onGameTick(GameTick event)
|
||||
{
|
||||
|
||||
if (client.getWidget(WidgetInfo.THEATRE_OF_BLOOD_RAIDING_PARTY) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Widget raidingParty = client.getWidget(WidgetInfo.THEATRE_OF_BLOOD_RAIDING_PARTY);
|
||||
String allNames = raidingParty.getText();
|
||||
|
||||
if (allNames.equalsIgnoreCase(tobNames))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
tobNames = allNames;
|
||||
|
||||
String[] split = allNames.split("<br>");
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
String name = split[i];
|
||||
if (!name.equalsIgnoreCase("-"))
|
||||
{
|
||||
ListType scamList = checkScamList(Text.standardize(name));
|
||||
|
||||
if (scamList != null)
|
||||
{
|
||||
sendWarning(name, scamList);
|
||||
}
|
||||
|
||||
ListType toxicList = checkToxicList(Text.standardize(name));
|
||||
|
||||
if (toxicList != null)
|
||||
{
|
||||
sendWarning(name, toxicList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
boolean inTobParty()
|
||||
{
|
||||
return client.getVar(Varbits.THEATRE_OF_BLOOD) == 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Compares player name to everything in the ban lists
|
||||
*/
|
||||
private ListType checkScamList(String nameToBeChecked)
|
||||
{
|
||||
if (wdrScamSet.size() > 0 && this.enableWDR && wdrScamSet.contains(nameToBeChecked))
|
||||
if (wdrScamSet.size() > 0 && this.enableWDRScam && wdrScamSet.contains(nameToBeChecked))
|
||||
{
|
||||
return ListType.WEDORAIDSSCAM_LIST;
|
||||
}
|
||||
@@ -260,7 +310,7 @@ public class BanListPlugin extends Plugin
|
||||
private ListType checkToxicList(String nameToBeChecked)
|
||||
{
|
||||
|
||||
if (wdrToxicSet.size() > 0 && this.enableWDR && wdrToxicSet.contains(nameToBeChecked))
|
||||
if (wdrToxicSet.size() > 0 && this.enableWDRToxic && wdrToxicSet.contains(nameToBeChecked))
|
||||
{
|
||||
return ListType.WEDORAIDSTOXIC_LIST;
|
||||
}
|
||||
@@ -304,7 +354,7 @@ public class BanListPlugin extends Plugin
|
||||
case RUNEWATCH_LIST:
|
||||
final String rw_message = new ChatMessageBuilder()
|
||||
.append(ChatColorType.HIGHLIGHT)
|
||||
.append("Warning! " + playerName + " is on the Runewatch\'s scammer list!")
|
||||
.append("Warning! " + playerName + " is on the Runewatch\'s potential scammer list!")
|
||||
.build();
|
||||
|
||||
chatMessageManager.queue(
|
||||
|
||||
Reference in New Issue
Block a user