diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/kits/perk/PerkPassiveWoolGain.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/kits/perk/PerkPassiveWoolGain.java index be1c6bc3c..0cb93085e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/kits/perk/PerkPassiveWoolGain.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/kits/perk/PerkPassiveWoolGain.java @@ -1,21 +1,28 @@ package nautilus.game.arcade.game.games.cakewars.kits.perk; +import java.util.concurrent.TimeUnit; + import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.inventory.ItemStack; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.games.cakewars.general.CakePlayerModule; import nautilus.game.arcade.kit.Perk; public class PerkPassiveWoolGain extends Perk { + private static final long PLATFORM_RECHARGE = TimeUnit.SECONDS.toMillis(10); + private static final int MAX_WOOL = 32; + private static final int MAX_PLATFORMS = 8; + public PerkPassiveWoolGain() { super("Knitter"); @@ -24,21 +31,33 @@ public class PerkPassiveWoolGain extends Perk @EventHandler public void updateGain(UpdateEvent event) { - if (event.getType() != UpdateType.SLOW || !Manager.GetGame().IsLive()) + if (event.getType() != UpdateType.SEC_05 || !Manager.GetGame().IsLive()) { return; } for (Player player : Manager.GetGame().GetPlayers(true)) { - if (UtilPlayer.isSpectator(player) || !hasPerk(player) || player.getInventory().contains(Material.WOOL, 32)) + if (UtilPlayer.isSpectator(player) || !hasPerk(player)) { continue; } - ItemStack itemStack = new ItemStack(Material.WOOL, 1, (short) 0, Manager.GetGame().GetTeam(player).GetColorData()); + if (!player.getInventory().contains(Material.WOOL, MAX_WOOL)) + { + ItemStack itemStack = new ItemStack(Material.WOOL, 1, (short) 0, Manager.GetGame().GetTeam(player).GetColorData()); - player.getInventory().addItem(itemStack); + player.getInventory().addItem(itemStack); + } + + if (!player.getInventory().contains(Material.INK_SACK, MAX_PLATFORMS) && Recharge.Instance.use(player, "Knitted Platforms", PLATFORM_RECHARGE, false, false)) + { + ItemStack itemStack = new ItemBuilder(CakePlayerModule.DEPLOY_PLATFORM) + .setData(Manager.GetGame().GetTeam(player).getDyeColor().getDyeData()) + .build(); + + player.getInventory().addItem(itemStack); + } } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/ui/CakeResourcePage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/ui/CakeResourcePage.java index a781712e8..b467a06c6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/ui/CakeResourcePage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/ui/CakeResourcePage.java @@ -125,7 +125,7 @@ public class CakeResourcePage extends ShopPageBase