banlistplugin: combine nested if statements
This commit is contained in:
@@ -122,9 +122,7 @@ public class BanListPlugin extends Plugin
|
|||||||
@Subscribe
|
@Subscribe
|
||||||
public void onConfigChanged(ConfigChanged event)
|
public void onConfigChanged(ConfigChanged event)
|
||||||
{
|
{
|
||||||
if (event.getGroup().equals("banlist"))
|
if (event.getGroup().equals("banlist")&& event.getKey().equals("bannedPlayers"))
|
||||||
{
|
|
||||||
if (event.getKey().equals("bannedPlayers"))
|
|
||||||
{
|
{
|
||||||
for (String manual : Text.fromCSV(config.getBannedPlayers()))
|
for (String manual : Text.fromCSV(config.getBannedPlayers()))
|
||||||
{
|
{
|
||||||
@@ -135,7 +133,6 @@ public class BanListPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void updateConfig()
|
public void updateConfig()
|
||||||
{
|
{
|
||||||
@@ -202,9 +199,7 @@ public class BanListPlugin extends Plugin
|
|||||||
@Subscribe
|
@Subscribe
|
||||||
public void onWidgetLoaded(WidgetLoaded widgetLoaded)
|
public void onWidgetLoaded(WidgetLoaded widgetLoaded)
|
||||||
{
|
{
|
||||||
if (this.highlightInTrade)
|
if (this.highlightInTrade && widgetLoaded.getGroupId() == 335)
|
||||||
{
|
|
||||||
if (widgetLoaded.getGroupId() == 335)
|
|
||||||
{ //if trading window was loaded
|
{ //if trading window was loaded
|
||||||
clientThread.invokeLater(() ->
|
clientThread.invokeLater(() ->
|
||||||
{
|
{
|
||||||
@@ -221,36 +216,26 @@ public class BanListPlugin extends Plugin
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compares player name to everything in the ban lists
|
* Compares player name to everything in the ban lists
|
||||||
*/
|
*/
|
||||||
private ListType checkScamList(String nameToBeChecked)
|
private ListType checkScamList(String nameToBeChecked)
|
||||||
{
|
{
|
||||||
if (wdrScamArrayList.size() > 0 && this.enableWDR)
|
if (wdrScamArrayList.size() > 0 && this.enableWDR && wdrScamArrayList.stream().anyMatch(nameToBeChecked::equalsIgnoreCase))
|
||||||
{
|
|
||||||
if (wdrScamArrayList.stream().anyMatch(nameToBeChecked::equalsIgnoreCase))
|
|
||||||
{
|
{
|
||||||
return ListType.WEDORAIDSSCAM_LIST;
|
return ListType.WEDORAIDSSCAM_LIST;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (runeWatchArrayList.size() > 0 && this.enableRuneWatch)
|
if (runeWatchArrayList.size() > 0 && this.enableRuneWatch && runeWatchArrayList.stream().anyMatch(nameToBeChecked::equalsIgnoreCase))
|
||||||
{
|
|
||||||
if (runeWatchArrayList.stream().anyMatch(nameToBeChecked::equalsIgnoreCase))
|
|
||||||
{
|
{
|
||||||
return ListType.RUNEWATCH_LIST;
|
return ListType.RUNEWATCH_LIST;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (manualBans.size() > 0)
|
if (manualBans.size() > 0 && manualBans.stream().anyMatch(nameToBeChecked::equalsIgnoreCase))
|
||||||
{
|
|
||||||
if (manualBans.stream().anyMatch(nameToBeChecked::equalsIgnoreCase))
|
|
||||||
{
|
{
|
||||||
return ListType.MANUAL_LIST;
|
return ListType.MANUAL_LIST;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -258,13 +243,10 @@ public class BanListPlugin extends Plugin
|
|||||||
private ListType checkToxicList(String nameToBeChecked)
|
private ListType checkToxicList(String nameToBeChecked)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (wdrToxicArrayList.size() > 0 && this.enableWDR)
|
if (wdrToxicArrayList.size() > 0 && this.enableWDR && wdrToxicArrayList.stream().anyMatch(nameToBeChecked::equalsIgnoreCase))
|
||||||
{
|
|
||||||
if (wdrToxicArrayList.stream().anyMatch(nameToBeChecked::equalsIgnoreCase))
|
|
||||||
{
|
{
|
||||||
return ListType.WEDORAIDSTOXIC_LIST;
|
return ListType.WEDORAIDSTOXIC_LIST;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user