Chat Reward
Chat Reward gives points to players who congratulate a buyer in chat after a public purchase announcement.
How it works
- A player completes a purchase that is publicly announced, meaning the offer does not use
hideAnnouncment: true. - If the purchase price is at least
MIN_PURCHASE_PRICE, a reward window opens forWINDOW_SECONDS. - Players who write a message matching
PATTERNduring that window receive a random amount of points betweenMIN_POINTSandMAX_POINTS.
Each player is rewarded at most once per announced purchase. The buyer is never rewarded.
Chat Reward works with chat plugins that cancel and resend messages, such as ChatControl and CMI, and with Paper's AsyncChatEvent.
Configuration
The settings are stored in plugins/PixaWallet/settings.yml:
ChatReward:
ENABLED: true
PATTERN: '(?i)\b(gg|gz)\b'
MIN_POINTS: 5
MAX_POINTS: 50
WINDOW_SECONDS: 30
MIN_PURCHASE_PRICE: 100
DAILY_LIMIT: 5
SKIP_SAME_IP: true| Setting | Default | Description |
|---|---|---|
ChatReward.ENABLED | true | Enables Chat Reward. |
ChatReward.PATTERN | '(?i)\b(gg|gz)\b' | Java regular expression a chat message must match. |
ChatReward.MIN_POINTS | 5 | Minimum number of points per reward. |
ChatReward.MAX_POINTS | 50 | Maximum number of points per reward. |
ChatReward.WINDOW_SECONDS | 30 | How long the reward window stays open after an announced purchase. |
ChatReward.MIN_PURCHASE_PRICE | 100 | Minimum purchase price that opens a reward window. |
ChatReward.DAILY_LIMIT | 5 | Maximum rewards per player per day. 0 means unlimited. |
ChatReward.SKIP_SAME_IP | true | Skips players on the same IP address as the buyer. |
Pattern
PATTERN is a Java regular expression tested with find(), so it only needs to match part of the message.
(?i)ignores letter case.\bmatches whole words only, soggandgz!match, buteggdoes not.
Add a word to the group to accept it as well:
ChatReward:
PATTERN: '(?i)\b(gg|gz|gratki)\b'ChatReward:
PATTERN: '(?i)\b(gg|gz|gratki|congrats)\b'Keep the pattern in single quotes so YAML does not interpret the backslashes.
Daily limit
DAILY_LIMIT is counted per server and kept in memory. It resets at midnight and when the server restarts.
Same IP address
With SKIP_SAME_IP: true, players connecting from the same IP address as the buyer are not rewarded.
BungeeCord and Velocity
Behind a proxy, SKIP_SAME_IP requires IP forwarding. Without it, every player appears to have the proxy's address. When testing with two accounts on one PC, set SKIP_SAME_IP: false.
Networks
On a network, each server has its own reward window. Only players on the server where the purchase happened can earn the reward. See Multi-server (MySQL) for recommended lobby settings.
Message
The reward message uses the Wallet.Chat_Reward key. See Messages for its placeholders.
Rewards do not work
Set DebugMessages.CHAT_REWARD: true to log every chat message and the reward window state to the console. Disable it again after testing.
