Skip to content

feat: add combination (AND) blacklist rules - #394

Open
netcrafts wants to merge 1 commit into
QuiltServerTools:masterfrom
netcrafts:feat/and-blacklist-rules
Open

netcrafts wants to merge 1 commit into
QuiltServerTools:masterfrom
netcrafts:feat/and-blacklist-rules

Conversation

@netcrafts

@netcrafts netcrafts commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

What does this change?

Adds combinationBlacklist to the [actions] config section. Each rule is an inline TOML table where all specified fields must match for an action to be suppressed (AND logic). The existing flat blacklists (typeBlacklist, objectBlacklist, sourceBlacklist, worldBlacklist) are evaluated first and are unchanged.

Rules now also support an optional spatial area filter: specify centerX, centerY, centerZ, and range to suppress all actions within a Chebyshev cube of the given radius around a fixed coordinate.

Why?

The existing blacklists use OR logic — adding an entry to any list suppresses every action that matches that single field. This makes it impossible to express rules like "suppress snow golem snow block placements without suppressing all block-place events or all snow interactions". Equally, there is no way to suppress logging within a specific zone (e.g. a spawn protection area) without blacklisting an entire dimension.

How?

CombinationBlacklistRule — data class with optional fields type, world, object, source, centerX, centerY, centerZ, range. Omitted fields are wildcards. matches() returns false for an empty/all-null rule, otherwise ANDs every non-null field against the action. The object field checks both objectIdentifier and oldObjectIdentifier, consistent with objectBlacklist. All four area fields (centerX/Y/Z + range >= 1) must be present together for the area check to apply; a partial spec is silently treated as no area filter.

ActionsSpec — one new required<List<CombinationBlacklistRule>> entry.

ActionType.isBlacklisted() — appends one clause at the end:

config[ActionsSpec.combinationBlacklist].any { it.matches(this) }

migrateConfig()appendKeyIfMissing() inserts the new key into existing ledger.toml files on first launch after upgrade, so users do not need to manually edit their config.

Config example

combinationBlacklist = [
  { type = "block-place", object = "minecraft:snow", source = "snow_golem" },
  { type = "block-place", object = "minecraft:dirt" },
  { world = "minecraft:overworld", centerX = 0, centerY = 64, centerZ = 0, range = 50 },
]

Backward compatibility

Servers upgrading from an older version do not need to touch their config. migrateConfig() writes the new key (with a commented example) automatically on the first restart after the jar is replaced.

@netcrafts
netcrafts requested a review from a team as a code owner September 3, 2026 13:44
@netcrafts
netcrafts force-pushed the feat/and-blacklist-rules branch from 013f5b4 to ef42ed6 Compare September 3, 2026 20:41
- Add combinationBlacklist to [actions] config: each rule is an inline
  TOML table where ALL specified fields must match to suppress an action
  (AND logic). Flat blacklists are evaluated first and unchanged.
- Supported fields: type, world, object, source, centerX, centerY,
  centerZ, range. Omitted fields are wildcards.
- Area filter: all four of centerX/Y/Z + range (>= 1) must be specified
  together; partial spec is silently skipped.
- CombinationBlacklistRule: new data class with matches() implementing
  AND logic and Chebyshev cube range check.
- ActionsSpec: new required<List<CombinationBlacklistRule>> entry.
- ActionType.isBlacklisted(): one appended clause for combination rules.
- migrateConfig(): appendKeyIfMissing() inserts the new key into existing
  ledger.toml files on first launch after upgrade.
- Style: trailing comma cleanup in AbstractActionType, MessageUtils,
  PageCommand.
@netcrafts
netcrafts force-pushed the feat/and-blacklist-rules branch from ef42ed6 to ac92d04 Compare September 3, 2026 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant