Add in cooldowns for other clans shop buttons to stop autoclick exploits

This commit is contained in:
AlexTheCoder 2016-08-05 14:33:59 -04:00
parent 599c47a8c2
commit 5b03692c97
4 changed files with 25 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.Callback;
import mineplex.core.donation.DonationManager;
import mineplex.core.recharge.Recharge;
import mineplex.core.shop.item.IButton;
import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.ClansManager;
@ -29,6 +30,11 @@ public class CashInButton implements IButton
{
if (clickType != ClickType.LEFT && clickType != ClickType.RIGHT) return;
if (!Recharge.Instance.use(player, "Attempt Buy Clans Shop Item", 1500, false, false))
{
return;
}
ItemStack item = player.getItemOnCursor();
CustomItem cursorItem = GearManager.parseItem(item);

View File

@ -7,6 +7,7 @@ import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.Callback;
import mineplex.core.donation.DonationManager;
import mineplex.core.recharge.Recharge;
import mineplex.core.shop.item.IButton;
import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.ClansManager;
@ -31,6 +32,11 @@ public class GemTransferButton implements IButton
{
if (clickType != ClickType.LEFT) return;
if (!Recharge.Instance.use(player, "Attempt Buy Clans Shop Item", 1500, false, false))
{
return;
}
if (GoldManager.getInstance().canTransferGems(player))
{
GoldManager.getInstance().transferGemsToCoins(player, _gemAmount);

View File

@ -4,6 +4,7 @@ import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.recharge.Recharge;
import mineplex.core.shop.item.IButton;
import mineplex.game.clans.economy.GoldManager;
@ -21,6 +22,11 @@ public class StoreGoldButton implements IButton
{
if (clickType != ClickType.LEFT) return;
if (!Recharge.Instance.use(player, "Attempt Buy Clans Shop Item", 1500, false, false))
{
return;
}
if (_page.hasEnoughGold())
{
int cost = BankPage.TOKEN_VALUE;
@ -29,4 +35,4 @@ public class StoreGoldButton implements IButton
}
}
}
}

View File

@ -3,6 +3,7 @@ package mineplex.game.clans.shop.energy;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.recharge.Recharge;
import mineplex.core.shop.confirmation.ConfirmationPage;
import mineplex.core.shop.item.IButton;
import mineplex.game.clans.clans.ClanEnergyManager;
@ -37,6 +38,11 @@ public class EnergyShopButton implements IButton
@Override
public void onClick(final Player player, ClickType clickType)
{
if (!Recharge.Instance.use(player, "Attempt Buy Clans Shop Item", 1500, false, false))
{
return;
}
if (UtilServer.CallEvent(new PreEnergyShopBuyEvent(player, _energyToPurchase, _cost)).isCancelled())
{
return;