Reward shards on thank claim instead of when being thanked

This commit is contained in:
Shaun Bennett 2016-09-28 18:24:43 -04:00 committed by Shaun Bennett
parent 3ede0e5644
commit b27e1ffbd1

View File

@ -93,7 +93,8 @@ public class ThankManager extends MiniDbClientPlugin<ThankData>
*/
public void claimThanks(Player player, Callback<ClaimThankResult> callback)
{
int accountId = ClientManager.getAccountId(player);
final String playerName = player.getName();
final int accountId = ClientManager.getAccountId(player);
if (accountId == -1)
{
@ -106,7 +107,11 @@ public class ThankManager extends MiniDbClientPlugin<ThankData>
{
ClaimThankResult result = _thankRepository.claimThank(accountId);
runSync(() -> {
if (result != null && result.getClaimed() > 0) Set(player, new ThankData(0));
if (result != null && result.getClaimed() > 0)
{
Set(player, new ThankData(0));
_donationManager.rewardCoinsUntilSuccess(null, "Thank", player.getName(), accountId, result.getClaimed());
}
callback.run(result);
});
}
@ -152,11 +157,10 @@ public class ThankManager extends MiniDbClientPlugin<ThankData>
try
{
boolean success = _thankRepository.thank(receiverAccountId, senderAccountId, receiverReward, reason, ignoreCooldown);
runSync(() -> {
if (success)
{
_donationManager.rewardCoinsUntilSuccess(null, "Thank", receiverName, receiverAccountId, receiverReward);
// Reward Shards for the sender now. The player being thanked can claim their shards at Carl.
_donationManager.rewardCoinsUntilSuccess(null, "Thank", senderName, senderAccountId, senderReward);
}