Skip to content

Chat Reward ​

Chat Reward gives points to players who congratulate a buyer in chat after a public purchase announcement.

How it works ​

  1. A player completes a purchase that is publicly announced, meaning the offer does not use hideAnnouncment: true.
  2. If the purchase price is at least MIN_PURCHASE_PRICE, a reward window opens for WINDOW_SECONDS.
  3. Players who write a message matching PATTERN during that window receive a random amount of points between MIN_POINTS and MAX_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:

yaml
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
SettingDefaultDescription
ChatReward.ENABLEDtrueEnables Chat Reward.
ChatReward.PATTERN'(?i)\b(gg|gz)\b'Java regular expression a chat message must match.
ChatReward.MIN_POINTS5Minimum number of points per reward.
ChatReward.MAX_POINTS50Maximum number of points per reward.
ChatReward.WINDOW_SECONDS30How long the reward window stays open after an announced purchase.
ChatReward.MIN_PURCHASE_PRICE100Minimum purchase price that opens a reward window.
ChatReward.DAILY_LIMIT5Maximum rewards per player per day. 0 means unlimited.
ChatReward.SKIP_SAME_IPtrueSkips 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.
  • \b matches whole words only, so gg and gz! match, but egg does not.

Add a word to the group to accept it as well:

yaml
ChatReward:
  PATTERN: '(?i)\b(gg|gz|gratki)\b'
yaml
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.

PixaDev is owned and built by DonPedroTV.