Merge pull request #87 from Silent-Client/PREMIUM2

Premium2
This commit is contained in:
kirillsaint 2024-01-01 16:35:52 +06:00 committed by GitHub
commit 736d08a2bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 22 deletions

View File

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

View File

@ -1,18 +1,52 @@
package net.silentclient.client.skillissue; package net.silentclient.client.skillissue;
import net.silentclient.client.Client; 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.Detection;
import net.silentclient.client.skillissue.detections.Reach; 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; import java.util.ArrayList;
public class SkillIssue { public class SkillIssue {
public static final String VERSION = "1.0.0-beta.1"; public static final String VERSION = "1.0.0-beta.1";
private final ArrayList<Detection> detections = new ArrayList<>(); private final ArrayList<Detection> detections = new ArrayList<>();
private TimerUtils timer;
public SkillIssue() { public SkillIssue() {
EventManager.register(this);
Client.logger.info(String.format("[SkillIssue]: Initialising (v%s)", VERSION)); Client.logger.info(String.format("[SkillIssue]: Initialising (v%s)", VERSION));
detections.add(new Reach(this)); 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();
}
if(jsonArray.isEmpty()) {
return;
}
JSONObject jsonObject = new JSONObject().put("detects", jsonArray);
Requests.post("https://api.silentclient.net/anticheat/detect", jsonObject.toString());
} }
public ArrayList<Detection> getDetections() { public ArrayList<Detection> getDetections() {

View File

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