Skip to content

Commit

Permalink
remove config name
Browse files Browse the repository at this point in the history
  • Loading branch information
ManInMyVan committed Dec 20, 2024
1 parent c87ae3a commit 9774167
Show file tree
Hide file tree
Showing 21 changed files with 68 additions and 79 deletions.
21 changes: 8 additions & 13 deletions src/main/java/ac/grim/grimac/checks/Check.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public class Check extends GrimProcessor implements AbstractCheck {
private double setbackVL;

private String checkName;
private String configName;
private String alternativeName;
private String displayName;
private String description;
Expand All @@ -34,11 +33,6 @@ public class Check extends GrimProcessor implements AbstractCheck {
private boolean isEnabled;
private boolean exempted;

@Override
public boolean isExperimental() {
return experimental;
}

public Check(final GrimPlayer player) {
this.player = player;

Expand All @@ -47,17 +41,14 @@ public Check(final GrimPlayer player) {
if (checkClass.isAnnotationPresent(CheckData.class)) {
final CheckData checkData = checkClass.getAnnotation(CheckData.class);
this.checkName = checkData.name();
this.configName = checkData.configName();
// Fall back to check name
if (this.configName.equals("DEFAULT")) this.configName = this.checkName;
this.decay = checkData.decay();
this.setbackVL = checkData.setback();
this.alternativeName = checkData.alternativeName();
this.experimental = checkData.experimental();
this.description = checkData.description();
this.displayName = this.checkName;
}
//

reload();
}

Expand Down Expand Up @@ -113,9 +104,9 @@ public final void reward() {

@Override
public void reload(ConfigManager configuration) {
decay = configuration.getDoubleElse(configName + ".decay", decay);
setbackVL = configuration.getDoubleElse(configName + ".setbackvl", setbackVL);
displayName = configuration.getStringElse(configName + ".displayname", checkName);
decay = configuration.getDoubleElse(checkName + ".decay", decay);
setbackVL = configuration.getDoubleElse(checkName + ".setbackvl", setbackVL);
displayName = configuration.getStringElse(checkName + ".displayname", checkName);
description = configuration.getStringElse(configName + ".description", description);

if (setbackVL == -1) setbackVL = Double.MAX_VALUE;
Expand Down Expand Up @@ -185,4 +176,8 @@ public boolean isTickPacketIncludingNonMovement(PacketTypeCommon packetType) {
return isFlying(packetType);
}

@Override
public String getConfigName() {
return checkName;
}
}
2 changes: 0 additions & 2 deletions src/main/java/ac/grim/grimac/checks/CheckData.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

String alternativeName() default "UNKNOWN";

String configName() default "DEFAULT";

String description() default "No description provided";

double decay() default 0.05;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ public void doCheck(final PacketReceiveEvent event) {

@Override
public void onReload(ConfigManager config) {
clockDrift = (long) (config.getDoubleElse(getConfigName() + ".drift", 1200.0) * 1e6);
clockDrift = (long) (config.getDoubleElse(getCheckName() + ".drift", 1200.0) * 1e6);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import ac.grim.grimac.utils.anticheat.update.PredictionComplete;
import com.github.retrooper.packetevents.protocol.player.ClientVersion;

@CheckData(name = "NoSlowA (Prediction)", configName = "NoSlowA", description = "Was not slowed while using an item", setback = 5)
@CheckData(name = "NoSlowA", description = "Was not slowed while using an item", setback = 5)
public class NoSlowA extends Check implements PostPredictionCheck {
double offsetToFlag;
double bestOffset = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon;

@CheckData(name = "Timer", configName = "TimerA", setback = 10)
@CheckData(name = "Timer", setback = 10)
public class TimerCheck extends Check implements PacketCheck {
long timerBalanceRealTime = 0;

Expand Down Expand Up @@ -111,7 +111,7 @@ public boolean shouldCountPacketForTimer(PacketTypeCommon packetType) {

@Override
public void onReload(ConfigManager config) {
clockDrift = (long) (config.getDoubleElse(getConfigName() + ".drift", 120.0) * 1e6);
limitAbuseOverPing = (long) (config.getDoubleElse(getConfigName() + ".ping-abuse-limit-threshold", 1000) * 1e6);
clockDrift = (long) (config.getDoubleElse(getCheckName() + ".drift", 120.0) * 1e6);
limitAbuseOverPing = (long) (config.getDoubleElse(getCheckName() + ".ping-abuse-limit-threshold", 1000) * 1e6);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon;

@CheckData(name = "Timer - Vehicle", configName = "TimerVehicle", setback = 10)
@CheckData(name = "VehicleTimer", setback = 10)
public class VehicleTimer extends TimerCheck {
boolean isDummy = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@ public void onBlockPlace(final BlockPlace place) {

@Override
public void onReload(ConfigManager config) {
this.cancelVL = config.getIntElse(getConfigName() + ".cancelVL", 0);
this.cancelVL = config.getIntElse(getCheckName() + ".cancelVL", 0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import java.util.Deque;
import java.util.LinkedList;

@CheckData(name = "AntiExplosion", configName = "Explosion", setback = 10)
@CheckData(name = "AntiExplosion", setback = 10)
public class ExplosionHandler extends Check implements PostPredictionCheck {
Deque<VelocityData> firstBreadMap = new LinkedList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.LinkedList;

// We are making a velocity sandwich between two pieces of transaction packets (bread)
@CheckData(name = "AntiKB", alternativeName = "AntiKnockback", configName = "Knockback", setback = 10, decay = 0.025)
@CheckData(name = "AntiKB", alternativeName = "AntiKnockback", setback = 10, decay = 0.025)
public class KnockbackHandler extends Check implements PostPredictionCheck {
Deque<VelocityData> firstBreadMap = new LinkedList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void onPostFlyingBlockPlace(BlockPlace place) {

@Override
public void onReload(ConfigManager config) {
this.cancelVL = config.getIntElse(getConfigName() + ".cancelVL", 5);
this.cancelVL = config.getIntElse(getCheckName() + ".cancelVL", 5);
}

protected boolean shouldCancel() {
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/config/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ NoSlowA:
# Verfall ist, wenn der Spieler einen Gegenstand benutzt UND dadurch verlangsamt wird
decay: 0.05

Knockback:
AntiKB:
# Mit wie viel soll der Gesamtvorteil multipliziert werden, wenn der Spieler legitim ist.
setback-decay-multiplier: 0.999
# Wie groß sollte der Abstand zur Bewegung des Spielers sein, um eine Verletzung zu erzeugen?
Expand All @@ -112,7 +112,7 @@ Knockback:
# Dies soll verhindern, dass der Spieler zu viele Verstöße sammelt und nie in der Lage ist, sie alle zu beseitigen.
max-ceiling: 4

Explosion:
AntiExplosion:
threshold: 0.001
setbackvl: 3

Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/config/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ NoSlowA:
# Decay's when the player uses an item AND is slowed by it
decay: 0.05

Knockback:
AntiKB:
# How much should we multiply total advantage by when the player is legit
setback-decay-multiplier: 0.999
# How large of an offset from the player's velocity should we create a violation for?
Expand All @@ -112,11 +112,11 @@ Knockback:
# This is to stop the player from gathering too many violations and never being able to clear them all
max-ceiling: 4

Explosion:
AntiExplosion:
threshold: 0.001
setbackvl: 3

TimerA:
Timer:
setbackvl: 10
# Milliseconds that the player can accumulate for later use when they fall behind
# Could potentially allow 1.8 fast use/fast heal/fast bow bypasses if set too high, 120 ms seems like a good balance
Expand All @@ -130,7 +130,7 @@ NegativeTimer:
# Number of milliseconds lost while moving before we should start flagging
drift: 1200

# Same check method as TimerA, but for vehicles
# Same check method as Timer, but for vehicles
TimerVehicle:
# Target 1.005 timer
setbackvl: 10
Expand Down
11 changes: 5 additions & 6 deletions src/main/resources/config/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ NoSlowA:
# Decadencia cuando un jugador usa un item Y se ralentiza por el
decay: 0.05

Knockback:
AntiKB:
# Por cuanto deberíamos multiplicar la ventaja total cuando el jugador es legítimo
setback-decay-multiplier: 0.999
# ¿Cuánta debería ser la compensacion del movimiento del jugador como para que creemos una violación?
Expand All @@ -115,12 +115,11 @@ Knockback:
# Esto es para prevenir que el jugador obtenga muchas violaciones y no pueda ser capaz de borrarlas
max-ceiling: 4


Explosion:
AntiExplosion:
threshold: 0.001
setbackvl: 3

TimerA:
Timer:
setbackvl: 10
# Milisegundos que el jugador puede acumular para ser usados mas tarde cuando se quedan por detrás
# Podría llegar a permitir pasos por alto de fast use/fast heal/fast bow en 1.8 si esta muy alto, 120 ms
Expand All @@ -135,8 +134,8 @@ NegativeTimer:
# Number of milliseconds lost while moving before we should start flagging
drift: 1200

# La misma comprobación que TimerA, pero para vehiculos
TimerVehicle:
# La misma comprobación que Timer, pero para vehiculos
VehicleTimer:
# Target 1.005 timer
setbackvl: 10

Expand Down
11 changes: 5 additions & 6 deletions src/main/resources/config/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ NoSlowA:
# Décroissance lorsque le joueur utilise un objet ET est ralenti par celui-ci.
decay: 0.05

Knockback:
AntiKB:
# De combien devons-nous multiplier l'avantage total lorsque le joueur est légitime ?
setback-decay-multiplier: 0.999
# Quel est l'écart maximal par rapport au mouvement du joueur pour lequel nous devrions créer une violation ?
Expand All @@ -112,12 +112,11 @@ Knockback:
# Cela vise à empêcher le joueur d'accumuler trop de violations et de ne jamais pouvoir toutes les réinitialiser.
max-ceiling: 4


Explosion:
AntiExplosion:
threshold: 0.001
setbackvl: 3

TimerA:
Timer:
setbackvl: 10
# Le nombre de millisecondes que le joueur peut accumuler pour une utilisation ultérieure lorsqu'il prend du retard.
# Si la valeur est trop élevée, cela pourrait potentiellement permettre de contourner les mécaniques 1.8, comme l'utilisation rapide, la guérison rapide et le tir à l'arc rapide. Une valeur de 120 ms semble être un bon équilibre.
Expand All @@ -131,8 +130,8 @@ NegativeTimer:
# Le nombre de millisecondes perdus pendant le déplacement avant de commencer à signaler des infractions.
drift: 1200

# Même méthode de vérification que TimerA, mais pour les véhicules.
TimerVehicle:
# Même méthode de vérification que Timer, mais pour les véhicules.
VehicleTimer:
# Cibler un chronomètre de 1,005.
setbackvl: 10

Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/config/it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ NoSlowA:
# Decadimento per l'uso scorretto dell'oggetto
decay: 0.05

Knockback:
AntiKB:
# Riduce gradualmente l'avanzamento totale del giocatore quando è legittimo
setback-decay-multiplier: 0.999
# Limite per creare una violazione rispetto alla velocità del giocatore
Expand All @@ -102,13 +102,13 @@ Knockback:
# Limite massimo di vantaggio accumulabile prima di arretrare il giocatore
max-ceiling: 4

Explosion:
AntiExplosion:
# Limite per rilevare l'esplosione
threshold: 0.001
# Livello di violazione per l'esplosione
setbackvl: 3

TimerA:
Timer:
# Livello di violazione per il timer
setbackvl: 10
# Millisecondi accumulabili per il timer
Expand All @@ -120,7 +120,7 @@ NegativeTimer:
# Millisecondi persi prima di rilevare il timer negativo
drift: 1200

TimerVehicle:
VehicleTimer:
# Livello di violazione per il timer dei veicoli
setbackvl: 10

Expand Down
10 changes: 5 additions & 5 deletions src/main/resources/config/ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ NoSlowA:
# プレイヤーがアイテム使用時に速度低下が発生する場合、この値によりアドバンテージの累積が減少します
decay: 0.05

Knockback:
AntiKB:
# プレイヤーが違反していない場合、総アドバンテージにどれだけの倍率を掛けるか
setback-decay-multiplier: 0.999
# プレイヤーの速度からどれだけズレたら違反とみなすか
Expand All @@ -114,11 +114,11 @@ Knockback:
# 違反が過剰に蓄積し、リセットが難しくなるのを防ぐための上限です
max-ceiling: 4

Explosion:
AntiExplosion:
threshold: 0.001
setbackvl: 3

TimerA:
Timer:
setbackvl: 10
# プレイヤーがネットワーク遅延やラグの影響で操作がサーバーの予測より遅れている場合、
# その遅れ分を後で使用できるように蓄積するためのミリ秒数を設定します。
Expand All @@ -135,8 +135,8 @@ NegativeTimer:
# ここで指定した遅延量(ミリ秒)を超えると、違反として検知される可能性があります
drift: 1200

# TimerAと同じチェック方法ですが、乗り物操作に適用されます
TimerVehicle:
# Timerと同じチェック方法ですが、乗り物操作に適用されます
VehicleTimer:
# 目標タイマー値は1.005です
setbackvl: 10

Expand Down
10 changes: 5 additions & 5 deletions src/main/resources/config/nl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ NoSlowA:
# Verval treedt op wanneer de speler een voorwerp gebruikt EN erdoor wordt vertraagd
decay: 0.05

Knockback:
AntiKB:
# Met hoeveel moeten we het totale voordeel vermenigvuldigen als de speler legitiem is?
setback-decay-multiplier: 0.999
# Hoe groot moet de afwijking van de snelheid van de speler zijn?
Expand All @@ -112,11 +112,11 @@ Knockback:
# Dit is om te voorkomen dat de speler te veel overtredingen verzamelt en ze nooit allemaal kan verwijderen
max-ceiling: 4

Explosion:
AntiExplosion:
threshold: 0.001
setbackvl: 3

TimerA:
Timer:
setbackvl: 10
# Milliseconden die de speler kan verzamelen om later te gebruiken als hij achterop raakt
# Kan mogelijk 1.8 snel gebruik/snelle genezing/snelle bron omleidingen toestaan als het te hoog is ingesteld, 120 ms lijkt een goede balans
Expand All @@ -130,8 +130,8 @@ NegativeTimer:
# Aantal milliseconden dat verloren gaat tijdens het bewegen voordat we moeten beginnen met flaggen
drift: 1200

# Dezelfde controlemethode als TimerA, maar dan voor voertuigen
TimerVehicle:
# Dezelfde controlemethode als Timer, maar dan voor voertuigen
VehicleTimer:
# Doel 1.005 timer
setbackvl: 10

Expand Down
Loading

0 comments on commit 9774167

Please sign in to comment.