Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public class EconomyService implements IMessageReceiveListener {
private static final Pattern BANK_NEW_BALANCE_PAYDAY_PATTERN = compile("^Neuer Betrag: (?<amount>\\d+)\\$ \\([+-]\\d+\\$\\)$");
private static final Pattern BANK_TRANSFER_TO_PATTERN = compile("^Du hast (?:\\[UC])?(?<playerName>[a-zA-Z0-9_]+) (?<amount>\\d+)\\$ überwiesen!$");
private static final Pattern BANK_TRANSFER_GET_PATTERN = compile("^(?:\\[UC])?(?<playerName>[a-zA-Z0-9_]+) hat dir (?<amount>\\d+)\\$ überwiesen!$");
private static final Pattern BANK_NEW_BALANCE_BANK_PATTERN = compile("^Neuer Bankkontostand: (?<amount>\\d+)\\$$");
private static final Pattern BANK_NEW_BALANCE_CASH_PATTERN = compile("^Neuer Bargeldbestand: (?<amount>\\d+)\\$$");

// cash
private static final Pattern CASH_GIVE_PATTERN = compile("^Du hast (?:\\[UC])?(?<playerName>[a-zA-Z0-9_]+) (?<amount>\\d+)\\$ gegeben!$");
Expand Down Expand Up @@ -101,6 +103,20 @@ public boolean onMessageReceive(Text text, String message) {
return true;
}

Matcher bankNewBalanceBankMatcher = BANK_NEW_BALANCE_BANK_PATTERN.matcher(message);
if (bankNewBalanceBankMatcher.find()) {
int amount = parseInt(bankNewBalanceBankMatcher.group("amount"));
configuration.setMoneyBankAmount(amount);
return true;
}

Matcher bankNewBalanceCashMatcher = BANK_NEW_BALANCE_CASH_PATTERN.matcher(message);
if (bankNewBalanceCashMatcher.find()) {
int amount = parseInt(bankNewBalanceCashMatcher.group("amount"));
configuration.setMoneyCashAmount(amount);
return true;
}

Matcher cashGiveMatcher = CASH_GIVE_PATTERN.matcher(message);
if (cashGiveMatcher.find()) {
int amount = parseInt(cashGiveMatcher.group("amount"));
Expand Down