mirror of
https://github.com/funkemunky/AntiVPN.git
synced 2026-05-31 09:31:54 +00:00
Fixing webhook spam
This commit is contained in:
@@ -20,6 +20,7 @@ import com.github.benmanes.caffeine.cache.Cache;
|
||||
import com.github.benmanes.caffeine.cache.Caffeine;
|
||||
import dev.brighten.antivpn.AntiVPN;
|
||||
import dev.brighten.antivpn.message.VpnString;
|
||||
import dev.brighten.antivpn.webhook.WebhookNotifier;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@@ -92,6 +93,7 @@ public abstract class APIPlayer {
|
||||
if(cachedResult.response().getIp().equals(ip.getHostAddress())) {
|
||||
AntiVPN.getInstance().getExecutor().log(Level.FINE, "Cached result for " + ip.getHostAddress() + " is " + cachedResult.resultType());
|
||||
if(cachedResult.resultType().isShouldBlock()) {
|
||||
WebhookNotifier.sendWebhookNotification(this, cachedResult);
|
||||
AntiVPN.getInstance().getExecutor().handleKickingOfPlayer(cachedResult, this);
|
||||
}
|
||||
onResult.accept(cachedResult);
|
||||
@@ -135,6 +137,7 @@ public abstract class APIPlayer {
|
||||
|
||||
checkResultCache.put(ip.getHostAddress(), new CheckResult(checkResult.response(), checkResult.resultType(), true));
|
||||
if(checkResult.resultType().isShouldBlock()) {
|
||||
WebhookNotifier.sendWebhookNotification(this, checkResult);
|
||||
AntiVPN.getInstance().getExecutor().handleKickingOfPlayer(checkResult, this);
|
||||
}
|
||||
onResult.accept(checkResult);
|
||||
|
||||
@@ -23,7 +23,6 @@ import dev.brighten.antivpn.utils.Tuple;
|
||||
import dev.brighten.antivpn.utils.json.JSONException;
|
||||
import dev.brighten.antivpn.web.FunkemunkyAPI;
|
||||
import dev.brighten.antivpn.web.objects.VPNResponse;
|
||||
import dev.brighten.antivpn.webhook.WebhookNotifier;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -78,7 +77,6 @@ public abstract class VPNExecutor {
|
||||
|
||||
public void handleKickingOfPlayer(CheckResult result, APIPlayer player) {
|
||||
// Send webhook notification if enabled
|
||||
WebhookNotifier.sendWebhookNotification(player, result);
|
||||
|
||||
//Ensuring kick task is always running
|
||||
if(kickTask == null || kickTask.isDone() || kickTask.isCancelled()) {
|
||||
|
||||
Reference in New Issue
Block a user