Use CoreClient instead of Player in case the player quits
This commit is contained in:
parent
ac63985419
commit
c5d5d86c1d
@ -284,7 +284,17 @@ public class DonationManager extends MiniClientPlugin<Donor>
|
||||
*/
|
||||
public void rewardCurrencyUntilSuccess(GlobalCurrency currency, Player player, String reason, int amount)
|
||||
{
|
||||
CoreClient client = _clientManager.Get(player);
|
||||
rewardCurrencyUntilSuccess(currency, _clientManager.Get(player), reason, amount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rewards the {@link CoreClient} with {@code amount} of {@code currency} because of {@code reason}
|
||||
* This method will retry the transaction for up to {@link DonationManager#MAX_GIVE_ATTEMPTS} attempts.
|
||||
*
|
||||
* This method is <b>not</b> thread safe, and should be called on the main thread
|
||||
*/
|
||||
public void rewardCurrencyUntilSuccess(GlobalCurrency currency, CoreClient client, String reason, int amount)
|
||||
{
|
||||
rewardCurrencyUntilSuccess(currency, client.getName(), client.getUniqueId(), reason, amount, null);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package mineplex.core.reward.rewards;
|
||||
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.currency.GlobalCurrency;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
@ -63,7 +64,7 @@ public class TreasureShardReward extends Reward
|
||||
rewardData = new RewardData(null, getRarity().getColor() + shards + " Treasure Shards", new ItemStack(Material.PRISMARINE_SHARD), getRarity());
|
||||
}
|
||||
|
||||
int accountId = _clientManager.getAccountId(player);
|
||||
CoreClient client = _clientManager.Get(player);
|
||||
|
||||
// Give shards 5 seconds later for better effect
|
||||
Bukkit.getScheduler().runTaskLater(_donationManager.getPlugin(), new Runnable()
|
||||
@ -71,7 +72,7 @@ public class TreasureShardReward extends Reward
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
_donationManager.rewardCurrencyUntilSuccess(GlobalCurrency.TREASURE_SHARD, player, "Treasure", shards);
|
||||
_donationManager.rewardCurrencyUntilSuccess(GlobalCurrency.TREASURE_SHARD, client, "Treasure", shards);
|
||||
}
|
||||
}, 100);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user