Initial commit: SynapseAiAnticheat v3.2 source, Maven, and IDEA setup

This commit is contained in:
xoo0524tw committed 2026-12-02 20:37:39 +08:00
commit a9337d2628
59 files changed
+9541

No files matched your search

@@ -0,0 +1,195 @@
package net.synapselabs.anticheat.engine;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import net.synapselabs.anticheat.data.ThreatState;
public record DetectionSnapshot(
UUID playerId,
String playerName,
long timestamp,
float rawScore,
float confidence,
float suspicion,
float killauraConfidence,
float aimConfidence,
ThreatState threatState,
List<String> hardViolations,
List<String> aiViolations,
FeatureVector featureVector,
Map<String, Object> metadata,
String verdict,
float riskScore,
List<String> reasons
) {
public boolean hasHardViolations() {
return this.hardViolations != null && !this.hardViolations.isEmpty();
}
public boolean hasAiViolations() {
return this.aiViolations != null && !this.aiViolations.isEmpty();
}
public boolean isFlagged() {
return "CHEAT".equals(this.verdict) || this.hasHardViolations() || this.hasAiViolations();
}
public boolean isActionable() {
return "CHEAT".equals(this.verdict);
}
public String getPrimaryViolation() {
if (this.hasHardViolations()) {
return this.hardViolations.get(0);
} else if (this.hasAiViolations()) {
return this.aiViolations.get(0);
} else if (this.reasons != null && !this.reasons.isEmpty()) {
String firstReason = this.reasons.get(0);
int lastSpace = firstReason.lastIndexOf(32);
return lastSpace > 0 && firstReason.endsWith("%") ? firstReason.substring(0, lastSpace) : firstReason;
} else {
return "Clean";
}
}
public int getRiskPercent() {
return Math.round(Math.max(0.0F, Math.min(1.0F, this.riskScore)) * 100.0F);
}
public int getConfidencePercent() {
return Math.round(this.confidence * 100.0F);
}
public int getSuspicionPercent() {
return Math.round(this.suspicion * 100.0F);
}
public int getKillauraPercent() {
return Math.round(this.killauraConfidence * 100.0F);
}
public int getAimPercent() {
return Math.round(this.aimConfidence * 100.0F);
}
public static DetectionSnapshot.Builder builder(UUID playerId, String playerName) {
return new DetectionSnapshot.Builder(playerId, playerName);
}
public static class Builder {
private final UUID playerId;
private final String playerName;
private long timestamp = System.currentTimeMillis();
private float rawScore = 0.0F;
private float confidence = 0.0F;
private float suspicion = 0.0F;
private float killauraConfidence = 0.0F;
private float aimConfidence = 0.0F;
private ThreatState threatState = ThreatState.CLEAN;
private List<String> hardViolations = Collections.emptyList();
private List<String> aiViolations = Collections.emptyList();
private FeatureVector featureVector = null;
private Map<String, Object> metadata = Collections.emptyMap();
private String verdict = "LEGIT";
private float riskScore = 0.0F;
private List<String> reasons = Collections.emptyList();
public Builder(UUID playerId, String playerName) {
this.playerId = playerId;
this.playerName = playerName;
}
public DetectionSnapshot.Builder timestamp(long timestamp) {
this.timestamp = timestamp;
return this;
}
public DetectionSnapshot.Builder rawScore(float rawScore) {
this.rawScore = rawScore;
return this;
}
public DetectionSnapshot.Builder confidence(float confidence) {
this.confidence = confidence;
return this;
}
public DetectionSnapshot.Builder suspicion(float suspicion) {
this.suspicion = suspicion;
return this;
}
public DetectionSnapshot.Builder killauraConfidence(float killauraConfidence) {
this.killauraConfidence = killauraConfidence;
return this;
}
public DetectionSnapshot.Builder aimConfidence(float aimConfidence) {
this.aimConfidence = aimConfidence;
return this;
}
public DetectionSnapshot.Builder threatState(ThreatState threatState) {
this.threatState = threatState;
return this;
}
public DetectionSnapshot.Builder hardViolations(List<String> hardViolations) {
this.hardViolations = hardViolations;
return this;
}
public DetectionSnapshot.Builder aiViolations(List<String> aiViolations) {
this.aiViolations = aiViolations;
return this;
}
public DetectionSnapshot.Builder featureVector(FeatureVector featureVector) {
this.featureVector = featureVector;
return this;
}
public DetectionSnapshot.Builder metadata(Map<String, Object> metadata) {
this.metadata = metadata;
return this;
}
public DetectionSnapshot.Builder verdict(String verdict) {
this.verdict = verdict;
return this;
}
public DetectionSnapshot.Builder riskScore(float riskScore) {
this.riskScore = riskScore;
return this;
}
public DetectionSnapshot.Builder reasons(List<String> reasons) {
this.reasons = reasons;
return this;
}
public DetectionSnapshot build() {
return new DetectionSnapshot(
this.playerId,
this.playerName,
this.timestamp,
this.rawScore,
this.confidence,
this.suspicion,
this.killauraConfidence,
this.aimConfidence,
this.threatState,
this.hardViolations,
this.aiViolations,
this.featureVector,
this.metadata,
this.verdict,
this.riskScore,
this.reasons
);
}
}
}