Fix Anticheat ban lengths

This commit is contained in:
cnr 2017-05-15 16:37:14 -07:00
parent 9cf5fda540
commit 9bc118dc41

View File

@ -233,7 +233,7 @@ public class AntiHack extends MiniPlugin
_compromisedAccountManager.submitImmediateBan(player); _compromisedAccountManager.submitImmediateBan(player);
_punish.AddPunishment(coreClient.getName(), Category.Hacking, finalMessage, AntiHack.NAME, 3, true, getDaysBanned(player, cause), true, after); _punish.AddPunishment(coreClient.getName(), Category.Hacking, finalMessage, AntiHack.NAME, 3, true, getHoursBanned(player, cause), true, after);
}; };
if (coreClient.GetRank().has(Rank.TWITCH)) if (coreClient.GetRank().has(Rank.TWITCH))
@ -272,7 +272,7 @@ public class AntiHack extends MiniPlugin
Consumer<Consumer<PunishmentResponse>> doPunish = after -> Consumer<Consumer<PunishmentResponse>> doPunish = after ->
{ {
_punish.AddPunishment(coreClient.getName(), Category.Hacking, info.getMessage(), AntiHack.NAME, 3, true, getDaysBanned(player, CheckManager.getCheckBySimpleName(info.getHackType())), true, after); _punish.AddPunishment(coreClient.getName(), Category.Hacking, info.getMessage(), AntiHack.NAME, 3, true, getHoursBanned(player, CheckManager.getCheckBySimpleName(info.getHackType())), true, after);
}; };
if (coreClient.GetRank().has(Rank.TWITCH)) if (coreClient.GetRank().has(Rank.TWITCH))
@ -358,7 +358,7 @@ public class AntiHack extends MiniPlugin
{ {
for (Punishment punishment : punishClient.GetPunishments().get(Category.Hacking)) for (Punishment punishment : punishClient.GetPunishments().get(Category.Hacking))
{ {
if (punishment.GetAdmin().equalsIgnoreCase(NAME) && punishment.GetReason().contains("[GWEN]")) if (punishment.GetAdmin().equalsIgnoreCase(NAME) && punishment.GetReason().contains("[GWEN"))
{ {
totalPunishments++; totalPunishments++;
} }
@ -368,40 +368,21 @@ public class AntiHack extends MiniPlugin
return totalPunishments; return totalPunishments;
} }
public int getDaysBanned(Player player, Class<? extends Check> check) public int getHoursBanned(Player player, Class<? extends Check> check)
{
if (check == null) // old banwaves
{ {
switch (getPunishments(player)) switch (getPunishments(player))
{ {
case 0: case 0:
return 5; return 5 * 24;
case 1: case 1:
return 14; return 14 * 24;
case 2: case 2:
return 30; return 30 * 24;
default: default:
return -1; return -1;
} }
} }
switch (check.getSimpleName())
{
default:
switch (getPunishments(player))
{
case 0:
return 5;
case 1:
return 14;
case 2:
return 30;
default:
return -1;
}
}
}
public void announceBan(Player player) public void announceBan(Player player)
{ {
Bukkit.getServer().broadcastMessage(String.format(USER_HAS_BEEN_BANNED, player.getName())); Bukkit.getServer().broadcastMessage(String.format(USER_HAS_BEEN_BANNED, player.getName()));