From 6c78bc6f8f82ad3bcb575f5c47116407cfe22bd8 Mon Sep 17 00:00:00 2001 From: Cheese Date: Fri, 20 Mar 2015 16:51:24 +1100 Subject: [PATCH] added 10s delay on getting bow in block hunt --- .../arcade/game/games/hideseek/HideSeek.java | 80 ++++++++++++------- .../games/survivalgames/SurvivalGames.java | 5 -- .../games/survivalgames/kit/KitStealer.java | 45 ----------- 3 files changed, 50 insertions(+), 80 deletions(-) delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitStealer.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java index f65581152..31c333ead 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java @@ -178,7 +178,10 @@ public class HideSeek extends TeamGame private long _hideTime = 20000; private long _gameTime = 360000; - + + private boolean _bowGiven = false; + private long _bowGiveTime = 0; + private boolean _started = false; private HashMap _arrowHits = new HashMap(); @@ -370,40 +373,47 @@ public class HideSeek extends TeamGame } } - public void GiveItems() + public void GiveItems(boolean bowOnly) { for (Player player : _hiders.GetPlayers(true)) { - // Axe - player.getInventory().setItem(0, - ItemStackFactory.Instance.CreateStack(Material.WOOD_AXE, (byte) 0, 1, C.cGreen + "Speed Axe")); + if (bowOnly) + { + // Bow + ItemStack bow = ItemStackFactory.Instance.CreateStack(Material.BOW, (byte) 0, 1, C.cYellow + C.Bold + "Shoot Hunters" + + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Upgrades Axe"); + bow.addEnchantment(Enchantment.ARROW_INFINITE, 1); + player.getInventory().setItem(1, bow); + player.getInventory().setItem(28, ItemStackFactory.Instance.CreateStack(Material.ARROW)); + } + else + { + // Axe + player.getInventory().setItem(0, + ItemStackFactory.Instance.CreateStack(Material.WOOD_AXE, (byte) 0, 1, C.cGreen + "Speed Axe")); - // Bow - ItemStack bow = ItemStackFactory.Instance.CreateStack(Material.BOW, (byte) 0, 1, C.cYellow + C.Bold + "Shoot Hunters" - + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Upgrades Axe"); - bow.addEnchantment(Enchantment.ARROW_INFINITE, 1); - player.getInventory().setItem(1, bow); - player.getInventory().setItem(28, ItemStackFactory.Instance.CreateStack(Material.ARROW)); + // Meower + player.getInventory().setItem( + 4, + ItemStackFactory.Instance.CreateStack(Material.SUGAR, (byte) 0, 1, C.cYellow + C.Bold + "Meow" + C.cWhite + + C.Bold + " - " + C.cGreen + C.Bold + "+0.25 Gems")); - // Meower - player.getInventory().setItem( - 4, - ItemStackFactory.Instance.CreateStack(Material.SUGAR, (byte) 0, 1, C.cYellow + C.Bold + "Meow" + C.cWhite - + C.Bold + " - " + C.cGreen + C.Bold + "+0.25 Gems")); + // Firework + ItemStack firework = ItemStackFactory.Instance.CreateStack(Material.FIREWORK, (byte) 0, 5, C.cYellow + C.Bold + + "Firework" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "+2 Gems"); + FireworkMeta metaData = (FireworkMeta) firework.getItemMeta(); + metaData.setPower(1); + metaData.addEffect(FireworkEffect.builder().flicker(true).withColor(Color.AQUA).with(Type.BALL_LARGE).trail(true) + .build()); + firework.setItemMeta(metaData); + player.getInventory().setItem(5, firework); - // Firework - ItemStack firework = ItemStackFactory.Instance.CreateStack(Material.FIREWORK, (byte) 0, 5, C.cYellow + C.Bold - + "Firework" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "+2 Gems"); - FireworkMeta metaData = (FireworkMeta) firework.getItemMeta(); - metaData.setPower(1); - metaData.addEffect(FireworkEffect.builder().flicker(true).withColor(Color.AQUA).with(Type.BALL_LARGE).trail(true) - .build()); - firework.setItemMeta(metaData); - player.getInventory().setItem(5, firework); - - // Recharges - Recharge.Instance.useForce(player, "Meow", 15000); - Recharge.Instance.useForce(player, "Firework", 15000); + // Recharges + Recharge.Instance.useForce(player, "Meow", 15000); + Recharge.Instance.useForce(player, "Firework", 15000); + } + + player.playSound(player.getLocation(), Sound.HORSE_ARMOR, 1f, 1f); } } @@ -1128,6 +1138,8 @@ public class HideSeek extends TeamGame if (event.getType() != UpdateType.TICK) return; + + // Hide Time if (!_started) { @@ -1138,7 +1150,8 @@ public class HideSeek extends TeamGame _started = true; // Hider Items - GiveItems(); + GiveItems(false); + _bowGiveTime = System.currentTimeMillis(); // Remove Barrier for (Location loc : WorldData.GetDataLocs("BLACK")) @@ -1150,6 +1163,13 @@ public class HideSeek extends TeamGame // Seek Time else { + //Give Bow + if (!_bowGiven && UtilTime.elapsed(_bowGiveTime, 10000)) + { + GiveItems(true); + _bowGiven = true; + } + long timeLeft = _gameTime - (System.currentTimeMillis() - GetStateTime() - _hideTime); if (timeLeft <= 0) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java index 287b0227c..8ef383f36 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java @@ -148,7 +148,6 @@ public class SurvivalGames extends SoloGame private Field _packetTeam; private IPacketHandler _useEntityPacketHandler; private int _deadBodyCount; - private NautHashMap _deadBodyLocations = new NautHashMap(); private int _chestRefillTime = 60 * 7; private NautHashMap _openedChests = new NautHashMap(); @@ -898,10 +897,6 @@ public class SurvivalGames extends SoloGame ex.printStackTrace(); } - //Store Kit - if (GetKit(player) != null && !(GetKit(player) instanceof KitStealer)) - _deadBodyLocations.put(player.getLocation(), GetKit(player)); - GameProfile newProfile = new GameProfile(UUID.randomUUID(), name); newProfile.getProperties().putAll(((CraftPlayer) player).getHandle().getProfile().getProperties()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitStealer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitStealer.java deleted file mode 100644 index 38269acb1..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitStealer.java +++ /dev/null @@ -1,45 +0,0 @@ -package nautilus.game.arcade.game.games.survivalgames.kit; - -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -import mineplex.core.common.util.C; -import mineplex.core.itemstack.ItemStackFactory; -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.*; - -public class KitStealer extends Kit -{ - public KitStealer(ArcadeManager manager) - { - super(manager, "Necromancer", KitAvailability.Gem, 5000, - - new String[] - { - "Steal kits from dead bodies" - }, - - new Perk[] - { - new PerkSkeletons(true) - }, - EntityType.ZOMBIE, - new ItemStack(Material.SKULL_ITEM)); - - } - - @Override - public void GiveItems(Player player) - { - player.getInventory().setItem(7, ItemStackFactory.Instance.CreateStack(Material.INK_SACK, (byte)1, 1, - C.cGreen + "Click" + - C.cWhite + C.Bold + " - " + - C.cYellow + "Absorb Kit")); - } -}