code cleanup courtesy of ganom (#428)

This commit is contained in:
OnlyHereToPlayOsrs
2019-05-29 00:04:01 +02:00
committed by Kyleeld
parent 255daf4b68
commit 3acb7ddf75
2 changed files with 24 additions and 19 deletions

View File

@@ -11,8 +11,8 @@ public interface BanListConfig extends Config
@ConfigItem(
keyName = "bannedPlayers",
name = "Banned Players List",
description = "manual entry ",
name = "Manual Scammer List",
description = "Players you add to this list will be shown when you join a clan.",
position = 0
)
@@ -31,8 +31,8 @@ public interface BanListConfig extends Config
@ConfigItem(
position = 1,
keyName = "enableWDR",
name = "use WDR list",
description = "Incorporate WDR ban list"
name = "Enable WDR Scammer List",
description = "Incorporate WDR Scammer list"
)
default boolean enableWDR()
{
@@ -42,8 +42,8 @@ public interface BanListConfig extends Config
@ConfigItem(
position = 2,
keyName = "enableRuneWatch",
name = "use RuneWatch list",
description = "Incorporate RuneWatch Ban list"
name = "Enable RuneWatch Scammer List",
description = "Incorporate RuneWatch Scammer list"
)
default boolean enableRuneWatch()
{

View File

@@ -1,5 +1,7 @@
/*
* Copyright (c) 2019 xperiaclash <https://github.com/xperiaclash>
* Copyright (c) 2019, xperiaclash <https://github.com/xperiaclash>
* Copyright (c) 2019, ganom <https://github.com/Ganom>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -82,9 +84,6 @@ public class BanListPlugin extends Plugin
@Override
protected void startUp() throws Exception
{
wdrArrayList = new ArrayList<>();
runeWatchArrayList = new ArrayList<>();
manualBans = new ArrayList<>();
manualBans.addAll(Text.fromCSV(config.getBannedPlayers()));
fetchFromWebsites();
}
@@ -92,9 +91,9 @@ public class BanListPlugin extends Plugin
@Override
protected void shutDown() throws Exception
{
wdrArrayList = null;
runeWatchArrayList = null;
manualBans = null;
wdrArrayList.clear();
runeWatchArrayList.clear();
manualBans.clear();
}
@Subscribe
@@ -107,11 +106,17 @@ public class BanListPlugin extends Plugin
@Subscribe
public void onConfigChanged(ConfigChanged event)
{
for (String manual : Text.fromCSV(config.getBannedPlayers()))
if (event.getGroup().equals("banlist"))
{
if (!manualBans.contains(manual))
if (event.getKey().equals("bannedPlayers"))
{
manualBans.add(Text.standardize(manual));
for (String manual : Text.fromCSV(config.getBannedPlayers()))
{
if (!manualBans.contains(manual))
{
manualBans.add(Text.standardize(manual));
}
}
}
}
}
@@ -153,7 +158,7 @@ public class BanListPlugin extends Plugin
// on wdr list
final String message = new ChatMessageBuilder()
.append(ChatColorType.HIGHLIGHT)
.append("Warning! " + playerName + " is on WDR ban List")
.append("Warning! " + playerName + " is on WDRs' scammer list")
.build();
chatMessageManager.queue(
@@ -167,7 +172,7 @@ public class BanListPlugin extends Plugin
// on runewatch list
final String message = new ChatMessageBuilder()
.append(ChatColorType.HIGHLIGHT)
.append("Warning! " + playerName + " is on Runewatch ban List")
.append("Warning! " + playerName + " is on Runewatchs' scammer list")
.build();
chatMessageManager.queue(
@@ -181,7 +186,7 @@ public class BanListPlugin extends Plugin
// on manual list
final String message = new ChatMessageBuilder()
.append(ChatColorType.HIGHLIGHT)
.append("Warning! " + playerName + " is on Your Manual ban List")
.append("Warning! " + playerName + " is on your Manual scammer list")
.build();
chatMessageManager.queue(