Discord Webhook Notifier
DiscordWebhookNotifier sends embedded alerts to a Discord channel when relevant events occur. All using the standard java.net.http.HttpClient (Java 11+) API — no JDA, no OkHttp, no external dependencies.
Configuration
enabled = !webhook_url.isEmpty() && HttpClient != null. If the JVM cannot instantiate HttpClient.newBuilder(), the notifier is silently disabled.
HttpClient (No External Libraries)
HttpRequest.BodyPublishers.ofString(json, UTF_8)— POST JSON methodHttpResponse.BodyHandlers.discarding()— does not parse response- Global 8s timeout +
CompletableFuture.orTimeout(10s, TimeUnit.SECONDS)
2xx range are logged as a warning: [Discord] Webhook returned HTTP 404.
Events That Trigger an Embed
DiscordWebhookNotifier is registered as a listener of TransactionLogService:
Embed Structure: Transaction > Threshold
discord.threshold.title,discord.threshold.descdiscord.dupe.title,discord.error.titlediscord.tx_type.PLAYER_PAYetc. (24+ keys, one per TxType)discord.field.txid,discord.field.currency,discord.field.amount…
config.language (of the 11 supported). If a key is missing, the raw TxType name is shown as a fallback.
Anti-spam LRU (500 IDs)
To avoid spam from repeated flushes, aRollingLinkedHashSet extends LinkedHashSet<String> of 500 max entries is used. When it reaches max size, it evicts the oldest by insertion order.
Registered keys:
- Normal transactions → raw
txId - Duplicates →
DUPE:prefix +txId
