Update Anticheat ban message and duration
This commit is contained in:
parent
999237fe69
commit
78fe41a8af
|
@ -61,7 +61,7 @@ import java.util.function.Predicate;
|
|||
@ReflectivelyCreateMiniPlugin
|
||||
public class AntiHack extends MiniPlugin
|
||||
{
|
||||
private static final Map<String, CheckThresholds> _checks = ImmutableMap.of(
|
||||
public static final Map<String, CheckThresholds> CHECKS = ImmutableMap.of(
|
||||
"Killaura (Type A)", new CheckThresholds("Kill Aura", 25, 50),
|
||||
"Killaura (Type B)", new CheckThresholds("High CPS", 0, Integer.MAX_VALUE),
|
||||
"Killaura (Type C)", new CheckThresholds("Reach", Integer.MAX_VALUE, Integer.MAX_VALUE),
|
||||
|
@ -373,7 +373,7 @@ public class AntiHack extends MiniPlugin
|
|||
.setColor(EnumChatFormat.YELLOW)
|
||||
)
|
||||
)
|
||||
.addSibling(_checks.get(violation.getHackType()).format(violation.getViolations()));
|
||||
.addSibling(CHECKS.get(violation.getHackType()).format(violation.getViolations()));
|
||||
|
||||
if (!violation.getOriginatingServer().equals(this._thisServer))
|
||||
{
|
||||
|
@ -552,19 +552,17 @@ public class AntiHack extends MiniPlugin
|
|||
{
|
||||
runSync(() ->
|
||||
{
|
||||
int totalPunishments = getPunishments(player);
|
||||
int daysBanned = getDaysBanned(player);
|
||||
CoreClient coreClient = _clientManager.Get(player);
|
||||
|
||||
if (coreClient.GetRank().has(Rank.TWITCH))
|
||||
{
|
||||
require(Punish.class).AddPunishment(coreClient.getName(), Category.Hacking, message, AntiHack.NAME, totalPunishments + 1, true, daysBanned == -1 ? -1 : TimeUnit.DAYS.toHours(daysBanned), true);
|
||||
require(Punish.class).AddPunishment(coreClient.getName(), Category.Hacking, message, AntiHack.NAME, 3, true, -1, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
runBanAnimation(player, () ->
|
||||
{
|
||||
require(Punish.class).AddPunishment(coreClient.getName(), Category.Hacking, message, AntiHack.NAME, totalPunishments + 1, true, daysBanned == -1 ? -1 : TimeUnit.DAYS.toHours(daysBanned), true);
|
||||
require(Punish.class).AddPunishment(coreClient.getName(), Category.Hacking, message, AntiHack.NAME, 3, true, -1, true);
|
||||
announceBan(player);
|
||||
});
|
||||
}
|
||||
|
@ -974,7 +972,7 @@ public class AntiHack extends MiniPlugin
|
|||
{
|
||||
if (event.shouldTellStaff())
|
||||
{
|
||||
String key = event.getPlayer().getName() + "." + event.getHackType() + "." + _checks.get(event.getHackType()).getSeverity(event.getViolations()).toString();
|
||||
String key = event.getPlayer().getName() + "." + event.getHackType() + "." + CHECKS.get(event.getHackType()).getSeverity(event.getViolations()).toString();
|
||||
Integer pastVl = this._cooldown.getIfPresent(key);
|
||||
if (pastVl != null)
|
||||
{
|
||||
|
|
|
@ -18,6 +18,11 @@ public class CheckThresholds
|
|||
_high = high;
|
||||
}
|
||||
|
||||
public String getFriendlyName()
|
||||
{
|
||||
return _friendlyName;
|
||||
}
|
||||
|
||||
public IChatBaseComponent format(int violationLevel)
|
||||
{
|
||||
EnumChatFormat color = getSeverity(violationLevel)._color;
|
||||
|
|
|
@ -3,10 +3,7 @@ package mineplex.core.antihack.actions;
|
|||
import com.mineplex.anticheat.api.PlayerViolationEvent;
|
||||
import mineplex.core.Managers;
|
||||
import mineplex.core.antihack.AntiHack;
|
||||
import mineplex.core.punish.Category;
|
||||
import mineplex.core.punish.Punish;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
|
||||
class ImmediateBanAction extends AntiHackAction
|
||||
{
|
||||
|
@ -20,7 +17,12 @@ class ImmediateBanAction extends AntiHackAction
|
|||
{
|
||||
if (event.getViolations() >= this.getMinVl())
|
||||
{
|
||||
Managers.get(AntiHack.class).doBan(event.getPlayer(), event.getMessage());
|
||||
String server = UtilServer.getServerName();
|
||||
if (server.contains("-"))
|
||||
{
|
||||
server = server.substring(0, server.indexOf('-'));
|
||||
}
|
||||
Managers.get(AntiHack.class).doBan(event.getPlayer(), "[GWEN] Hacking - " + AntiHack.CHECKS.get(event.getHackType()).getFriendlyName() + " [" + server + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue