This commit is contained in:
kirillsaint 2024-01-01 16:22:21 +06:00
parent 8086c8b840
commit eb6513e818
3 changed files with 39 additions and 22 deletions

View File

@ -368,6 +368,7 @@ public class Client {
logger.info("---------[ Silent Client Stopping ]--------------");
logger.info("STOPPING > silent-socket");
Players.unregister();
skillIssue.sendDetections();
logger.info("-------------------------------------------------");
}

View File

@ -1,18 +1,49 @@
package net.silentclient.client.skillissue;
import net.silentclient.client.Client;
import net.silentclient.client.event.EventManager;
import net.silentclient.client.event.EventTarget;
import net.silentclient.client.event.impl.ClientTickEvent;
import net.silentclient.client.skillissue.detections.Detection;
import net.silentclient.client.skillissue.detections.Reach;
import net.silentclient.client.utils.Requests;
import net.silentclient.client.utils.TimerUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
public class SkillIssue {
public static final String VERSION = "1.0.0-beta.1";
private final ArrayList<Detection> detections = new ArrayList<>();
private TimerUtils timer;
public SkillIssue() {
EventManager.register(this);
Client.logger.info(String.format("[SkillIssue]: Initialising (v%s)", VERSION));
detections.add(new Reach(this));
timer = new TimerUtils();
}
@EventTarget
public void tickEvent(ClientTickEvent event) {
if(timer.delay(30000)) {
timer.reset();
(new Thread(this::sendDetections)).start();
}
}
public void sendDetections() {
JSONArray jsonArray = new JSONArray();
for(Detection detection : detections) {
for(String detectReason : detection.getDetections()) {
jsonArray.put(new JSONObject().put("type", detection.getName().toLowerCase()).put("message", detectReason));
}
detection.getDetections().clear();
}
JSONObject jsonObject = new JSONObject().put("detects", jsonArray);
Requests.post("https://api.silentclient.net/anticheat/detect", jsonObject.toString());
}
public ArrayList<Detection> getDetections() {

View File

@ -3,18 +3,15 @@ package net.silentclient.client.skillissue.detections;
import net.minecraft.client.Minecraft;
import net.silentclient.client.Client;
import net.silentclient.client.event.EventManager;
import net.silentclient.client.event.EventTarget;
import net.silentclient.client.event.impl.ClientTickEvent;
import net.silentclient.client.skillissue.SkillIssue;
import net.silentclient.client.utils.Requests;
import org.json.JSONObject;
import java.util.ArrayList;
public class Detection {
protected Minecraft mc = Minecraft.getMinecraft();
protected SkillIssue skillIssue;
protected int detections = 0;
protected long lastDetection = 0;
private final String name;
protected ArrayList<String> detections = new ArrayList<>();
public Detection(SkillIssue skillIssue, String name) {
this.skillIssue = skillIssue;
@ -23,24 +20,12 @@ public class Detection {
}
public void detect(String data) {
this.detections += 1;
this.lastDetection = System.currentTimeMillis();
Client.logger.warn(String.format("[SkillIssue]: %s Detection: %s (vl: %s)", name, data, detections));
(new Thread(() -> {
Requests.post("https://api.silentclient.net/anticheat/detect", new JSONObject().put("type", name.toLowerCase()).put("message", data).toString());
if(detections >= 10) {
Client.getInstance().updateUserInformation();
}
})).start();
this.detections.add(data);
Client.logger.warn(String.format("[SkillIssue]: %s Detection: %s (vl: %s)", name, data, detections.size()));
}
@EventTarget
public void updateDetection(ClientTickEvent event) {
if(lastDetection != 0) {
if(System.currentTimeMillis() - lastDetection >= 600000) {
lastDetection = 0;
}
}
public ArrayList<String> getDetections() {
return detections;
}
public String getName() {