Fixing webhook spam

This commit is contained in:
2026-02-20 09:29:52 -05:00
parent 51340754e6
commit 95d8747bd5
2 changed files with 3 additions and 2 deletions
@@ -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()) {