Add a cooldown to clans shops to reduce chance of edge-case negative gold balances

This commit is contained in:
AlexTheCoder 2016-07-30 09:46:02 -04:00
parent 9e2ba8c653
commit d1d366dcf8

View File

@ -15,6 +15,7 @@ import mineplex.core.common.util.InventoryUtil;
import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.recharge.Recharge;
import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.IButton;
import mineplex.core.shop.page.ShopPageBase; import mineplex.core.shop.page.ShopPageBase;
import mineplex.game.clans.clans.event.ClansPlayerBuyItemEvent; import mineplex.game.clans.clans.event.ClansPlayerBuyItemEvent;
@ -57,6 +58,10 @@ public class ShopItemButton<T extends ShopPageBase<?, ?>> implements IButton
@Override @Override
public void onClick(final Player player, ClickType clickType) public void onClick(final Player player, ClickType clickType)
{ {
if (!Recharge.Instance.use(player, "Attempt Buy Clans Shop Item", 1500, false, false))
{
return;
}
boolean shiftClick = (clickType == ClickType.SHIFT_LEFT || clickType == ClickType.SHIFT_RIGHT); boolean shiftClick = (clickType == ClickType.SHIFT_LEFT || clickType == ClickType.SHIFT_RIGHT);
if (clickType == ClickType.SHIFT_RIGHT || clickType == ClickType.RIGHT) if (clickType == ClickType.SHIFT_RIGHT || clickType == ClickType.RIGHT)