Work on Gold.
This commit is contained in:
parent
9cf4ff005a
commit
3660b348cd
@ -26,6 +26,7 @@ import mineplex.game.clans.items.economy.GoldToken;
|
|||||||
import mineplex.core.MiniPlugin;
|
import mineplex.core.MiniPlugin;
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.Callback;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.donation.DonationManager;
|
import mineplex.core.donation.DonationManager;
|
||||||
@ -155,8 +156,7 @@ public class GoldManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
deductGems(player, gemAmount);
|
deductGems(player, gemAmount);
|
||||||
addGold(player, goldCount);
|
addGold(player, goldCount);
|
||||||
_transferTracker.insertTransfer(player);
|
notify(player, String.format("You have transferred %d gems into %d gold coins!", gemCount, goldCount));
|
||||||
notify(player, String.format("You have transferred %d gems into %d gold coins!", gemAmount, goldCount));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,14 +170,14 @@ public class GoldManager extends MiniPlugin
|
|||||||
return !_transferTracker.hasTransferredToday(player);
|
return !_transferTracker.hasTransferredToday(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addGold(Player player, int amount)
|
public void addGold(Callback<Boolean> resultCallback, Player player, int amount)
|
||||||
{
|
{
|
||||||
_donationManager.RewardGoldLater("GoldManager", player, amount);
|
_donationManager.RewardGoldLater("GoldManager", player, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deductGold(Player player, int amount)
|
public void deductGold(Callback<Boolean> resultCallback, Player player, int amount)
|
||||||
{
|
{
|
||||||
addGold(player, -amount);
|
addGold(resultCallback, player, -amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cashIn(Player player, GoldToken token)
|
public void cashIn(Player player, GoldToken token)
|
||||||
@ -213,9 +213,21 @@ public class GoldManager extends MiniPlugin
|
|||||||
public void purchaseToken(Player player, int tokenValue)
|
public void purchaseToken(Player player, int tokenValue)
|
||||||
{
|
{
|
||||||
GoldToken token = new GoldToken(tokenValue);
|
GoldToken token = new GoldToken(tokenValue);
|
||||||
deductGold(player, tokenValue);
|
deductGold(new Callback<Boolean>()
|
||||||
player.getInventory().addItem(token.toItemStack());
|
{
|
||||||
notify(player, String.format("You have purchased a gold token worth %dg!", tokenValue));
|
public void run(Boolean success)
|
||||||
|
{
|
||||||
|
if (sucess)
|
||||||
|
{
|
||||||
|
player.getInventory().addItem(token.toItemStack());
|
||||||
|
notify(player, String.format("You have purchased a gold token worth %dg!", tokenValue));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
notify(player, String.format("You have purchased a gold token worth %dg!", tokenValue));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, player, tokenValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addGems(Player player, int amount)
|
public void addGems(Player player, int amount)
|
||||||
|
Loading…
Reference in New Issue
Block a user