Change Bulders's passive
This commit is contained in:
parent
a9d4e3e62c
commit
85c721bb93
@ -1,21 +1,28 @@
|
|||||||
package nautilus.game.arcade.game.games.cakewars.kits.perk;
|
package nautilus.game.arcade.game.games.cakewars.kits.perk;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.inventory.ItemStack;
|
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.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.itemstack.ItemBuilder;
|
||||||
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
|
||||||
|
import nautilus.game.arcade.game.games.cakewars.general.CakePlayerModule;
|
||||||
import nautilus.game.arcade.kit.Perk;
|
import nautilus.game.arcade.kit.Perk;
|
||||||
|
|
||||||
public class PerkPassiveWoolGain extends 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()
|
public PerkPassiveWoolGain()
|
||||||
{
|
{
|
||||||
super("Knitter");
|
super("Knitter");
|
||||||
@ -24,21 +31,33 @@ public class PerkPassiveWoolGain extends Perk
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void updateGain(UpdateEvent event)
|
public void updateGain(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.SLOW || !Manager.GetGame().IsLive())
|
if (event.getType() != UpdateType.SEC_05 || !Manager.GetGame().IsLive())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Player player : Manager.GetGame().GetPlayers(true))
|
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;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ public class CakeResourcePage extends ShopPageBase<ArcadeManager, CakeResourceSh
|
|||||||
}
|
}
|
||||||
else if (material == Material.INK_SACK)
|
else if (material == Material.INK_SACK)
|
||||||
{
|
{
|
||||||
builder.setData(DyeColor.getByWoolData(_team.GetColorData()).getDyeData());
|
builder.setData(_team.getDyeColor().getDyeData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user