From 35c10f22a19c7c218018157c0d7a42662af1b641 Mon Sep 17 00:00:00 2001 From: Chiss Date: Sat, 14 Sep 2013 08:13:21 +1000 Subject: [PATCH] Fixed gems in a few games Milk Cow; cannot pickup water, cannot drink milk after end --- .../game/games/barbarians/Barbarians.java | 20 +++++++++++++++++- .../arcade/game/games/deathtag/DeathTag.java | 11 ++++++++++ .../arcade/game/games/milkcow/MilkCow.java | 21 +++++++++++++++++++ .../games/milkcow/kits/KitFarmerJump.java | 1 - .../arcade/game/games/smash/SuperSmash.java | 6 ++++++ .../game/arcade/game/games/spleef/Spleef.java | 6 ++---- 6 files changed, 59 insertions(+), 6 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/Barbarians.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/Barbarians.java index df99307fc..75bd467fc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/Barbarians.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/Barbarians.java @@ -5,6 +5,7 @@ import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.block.BlockDamageEvent; +import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.PlayerDeathEvent; import mineplex.core.common.util.UtilServer; @@ -169,8 +170,25 @@ public class Barbarians extends SoloGame } @EventHandler - public void BlockBreak(BlockDamageEvent event) + public void BlockDamage(BlockDamageEvent event) { event.setInstaBreak(true); } + + @EventHandler + public void ItemSpawn(ItemSpawnEvent event) + { + event.setCancelled(true); + } + + @Override + public double GetKillsGems(Player killer, Player killed, boolean assist) + { + if (GetTeam(killed).equals(_barbs)) + { + return 4; + } + + return 0; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java index 5f2af8663..19ee4fcf1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java @@ -306,4 +306,15 @@ public class DeathTag extends SoloGame return true; } + + @Override + public double GetKillsGems(Player killer, Player killed, boolean assist) + { + if (GetTeam(killed).equals(_runners)) + { + return 4; + } + + return 0; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java index 426362971..62ecb9067 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java @@ -17,6 +17,7 @@ import org.bukkit.entity.Pig; import org.bukkit.entity.Player; import org.bukkit.entity.Villager; import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerBucketFillEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerItemConsumeEvent; import org.bukkit.inventory.ItemStack; @@ -25,6 +26,7 @@ import org.bukkit.scoreboard.Objective; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; @@ -313,12 +315,17 @@ public class MilkCow extends SoloGame @EventHandler public void DrinkMilk(PlayerItemConsumeEvent event) { + if (!IsLive()) + return; + if (event.getItem().getType() != Material.MILK_BUCKET) return; SetScore(event.getPlayer(), GetScore(event.getPlayer())+1); event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.BURP, 2f, 1f); UtilPlayer.health(event.getPlayer(), 8); + + this.AddGems(event.getPlayer(), 0.5, "Milk Drunk", true); } public void SetScore(Player player, double level) @@ -479,4 +486,18 @@ public class MilkCow extends SoloGame return true; } + + @EventHandler + public void BucketFill(PlayerBucketFillEvent event) + { + if (event.getBlockClicked() == null) + return; + + if (event.getBlockClicked().getTypeId() != 8 && event.getBlockClicked().getTypeId() != 9) + return; + + event.setCancelled(true); + UtilInv.Update(event.getPlayer()); + event.getPlayer().sendBlockChange(event.getBlockClicked().getLocation(), 8, (byte)0); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/kits/KitFarmerJump.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/kits/KitFarmerJump.java index d7d6adc5b..f33982c20 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/kits/KitFarmerJump.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/kits/KitFarmerJump.java @@ -44,7 +44,6 @@ public class KitFarmerJump extends Kit @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_HOE)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BUCKET)); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java index 9857648f4..68833b26c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java @@ -299,4 +299,10 @@ public class SuperSmash extends SoloGame event.setCancelled(true); } } + + @Override + public double GetKillsGems(Player killer, Player killed, boolean assist) + { + return 4; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java index cb7a7e834..13bc5422e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java @@ -132,8 +132,6 @@ public class Spleef extends SoloGame public void BlockFade(Block block, Player player) { - this.AddGems(player, 0.015, "Spleef Blocks Broken", true); - UtilPlayer.hunger(player, 1); //Wool and Stained Clay @@ -200,9 +198,9 @@ public class Spleef extends SoloGame } @EventHandler - public void DamageUpdate(UpdateEvent event) + public void Hunger(UpdateEvent event) { - if (event.getType() != UpdateType.FAST) + if (event.getType() != UpdateType.SEC) return; if (!IsLive())