diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkRemoveEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkRemoveEvent.java new file mode 100644 index 000000000..5ac777588 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkRemoveEvent.java @@ -0,0 +1,56 @@ +package nautilus.game.arcade.game.games.milkcow; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class MilkRemoveEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + private Player _player; + private int _milk; + private RemoveType _cause; + + public MilkRemoveEvent(Player player, int milk, RemoveType cause) + { + _player = player; + _milk = milk; + _cause = cause; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + public Player GetPlayer() + { + return _player; + } + + public int GetMilk() + { + return _milk; + } + + public RemoveType GetCause() + { + return _cause; + } + + public void SetMilk(int milk) + { + _milk = milk; + } + + public static enum RemoveType + { + FLING, DEATH; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/kits/KitSturdyFarmhand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/kits/KitSturdyFarmhand.java new file mode 100644 index 000000000..feeb802d1 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/kits/KitSturdyFarmhand.java @@ -0,0 +1,51 @@ +package nautilus.game.arcade.game.games.milkcow.kits; + +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkIronSkin; +import nautilus.game.arcade.kit.perks.PerkNoSpillMilk; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; + +public class KitSturdyFarmhand extends Kit +{ + public KitSturdyFarmhand(ArcadeManager manager) + { + super(manager, "Sturdy Farmhand", KitAvailability.Gem, 2000, + + new String[] + { + "Been working on the ranch so long, even a charging bull can't faze him!" + }, + + new Perk[] + { + new PerkNoSpillMilk(manager), + new PerkIronSkin(2), + }, + + EntityType.ZOMBIE, + new ItemStack(Material.IRON_SPADE)); + + } + + @EventHandler + public void FireItemResist(UpdateEvent event) + { + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BUCKET)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNoSpillMilk.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNoSpillMilk.java new file mode 100644 index 000000000..5752294ee --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNoSpillMilk.java @@ -0,0 +1,43 @@ +package nautilus.game.arcade.kit.perks; + +import mineplex.core.common.util.C; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.milkcow.MilkRemoveEvent; +import nautilus.game.arcade.game.games.milkcow.MilkRemoveEvent.RemoveType; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +public class PerkNoSpillMilk extends Perk +{ + + public PerkNoSpillMilk(ArcadeManager manager) + { + super("Steady Hands", new String[] + { + C.cGray + "Lose less milk when you die", + C.cGray + "Don't lose your bucket of milk when cows run into you", + }); + } + + @EventHandler + public void onLoseMilk(MilkRemoveEvent event) + { + Player player = event.GetPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (event.GetCause() == RemoveType.DEATH) + { + if (event.GetMilk() > 3) + event.SetMilk(3); + } + + if (event.GetCause() == RemoveType.FLING) + { + event.SetMilk(-1); + } + } +}