Wire configurable punishments for RP spoof, key spoof, command book, and asset decline checks
This commit is contained in:
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 geyserSpoofRule;
|
||||
private PunishmentRule blockedVirtualHostRule;
|
||||
private PunishmentRule rpSpoofRule;
|
||||
private PunishmentRule keySpoofRule;
|
||||
private PunishmentRule commandBookRule;
|
||||
private PunishmentRule assetDeclinedRule;
|
||||
|
||||
// Translatable / Anvil / Sign / Book probes
|
||||
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%");
|
||||
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%");
|
||||
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();
|
||||
for (String h : config.getStringList("blocked-virtual-hosts.hosts")) {
|
||||
@@ -550,6 +558,10 @@ public final class ConfigManager {
|
||||
public PunishmentRule getChannelWhitelistRule() { return channelWhitelistRule; }
|
||||
public PunishmentRule getGeyserSpoofRule() { return geyserSpoofRule; }
|
||||
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 ProbeMode getDefaultProbeMode() { return defaultProbeMode; }
|
||||
|
||||
@@ -294,6 +294,12 @@ public final class AntiSpoofPlugin extends JavaPlugin {
|
||||
List<String> commands,
|
||||
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);
|
||||
AntiSpoofPrePunishmentEvent preEvent = new AntiSpoofPrePunishmentEvent(player, tier, threatLevel);
|
||||
Bukkit.getPluginManager().callEvent(preEvent);
|
||||
@@ -306,7 +312,9 @@ public final class AntiSpoofPlugin extends JavaPlugin {
|
||||
for (String rawCmd : commands) {
|
||||
String formatted = PlaceholderFormatter.formatTemplate(this, player, rawCmd)
|
||||
.replace("%reason%", reason)
|
||||
.replace("%type%", violationType);
|
||||
.replace("%type%", violationType)
|
||||
.replace("%mod%", violatedChannel != null ? violatedChannel : "")
|
||||
.replace("%channel%", violatedChannel != null ? violatedChannel : "");
|
||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), 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.GEYSER_SPOOF -> configManager.getGeyserSpoofRule();
|
||||
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;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -195,6 +195,11 @@ public final class AssetProbeListener implements Listener {
|
||||
session.currentPackId = null;
|
||||
|
||||
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) {
|
||||
session.bitmapControlStatus = status.name();
|
||||
// On 1.20.5+ (protocol >= 766), a missing bitmap in font/default.json MUST return FAILED_RELOAD.
|
||||
|
||||
@@ -209,6 +209,10 @@ anvil-probe:
|
||||
|
||||
command-book:
|
||||
enabled: false
|
||||
discord-alert: true
|
||||
punish: false
|
||||
punishments:
|
||||
- "kick %player% Please complete server verification"
|
||||
|
||||
identity-linker:
|
||||
enabled: false
|
||||
@@ -229,6 +233,12 @@ probe-freeze:
|
||||
|
||||
asset-probe:
|
||||
enabled: false
|
||||
declined:
|
||||
enabled: true
|
||||
discord-alert: true
|
||||
punish: false
|
||||
punishments:
|
||||
- "kick %player% Please accept the server resource pack"
|
||||
rules:
|
||||
meteor-logo:
|
||||
enabled: true
|
||||
@@ -237,17 +247,26 @@ asset-probe:
|
||||
name: "Meteor Client"
|
||||
punish: false
|
||||
discord-alert: true
|
||||
punishments: []
|
||||
punishments:
|
||||
- "ban %player% Illegal client detected (Meteor Client)"
|
||||
|
||||
key-spoof-probe:
|
||||
enabled: true
|
||||
require-pack: true
|
||||
discord-alert: true
|
||||
punish: false
|
||||
punishments:
|
||||
- "ban %player% Client key spoofing detected"
|
||||
|
||||
resource-pack-spoof-check:
|
||||
enabled: true
|
||||
honeypot-bad-sha1: true
|
||||
proof-of-apply: true
|
||||
require-pack: true
|
||||
discord-alert: true
|
||||
punish: false
|
||||
punishments:
|
||||
- "ban %player% Resource-pack spoofer detected"
|
||||
|
||||
proxy-detection:
|
||||
enabled: true
|
||||
|
||||
Reference in new issue
Block a user