public void setCashCredits(int cashCredits) { synchronized (objectMutex) { this.cashCredits = cashCredits; } if (getClient() != null && getClient().getSession() != null) { getClient().getSession().write(messageBuilder.buildCashCreditsDelta(cashCredits)); } }
public void addCashCredits(int amountToAdd) { synchronized (objectMutex) { this.cashCredits += amountToAdd; } if (getClient() != null && getClient().getSession() != null) { getClient().getSession().write(messageBuilder.buildCashCreditsDelta(cashCredits)); } }