Wire configurable punishments for RP spoof, key spoof, command book, and asset decline checks

This commit is contained in:
notme_ssa committed 2026-11-29 22:08:05 +07:00
1 parent 90523b050e
commit 406dc8470e
4 files changed
+50 -2

No files matched your search

@@ -73,6 +73,10 @@ public final class ConfigManager {
private PunishmentRule channelWhitelistRule; private PunishmentRule channelWhitelistRule;
private PunishmentRule geyserSpoofRule; private PunishmentRule geyserSpoofRule;
private PunishmentRule blockedVirtualHostRule; private PunishmentRule blockedVirtualHostRule;
private PunishmentRule rpSpoofRule;
private PunishmentRule keySpoofRule;
private PunishmentRule commandBookRule;
private PunishmentRule assetDeclinedRule;
// Translatable / Anvil / Sign / Book probes // Translatable / Anvil / Sign / Book probes
private boolean translatableEnabled; private boolean translatableEnabled;
@@ -299,6 +303,10 @@ public final class ConfigManager {
channelWhitelistRule = readRule("channel-whitelist", "%prefix% &e%player% flagged! &cNon-whitelisted channel: %channel%", "%player% flagged! Non-whitelisted channel: %channel%"); channelWhitelistRule = readRule("channel-whitelist", "%prefix% &e%player% flagged! &cNon-whitelisted channel: %channel%", "%player% flagged! Non-whitelisted channel: %channel%");
geyserSpoofRule = readRule("geyser-spoof-check", "%prefix% &e%player% flagged! &cGeyser/Bedrock spoof detected", "%player% flagged! Geyser spoof"); geyserSpoofRule = readRule("geyser-spoof-check", "%prefix% &e%player% flagged! &cGeyser/Bedrock spoof detected", "%player% flagged! Geyser spoof");
blockedVirtualHostRule = readRule("blocked-virtual-hosts", "%prefix% &e%player% flagged! &cBlocked virtual host: %host%", "%player% flagged! Blocked virtual host: %host%"); blockedVirtualHostRule = readRule("blocked-virtual-hosts", "%prefix% &e%player% flagged! &cBlocked virtual host: %host%", "%player% flagged! Blocked virtual host: %host%");
rpSpoofRule = readRule("resource-pack-spoof-check", "%prefix% &e%player% flagged! &cResource-Pack Spoofer detected (%reason%)", "%player% flagged! Resource-Pack Spoofer (%reason%)");
keySpoofRule = readRule("key-spoof-probe", "%prefix% &e%player% flagged! &cKey Spoof detected (%reason%)", "%player% flagged! Key Spoof (%reason%)");
commandBookRule = readRule("command-book", "%prefix% &e%player% flagged! &cCommand-book verification blocked", "%player% flagged! Command-book blocked");
assetDeclinedRule = readRule("asset-probe.declined", "%prefix% &e%player% flagged! &cDeclined required verification resource pack", "%player% flagged! Declined verification resource pack");
blockedVirtualHosts.clear(); blockedVirtualHosts.clear();
for (String h : config.getStringList("blocked-virtual-hosts.hosts")) { for (String h : config.getStringList("blocked-virtual-hosts.hosts")) {
@@ -550,6 +558,10 @@ public final class ConfigManager {
public PunishmentRule getChannelWhitelistRule() { return channelWhitelistRule; } public PunishmentRule getChannelWhitelistRule() { return channelWhitelistRule; }
public PunishmentRule getGeyserSpoofRule() { return geyserSpoofRule; } public PunishmentRule getGeyserSpoofRule() { return geyserSpoofRule; }
public PunishmentRule getBlockedVirtualHostRule() { return blockedVirtualHostRule; } public PunishmentRule getBlockedVirtualHostRule() { return blockedVirtualHostRule; }
public PunishmentRule getRpSpoofRule() { return rpSpoofRule; }
public PunishmentRule getKeySpoofRule() { return keySpoofRule; }
public PunishmentRule getCommandBookRule() { return commandBookRule; }
public PunishmentRule getAssetDeclinedRule() { return assetDeclinedRule; }
public boolean isTranslatableEnabled() { return translatableEnabled; } public boolean isTranslatableEnabled() { return translatableEnabled; }
public ProbeMode getDefaultProbeMode() { return defaultProbeMode; } public ProbeMode getDefaultProbeMode() { return defaultProbeMode; }
@@ -294,6 +294,12 @@ public final class AntiSpoofPlugin extends JavaPlugin {
List<String> commands, List<String> commands,
long threatLevel long threatLevel
) { ) {
if (player == null || commands == null || commands.isEmpty()) {
return;
}
if (isBypassed(player.getUniqueId()) || player.hasPermission("antispoof.bypass")) {
return;
}
PunishmentTier tier = new PunishmentTier(violationType, commands, reason, brand, violatedChannel); PunishmentTier tier = new PunishmentTier(violationType, commands, reason, brand, violatedChannel);
AntiSpoofPrePunishmentEvent preEvent = new AntiSpoofPrePunishmentEvent(player, tier, threatLevel); AntiSpoofPrePunishmentEvent preEvent = new AntiSpoofPrePunishmentEvent(player, tier, threatLevel);
Bukkit.getPluginManager().callEvent(preEvent); Bukkit.getPluginManager().callEvent(preEvent);
@@ -306,7 +312,9 @@ public final class AntiSpoofPlugin extends JavaPlugin {
for (String rawCmd : commands) { for (String rawCmd : commands) {
String formatted = PlaceholderFormatter.formatTemplate(this, player, rawCmd) String formatted = PlaceholderFormatter.formatTemplate(this, player, rawCmd)
.replace("%reason%", reason) .replace("%reason%", reason)
.replace("%type%", violationType); .replace("%type%", violationType)
.replace("%mod%", violatedChannel != null ? violatedChannel : "")
.replace("%channel%", violatedChannel != null ? violatedChannel : "");
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), formatted); Bukkit.dispatchCommand(Bukkit.getConsoleSender(), formatted);
playerLogManager.log(player, LogType.PUNISH, "Ran command: " + formatted); playerLogManager.log(player, LogType.PUNISH, "Ran command: " + formatted);
} }
@@ -340,6 +348,10 @@ public final class AntiSpoofPlugin extends JavaPlugin {
case ViolationType.CHANNEL_WHITELIST -> configManager.getChannelWhitelistRule(); case ViolationType.CHANNEL_WHITELIST -> configManager.getChannelWhitelistRule();
case ViolationType.GEYSER_SPOOF -> configManager.getGeyserSpoofRule(); case ViolationType.GEYSER_SPOOF -> configManager.getGeyserSpoofRule();
case ViolationType.BLOCKED_VIRTUAL_HOST -> configManager.getBlockedVirtualHostRule(); case ViolationType.BLOCKED_VIRTUAL_HOST -> configManager.getBlockedVirtualHostRule();
case ViolationType.RESOURCE_PACK_SPOOF, ViolationType.RESOURCE_PACK_INTEGRITY -> configManager.getRpSpoofRule();
case ViolationType.KEY_SPOOF_DETECTED, ViolationType.KEY_SPOOF_RP_REJECTED -> configManager.getKeySpoofRule();
case ViolationType.COMMAND_BOOK_BLOCKED -> configManager.getCommandBookRule();
case ViolationType.ASSET_DECLINED -> configManager.getAssetDeclinedRule();
default -> null; default -> null;
}; };
} }
@@ -195,6 +195,11 @@ public final class AssetProbeListener implements Listener {
session.currentPackId = null; session.currentPackId = null;
if (item.control()) { if (item.control()) {
if (status == PlayerResourcePackStatusEvent.Status.DECLINED) {
plugin.flagPlayer(player, ViolationType.ASSET_DECLINED, "Declined asset probe control pack (" + item.checkType() + ")");
finishSession(player, session);
return;
}
if (item.checkType() == AssetCheckType.TEXTURES) { if (item.checkType() == AssetCheckType.TEXTURES) {
session.bitmapControlStatus = status.name(); session.bitmapControlStatus = status.name();
// On 1.20.5+ (protocol >= 766), a missing bitmap in font/default.json MUST return FAILED_RELOAD. // On 1.20.5+ (protocol >= 766), a missing bitmap in font/default.json MUST return FAILED_RELOAD.
+20 -1
View File
@@ -209,6 +209,10 @@ anvil-probe:
command-book: command-book:
enabled: false enabled: false
discord-alert: true
punish: false
punishments:
- "kick %player% Please complete server verification"
identity-linker: identity-linker:
enabled: false enabled: false
@@ -229,6 +233,12 @@ probe-freeze:
asset-probe: asset-probe:
enabled: false enabled: false
declined:
enabled: true
discord-alert: true
punish: false
punishments:
- "kick %player% Please accept the server resource pack"
rules: rules:
meteor-logo: meteor-logo:
enabled: true enabled: true
@@ -237,17 +247,26 @@ asset-probe:
name: "Meteor Client" name: "Meteor Client"
punish: false punish: false
discord-alert: true discord-alert: true
punishments: [] punishments:
- "ban %player% Illegal client detected (Meteor Client)"
key-spoof-probe: key-spoof-probe:
enabled: true enabled: true
require-pack: true require-pack: true
discord-alert: true
punish: false
punishments:
- "ban %player% Client key spoofing detected"
resource-pack-spoof-check: resource-pack-spoof-check:
enabled: true enabled: true
honeypot-bad-sha1: true honeypot-bad-sha1: true
proof-of-apply: true proof-of-apply: true
require-pack: true require-pack: true
discord-alert: true
punish: false
punishments:
- "ban %player% Resource-pack spoofer detected"
proxy-detection: proxy-detection:
enabled: true enabled: true