Change Bulders's passive

This commit is contained in:
Sam 2018-01-11 10:42:43 +00:00 committed by Alexander Meech
parent a9d4e3e62c
commit 85c721bb93
2 changed files with 26 additions and 7 deletions

View File

@ -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);
}
}
}
}

View File

@ -125,7 +125,7 @@ public class CakeResourcePage extends ShopPageBase<ArcadeManager, CakeResourceSh
}
else if (material == Material.INK_SACK)
{
builder.setData(DyeColor.getByWoolData(_team.GetColorData()).getDyeData());
builder.setData(_team.getDyeColor().getDyeData());
}
}