From 69fd78bbf28cc9c5b23d59e6568efadec0d1d80c Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 11 Aug 2016 19:05:13 +0100 Subject: [PATCH] Remove Shurikens --- .../game/games/quiver/QuiverPayload.java | 55 +----- .../games/quiver/data/PowerupGenerator.java | 17 +- .../game/games/quiver/kits/KitNewNinja.java | 18 +- .../game/arcade/kit/perks/PerkShurikens.java | 175 ------------------ 4 files changed, 6 insertions(+), 259 deletions(-) delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkShurikens.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverPayload.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverPayload.java index 71ad17f61..0e38182e2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverPayload.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverPayload.java @@ -24,7 +24,6 @@ import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.vehicle.VehicleDamageEvent; import org.bukkit.event.vehicle.VehicleEnterEvent; import org.bukkit.event.vehicle.VehicleEntityCollisionEvent; -import org.bukkit.inventory.ItemStack; import org.bukkit.material.MaterialData; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; @@ -91,8 +90,6 @@ public class QuiverPayload extends TeamGame private static final int END_EFFECT_TNT_AMOUNT = 8; private static final int END_EFFECT_EXPLOSION_RADIUS = 5; - public static final int KIT_NINJA_SHURIKEN_AMOUNT = 15; - public static final String DATA_POINT_MARKER_START = "PINK"; public static final String DATA_POINT_RED = "RED"; public static final String DATA_POINT_BLUE = "BLUE"; @@ -229,12 +226,7 @@ public class QuiverPayload extends TeamGame for (Player player : GetPlayers(true)) - { - if (GetKit(player) instanceof KitNewNinja) - { - continue; - } - + { // Give all players a Super Arrow item. player.getInventory().addItem(Quiver.SUPER_ARROW); } @@ -766,14 +758,7 @@ public class QuiverPayload extends TeamGame return; } - if (GetKit(player) instanceof KitNewNinja) - { - player.getInventory().addItem(getMaxShurikens(player)); - } - else - { - player.getInventory().addItem(Quiver.SUPER_ARROW); - } + player.getInventory().addItem(Quiver.SUPER_ARROW); incrementUltimate(player, ULTIMATE_PERCENTAGE_INCREASE_KILL); @@ -795,11 +780,6 @@ public class QuiverPayload extends TeamGame } } - if (GetKit(killed) instanceof KitNewNinja) - { - return; - } - new BukkitRunnable() { @@ -931,37 +911,6 @@ public class QuiverPayload extends TeamGame GetScoreboard().GetScoreboard().getTeam(added).addEntry(minecartID); } - public ItemStack getMaxShurikens(Player player) - { - ItemStack itemStack = KitNewNinja.SHURIKEN.clone(); - int toRemove = 0; - - for (int i = 0; i < player.getInventory().getSize(); i++) - { - ItemStack itemStack2 = player.getInventory().getItem(i); - - if (itemStack2 == null) - { - continue; - } - - if (itemStack2.getType().equals(KitNewNinja.SHURIKEN.getType())) - { - toRemove = itemStack2.getAmount(); - break; - } - } - - itemStack.setAmount(QuiverPayload.KIT_NINJA_SHURIKEN_AMOUNT - toRemove); - - if (itemStack.getAmount() == 0) - { - return null; - } - - return itemStack; - } - public String getTopBar(int teamACount, int teamBCount) { String progress = C.cAqua; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/data/PowerupGenerator.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/data/PowerupGenerator.java index 0d11f2942..78c6e54a4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/data/PowerupGenerator.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/data/PowerupGenerator.java @@ -18,7 +18,6 @@ import mineplex.core.common.util.UtilTime; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.games.quiver.Quiver; import nautilus.game.arcade.game.games.quiver.QuiverPayload; -import nautilus.game.arcade.game.games.quiver.kits.KitNewNinja; public class PowerupGenerator { @@ -109,20 +108,8 @@ public class PowerupGenerator ItemStack itemStack = Quiver.SUPER_ARROW.clone(); - if (Host.GetKit(player) instanceof KitNewNinja) - { - itemStack = Host.getMaxShurikens(player); - } - else - { - itemStack.setAmount(ARROWS_TO_GIVE); - } - - if (itemStack == null) - { - return; - } - + itemStack.setAmount(ARROWS_TO_GIVE); + player.getInventory().addItem(itemStack); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitNewNinja.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitNewNinja.java index f59dc3049..620cd0f6a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitNewNinja.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitNewNinja.java @@ -6,24 +6,20 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.C; -import mineplex.core.common.util.F; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilServer; import mineplex.core.itemstack.ItemBuilder; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; -import nautilus.game.arcade.game.games.quiver.QuiverPayload; import nautilus.game.arcade.game.games.quiver.ultimates.UltimateNinja; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.ProgressingKit; import nautilus.game.arcade.kit.perks.PerkDash; import nautilus.game.arcade.kit.perks.PerkDoubleJump; -import nautilus.game.arcade.kit.perks.PerkShurikens; public class KitNewNinja extends ProgressingKit { - public static final ItemStack SHURIKEN = new ItemBuilder(Material.NETHER_STAR).setTitle(F.item("Shuriken")).build(); private static final String[] DESCRIPTION = { "Zip zap boing around the map!", @@ -41,37 +37,31 @@ public class KitNewNinja extends ProgressingKit private static final Perk[][] PERKS = { { new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true), - new PerkShurikens(1000, 4), - new PerkDash(5000, 10, 8), + new PerkDash(5000, 10, 8), new UltimateNinja(6000) }, { new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true), - new PerkShurikens(1000, 4), new PerkDash(5000, 10, 8), new UltimateNinja(6500) }, { new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true), - new PerkShurikens(1000, 4), new PerkDash(5000, 10, 8), new UltimateNinja(7000) }, { new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true), - new PerkShurikens(1000, 4), new PerkDash(5000, 10, 8), new UltimateNinja(7500) }, { new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true), - new PerkShurikens(1000, 4), new PerkDash(5000, 10, 8), new UltimateNinja(8000) }, { new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true), - new PerkShurikens(1000, 4), new PerkDash(5000, 10, 8), new UltimateNinja(8500) } @@ -81,6 +71,7 @@ public class KitNewNinja extends ProgressingKit private static final ItemStack[] PLAYER_ITEMS = { new ItemBuilder(Material.GOLD_SWORD).setUnbreakable(true).build(), + new ItemBuilder(Material.BOW).setUnbreakable(true).build(), }; public KitNewNinja(ArcadeManager manager) @@ -93,11 +84,6 @@ public class KitNewNinja extends ProgressingKit { player.getInventory().addItem(PLAYER_ITEMS); - ItemStack itemStack = SHURIKEN.clone(); - - itemStack.setAmount(QuiverPayload.KIT_NINJA_SHURIKEN_AMOUNT); - player.getInventory().addItem(itemStack); - if (Manager.GetGame().GetState() == GameState.Live) { UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), () -> UtilInv.Update(player), 10); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkShurikens.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkShurikens.java deleted file mode 100644 index a65529b06..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkShurikens.java +++ /dev/null @@ -1,175 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.block.Block; -import org.bukkit.entity.Item; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.scheduler.BukkitRunnable; -import org.bukkit.util.Vector; - -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.projectile.IThrown; -import mineplex.core.projectile.ProjectileUser; -import mineplex.core.recharge.Recharge; -import nautilus.game.arcade.game.TeamGame; -import nautilus.game.arcade.game.games.quiver.kits.KitNewNinja; -import nautilus.game.arcade.kit.Perk; - -public class PerkShurikens extends Perk implements IThrown -{ - - private static final float HIT_BOX_GROWTH = 0.5F; - private static final long EXPIRE_TICKS = 80; - - private long _cooldown; - private double _damage; - - public PerkShurikens(long cooldown, double damage) - { - super("Shurikens", new String[] {}); - - _cooldown = cooldown; - _damage = damage; - } - - @EventHandler - public void onPlayerInteract(PlayerInteractEvent event) - { - if (event.isCancelled()) - { - return; - } - - Player player = event.getPlayer(); - - if (player.getItemInHand() == null) - { - return; - } - - if (player.getItemInHand().getType() != KitNewNinja.SHURIKEN.getType()) - { - return; - } - - if (!Kit.HasKit(player)) - { - return; - } - - if (!Recharge.Instance.use(player, GetName(), _cooldown, false, true)) - { - return; - } - - PerkShurikens perkShurikens = this; - Set shurikens = new HashSet<>(); - - UtilInv.remove(player, Material.NETHER_STAR, (byte) 0, 3); - - new BukkitRunnable() - { - - Vector vector = player.getLocation().getDirection().multiply(2); - int thrown = 0; - - @Override - public void run() - { - if (thrown < 3) - { - Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), new ItemStack(Material.NETHER_STAR)); - - item.setVelocity(vector); - shurikens.add(item); - Manager.GetProjectile().AddThrow(item, player, perkShurikens, -1, true, true, true, true, false, HIT_BOX_GROWTH); - thrown++; - } - - Iterator iterator = shurikens.iterator(); - - while (iterator.hasNext()) - { - Item shuriken = iterator.next(); - - if (!shuriken.isValid() || shuriken.isDead() || shuriken.getTicksLived() > EXPIRE_TICKS) - { - shuriken.remove(); - iterator.remove(); - continue; - } - - shuriken.setVelocity(vector); - } - - if (shurikens.isEmpty()) - { - cancel(); - return; - } - } - }.runTaskTimer(Manager.getPlugin(), 0, 3); - } - - @Override - public void Collide(LivingEntity target, Block block, ProjectileUser data) - { - if (target == null) - { - data.getThrown().remove(); - return; - } - - if (target instanceof Player) - { - if (UtilPlayer.isSpectator(target)) - { - return; - } - } - - Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, _damage, false, false, false, data.getThrower().getName(), GetName()); - - if (data.getThrower() instanceof Player && target instanceof Player) - { - Player player = (Player) data.getThrower(); - Player targetPlayer = (Player) target; - - if (Manager.GetGame() instanceof TeamGame) - { - TeamGame game = (TeamGame) Manager.GetGame(); - - if (game.GetTeam(player).equals(game.GetTeam(targetPlayer))) - { - return; - } - } - - player.playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 1F, 1.2F); - } - - data.getThrown().remove(); - } - - @Override - public void Idle(ProjectileUser data) - { - } - - @Override - public void Expire(ProjectileUser data) - { - } - -}