From 0b7fdc01eb2a17dcb6203c0512a5fc39f6e1e749 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 31 Aug 2016 16:30:50 +0100 Subject: [PATCH 001/147] Initial balence change --- .../game/arcade/game/games/smash/kits/KitBlaze.java | 2 +- .../game/arcade/game/games/smash/kits/KitChicken.java | 2 +- .../nautilus/game/arcade/game/games/smash/kits/KitCow.java | 6 +++--- .../game/arcade/game/games/smash/kits/KitSheep.java | 2 +- .../arcade/game/games/smash/kits/KitSkeletalHorse.java | 4 ++-- .../game/arcade/game/games/smash/kits/KitSkeleton.java | 2 +- .../game/arcade/game/games/smash/kits/KitSlime.java | 2 +- .../game/arcade/game/games/smash/kits/KitSnowman.java | 2 +- .../game/arcade/game/games/smash/kits/KitWolf.java | 4 ++-- .../arcade/game/games/smash/perks/PerkCowAngryHerd.java | 2 +- .../arcade/game/games/smash/perks/PerkCowMilkSpiral.java | 2 +- .../src/nautilus/game/arcade/kit/perks/PerkBlockToss.java | 2 +- .../game/arcade/kit/perks/PerkCreeperSulphurBomb.java | 4 ++-- .../src/nautilus/game/arcade/kit/perks/PerkFirefly.java | 2 +- .../src/nautilus/game/arcade/kit/perks/PerkFlap.java | 2 +- .../src/nautilus/game/arcade/kit/perks/PerkHorseKick.java | 2 +- .../src/nautilus/game/arcade/kit/perks/PerkInferno.java | 2 +- .../src/nautilus/game/arcade/kit/perks/PerkInkBlast.java | 2 +- .../src/nautilus/game/arcade/kit/perks/PerkMagmaBlast.java | 2 ++ .../src/nautilus/game/arcade/kit/perks/PerkOvercharge.java | 2 +- .../nautilus/game/arcade/kit/perks/PerkPigBaconBomb.java | 4 ++-- .../src/nautilus/game/arcade/kit/perks/PerkSlimeSlam.java | 2 +- .../nautilus/game/arcade/kit/perks/PerkWitchPotion.java | 2 +- .../nautilus/game/arcade/kit/perks/PerkWitherImage.java | 2 +- .../src/nautilus/game/arcade/kit/perks/PerkWolf.java | 4 ++-- .../src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java | 7 ++++++- .../src/nautilus/game/arcade/kit/perks/PerkZombieBile.java | 2 +- 27 files changed, 40 insertions(+), 33 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java index 2214dfa2a..3d1d42840 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java @@ -27,7 +27,7 @@ public class KitBlaze extends SmashKit }; private static final Perk[] PERKS = { - new PerkSmashStats(6, 1.5, 0.15, 5), + new PerkSmashStats(6, 1.5, 0.25, 5), new PerkDoubleJump("Double Jump", 1, 1, false), new PerkKnockbackFire(1.50), new PerkSpeed(0), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java index 3cf01c3f6..7c8e185d2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java @@ -26,7 +26,7 @@ public class KitChicken extends SmashKit }; private static final Perk[] PERKS = { - new PerkSmashStats(4, 2.0, 0.15, 2), + new PerkSmashStats(4.5, 2.0, 0.2, 2), new PerkFlap(0.8, 0.8, false), new PerkEggGun(), new PerkChickenRocket() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java index 532d38060..8bfc4aa06 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java @@ -27,9 +27,9 @@ public class KitCow extends SmashKit }; private static final Perk[] PERKS = { - new PerkSmashStats(6, 0.9, 0.25, 7.5), + new PerkSmashStats(6, 1.1, 0.25, 6.5), new PerkDoubleJump("Double Jump", 0.9, 0.9, false), - new PerkCowStampede(), + new PerkCowStampede(), new PerkCowAngryHerd(), new PerkCowMilkSpiral(), new PerkCowMooshroomMadness() @@ -77,7 +77,7 @@ public class KitCow extends SmashKit private static final ItemStack[] PLAYER_ARMOR = { ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS), ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS), - ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET), }; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java index f3a600a09..04013e1af 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java @@ -27,7 +27,7 @@ public class KitSheep extends SmashKit private static final Perk[] PERKS = { new PerkSmashStats(5, 1.7, 0.25, 5), new PerkDoubleJump("Double Jump", 1, 1, false), - new PerkLazer(40, 6000), + new PerkLazer(40, 7000), new PerkWoolBomb(), new PerkWoolCloud(), new PerkSheepHoming() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java index 119b90b7c..c9219acf2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java @@ -25,7 +25,7 @@ public class KitSkeletalHorse extends SmashKit }; private static final Perk[] PERKS = { - new PerkSmashStats(6, 1.4, 0.3, 6), + new PerkSmashStats(6, 1.4, 0.3, 6.5), new PerkDoubleJump("Double Jump", 1, 1, false), new PerkHorseKick(), new PerkBoneRush(), @@ -71,7 +71,7 @@ public class KitSkeletalHorse extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS), ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java index cb9adbe24..b8e5b54da 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java @@ -23,7 +23,7 @@ public class KitSkeleton extends SmashKit }; private static final Perk[] PERKS = { - new PerkSmashStats(5, 1.25, 0.15, 6), + new PerkSmashStats(5, 1.25, 0.2, 6), new PerkDoubleJump("Double Jump", 0.9, 0.9, false), new PerkFletcher(3, 3, false), new PerkKnockbackArrow(1.5), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java index c8a1915d1..a2b4fdd5f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java @@ -34,7 +34,7 @@ public class KitSlime extends SmashKit }; private static final Perk[] PERKS = { - new PerkSmashStats(6, 1.75, 0.5, 3), + new PerkSmashStats(6, 1.75, 0.35, 3), new PerkDoubleJump("Double Jump", 1.2, 1, false), new PerkSlimeSlam(), new PerkSlimeRocket() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java index 3b877ec1f..039a7de57 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java @@ -23,7 +23,7 @@ public class KitSnowman extends SmashKit }; private static final Perk[] PERKS = { - new PerkSmashStats(5.5, 1.4, 0.3, 6), + new PerkSmashStats(6, 1.4, 0.3, 6), new PerkDoubleJump("Double Jump", 0.9, 0.9, false), new PerkDamageSnow(1, 0.4), new PerkArcticAura(), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java index d6bcf19a5..6ee1c78e4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java @@ -26,7 +26,7 @@ public class KitWolf extends SmashKit }; private static final Perk[] PERKS = { - new PerkSmashStats(5, 1.6, 0.25, 4.5), + new PerkSmashStats(5, 1.6, 0.25, 5), new PerkDoubleJump("Wolf Jump", 1.0, 1.0, true), new PerkWolf() }; @@ -70,7 +70,7 @@ public class KitWolf extends SmashKit private static final ItemStack[] PLAYER_ARMOR = { null, ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE), null }; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowAngryHerd.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowAngryHerd.java index d398bba74..2c0ac9941 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowAngryHerd.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowAngryHerd.java @@ -70,7 +70,7 @@ public class PerkCowAngryHerd extends SmashPerk if (!Kit.HasKit(player)) return; - if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? 6000 : 12000, true, true)) + if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? 6000 : 13000, true, true)) return; event.setCancelled(true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowMilkSpiral.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowMilkSpiral.java index 0bea3c61a..4227aebb5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowMilkSpiral.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowMilkSpiral.java @@ -59,7 +59,7 @@ public class PerkCowMilkSpiral extends SmashPerk if (!Kit.HasKit(player)) return; - if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? 6000 : 12000, true, true)) + if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? 6000 : 11000, true, true)) return; _active.put(player, new DataCowMilkSpiral(player, isSuperActive(player))); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockToss.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockToss.java index 83870c9d9..067d88734 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockToss.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockToss.java @@ -167,7 +167,7 @@ public class PerkBlockToss extends SmashPerk implements IThrown //Damage Event Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, - DamageCause.PROJECTILE, data.getThrown().getVelocity().length() * 10, true, true, false, + DamageCause.PROJECTILE, data.getThrown().getVelocity().length() * 8, true, true, false, UtilEnt.getName(data.getThrower()), GetName()); //Block to Item diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperSulphurBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperSulphurBomb.java index c1d93f7b7..942b5b34d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperSulphurBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperSulphurBomb.java @@ -80,7 +80,7 @@ public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true, null, 1f, 1f, null, 1, UpdateType.SLOW, - 0.65f); + 0.6f); //Inform UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); @@ -99,7 +99,7 @@ public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown //Damage Event Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, - DamageCause.PROJECTILE, 7, true, true, false, + DamageCause.PROJECTILE, 6.5, true, true, false, UtilEnt.getName(data.getThrower()), GetName()); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java index f16ef797c..eee658ecc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java @@ -151,7 +151,7 @@ public class PerkFirefly extends SmashPerk { //Damage Event Manager.GetDamage().NewDamageEvent(other, data.Player, null, - DamageCause.CUSTOM, 10, true, true, false, + DamageCause.CUSTOM, 7, true, true, false, data.Player.getName(), isSuperActive(data.Player) ? "Phoenix" : GetName()); UtilPlayer.message(other, F.main("Game", F.elem(Manager.GetColor(data.Player) + data.Player.getName()) + " hit you with " + F.elem(GetName()) + ".")); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlap.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlap.java index 490e1e79a..8150a1d4a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlap.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlap.java @@ -91,7 +91,7 @@ public class PerkFlap extends SmashPerk if (!Kit.HasKit(player)) continue; - if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) + if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)) || UtilBlock.solid(player.getLocation().subtract(0, 1, 0).getBlock())) { player.setExp(Math.min(0.9999f, player.getExp() + 0.03f)); player.setAllowFlight(true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorseKick.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorseKick.java index 8339b3b3c..c686b2abe 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorseKick.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorseKick.java @@ -103,7 +103,7 @@ public class PerkHorseKick extends SmashPerk //Damage Event Manager.GetDamage().NewDamageEvent((LivingEntity)other, player, null, - DamageCause.CUSTOM, 7, true, true, false, + DamageCause.CUSTOM, 6.5, true, true, false, player.getName(), GetName()); //Sound diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInferno.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInferno.java index afba15ebd..645d9c305 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInferno.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInferno.java @@ -107,7 +107,7 @@ public class PerkInferno extends SmashPerk //Fire Item fire = cur.getWorld().dropItem(cur.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER)); - Manager.GetFire().Add(fire, cur, 0.7, 0, 0.5, 1.25, "Inferno", false); + Manager.GetFire().Add(fire, cur, 0.7, 0, 0.5, 0.95, "Inferno", false); fire.teleport(cur.getEyeLocation()); double x = 0.07 - (UtilMath.r(14)/100d); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java index bc40a81ae..35c3e3855 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java @@ -73,7 +73,7 @@ public class PerkInkBlast extends SmashPerk implements IThrown if (!Kit.HasKit(player)) return; - if (!Recharge.Instance.use(player, GetName(), 5000, true, true)) + if (!Recharge.Instance.use(player, GetName(), 6000, true, true)) return; event.setCancelled(true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMagmaBlast.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMagmaBlast.java index 339dd0a7c..b25cb4ea7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMagmaBlast.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMagmaBlast.java @@ -149,6 +149,8 @@ public class PerkMagmaBlast extends Perk //Velocity UtilAction.velocity(cur, UtilAlg.getTrajectory(proj.getLocation().add(0, -0.5, 0), cur.getEyeLocation()), 1 + 2 * range, false, 0, 0.2 + 0.4 * range, 1.2, true); + + cur.setFireTicks(40); } //Particles diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkOvercharge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkOvercharge.java index 80813cbf7..b90f487d6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkOvercharge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkOvercharge.java @@ -172,7 +172,7 @@ public class PerkOvercharge extends SmashPerk int charge = _arrows.remove(event.GetProjectile()); - event.AddMod(GetName(), GetName(), charge, true); + event.AddMod(GetName(), GetName(), charge * 0.9, true); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBomb.java index ba3a225c8..9c616a588 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBomb.java @@ -69,7 +69,7 @@ public class PerkPigBaconBomb extends SmashPerk if (!Kit.HasKit(player)) return; - float energy = 0.30f; + float energy = 0.35f; DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); if (disguise != null && disguise instanceof DisguisePigZombie) @@ -167,7 +167,7 @@ public class PerkPigBaconBomb extends SmashPerk //Damage Event Manager.GetDamage().NewDamageEvent(cur, owner, null, - DamageCause.CUSTOM, 4 * targets.get(cur) + 2, false, true, false, + DamageCause.CUSTOM, 4, false, true, false, owner.getName(), GetName()); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeSlam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeSlam.java index 467ce8d7c..ecb0e67ab 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeSlam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeSlam.java @@ -112,7 +112,7 @@ public class PerkSlimeSlam extends SmashPerk public void DoSlam(Player damager, LivingEntity damagee) { - int damage = 8; + int damage = 7; //Recoil Event if (!isSuperActive(damager)) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitchPotion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitchPotion.java index 7baa5eb0a..54963e81e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitchPotion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitchPotion.java @@ -107,7 +107,7 @@ public class PerkWitchPotion extends SmashPerk { //Damage Event Manager.GetDamage().NewDamageEvent(player, thrower, null, - DamageCause.CUSTOM, 5, true, true, false, + DamageCause.CUSTOM, 7, true, true, false, UtilEnt.getName((LivingEntity)event.getEntity().getShooter()), GetName()); Manager.GetCondition().Factory().Slow("Witch Potion", player, null, 3, 1, true, false, false, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java index 28011f7ff..aacf75746 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java @@ -196,7 +196,7 @@ public class PerkWitherImage extends SmashPerk Player player = playerIterator.next(); Skeleton skel = _ownerToSkeleton.get(player); - if (!player.isValid() || !skel.isValid() || skel.getTicksLived() > 160) + if (!player.isValid() || !skel.isValid() || skel.getTicksLived() > 160 || UtilBlock.liquid(skel.getLocation().getBlock())) { //Effect Manager.GetBlood().Effects(null, skel.getLocation().add(0, 0.5, 0), 12, 0.3, Sound.WITHER_HURT, 1f, 0.75f, Material.BONE, (byte)0, 40, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java index febca2e0a..526906a05 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java @@ -127,7 +127,7 @@ public class PerkWolf extends SmashPerk //Hit Player for (Player other : Manager.GetGame().GetPlayers(true)) if (!Manager.isSpectator(other)) - if (UtilEnt.hitBox(wolf.getLocation(), other, 2, null)) + if (UtilEnt.hitBox(wolf.getLocation(), other, 2.5, null)) { if (other.equals(TackleGetOwner(wolf))) continue; @@ -181,7 +181,7 @@ public class PerkWolf extends SmashPerk Wolf wolf = wolfIterator.next(); LivingEntity ent = _tackle.get(wolf); - if (!wolf.isValid() || !ent.isValid() || wolf.getTicksLived() > 80) + if (!wolf.isValid() || !ent.isValid() || wolf.getTicksLived() > 70) { wolf.remove(); wolfIterator.remove(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java index 436db672e..27f62a7ae 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java @@ -99,7 +99,7 @@ public class PerkWoolBomb extends Perk implements IThrown private void launch(Player player) { - if (!Recharge.Instance.use(player, GetName(), 8000, true, true)) + if (!Recharge.Instance.usable(player, GetName(), true)) return; org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.WOOL, (byte)0)); @@ -196,6 +196,11 @@ public class PerkWoolBomb extends Perk implements IThrown if (data == null) return false; + if (!Recharge.Instance.use(player, GetName(), 8000, true, true)) + { + return false; + } + //Restore data.restore(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java index adb0f1455..4d6bbbbc2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java @@ -112,7 +112,7 @@ public class PerkZombieBile extends SmashPerk implements IThrown //Projectiles for (int i=0 ; i<3 ; i++) { - Vector rand = new Vector((Math.random()-0.5)*0.6,(Math.random()-0.5)*0.6,(Math.random()-0.5)*0.6); + Vector rand = new Vector((Math.random()-0.5)*0.525,(Math.random()-0.5)*0.525,(Math.random()-0.5)*0.525); org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()).subtract(0, 0.5, 0), ItemStackFactory.Instance.CreateStack(Material.ROTTEN_FLESH)); UtilAction.velocity(ent, player.getLocation().getDirection().add(rand), 0.8, false, 0, 0.2, 10, false); From 2ba2b215771f8b4a829770d0630ca1945130dfb3 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 22 Sep 2016 17:11:21 +0100 Subject: [PATCH 002/147] Progress on converting SSM to a new cleaner system --- .../perks/PerkBlinkMonsterLeague.java | 1 - .../arcade/game/games/smash/SuperSmash.java | 3 +- .../game/games/smash/TeamSuperSmash.java | 94 ++--- .../game/games/smash/kits/KitBlaze.java | 84 ++-- .../game/games/smash/kits/KitChicken.java | 63 +-- .../arcade/game/games/smash/kits/KitCow.java | 68 ++-- .../game/games/smash/kits/KitCreeper.java | 63 +-- .../game/games/smash/kits/KitEnderman.java | 108 +++--- .../game/games/smash/kits/KitGolem.java | 4 +- .../game/games/smash/kits/KitKnight.java | 291 -------------- .../game/games/smash/kits/KitMagmaCube.java | 68 ++-- .../arcade/game/games/smash/kits/KitPig.java | 90 ++--- .../game/games/smash/kits/KitSheep.java | 59 +-- .../games/smash/kits/KitSkeletalHorse.java | 106 ++--- .../game/games/smash/kits/KitSkeleton.java | 74 ++-- .../game/games/smash/kits/KitSkySquid.java | 3 +- .../game/games/smash/kits/KitSlime.java | 5 +- .../game/games/smash/kits/KitSnowman.java | 3 +- .../game/games/smash/kits/KitSpider.java | 8 +- .../game/games/smash/kits/KitWitch.java | 3 +- .../game/games/smash/kits/KitWither.java | 4 +- .../games/smash/kits/KitWitherSkeleton.java | 3 +- .../arcade/game/games/smash/kits/KitWolf.java | 4 +- .../game/games/smash/kits/KitZombie.java | 3 +- .../games/smash/modes/kits/KitHipster.java | 2 +- .../smash/perks/PerkCowMooshroomMadness.java | 77 ---- .../games/smash/perks/PerkFishFlurry.java | 3 +- .../games/smash}/perks/PerkSmashStats.java | 2 +- .../games/smash/perks}/SmashKit.java | 41 +- .../game/games/smash/perks/SmashKit2.java | 154 ++++++++ .../game/games/smash/perks/SmashPerk.java | 65 ++++ .../game/games/smash/perks/SmashUltimate.java | 141 +++++++ .../games/smash/perks/blaze/PerkFirefly.java | 256 ++++++++++++ .../games/smash/perks/blaze/PerkInferno.java | 159 ++++++++ .../games/smash/perks/blaze/SmashBlaze.java | 40 ++ .../perks/chicken/PerkChickenRocket.java | 219 +++++++++++ .../games/smash/perks/chicken/PerkEggGun.java | 162 ++++++++ .../games/smash/perks/chicken/PerkFlap.java | 121 ++++++ .../smash/perks/chicken/SmashChicken.java | 30 ++ .../smash/perks/{ => cow}/DataCowCharge.java | 2 +- .../perks/{ => cow}/DataCowMilkSpiral.java | 3 +- .../perks/{ => cow}/PerkCowAngryHerd.java | 173 +++++---- .../perks/{ => cow}/PerkCowMilkSpiral.java | 120 +++--- .../perks/cow/PerkCowMooshroomMadness.java | 72 ++++ .../perks/{ => cow}/PerkCowStampede.java | 199 +++++----- .../perks/creeper/PerkCreeperElectricity.java | 204 ++++++++++ .../perks/creeper/PerkCreeperExplode.java | 334 ++++++++++++++++ .../perks/creeper/PerkCreeperSulphurBomb.java | 146 +++++++ .../smash/perks/creeper/SmashCreeper.java | 35 ++ .../games/smash/perks/enderman/PerkBlink.java | 102 +++++ .../smash/perks/enderman/PerkBlockToss.java | 269 +++++++++++++ .../{ => enderman}/PerkEndermanTeleport.java | 103 ++--- .../smash/perks/enderman/SmashEnderman.java | 236 ++++++++++++ .../games/smash/perks/golem}/PerkFissure.java | 70 ++-- .../games/smash/perks/golem/PerkIronHook.java | 132 +++++++ .../smash/perks/golem/PerkSeismicSlam.java | 192 +++++++++ .../smash/perks/golem/SmashEnderman.java | 123 ++++++ .../smash/perks/magmacube/PerkFlameDash.java | 195 ++++++++++ .../smash/perks/magmacube/PerkMagmaBlast.java | 176 +++++++++ .../smash/perks/magmacube/PerkMagmaBoost.java | 176 +++++++++ .../smash/perks/magmacube/SmashMagmacube.java | 55 +++ .../smash/perks/pig/PerkPigBaconBomb.java | 216 +++++++++++ .../smash/perks/pig/PerkPigBaconBounce.java | 199 ++++++++++ .../games/smash/perks/pig/PerkPigZombie.java | 124 ++++++ .../game/games/smash/perks/pig/SmashPig.java | 30 ++ .../games/smash/perks/sheep/PerkLazer.java | 244 ++++++++++++ .../games/smash/perks/sheep/PerkWoolBomb.java | 364 ++++++++++++++++++ .../smash/perks/sheep/PerkWoolCloud.java | 189 +++++++++ .../games/smash/perks/sheep/SmashSheep.java | 123 ++++++ .../perks/skeletalhorse/PerkBoneRush.java | 241 ++++++++++++ .../perks/skeletalhorse/PerkDeadlyBones.java | 140 +++++++ .../perks/skeletalhorse/PerkHorseKick.java | 197 ++++++++++ .../skeletalhorse/SmashSkeletalHorse.java | 55 +++ .../smash/perks/skeleton/PerkBarrage.java | 322 ++++++++++++++++ .../perks/skeleton/PerkBoneExplosion.java | 109 ++++++ .../src/nautilus/game/arcade/kit/Perk.java | 5 + .../nautilus/game/arcade/kit/SmashPerk.java | 48 --- .../game/arcade/kit/perks/PerkBarrage.java | 2 +- .../game/arcade/kit/perks/PerkBatForm.java | 4 +- .../game/arcade/kit/perks/PerkBatWave.java | 2 +- .../game/arcade/kit/perks/PerkBlink.java | 114 +++--- .../game/arcade/kit/perks/PerkBlockToss.java | 254 +++++++----- .../arcade/kit/perks/PerkBoneExplosion.java | 2 +- .../game/arcade/kit/perks/PerkBoneRush.java | 2 +- .../arcade/kit/perks/PerkChickenRocket.java | 8 +- .../kit/perks/PerkCreeperElectricity.java | 147 ++++--- .../arcade/kit/perks/PerkCreeperExplode.java | 231 ++++++----- .../kit/perks/PerkCreeperSulphurBomb.java | 96 +++-- .../arcade/kit/perks/PerkDeadlyBones.java | 3 +- .../game/arcade/kit/perks/PerkEarthquake.java | 2 +- .../game/arcade/kit/perks/PerkEggGun.java | 2 +- .../arcade/kit/perks/PerkEndermanDragon.java | 2 +- .../game/arcade/kit/perks/PerkFirefly.java | 199 +++++----- .../game/arcade/kit/perks/PerkFlameDash.java | 116 +++--- .../game/arcade/kit/perks/PerkFlap.java | 2 +- .../game/arcade/kit/perks/PerkFleshArrow.java | 2 +- .../game/arcade/kit/perks/PerkHorseKick.java | 154 +++++--- .../arcade/kit/perks/PerkInfernalHorror.java | 2 +- .../game/arcade/kit/perks/PerkInferno.java | 142 ------- .../game/arcade/kit/perks/PerkInkBlast.java | 2 +- .../game/arcade/kit/perks/PerkIronHook.java | 90 +++-- .../game/arcade/kit/perks/PerkLazer.java | 212 +++++----- .../arcade/kit/perks/PerkMeteorShower.java | 2 +- .../game/arcade/kit/perks/PerkNeedler.java | 2 +- .../arcade/kit/perks/PerkNightLivingDead.java | 2 +- .../arcade/kit/perks/PerkNotFinished.java | 15 - .../game/arcade/kit/perks/PerkOvercharge.java | 2 +- .../arcade/kit/perks/PerkPigBaconBomb.java | 2 +- .../arcade/kit/perks/PerkPigBaconBounce.java | 2 +- .../game/arcade/kit/perks/PerkPigZombie.java | 2 +- .../game/arcade/kit/perks/PerkRopedArrow.java | 2 +- .../arcade/kit/perks/PerkSeismicSlam.java | 167 ++++---- .../arcade/kit/perks/PerkSheepHoming.java | 2 +- .../kit/perks/PerkSkeletonArrowStorm.java | 4 +- .../arcade/kit/perks/PerkSlimeRocket.java | 2 +- .../game/arcade/kit/perks/PerkSlimeSlam.java | 2 +- .../game/arcade/kit/perks/PerkSnowTurret.java | 2 +- .../arcade/kit/perks/PerkSpidersNest.java | 2 +- .../game/arcade/kit/perks/PerkStormSquid.java | 4 +- .../game/arcade/kit/perks/PerkSuperSquid.java | 2 +- .../game/arcade/kit/perks/PerkWebShot.java | 2 +- .../arcade/kit/perks/PerkWitchPotion.java | 2 +- .../game/arcade/kit/perks/PerkWitherForm.java | 4 +- .../arcade/kit/perks/PerkWitherImage.java | 2 +- .../arcade/kit/perks/PerkWitherSkull.java | 2 +- .../game/arcade/kit/perks/PerkWolf.java | 2 +- .../game/arcade/kit/perks/PerkWoolBomb.java | 264 +++++++------ .../game/arcade/kit/perks/PerkWoolCloud.java | 158 +++++--- .../game/arcade/kit/perks/PerkZombieBile.java | 2 +- .../arcade/kit/perks/PerkZombieNightDead.java | 2 +- .../game/arcade/kit/perks/PerkZombieRot.java | 2 +- .../arcade/kit/perks/data/FissureData.java | 16 +- .../kit/perks/data/HomingSheepData.java | 18 +- .../kit/perks/data/MeteorShowerData.java | 7 +- .../arcade/kit/perks/data/WoolBombData.java | 3 +- .../stats/RecoveryMasterStatTracker.java | 6 + 136 files changed, 8436 insertions(+), 2473 deletions(-) delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitKnight.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowMooshroomMadness.java rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/{kit => game/games/smash}/perks/PerkSmashStats.java (97%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/{kit => game/games/smash/perks}/SmashKit.java (90%) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashKit2.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashPerk.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashUltimate.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkFirefly.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkInferno.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/SmashBlaze.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkEggGun.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkFlap.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/SmashChicken.java rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/{ => cow}/DataCowCharge.java (92%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/{ => cow}/DataCowMilkSpiral.java (97%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/{ => cow}/PerkCowAngryHerd.java (63%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/{ => cow}/PerkCowMilkSpiral.java (56%) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowMooshroomMadness.java rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/{ => cow}/PerkCowStampede.java (61%) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperElectricity.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperExplode.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperSulphurBomb.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/SmashCreeper.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlink.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/{ => enderman}/PerkEndermanTeleport.java (54%) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/SmashEnderman.java rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/{kit/perks => game/games/smash/perks/golem}/PerkFissure.java (66%) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkIronHook.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkSeismicSlam.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashEnderman.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkFlameDash.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBlast.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBoost.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/SmashMagmacube.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBomb.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBounce.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigZombie.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/SmashPig.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkLazer.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolBomb.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolCloud.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/SmashSheep.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkBoneRush.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkDeadlyBones.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkHorseKick.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/SmashSkeletalHorse.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBarrage.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBoneExplosion.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/SmashPerk.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInferno.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNotFinished.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkBlinkMonsterLeague.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkBlinkMonsterLeague.java index de32a72e1..2ee19c256 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkBlinkMonsterLeague.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkBlinkMonsterLeague.java @@ -20,7 +20,6 @@ import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilPlayer; import mineplex.core.recharge.Recharge; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashPerk; public class PerkBlinkMonsterLeague extends Perk { 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 2ce62d81c..c4e8fa040 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 @@ -15,8 +15,9 @@ import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam.PlayerState; import nautilus.game.arcade.game.games.smash.kits.*; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.SmashKit; + import org.bukkit.*; import org.bukkit.FireworkEffect.Type; import org.bukkit.block.BlockFace; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java index 7d560c10a..d129e972d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java @@ -3,9 +3,14 @@ package nautilus.game.arcade.game.games.smash; import java.util.ArrayList; import java.util.List; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + import mineplex.core.common.util.C; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.game.GameTeam; @@ -17,55 +22,31 @@ import nautilus.game.arcade.stats.OneVThreeStatTracker; import nautilus.game.arcade.stats.RecoveryMasterStatTracker; import nautilus.game.arcade.stats.WinWithoutDyingStatTracker; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; - public class TeamSuperSmash extends SuperSmash { - - public TeamSuperSmash(ArcadeManager manager) + + public TeamSuperSmash(ArcadeManager manager) { - super(manager, GameType.SmashTeams, - new String[] - { - "Each player has 3 respawns", - "Attack to restore hunger!", - "Last team alive wins!" - }); - + super(manager, GameType.SmashTeams, new String[] { "Each player has 3 respawns", "Attack to restore hunger!", "Last team alive wins!" }); + PlayersPerTeam = 2; FillTeamsInOrderToCount = 2; - + SpawnNearAllies = true; DamageTeamSelf = false; - + TeamArmorHotbar = true; - + DontAllowOverfill = true; - + TeamMode = true; registerModule(new TeamModule()); - registerStatTrackers( - new WinWithoutDyingStatTracker(this, "MLGPro"), - new FreeKitWinStatTracker(this), - new OneVThreeStatTracker(this), - new KillFastStatTracker(this, 3, 10, "TripleKill"), - new RecoveryMasterStatTracker(this) - ); + registerStatTrackers(new WinWithoutDyingStatTracker(this, "MLGPro"), new FreeKitWinStatTracker(this), new OneVThreeStatTracker(this), new KillFastStatTracker(this, 3, 10, "TripleKill"), + new RecoveryMasterStatTracker(this)); - registerChatStats( - Kills, - Deaths, - KDRatio, - BlankLine, - Assists, - DamageTaken, - DamageDealt, - BlankLine, - new ChatStatData("kit", "Kit", true) - ); + registerChatStats(Kills, Deaths, KDRatio, BlankLine, Assists, DamageTaken, DamageDealt, BlankLine, new ChatStatData("kit", "Kit", true)); } @Override @@ -81,20 +62,20 @@ public class TeamSuperSmash extends SuperSmash if (team.IsTeamAlive()) alive.add(team); } - - //Wipe Last + + // Wipe Last Scoreboard.reset(); Scoreboard.writeNewLine(); - + if (GetPlayers(true).size() < 16) { - + for (GameTeam team : GetTeamList()) { for (Player player : team.GetPlayers(true)) { int lives = GetLives(player); - + Scoreboard.write(C.cWhite + lives + " " + team.GetColor() + player.getName()); } } @@ -104,12 +85,12 @@ public class TeamSuperSmash extends SuperSmash for (GameTeam team : alive) { int lives = 0; - + for (Player player : team.GetPlayers(true)) { lives += GetLives(player); } - + Scoreboard.write(C.cWhite + lives + " " + team.GetColor() + team.GetName()); } } @@ -118,10 +99,31 @@ public class TeamSuperSmash extends SuperSmash Scoreboard.write(C.cYellow + C.Bold + "Teams Alive"); Scoreboard.write(C.cWhite + alive.size()); } - + Scoreboard.draw(); } + @EventHandler + public void onCustomDamage(CustomDamageEvent event) + { + if (!(event.GetDamagerEntity(true) instanceof Player || event.GetDamageeEntity() instanceof Player)) + { + return; + } + + Player damager = event.GetDamagerPlayer(true); + Player damagee = event.GetDamageePlayer(); + + if (GetTeam(damager).equals(GetTeam(damagee))) + { + if (event.GetCause() == DamageCause.FIRE) + { + damagee.setFireTicks(0); + } + + event.SetCancelled("Team Damage"); + } + } @Override public void EndCheck() { @@ -136,7 +138,7 @@ public class TeamSuperSmash extends SuperSmash if (teamsAlive.size() <= 1) { - //Announce + // Announce if (teamsAlive.size() > 0) AnnounceEnd(teamsAlive.get(0)); @@ -153,7 +155,7 @@ public class TeamSuperSmash extends SuperSmash AddGems(player, 10, "Participation", false, false); } - //End + // End SetState(GameState.End); } } @@ -183,7 +185,7 @@ public class TeamSuperSmash extends SuperSmash return players; } - + @Override public String GetMode() { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java index 3d1d42840..f76f1fb2c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java @@ -1,5 +1,12 @@ package nautilus.game.arcade.game.games.smash.kits; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; + import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseBlaze; @@ -8,24 +15,18 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; +import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.game.games.smash.perks.blaze.PerkInferno; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashKit; -import nautilus.game.arcade.kit.perks.*; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.inventory.ItemStack; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import nautilus.game.arcade.kit.perks.PerkFirefly; +import nautilus.game.arcade.kit.perks.PerkKnockbackFire; +import nautilus.game.arcade.kit.perks.PerkSpeed; -public class KitBlaze extends SmashKit +public class KitBlaze extends SmashKit2 { - private static final String[] DESCRIPTION = { - DOUBLE_JUMP, - }; - private static final Perk[] PERKS = { new PerkSmashStats(6, 1.5, 0.25, 5), new PerkDoubleJump("Double Jump", 1, 1, false), @@ -64,20 +65,22 @@ public class KitBlaze extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + new ItemStack(Material.CHAINMAIL_BOOTS), + new ItemStack(Material.CHAINMAIL_LEGGINGS), + new ItemStack(Material.CHAINMAIL_CHESTPLATE), }; public KitBlaze(ArcadeManager manager) { - super(manager, "Blaze", KitAvailability.Gem, 8000, DESCRIPTION, PERKS, EntityType.BLAZE, IN_HAND, "Phoenix", 18000, Sound.BLAZE_DEATH); + super(manager, "Blaze", KitAvailability.Gem, 8000, PERKS, EntityType.BLAZE, IN_HAND, DisguiseBlaze.class); } - + @Override - public void giveCoreItems(Player player) - { + public void GiveItems(Player player) + { + disguise(player); + UtilInv.Clear(player); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); @@ -86,51 +89,30 @@ public class KitBlaze extends SmashKit player.getInventory().addItem(PLAYER_ITEMS[2]); } - player.getInventory().setArmorContents(PLAYER_ARMOR); } - @Override - public void giveSuperItems(Player player) - { - player.getInventory().remove(Material.IRON_SWORD); - player.getInventory().remove(Material.IRON_AXE); - - UtilInv.Update(player); - } - - @Override - public void GiveItems(Player player) - { - giveCoreItems(player); - - //Disguise - DisguiseBlaze disguise = new DisguiseBlaze(player); - - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else - disguise.setName(player.getName()); - - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); - } - @EventHandler public void FireItemResist(UpdateEvent event) { if (event.getType() != UpdateType.FAST) + { return; - + } + if (Manager.GetGame() == null) + { return; - + } + for (Player player : Manager.GetGame().GetPlayers(true)) { if (!HasKit(player)) + { continue; - + } + Manager.GetCondition().Factory().FireItemImmunity(GetName(), player, player, 1.9, false); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java index 7c8e185d2..cbb78ffce 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java @@ -1,30 +1,28 @@ package nautilus.game.arcade.game.games.smash.kits; +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.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseChicken; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; +import nautilus.game.arcade.game.games.smash.perks.SmashKit2; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.perks.PerkChickenRocket; import nautilus.game.arcade.kit.perks.PerkEggGun; import nautilus.game.arcade.kit.perks.PerkFlap; -import nautilus.game.arcade.kit.perks.PerkSmashStats; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -public class KitChicken extends SmashKit +public class KitChicken extends SmashKit2 { - private static final String[] DESCRIPTION = { - }; - + private static final Perk[] PERKS = { new PerkSmashStats(4.5, 2.0, 0.2, 2), new PerkFlap(0.8, 0.8, false), @@ -71,19 +69,21 @@ public class KitChicken extends SmashKit private static final ItemStack[] PLAYER_ARMOR = { null, null, - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + new ItemStack(Material.CHAINMAIL_CHESTPLATE), null }; public KitChicken(ArcadeManager manager) { - super(manager, "Chicken", KitAvailability.Gem, 8000, DESCRIPTION, PERKS, EntityType.CHICKEN, IN_HAND, "Aerial Gunner", 20000, Sound.CHICKEN_HURT); + super(manager, "Chicken", KitAvailability.Gem, 8000, PERKS, EntityType.CHICKEN, IN_HAND, DisguiseChicken.class); } @Override - public void giveCoreItems(Player player) + public void GiveItems(Player player) { + disguise(player); + UtilInv.Clear(player); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); @@ -93,39 +93,6 @@ public class KitChicken extends SmashKit player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]); } - player.getInventory().setArmorContents(PLAYER_ARMOR); } - - @Override - public void giveSuperItems(Player player) - { - player.getInventory().remove(Material.IRON_SWORD); - player.getInventory().remove(Material.IRON_AXE); - - UtilInv.Update(player); - } - - @Override - public void GiveItems(Player player) - { - giveCoreItems(player); - - //Disguise - DisguiseChicken disguise = new DisguiseChicken(player); - - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else - disguise.setName(player.getName()); - - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); - } - - @Override - public void activateSuperCustom(Player player) - { - player.setExp(0.99f); - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java index 8bfc4aa06..87d62ed0e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java @@ -1,30 +1,29 @@ package nautilus.game.arcade.game.games.smash.kits; +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.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseCow; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; -import nautilus.game.arcade.game.games.smash.perks.PerkCowAngryHerd; -import nautilus.game.arcade.game.games.smash.perks.PerkCowMilkSpiral; -import nautilus.game.arcade.game.games.smash.perks.PerkCowMooshroomMadness; -import nautilus.game.arcade.game.games.smash.perks.PerkCowStampede; +import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; +import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.game.games.smash.perks.cow.PerkCowAngryHerd; +import nautilus.game.arcade.game.games.smash.perks.cow.PerkCowMilkSpiral; +import nautilus.game.arcade.game.games.smash.perks.cow.PerkCowMooshroomMadness; +import nautilus.game.arcade.game.games.smash.perks.cow.PerkCowStampede; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.perks.PerkDoubleJump; -import nautilus.game.arcade.kit.perks.PerkSmashStats; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -public class KitCow extends SmashKit +public class KitCow extends SmashKit2 { - private static final String[] DESCRIPTION = { - }; private static final Perk[] PERKS = { new PerkSmashStats(6, 1.1, 0.25, 6.5), @@ -70,57 +69,34 @@ public class KitCow extends SmashKit ChatColor.RESET + "and abilities, halves ability cooldowns,", ChatColor.RESET + "and increases your health to 15 hearts.", ChatColor.RESET + "", - ChatColor.RESET + "You remain a Mooshroom until you die.", + ChatColor.RESET + "You remain a Mooshroom for 30 seconds.", }) }; private static final ItemStack[] PLAYER_ARMOR = { - ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS), - ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), - ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET), - + new ItemStack(Material.IRON_BOOTS), + new ItemStack(Material.IRON_LEGGINGS), + new ItemStack(Material.CHAINMAIL_CHESTPLATE), + new ItemStack(Material.IRON_HELMET), }; public KitCow(ArcadeManager manager) { - super(manager, "Cow", KitAvailability.Gem, 6000, DESCRIPTION, PERKS, EntityType.COW, IN_HAND, "Mooshroom Madness", 0, null); + super(manager, "Cow", KitAvailability.Gem, 6000, PERKS, EntityType.COW, IN_HAND, DisguiseCow.class); } @Override - public void giveCoreItems(Player player) + public void GiveItems(Player player) { + disguise(player); + UtilInv.Clear(player); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); if (Manager.GetGame().GetState() == GameState.Recruit) player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]); - player.getInventory().setArmorContents(PLAYER_ARMOR); } - - @Override - public void giveSuperItems(Player player) - { - - } - - @Override - public void GiveItems(Player player) - { - giveCoreItems(player); - - //Disguise - DisguiseCow disguise = new DisguiseCow(player); - - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else - disguise.setName(player.getName()); - - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java index 46d839e2b..378b612e6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java @@ -1,27 +1,28 @@ package nautilus.game.arcade.game.games.smash.kits; +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.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseCreeper; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; +import nautilus.game.arcade.game.games.smash.perks.SmashKit2; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashKit; -import nautilus.game.arcade.kit.perks.*; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; +import nautilus.game.arcade.kit.perks.PerkCreeperElectricity; +import nautilus.game.arcade.kit.perks.PerkCreeperExplode; +import nautilus.game.arcade.kit.perks.PerkCreeperSulphurBomb; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; -public class KitCreeper extends SmashKit +public class KitCreeper extends SmashKit2 { - private static final String[] DESCRIPTION = { - }; - private static final Perk[] PERKS = { new PerkSmashStats(6, 1.65, 0.4, 3.5), new PerkDoubleJump("Double Jump", 0.9, 0.9, false), @@ -72,21 +73,22 @@ public class KitCreeper extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS), - ItemStackFactory.Instance.CreateStack(Material.LEATHER_LEGGINGS), - ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE), - ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET), - + new ItemStack(Material.LEATHER_BOOTS), + new ItemStack(Material.LEATHER_LEGGINGS), + new ItemStack(Material.LEATHER_CHESTPLATE), + new ItemStack(Material.LEATHER_HELMET), }; public KitCreeper(ArcadeManager manager) { - super(manager, "Creeper", KitAvailability.Gem, 4000, DESCRIPTION, PERKS, EntityType.CREEPER, IN_HAND, "Atomic Blast", 0, Sound.CREEPER_DEATH); + super(manager, "Creeper", KitAvailability.Gem, 4000, PERKS, EntityType.CREEPER, IN_HAND, DisguiseCreeper.class); } @Override - public void giveCoreItems(Player player) + public void GiveItems(Player player) { + disguise(player); + UtilInv.Clear(player); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); @@ -95,27 +97,4 @@ public class KitCreeper extends SmashKit player.getInventory().setArmorContents(PLAYER_ARMOR); } - - @Override - public void giveSuperItems(Player player) - { - - } - - @Override - public void GiveItems(Player player) - { - giveCoreItems(player); - - //Disguise - DisguiseCreeper disguise = new DisguiseCreeper(player); - - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else - disguise.setName(player.getName()); - - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitEnderman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitEnderman.java index d064ad2ba..f2745458a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitEnderman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitEnderman.java @@ -1,5 +1,17 @@ package nautilus.game.arcade.game.games.smash.kits; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map.Entry; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.inventory.ItemStack; + import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseEnderman; @@ -8,30 +20,20 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; -import nautilus.game.arcade.game.games.smash.perks.PerkEndermanTeleport; +import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; +import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.game.games.smash.perks.enderman.PerkEndermanTeleport; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashKit; -import nautilus.game.arcade.kit.perks.*; +import nautilus.game.arcade.kit.perks.PerkBlink; +import nautilus.game.arcade.kit.perks.PerkBlockToss; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import nautilus.game.arcade.kit.perks.PerkEndermanDragon; import nautilus.game.arcade.kit.perks.event.PerkBlockGrabEvent; import nautilus.game.arcade.kit.perks.event.PerkBlockThrowEvent; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.inventory.ItemStack; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map.Entry; - -public class KitEnderman extends SmashKit +public class KitEnderman extends SmashKit2 { - private static final String[] DESCRIPTION = { - }; private static final Perk[] PERKS = { new PerkSmashStats(7, 1.3, 0.25, 6), @@ -73,10 +75,10 @@ public class KitEnderman extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + new ItemStack(Material.CHAINMAIL_BOOTS), + new ItemStack(Material.CHAINMAIL_LEGGINGS), + new ItemStack(Material.CHAINMAIL_CHESTPLATE), + new ItemStack(Material.CHAINMAIL_HELMET), }; @@ -84,49 +86,26 @@ public class KitEnderman extends SmashKit public KitEnderman(ArcadeManager manager) { - super(manager, "Enderman", KitAvailability.Gem, 3000, DESCRIPTION, PERKS, EntityType.ENDERMAN, IN_HAND, "Dragon Rider", 30000, Sound.ENDERDRAGON_GROWL); - } - - @Override - public void giveCoreItems(Player player) - { - UtilInv.Clear(player); - - player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); - - if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(PLAYER_ITEMS[2]); - - player.getInventory().setArmorContents(PLAYER_ARMOR); - } - - @Override - public void giveSuperItems(Player player) - { - player.getInventory().remove(Material.IRON_SWORD); - player.getInventory().remove(Material.IRON_AXE); - - UtilInv.Update(player); + super(manager, "Enderman", KitAvailability.Gem, 3000, PERKS, EntityType.ENDERMAN, IN_HAND, DisguiseEnderman.class); } @Override public void GiveItems(Player player) { - giveCoreItems(player); + disguise(player); + + _disguises.put(player, (DisguiseEnderman) Manager.GetDisguise().getActiveDisguise(player)); + + UtilInv.Clear(player); - //Disguise - DisguiseEnderman disguise = new DisguiseEnderman(player); + player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else - disguise.setName(player.getName()); - - disguise.setCustomNameVisible(true); - disguise.a(false); - Manager.GetDisguise().disguise(disguise); - - _disguises.put(player, disguise); + if (Manager.GetGame().GetState() == GameState.Recruit) + { + player.getInventory().addItem(PLAYER_ITEMS[2]); + } + + player.getInventory().setArmorContents(PLAYER_ARMOR); } @EventHandler @@ -150,8 +129,10 @@ public class KitEnderman extends SmashKit public void SetBlock(DisguiseEnderman disguise, int id, byte data) { if (disguise == null) + { return; - + } + disguise.SetCarriedId(id); disguise.SetCarriedData(data); @@ -162,16 +143,19 @@ public class KitEnderman extends SmashKit public void cleanDisguises(UpdateEvent event) { if (event.getType() != UpdateType.FAST) + { return; - - for (Iterator> iterator = _disguises.entrySet().iterator(); iterator.hasNext(); ) + } + + for (Iterator> iterator = _disguises.entrySet().iterator(); iterator.hasNext();) { Entry current = iterator.next(); if (!Manager.GetDisguise().isDisguised(current.getKey())) { iterator.remove(); - } else if (Manager.GetDisguise().getDisguise(current.getKey()) != current.getValue()) + } + else if (Manager.GetDisguise().getActiveDisguise(current.getKey()) != current.getValue()) { iterator.remove(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGolem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGolem.java index 14d1f20d9..3d9e0c5da 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGolem.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGolem.java @@ -6,9 +6,11 @@ import mineplex.core.disguise.disguises.DisguiseIronGolem; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.golem.PerkFissure; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.perks.*; import org.bukkit.ChatColor; import org.bukkit.Material; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitKnight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitKnight.java deleted file mode 100644 index 5981b1303..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitKnight.java +++ /dev/null @@ -1,291 +0,0 @@ -package nautilus.game.arcade.game.games.smash.kits; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; - -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Horse; -import org.bukkit.entity.Horse.Color; -import org.bukkit.entity.Horse.Style; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Horse.Variant; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.player.PlayerInteractEntityEvent; -import org.bukkit.inventory.ItemStack; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.disguise.disguises.DisguiseSkeleton; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashKit; -import nautilus.game.arcade.kit.perks.PerkNotFinished; -import nautilus.game.arcade.kit.perks.PerkDoubleJumpHorse; -import nautilus.game.arcade.kit.perks.PerkFletcher; -import nautilus.game.arcade.kit.perks.PerkHorseKick; -import nautilus.game.arcade.kit.perks.PerkKnockbackArrow; -import nautilus.game.arcade.kit.perks.PerkSmashStats; - -public class KitKnight extends SmashKit -{ - private HashMap _mounts = new HashMap(); - private HashSet _horses = new HashSet(); - - private HashSet _calledEvents = new HashSet(); - - public KitKnight(ArcadeManager manager) - { - super(manager, "Undead Knight", KitAvailability.Gem, 5000, - - new String[] - { - }, - - new Perk[] - { - new PerkSmashStats(6, 1.2, 0.25, 7.5), - new PerkFletcher(1, 2, false), - new PerkKnockbackArrow(2), - new PerkDoubleJumpHorse(), - new PerkHorseKick(), - new PerkNotFinished() - }, - EntityType.HORSE, - new ItemStack(Material.IRON_BARDING), - "", 0, null); - } - - @Override - public void giveCoreItems(Player player) - { - UtilInv.Clear(player); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Horse Kick", - new String[] - { - - })); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Coming Soon...", - new String[] - { - - })); - - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS)); - } - - @Override - public void giveSuperItems(Player player) - { - - } - - @Override - public void GiveItems(Player player) - { - //Disguise - DisguiseSkeleton disguise = new DisguiseSkeleton(player); - - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else - disguise.setName(player.getName()); - - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); - - //Horse - Manager.GetGame().CreatureAllowOverride = true; - final Horse horse = player.getWorld().spawn(player.getLocation(), Horse.class); - Manager.GetGame().CreatureAllowOverride = false; - - //Owner - horse.setTamed(true); - horse.setOwner(player); - horse.setMaxDomestication(1); - - //Visual - horse.setColor(Color.DARK_BROWN); - horse.setStyle(Style.WHITE_DOTS); - horse.setVariant(Variant.UNDEAD_HORSE); - horse.getInventory().setSaddle(new ItemStack(Material.SADDLE)); - horse.getInventory().setArmor(new ItemStack(Material.IRON_BARDING)); - - //Stats - horse.setAdult(); - horse.setJumpStrength(1); - horse.setMaxHealth(100); - horse.setHealth(horse.getMaxHealth()); - - _horses.add(horse); - _mounts.put(player, horse); - - /* - final Player fPlayer = player; - - Manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() - { - public void run() - { - horse.setPassenger(fPlayer); - } - }, 1); - */ - } - - @EventHandler - public void HorseUpdate(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - Iterator horseIterator = _horses.iterator(); - - while (horseIterator.hasNext()) - { - Horse horse = horseIterator.next(); - - if (horse.isValid() && _mounts.containsValue(horse)) - continue; - - horseIterator.remove(); - horse.remove(); - } - } - - @EventHandler - public void HorseUpdate(PlayerInteractEntityEvent event) - { - if (!(event.getRightClicked() instanceof Horse)) - return; - - Player player = event.getPlayer(); - Horse horse = (Horse)event.getRightClicked(); - - if (_mounts.containsKey(player) && _mounts.get(player).equals(horse)) - return; - - UtilPlayer.message(player, F.main("Game", "This is not your " + F.elem("Skeletal Horse") + "!")); - event.setCancelled(true); - } - - @EventHandler(priority = EventPriority.LOWEST) - public void PlayerDamage(CustomDamageEvent event) - { - if (_calledEvents.contains(event)) - return; - - Player damagee = event.GetDamageePlayer(); - if (damagee == null) return; - - if (damagee.getVehicle() == null) - return; - - if (!(damagee.getVehicle() instanceof Horse)) - return; - - if (event.GetCause() == DamageCause.SUFFOCATION) - { - event.SetCancelled("Horse Suffocation"); - return; - } - - Horse horse = (Horse)damagee.getVehicle(); - - //Damage Event - CustomDamageEvent newEvent = new CustomDamageEvent(horse, event.GetDamagerEntity(true), event.GetProjectile(), null, - event.GetCause(), event.GetDamageInitial(), true, false, false, - UtilEnt.getName(event.GetDamagerPlayer(true)), event.GetReason(), false); - -// _calledEvents.add(newEvent); -// Manager.getPlugin().getServer().getPluginManager().callEvent(newEvent); -// _calledEvents.remove(newEvent); - } - - @EventHandler(priority = EventPriority.LOWEST) - public void HorseDamage(CustomDamageEvent event) - { - if (_calledEvents.contains(event)) - return; - - if (event.GetCause() == DamageCause.THORNS) - return; - - if (!(event.GetDamageeEntity() instanceof Horse)) - return; - - Horse horse = (Horse)event.GetDamageeEntity(); - - if (horse.getPassenger() == null) - return; - - if (!(horse.getPassenger() instanceof Player)) - return; - - Player player = (Player)horse.getPassenger(); - - //Damage Event - final CustomDamageEvent newEvent = new CustomDamageEvent(player, event.GetDamagerEntity(true), event.GetProjectile(), null, - event.GetCause(), event.GetDamageInitial(), true, false, false, - UtilEnt.getName(event.GetDamagerPlayer(true)), event.GetReason(), false); - - _calledEvents.add(newEvent); - Manager.getPlugin().getServer().getPluginManager().callEvent(newEvent); - _calledEvents.remove(newEvent); - //Add Knockback - event.AddKnockback("Knockback Multiplier", 1.2); - } - - @Override - public Entity SpawnEntity(Location loc) - { - EntityType type = _entityType; - if (type == EntityType.PLAYER) - type = EntityType.ZOMBIE; - - LivingEntity entity = (LivingEntity) Manager.GetCreature().SpawnEntity(loc, type); - - entity.setRemoveWhenFarAway(false); - entity.setCustomName(GetAvailability().GetColor() + GetName() + " Kit"); - entity.setCustomNameVisible(true); - entity.getEquipment().setItemInHand(_itemInHand); - - if (type == EntityType.HORSE) - { - Horse horse = (Horse)entity; - horse.setAdult(); - horse.setColor(Color.DARK_BROWN); - horse.setStyle(Style.WHITE_DOTS); - horse.setVariant(Variant.UNDEAD_HORSE); - horse.getInventory().setSaddle(new ItemStack(Material.SADDLE)); - horse.getInventory().setArmor(new ItemStack(Material.IRON_BARDING)); - } - - UtilEnt.Vegetate(entity); - - SpawnCustom(entity); - - return entity; - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java index f90b5c729..bbbc8d711 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java @@ -1,26 +1,29 @@ package nautilus.game.arcade.game.games.smash.kits; +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.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseMagmaCube; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; +import nautilus.game.arcade.game.games.smash.perks.SmashKit2; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashKit; -import nautilus.game.arcade.kit.perks.*; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import nautilus.game.arcade.kit.perks.PerkFlameDash; +import nautilus.game.arcade.kit.perks.PerkMagmaBlast; +import nautilus.game.arcade.kit.perks.PerkMagmaBoost; +import nautilus.game.arcade.kit.perks.PerkMeteorShower; -public class KitMagmaCube extends SmashKit +public class KitMagmaCube extends SmashKit2 { - private static final String[] DESCRIPTION = { - }; private static final Perk[] PERKS = { new PerkSmashStats(5, 1.75, 0.35, 5), @@ -67,20 +70,26 @@ public class KitMagmaCube extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + new ItemStack(Material.CHAINMAIL_BOOTS), null, - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + new ItemStack(Material.CHAINMAIL_CHESTPLATE), + new ItemStack(Material.CHAINMAIL_HELMET), }; public KitMagmaCube(ArcadeManager manager) { - super(manager, "Magma Cube", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, EntityType.MAGMA_CUBE, IN_HAND, "Meteor Shower", 0, Sound.AMBIENCE_THUNDER); + super(manager, "Magma Cube", KitAvailability.Gem, 5000, PERKS, EntityType.MAGMA_CUBE, IN_HAND, DisguiseMagmaCube.class); } @Override - public void giveCoreItems(Player player) + public void GiveItems(Player player) { + disguise(player); + + DisguiseMagmaCube disguise = (DisguiseMagmaCube) Manager.GetDisguise().getActiveDisguise(player); + + disguise.SetSize(1); + UtilInv.Clear(player); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); @@ -88,31 +97,6 @@ public class KitMagmaCube extends SmashKit if (Manager.GetGame().GetState() == GameState.Recruit) player.getInventory().addItem(PLAYER_ITEMS[2]); - player.getInventory().setArmorContents(PLAYER_ARMOR); - } - - @Override - public void giveSuperItems(Player player) - { - - } - - @Override - public void GiveItems(Player player) - { - giveCoreItems(player); - - //Disguise - DisguiseMagmaCube disguise = new DisguiseMagmaCube(player); - - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else - disguise.setName(player.getName()); - - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); - - disguise.SetSize(1); + player.getInventory().setArmorContents(PLAYER_ARMOR);; } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java index 228622660..f2956631d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java @@ -1,5 +1,12 @@ package nautilus.game.arcade.game.games.smash.kits; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; + import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguisePig; @@ -8,23 +15,22 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; +import nautilus.game.arcade.game.games.smash.perks.SmashKit2; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashKit; -import nautilus.game.arcade.kit.perks.*; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.inventory.ItemStack; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import nautilus.game.arcade.kit.perks.PerkPigBaconBomb; +import nautilus.game.arcade.kit.perks.PerkPigBaconBounce; +import nautilus.game.arcade.kit.perks.PerkPigZombie; -public class KitPig extends SmashKit +public class KitPig extends SmashKit2 { - private static final String[] DESCRIPTION = { - }; + private static final float MAX_ENERGY = 0.99F; + private static final float ENERGY_PER_TICK_NORMAL = 0.005F; + private static final float ENERGY_PER_TICK_SMASH = 0.02F; + private static final Perk[] PERKS = { new PerkSmashStats(5, 1.5, 0.25, 5), new PerkDoubleJump("Double Jump", 0.9, 0.9, false), @@ -75,21 +81,23 @@ public class KitPig extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + new ItemStack(Material.CHAINMAIL_BOOTS), + new ItemStack(Material.CHAINMAIL_LEGGINGS), + new ItemStack(Material.CHAINMAIL_CHESTPLATE), null, }; public KitPig(ArcadeManager manager) { - super(manager, "Pig", KitAvailability.Gem, 7000, DESCRIPTION, PERKS, EntityType.PIG, IN_HAND, "Pig Stink", 40000, Sound.PIG_DEATH); + super(manager, "Pig", KitAvailability.Gem, 7000, PERKS, EntityType.PIG, IN_HAND, DisguisePig.class); } @Override - public void giveCoreItems(Player player) + public void GiveItems(Player player) { + disguise(player); + UtilInv.Clear(player); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); @@ -97,59 +105,25 @@ public class KitPig extends SmashKit if (Manager.GetGame().GetState() == GameState.Recruit) player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]); - player.getInventory().setArmorContents(PLAYER_ARMOR); } - @Override - public void giveSuperItems(Player player) - { - - } - - @Override - public void GiveItems(Player player) - { - giveCoreItems(player); - - //Disguise - DisguisePig disguise = new DisguisePig(player); - - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else - disguise.setName(player.getName()); - - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); - } - @EventHandler public void EnergyUpdate(UpdateEvent event) { if (event.getType() != UpdateType.TICK) + { return; - + } + for (Player player : Manager.GetGame().GetPlayers(true)) { if (!HasKit(player)) + { continue; - - player.setExp((float) Math.min(0.999, player.getExp() + (isSuperActive(player) ? 0.02 : 0.005))); + } + + player.setExp((float) Math.min(MAX_ENERGY, player.getExp() + (isSmashActive(player) ? ENERGY_PER_TICK_SMASH : ENERGY_PER_TICK_NORMAL))); } } - - @Override - public void activateSuperCustom(Player player) - { - for (Player other : Manager.GetGame().GetPlayers(true)) - if (!player.equals(other)) - Manager.GetCondition().Factory().Confuse("Pig Stink " + player.getName(), other, player, 40, 0, false, false, false); - } - - @Override - public void deactivateSuperCustom(Player player) - { - - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java index 04013e1af..9ca8f4caa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java @@ -1,5 +1,11 @@ package nautilus.game.arcade.game.games.smash.kits; +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.achievement.Achievement; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; @@ -7,22 +13,18 @@ import mineplex.core.disguise.disguises.DisguiseSheep; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; +import nautilus.game.arcade.game.games.smash.perks.SmashKit2; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashKit; -import nautilus.game.arcade.kit.perks.*; -import org.bukkit.ChatColor; -import org.bukkit.DyeColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import nautilus.game.arcade.kit.perks.PerkLazer; +import nautilus.game.arcade.kit.perks.PerkSheepHoming; +import nautilus.game.arcade.kit.perks.PerkWoolBomb; +import nautilus.game.arcade.kit.perks.PerkWoolCloud; -public class KitSheep extends SmashKit +public class KitSheep extends SmashKit2 { - private static final String[] DESCRIPTION = { - }; private static final Perk[] PERKS = { new PerkSmashStats(5, 1.7, 0.25, 5), @@ -89,14 +91,16 @@ public class KitSheep extends SmashKit public KitSheep(ArcadeManager manager) { - super(manager, "Sir. Sheep", KitAvailability.Achievement, 99999, DESCRIPTION, PERKS, EntityType.SHEEP, IN_HAND, "Homing Sheeples", 0, Sound.SHEEP_IDLE); + super(manager, "Sir. Sheep", KitAvailability.Achievement, 99999, PERKS, EntityType.SHEEP, IN_HAND, DisguiseSheep.class); this.setAchievementRequirements(ACHIEVEMENTS); } - + @Override - public void giveCoreItems(Player player) + public void GiveItems(Player player) { + disguise(player); + UtilInv.Clear(player); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1], PLAYER_ITEMS[2]); @@ -106,29 +110,4 @@ public class KitSheep extends SmashKit player.getInventory().setArmorContents(PLAYER_ARMOR); } - - @Override - public void giveSuperItems(Player player) - { - - } - - @Override - public void GiveItems(Player player) - { - giveCoreItems(player); - - //Disguise - DisguiseSheep disguise = new DisguiseSheep(player); - - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else - disguise.setName(player.getName()); - - disguise.setColor(DyeColor.WHITE); - - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java index c9219acf2..a903da8d7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java @@ -1,28 +1,32 @@ package nautilus.game.arcade.game.games.smash.kits; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Horse; +import org.bukkit.entity.Horse.Variant; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseHorse; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; +import nautilus.game.arcade.game.games.smash.perks.SmashKit2; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashKit; -import nautilus.game.arcade.kit.perks.*; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.*; -import org.bukkit.entity.Horse.Variant; -import org.bukkit.inventory.ItemStack; +import nautilus.game.arcade.kit.perks.PerkBoneRush; +import nautilus.game.arcade.kit.perks.PerkDeadlyBones; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import nautilus.game.arcade.kit.perks.PerkHorseKick; -public class KitSkeletalHorse extends SmashKit +public class KitSkeletalHorse extends SmashKit2 { - private static final String[] DESCRIPTION = { - }; private static final Perk[] PERKS = { new PerkSmashStats(6, 1.4, 0.3, 6.5), @@ -71,20 +75,26 @@ public class KitSkeletalHorse extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + new ItemStack(Material.IRON_BOOTS), + new ItemStack(Material.CHAINMAIL_LEGGINGS), + new ItemStack(Material.CHAINMAIL_CHESTPLATE), + new ItemStack(Material.CHAINMAIL_HELMET), }; public KitSkeletalHorse(ArcadeManager manager) { - super(manager, "Skeletal Horse", KitAvailability.Gem, 7000, DESCRIPTION, PERKS, EntityType.HORSE, IN_HAND, "Bone Storm", 20000, Sound.HORSE_SKELETON_DEATH); + super(manager, "Skeletal Horse", KitAvailability.Gem, 7000, PERKS, EntityType.HORSE, IN_HAND, DisguiseHorse.class); } - + @Override - public void giveCoreItems(Player player) + public void GiveItems(Player player) { + disguise(player); + + DisguiseHorse disguise = (DisguiseHorse) Manager.GetDisguise().getActiveDisguise(player); + + disguise.setType(Variant.SKELETON_HORSE); + UtilInv.Clear(player); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); @@ -92,62 +102,16 @@ public class KitSkeletalHorse extends SmashKit if (Manager.GetGame().GetState() == GameState.Recruit) player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]); - player.getInventory().setArmorContents(PLAYER_ARMOR); } - @Override - public void giveSuperItems(Player player) - { - player.getInventory().remove(Material.IRON_SPADE); - player.getInventory().remove(Material.IRON_AXE); - - UtilInv.Update(player); - } - - @Override - public void GiveItems(Player player) - { - giveCoreItems(player); - - //Disguise - DisguiseHorse disguise = new DisguiseHorse(player); - disguise.setType(Variant.SKELETON_HORSE); - - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else - disguise.setName(player.getName()); - - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); - } - @Override public Entity SpawnEntity(Location loc) { - EntityType type = _entityType; - if (type == EntityType.PLAYER) - type = EntityType.ZOMBIE; - - LivingEntity entity = (LivingEntity) Manager.GetCreature().SpawnEntity(loc, type); - - entity.setRemoveWhenFarAway(false); - entity.setCustomName(GetAvailability().GetColor() + GetName() + " Kit"); - entity.setCustomNameVisible(true); - entity.getEquipment().setItemInHand(_itemInHand); - - if (type == EntityType.HORSE) - { - Horse horse = (Horse) entity; - horse.setAdult(); - horse.setVariant(Variant.SKELETON_HORSE); - } - - UtilEnt.Vegetate(entity); - - SpawnCustom(entity); - - return entity; + Horse horse = (Horse) super.SpawnEntity(loc); + + horse.setVariant(Variant.SKELETON_HORSE); + + return horse; } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java index b8e5b54da..dfb44c354 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java @@ -1,26 +1,31 @@ package nautilus.game.arcade.game.games.smash.kits; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilInv; -import mineplex.core.disguise.disguises.DisguiseSkeleton; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.game.Game.GameState; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashKit; -import nautilus.game.arcade.kit.perks.*; import org.bukkit.ChatColor; import org.bukkit.Material; -import org.bukkit.Sound; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -public class KitSkeleton extends SmashKit +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilInv; +import mineplex.core.disguise.disguises.DisguiseCow; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; +import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkBarrage; +import nautilus.game.arcade.kit.perks.PerkBoneExplosion; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import nautilus.game.arcade.kit.perks.PerkFletcher; +import nautilus.game.arcade.kit.perks.PerkKnockbackArrow; +import nautilus.game.arcade.kit.perks.PerkRopedArrow; +import nautilus.game.arcade.kit.perks.PerkSkeletonArrowStorm; + +public class KitSkeleton extends SmashKit2 { - private static final String[] DESCRIPTION = { - }; private static final Perk[] PERKS = { new PerkSmashStats(5, 1.25, 0.2, 6), @@ -69,21 +74,23 @@ public class KitSkeleton extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + new ItemStack(Material.CHAINMAIL_BOOTS), + new ItemStack(Material.CHAINMAIL_LEGGINGS), + new ItemStack(Material.CHAINMAIL_CHESTPLATE), + new ItemStack(Material.CHAINMAIL_HELMET), }; public KitSkeleton(ArcadeManager manager) { - super(manager, "Skeleton", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND, "Arrow Storm", 8000, Sound.SKELETON_HURT); + super(manager, "Skeleton", KitAvailability.Free, PERKS, EntityType.SKELETON, IN_HAND, DisguiseCow.class); } @Override - public void giveCoreItems(Player player) + public void GiveItems(Player player) { + disguise(player); + UtilInv.Clear(player); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); @@ -95,31 +102,4 @@ public class KitSkeleton extends SmashKit player.getInventory().setArmorContents(PLAYER_ARMOR); } - - @Override - public void giveSuperItems(Player player) - { - - } - - @Override - public void GiveItems(Player player) - { - giveCoreItems(player); - - //Disguise - DisguiseSkeleton disguise = new DisguiseSkeleton(player); - - if (Manager.GetGame().GetTeam(player) != null) - { - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - } else - { - disguise.setName(player.getName()); - } - - disguise.setCustomNameVisible(true); - disguise.hideArmor(); - Manager.GetDisguise().disguise(disguise); - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java index 4f133927e..9533837d8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java @@ -7,9 +7,10 @@ import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkFishFlurry; +import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.perks.*; import org.bukkit.ChatColor; import org.bukkit.Material; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java index a2b4fdd5f..a33ce5f77 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java @@ -11,13 +11,14 @@ import mineplex.minecraft.game.core.condition.Condition.ConditionType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.perks.PerkDoubleJump; import nautilus.game.arcade.kit.perks.PerkSlimeRocket; import nautilus.game.arcade.kit.perks.PerkSlimeSlam; -import nautilus.game.arcade.kit.perks.PerkSmashStats; + import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Sound; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java index 039a7de57..a9c90dc1d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java @@ -6,9 +6,10 @@ import mineplex.core.disguise.disguises.DisguiseSnowman; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.perks.*; import org.bukkit.ChatColor; import org.bukkit.Material; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java index 87ae8f0b0..3569d5168 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java @@ -6,9 +6,10 @@ import mineplex.core.disguise.disguises.DisguiseSpider; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.perks.*; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -122,5 +123,10 @@ public class KitSpider extends SmashKit disguise.setCustomNameVisible(true); Manager.GetDisguise().disguise(disguise); + + if (Manager.GetGame().GetState() == GameState.Prepare) + { + player.setExp(0.99F); + } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java index 6a7bfc74f..077cb52de 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java @@ -6,9 +6,10 @@ import mineplex.core.disguise.disguises.DisguiseWitch; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.perks.*; import org.bukkit.ChatColor; import org.bukkit.Material; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWither.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWither.java index 9aa80de7c..c0bc1f970 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWither.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWither.java @@ -18,11 +18,11 @@ import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.perks.PerkDoubleJump; -import nautilus.game.arcade.kit.perks.PerkSmashStats; import nautilus.game.arcade.kit.perks.PerkSkullShot; public class KitWither extends SmashKit diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java index 75739762e..05df3d898 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java @@ -6,9 +6,10 @@ import mineplex.core.disguise.disguises.DisguiseSkeleton; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.perks.*; import org.bukkit.ChatColor; import org.bukkit.Material; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java index 6ee1c78e4..11e9d18d0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java @@ -7,11 +7,11 @@ import mineplex.core.disguise.disguises.DisguiseWolf; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.perks.PerkDoubleJump; -import nautilus.game.arcade.kit.perks.PerkSmashStats; import nautilus.game.arcade.kit.perks.PerkWolf; import org.bukkit.ChatColor; import org.bukkit.Material; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java index 6f2d17e76..2edb8d1c2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java @@ -6,9 +6,10 @@ import mineplex.core.disguise.disguises.DisguiseZombie; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.perks.*; import org.bukkit.ChatColor; import org.bukkit.Material; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/modes/kits/KitHipster.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/modes/kits/KitHipster.java index f32ea4f82..0957cfc3c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/modes/kits/KitHipster.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/modes/kits/KitHipster.java @@ -7,9 +7,9 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashKit; /** * KitPlayer diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowMooshroomMadness.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowMooshroomMadness.java deleted file mode 100644 index 4ec1a0909..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowMooshroomMadness.java +++ /dev/null @@ -1,77 +0,0 @@ -package nautilus.game.arcade.game.games.smash.perks; - -import java.util.HashSet; - -import org.bukkit.Sound; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.PlayerDeathEvent; - -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.disguise.disguises.DisguiseBase; -import mineplex.core.disguise.disguises.DisguiseMooshroom; -import mineplex.core.recharge.Recharge; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.SmashPerk; - -public class PerkCowMooshroomMadness extends SmashPerk -{ - private HashSet _cowSuperActive = new HashSet(); - - public PerkCowMooshroomMadness() - { - super("Mooshroom Madness", new String[] - { - }, false); - } - - @Override - public void addSuperCustom(Player player) - { - _cowSuperActive.add(player.getName()); - - //Disguise - DisguiseMooshroom disguise = new DisguiseMooshroom(player); - - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else - disguise.setName(player.getName()); - - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); - - //Armor - player.setMaxHealth(30); - player.setHealth(30); - - //Sound - player.getWorld().playSound(player.getLocation(), Sound.COW_HURT, 5f, 0.25f); - - //Recharges - Recharge.Instance.recharge(player, "Angry Herd"); - Recharge.Instance.recharge(player, "Milk Spiral"); - } - - @EventHandler - public void damageBuff(CustomDamageEvent event) - { - Player player = event.GetDamagerPlayer(true); - if (player == null) - return; - - if (_cowSuperActive.contains(player.getName())) - { - event.AddMod(player.getName(), GetName(), 1, false); - } - } - - @Override - public boolean isSuperActive(Player player) - { - DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); - - return disguise != null && disguise instanceof DisguiseMooshroom; - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkFishFlurry.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkFishFlurry.java index 6ca0a54e1..52e4002dc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkFishFlurry.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkFishFlurry.java @@ -37,7 +37,6 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.SmashPerk; public class PerkFishFlurry extends SmashPerk implements IThrown { @@ -174,7 +173,7 @@ public class PerkFishFlurry extends SmashPerk implements IThrown { //Damage Event Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, - DamageCause.PROJECTILE, 3, true, true, false, + DamageCause.PROJECTILE, 3, true, false, false, UtilEnt.getName(data.getThrower()), GetName()); UtilParticle.PlayParticle(ParticleType.EXPLODE, target.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 12, ViewDist.LONG, UtilServer.getPlayers()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSmashStats.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkSmashStats.java similarity index 97% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSmashStats.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkSmashStats.java index bf9bc5c47..2b5d00808 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSmashStats.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkSmashStats.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.kit.perks; +package nautilus.game.arcade.game.games.smash.perks; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilPlayer; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/SmashKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashKit.java similarity index 90% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/SmashKit.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashKit.java index a277c147e..b67f498d4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/SmashKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashKit.java @@ -1,11 +1,9 @@ -package nautilus.game.arcade.kit; +package nautilus.game.arcade.game.games.smash.perks; + +import java.util.Collection; +import java.util.Iterator; +import java.util.UUID; -import mineplex.core.common.util.*; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.ArcadeFormat; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.events.GameStateChangeEvent; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Sound; @@ -16,8 +14,21 @@ import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; -import java.util.Collection; -import java.util.Iterator; +import mineplex.core.common.util.C; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.ArcadeFormat; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; public abstract class SmashKit extends ProgressingKit { @@ -25,7 +36,7 @@ public abstract class SmashKit extends ProgressingKit protected static final String DOUBLE_JUMP = C.cYellow + "Double tap " + C.cWhite + "your jump key to " + C.cGreen + "Double Jump"; private NautHashMap _superActive = new NautHashMap(); - + private int _superCharges = 1; private String _superName; private long _superDuration; @@ -55,6 +66,14 @@ public abstract class SmashKit extends ProgressingKit _superSound = superSound; } + @Override + public void onSelected(UUID player) + { + super.onSelected(player); + + DisplayDesc(UtilPlayer.searchExact(player)); + } + @Override public void DisplayDesc(Player player) { @@ -235,7 +254,7 @@ public abstract class SmashKit extends ProgressingKit { _superCharges = charges; } - + public abstract void giveCoreItems(Player player); public abstract void giveSuperItems(Player player); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashKit2.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashKit2.java new file mode 100644 index 000000000..46dd1ffb5 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashKit2.java @@ -0,0 +1,154 @@ +package nautilus.game.arcade.game.games.smash.perks; + +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.disguise.disguises.DisguiseInsentient; +import nautilus.game.arcade.ArcadeFormat; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; + +public abstract class SmashKit2 extends ProgressingKit +{ + + protected static final String DOUBLE_JUMP = C.cYellow + "Double tap " + C.cWhite + "your jump key to " + C.cGreen + "Double Jump"; + + private static final int DESCRIPTION_SPACING_LINES = 3; + + private Class _clazz; + private String[] _description; + + public SmashKit2(ArcadeManager manager, String name, KitAvailability kitAvailability, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand, Class clazz) + { + this(manager, name, kitAvailability, 0, kitPerks, entityType, itemInHand, clazz); + } + + public SmashKit2(ArcadeManager manager, String name, KitAvailability kitAvailability, int cost, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand, + Class clazz) + { + super(manager, name, "smash" + name.toLowerCase().replace(" ", ""), kitAvailability, cost, null, kitPerks, entityType, itemInHand); + + _clazz = clazz; + } + + public boolean isSmashActive(Player player) + { + for (Perk perk : GetPerks()) + { + if (!(perk instanceof SmashUltimate)) + { + continue; + } + + SmashUltimate ultimate = (SmashUltimate) perk; + + if (ultimate.isUsingUltimate(player)) + { + return true; + } + } + + return false; + } + + public void disguise(Player player) + { + disguise(player, _clazz); + } + + public void disguise(Player player, Class clazz) + { + try + { + DisguiseInsentient disguise = _clazz.getConstructor(Player.class).newInstance(player); + GameTeam gameTeam = Manager.GetGame().GetTeam(player); + + if (gameTeam != null) + { + disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); + } + else + { + disguise.setName(player.getName()); + } + + disguise.setCustomNameVisible(true); + Manager.GetDisguise().disguise(disguise); + } + catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) + { + e.printStackTrace(); + } + } + + /** + * When the player clicks to select the kit or we give them that kit, we + * need to send custom information for Smash stuff. + */ + @Override + public void onSelected(UUID player) + { + super.onSelected(player); + + Player playerObj = UtilPlayer.searchExact(player); + + if (playerObj == null) + { + return; + } + + for (int i = 0; i < DESCRIPTION_SPACING_LINES; i++) + { + playerObj.sendMessage(""); + } + + playerObj.sendMessage(ArcadeFormat.Line); + + for (String line : GetDesc()) + { + playerObj.sendMessage(line); + } + + playerObj.sendMessage(ArcadeFormat.Line); + } + + @Override + public String[] GetDesc() + { + if (_description == null) + { + List description = new ArrayList<>(); + + description.add(C.cGreen + "Kit - " + C.cWhiteB + GetName()); + + for (Perk perk : GetPerks()) + { + if (!perk.IsVisible()) + { + continue; + } + + for (String line : perk.GetDesc()) + { + description.add(C.cGray + " " + line); + } + } + + _description = description.toArray(new String[description.size()]); + } + + return _description; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashPerk.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashPerk.java new file mode 100644 index 000000000..e76c24a98 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashPerk.java @@ -0,0 +1,65 @@ +package nautilus.game.arcade.game.games.smash.perks; + +import org.bukkit.entity.Player; + +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.games.smash.TeamSuperSmash; +import nautilus.game.arcade.kit.Perk; + +public class SmashPerk extends Perk +{ + + public SmashPerk(String name, String[] perkDesc) + { + super(name, perkDesc); + } + + /** + * @param player + * The player that you need to check. + * + * @return true when the player is currently using a SmashUltimate. + */ + public boolean isSuperActive(Player player) + { + if (Kit instanceof SmashKit2) + { + SmashKit2 kit = (SmashKit2) Kit; + + if (kit.isSmashActive(player)) + { + return true; + } + } + + return false; + } + + /** + * Checks to see if an attack would count as team damage. + * Always returns false if the game is not {@link TeamSuperSmash}. + * + * @param player1 + * @param player2 + * @return true when the team of player1 equals the team of player2. + * @see GameTeam + */ + public boolean isTeamDamage(Player player1, Player player2) + { + Game game = Manager.GetGame(); + + if (!(game instanceof TeamSuperSmash)) + { + return false; + } + + if (game.GetTeam(player1).equals(game.GetTeam(player2))) + { + return true; + } + + return false; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashUltimate.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashUltimate.java new file mode 100644 index 000000000..0b4b47dec --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashUltimate.java @@ -0,0 +1,141 @@ +package nautilus.game.arcade.game.games.smash.perks; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.quiver.Quiver; +import nautilus.game.arcade.kit.Perk; + +public class SmashUltimate extends Perk +{ + + private Map _lastUltimate = new HashMap<>(); + + private Sound _sound; + private long _length; + + public SmashUltimate(String name, String[] perkDesc, Sound sound, long length) + { + super(name, perkDesc); + + _sound = sound; + _length = length; + } + + public void activate(Player player) + { + _lastUltimate.put(player.getUniqueId(), System.currentTimeMillis()); + + player.getInventory().addItem(Quiver.SUPER_ARROW); + + UtilServer.broadcast(C.cGreenB + player.getName() + C.cWhiteB + " activated their " + C.cGreenB + C.Bold + GetName() + C.cWhiteB + "."); + + for (Player other : UtilServer.getPlayers()) + { + other.playSound(other.getLocation(), _sound, 1, 0); + } + } + + public void cancel(Player player) + { + _lastUltimate.remove(player.getUniqueId()); + + player.getInventory().clear(); + Kit.GiveItems(player); + player.playSound(player.getLocation(), Sound.BLAZE_DEATH, 1, 0); + } + + public boolean isUsable(Player player) + { + return true; + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST || _length == 0) + { + return; + } + + for (UUID uuid : _lastUltimate.keySet()) + { + Player player = UtilPlayer.searchExact(uuid); + + if (player == null) + { + continue; + } + + if (UtilTime.elapsed(_lastUltimate.get(uuid), _length)) + { + cancel(player); + } + } + } + + @EventHandler + public void onCombatDeath(CombatDeathEvent event) + { + if (!(event.GetEvent().getEntity() instanceof Player)) + { + return; + } + + Player player = (Player) event.GetEvent().getEntity(); + + if (!isUsingUltimate(player)) + { + return; + } + + cancel(player); + } + + @EventHandler + public void onGameStateChange(GameStateChangeEvent event) + { + if (event.GetState() != GameState.End) + { + for (UUID uuid : _lastUltimate.keySet()) + { + cancel(UtilPlayer.searchExact(uuid)); + } + } + } + + public boolean isUsingUltimate(Player player) + { + return isUsingUltimate(player.getUniqueId()); + } + + public boolean isUsingUltimate(UUID uuid) + { + return _lastUltimate.containsKey(uuid); + } + + public Map getLastUltimate() + { + return _lastUltimate; + } + + public long getLength() + { + return _length; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkFirefly.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkFirefly.java new file mode 100644 index 000000000..4017edff7 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkFirefly.java @@ -0,0 +1,256 @@ +package nautilus.game.arcade.game.games.smash.perks.blaze; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + +import org.bukkit.EntityEffect; +import org.bukkit.Sound; +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.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.data.FireflyData; + +public class PerkFirefly extends SmashPerk +{ + + private static final long COOLDOWN = 12000; + private static final long DURATION = 2750; + private static final int DAMAGE = 7; + + private static final int RADIUS_NORMAL = 4; + private static final float VELOCITY_NORMAL = 0.7F; + + private static final int RADIUS_SMASH = 7; + private static final float VELOCITY_SMASH = 0.79F; + + private static final long HIT_FREQUENCY = 2000; + private static final long WARMUP_TIME = 1500; + private static final int MIN_CANCEL_DAMAGE = 4; + private static final int KNOCKBACK_MAGNITUDE = 2; + + private Set _data = new HashSet(); + + private int _tick = 0; + + public PerkFirefly() + { + super("Firefly", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Firefly" }); + } + + @EventHandler + public void Skill(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isAxe(player.getItemInHand().getType())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (isSuperActive(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } + + activate(player, this); + } + + /* + * It is split like this so Blaze's Smash can be called without the need to + * copy code. + */ + public void activate(Player player, Perk caller) + { + _data.add(new FireflyData(player)); + + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(caller.GetName()) + ".")); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + _tick++; + + Iterator dataIterator = _data.iterator(); + + //There are a lot of magic numbers here, they are all arbitrary sound and particle values. + + while (dataIterator.hasNext()) + { + FireflyData data = dataIterator.next(); + + Player player = data.Player; + boolean superActive = isSuperActive(data.Player); + String skillName = superActive ? "Phoenix" : GetName(); + + // Warmup + if (!UtilTime.elapsed(data.Time, WARMUP_TIME) && !superActive) + { + UtilAction.zeroVelocity(player); + player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 0.2f, 0.6f); + data.Location = player.getLocation(); + + // Sound and Effect + UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, player.getLocation().add(0, 1, 0), 0.6f, 0.6f, 0.6f, 0, 10, ViewDist.LONG); + + float progress = (float) (System.currentTimeMillis() - data.Time) / WARMUP_TIME; + + player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 0.5f, 1f + progress); + } + // Velocity + else if (!UtilTime.elapsed(data.Time, DURATION) || superActive) + { + UtilAction.velocity(player, player.getLocation().getDirection().multiply(superActive ? VELOCITY_SMASH : VELOCITY_NORMAL).add(new Vector(0, 0.15, 0))); + player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 0.6f, 1.2f); + + // Sound and Effect + if (!superActive) + { + UtilParticle.PlayParticleToAll(ParticleType.FLAME, player.getLocation().add(0, 1, 0), 0.6f, 0.6f, 0.6f, 0, 40, ViewDist.LONG); + + player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 0.5f, 1.25f); + } + else + { + UtilParticle.PlayParticleToAll(ParticleType.FLAME, player.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 60, ViewDist.LONG); + UtilParticle.PlayParticleToAll(ParticleType.LAVA, player.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 40, ViewDist.LONG); + + player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 0.75f, 0.75f); + } + + for (Player other : UtilPlayer.getNearby(player.getLocation(), superActive ? RADIUS_SMASH : RADIUS_NORMAL)) + { + if (other.equals(player)) + { + continue; + } + + if (UtilPlayer.isSpectator(other)) + { + continue; + } + + other.playEffect(EntityEffect.HURT); + + if (_tick % 12 == 0) + { + if (Recharge.Instance.use(other, GetName() + " hit by " + player.getName(), HIT_FREQUENCY, false, false)) + { + // Damage Event + Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE, true, true, false, player.getName(), skillName); + + UtilPlayer.message(other, F.main("Game", F.elem(Manager.GetColor(player) + player.getName()) + " hit you with " + F.elem(skillName) + ".")); + } + } + } + } + else + { + dataIterator.remove(); + } + } + } + + @EventHandler + public void FireflyDamage(CustomDamageEvent event) + { + if (event.GetDamage() < MIN_CANCEL_DAMAGE) + { + return; + } + + if (!(event.GetDamagerEntity(true) instanceof Player)) + { + return; + } + + Iterator dataIterator = _data.iterator(); + + while (dataIterator.hasNext()) + { + FireflyData data = dataIterator.next(); + + if (!data.Player.equals(event.GetDamageeEntity())) + { + continue; + } + + if (!UtilTime.elapsed(data.Time, 1250) && !isSuperActive(data.Player)) + { + if (isTeamDamage(data.Player, event.GetDamagerPlayer(true))) + { + continue; + } + + dataIterator.remove(); + } + else + { + event.SetCancelled("Firefly Immunity"); + } + } + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkInferno.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkInferno.java new file mode 100644 index 000000000..36f108068 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkInferno.java @@ -0,0 +1,159 @@ +package nautilus.game.arcade.game.games.smash.perks.blaze; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkInferno extends SmashPerk +{ + + private static final float MAX_ENERGY = 0.999F; + private static final float ENERGY_PER_TICK = 0.025F; + private static final float ENERGY_PER_ITEM = 0.035F; + + private static final double ITEM_EXPIRE_TIME = 0.7; + private static final double ITEM_BURN_TIME = 0.5; + private static final double ITEM_DAMAGE = 0.25; + private static final float ITEM_VELOCITY_MAGNITUDE = 1.6F; + + private Map _active = new HashMap<>(); + + public PerkInferno() + { + super("Inferno", new String[] { C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Inferno" }); + } + + @EventHandler + public void EnergyUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!hasPerk(player)) + { + continue; + } + + if (!player.isBlocking()) + { + player.setExp(Math.min(MAX_ENERGY, player.getExp() + ENERGY_PER_TICK)); + } + } + } + + @EventHandler + public void Activate(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isSword(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (isSuperActive(player)) + { + return; + } + + _active.put(player.getUniqueId(), System.currentTimeMillis()); + + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + for (Player cur : UtilServer.getPlayers()) + { + UUID key = cur.getUniqueId(); + + if (!_active.containsKey(key)) + { + continue; + } + + if (!cur.isBlocking()) + { + _active.remove(key); + continue; + } + + cur.setExp(cur.getExp() - ENERGY_PER_ITEM); + + if (cur.getExp() <= 0) + { + _active.remove(key); + continue; + } + + // Fire + Item fire = cur.getWorld().dropItem(cur.getEyeLocation(), new ItemStack(Material.BLAZE_POWDER)); + Manager.GetFire().Add(fire, cur, ITEM_EXPIRE_TIME, 0, ITEM_BURN_TIME, ITEM_DAMAGE, GetName(), false); + + fire.teleport(cur.getEyeLocation()); + fire.setVelocity(cur.getLocation().getDirection().add(getRandomVector()).multiply(ITEM_VELOCITY_MAGNITUDE)); + + // Effect + cur.getWorld().playSound(cur.getLocation(), Sound.GHAST_FIREBALL, 0.1f, 1f); + } + } + + private Vector getRandomVector() + { + double x = 0.07 - (UtilMath.r(14) / 100); + double y = 0.07 - (UtilMath.r(14) / 100); + double z = 0.07 - (UtilMath.r(14) / 100); + + return new Vector(x, y, z); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/SmashBlaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/SmashBlaze.java new file mode 100644 index 000000000..341dd1df6 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/SmashBlaze.java @@ -0,0 +1,40 @@ +package nautilus.game.arcade.game.games.smash.perks.blaze; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; + +import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; +import nautilus.game.arcade.kit.Perk; + +public class SmashBlaze extends SmashUltimate +{ + + private static final long DURATION = 18000; + + public SmashBlaze() + { + super("Phoneix", new String[] {}, Sound.BLAZE_DEATH, DURATION); + } + + @Override + public void activate(Player player) + { + super.activate(player); + + player.getInventory().remove(Material.IRON_SWORD); + player.getInventory().remove(Material.IRON_AXE); + + for (Perk perk : Kit.GetPerks()) + { + if (!(perk instanceof PerkFirefly)) + { + continue; + } + + PerkFirefly firefly = (PerkFirefly) perk; + + firefly.activate(player, this); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java new file mode 100644 index 000000000..f8f5e06a9 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java @@ -0,0 +1,219 @@ +package nautilus.game.arcade.game.games.smash.perks.chicken; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + +import org.bukkit.Color; +import org.bukkit.FireworkEffect.Type; +import org.bukkit.Sound; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Chicken; +import org.bukkit.entity.Entity; +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 mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; +import nautilus.game.arcade.kit.perks.data.ChickenMissileData; + +public class PerkChickenRocket extends SmashPerk +{ + + private static final long COOLDOWN = 7000; + private static final long MIN_TIME = 200; + private static final long MAX_TIME = 4000; + private static final int HIT_BOX_RADIUS = 2; + private static final int DAMAGE_RADIUS = 3; + private static final int DAMAGE = 8; + + private Set _data = new HashSet<>(); + + public PerkChickenRocket() + { + super("Chicken Missile", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Chicken Missile", C.cGreen + "Chicken Missile" + C.cGray + + " instantly recharges if you hit a player." }); + } + + @EventHandler + public void Missile(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isAxe(player.getItemInHand())) + { + return; + } + + if (isSuperActive(player)) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } + + Manager.GetGame().CreatureAllowOverride = true; + Chicken ent = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Chicken.class); + ent.getLocation().setPitch(0); + ent.getLocation().setYaw(player.getLocation().getYaw()); + ent.setBaby(); + ent.setAgeLock(true); + UtilEnt.Vegetate(ent); + Manager.GetGame().CreatureAllowOverride = false; + + _data.add(new ChickenMissileData(player, ent)); + + // Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + Iterator dataIterator = _data.iterator(); + + while (dataIterator.hasNext()) + { + ChickenMissileData data = dataIterator.next(); + + data.Chicken.setVelocity(data.Direction); + data.Chicken.getWorld().playSound(data.Chicken.getLocation(), Sound.CHICKEN_HURT, 0.3f, 1.5f); + + if (!UtilTime.elapsed(data.Time, MIN_TIME)) + { + continue; + } + + boolean detonate = false; + + if (UtilTime.elapsed(data.Time, MAX_TIME)) + { + detonate = true; + } + else + { + // Hit Entity + for (Entity ent : UtilEnt.getInRadius(data.Chicken.getLocation(), HIT_BOX_RADIUS).keySet()) + { + if (ent instanceof Arrow) + { + if (((Arrow) ent).isOnGround()) + { + continue; + } + } + + if (ent.equals(data.Player) || ent.equals(data.Chicken)) + { + continue; + } + + if (ent instanceof Player) + { + if (UtilPlayer.isSpectator(ent)) + { + continue; + } + } + + // Recharge + Recharge.Instance.useForce(data.Player, GetName(), -1); + + detonate = true; + break; + } + + // Hit Block + if (!detonate && data.HasHitBlock()) + { + detonate = true; + } + } + + if (detonate) + { + // Damage + for (LivingEntity ent : UtilEnt.getInRadius(data.Chicken.getLocation(), DAMAGE_RADIUS).keySet()) + { + if (ent.equals(data.Player)) + { + continue; + } + + if (ent instanceof Player) + { + if (UtilPlayer.isSpectator(ent)) + { + continue; + } + } + + // Damage Event + Manager.GetDamage().NewDamageEvent(ent, data.Player, null, DamageCause.PROJECTILE, DAMAGE, false, true, false, data.Player.getName(), GetName()); + + UtilAction.velocity(ent, UtilAlg.getTrajectory2d(data.Chicken, ent), 1.6, true, 0.8, 0, 10, true); + } + + // Effect + UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, data.Chicken.getLocation(), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); + data.Chicken.getWorld().playSound(data.Chicken.getLocation(), Sound.EXPLODE, 2f, 1.2f); + + // Firework + UtilFirework.playFirework(data.Chicken.getLocation().add(0, 0.6, 0), Type.BALL, Color.WHITE, false, false); + + data.Chicken.remove(); + dataIterator.remove(); + continue; + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkEggGun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkEggGun.java new file mode 100644 index 000000000..ae1c86bca --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkEggGun.java @@ -0,0 +1,162 @@ +package nautilus.game.arcade.game.games.smash.perks.chicken; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Sound; +import org.bukkit.entity.Egg; +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.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkEggGun extends SmashPerk +{ + + private static final long COOLDOWN = 2500; + private static final long DURATION = 750; + private static final long DAMAGE = 1; + + private Map _active = new HashMap<>(); + + public PerkEggGun() + { + super("Egg Blaster", new String[] { C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Egg Blaster" }); + } + + @EventHandler + public void Activate(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (isSuperActive(event.getPlayer())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } + + _active.put(player.getUniqueId(), System.currentTimeMillis()); + + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + for (Player cur : UtilServer.getPlayers()) + { + UUID key = cur.getUniqueId(); + + if (!isSuperActive(cur)) + { + if (!_active.containsKey(key)) + { + continue; + } + + if (!cur.isBlocking()) + { + _active.remove(key); + continue; + } + + if (UtilTime.elapsed(_active.get(key), DURATION)) + { + _active.remove(key); + continue; + } + } + + Vector offset = cur.getLocation().getDirection(); + + if (offset.getY() < 0) + { + offset.setY(0); + } + + Egg egg = cur.getWorld().spawn(cur.getLocation().add(0, 0.5, 0).add(offset), Egg.class); + egg.setVelocity(cur.getLocation().getDirection().add(new Vector(0, 0.2, 0))); + egg.setShooter(cur); + + // Effect + cur.getWorld().playSound(cur.getLocation(), Sound.CHICKEN_EGG_POP, 0.5f, 1f); + } + } + + @EventHandler + public void EggHit(CustomDamageEvent event) + { + if (event.GetProjectile() == null) + { + return; + } + + if (!(event.GetProjectile() instanceof Egg)) + { + return; + } + + if (event.GetDamage() >= DAMAGE) + { + return; + } + + event.SetCancelled("Egg Blaster"); + + Egg egg = (Egg) event.GetProjectile(); + + // Damage Event + Manager.GetDamage().NewDamageEvent(event.GetDamageeEntity(), (LivingEntity) egg.getShooter(), egg, DamageCause.PROJECTILE, DAMAGE, true, true, false, UtilEnt.getName((LivingEntity) egg + .getShooter()), GetName()); + + UtilAction.zeroVelocity(event.GetDamageeEntity()); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkFlap.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkFlap.java new file mode 100644 index 000000000..e5a7ef692 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkFlap.java @@ -0,0 +1,121 @@ +package nautilus.game.arcade.game.games.smash.perks.chicken; + +import org.bukkit.GameMode; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerToggleFlightEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkFlap extends SmashPerk +{ + + private static final float MAX_ENERGY = 0.999F; + private static final float ENERGY_PER_TICK = 0.03F; + private static final float ENERGY_PER_FLAP = 0.17F; + private static final long COOLDOWN = 80; + + private double _power; + private boolean _control; + + public PerkFlap(double power, double heightLimit, boolean control) + { + super("Flap", new String[] { C.cYellow + "Tap Jump Twice" + C.cGray + " to " + C.cGreen + "Flap" }); + + _power = power; + _control = control; + } + + @EventHandler + public void FlightHop(PlayerToggleFlightEvent event) + { + Player player = event.getPlayer(); + + if (UtilPlayer.isSpectator(player)) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (player.getGameMode() == GameMode.CREATIVE) + { + return; + } + + event.setCancelled(true); + player.setFlying(false); + + // Disable Flight + player.setAllowFlight(false); + + double power = 0.4 + 0.6 * (_power * player.getExp()); + + // Velocity + if (_control) + { + UtilAction.velocity(player, power, 0.2, 10, true); + } + else + { + UtilAction.velocity(player, player.getLocation().getDirection(), power, true, power, 0, 10, true); + } + + // Sound + player.getWorld().playSound(player.getLocation(), Sound.BAT_TAKEOFF, (float) (0.3 + player.getExp()), (float) (Math.random() / 2 + 1)); + + // Set Recharge + Recharge.Instance.use(player, GetName(), COOLDOWN, false, false); + + // Energy + if (!isSuperActive(player)) + { + player.setExp(Math.max(0f, player.getExp() - ENERGY_PER_FLAP)); + } + } + + @EventHandler + public void FlightUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + for (Player player : UtilServer.getPlayers()) + { + if (player.getGameMode() == GameMode.CREATIVE) + { + continue; + } + + if (!hasPerk(player)) + { + continue; + } + + if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().subtract(0, 2, 0).getBlock())) + { + player.setExp(Math.min(MAX_ENERGY, player.getExp() + ENERGY_PER_TICK)); + player.setAllowFlight(true); + } + else if (Recharge.Instance.usable(player, GetName()) && player.getExp() > 0) + { + player.setAllowFlight(true); + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/SmashChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/SmashChicken.java new file mode 100644 index 000000000..beea2b8b9 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/SmashChicken.java @@ -0,0 +1,30 @@ +package nautilus.game.arcade.game.games.smash.perks.chicken; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; + +import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; + +public class SmashChicken extends SmashUltimate +{ + + private static final long DURATION = 20000; + + public SmashChicken() + { + super("Aerial Gunner", new String[] {}, Sound.CHICKEN_IDLE, DURATION); + } + + /** + * See {@link PerkEggGun} for smash code. + */ + @Override + public void activate(Player player) + { + super.activate(player); + + player.getInventory().remove(Material.IRON_SWORD); + player.getInventory().remove(Material.IRON_AXE); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/DataCowCharge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/DataCowCharge.java similarity index 92% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/DataCowCharge.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/DataCowCharge.java index a03be6065..b57c15d2d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/DataCowCharge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/DataCowCharge.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.smash.perks; +package nautilus.game.arcade.game.games.smash.perks.cow; import org.bukkit.Location; import org.bukkit.entity.Cow; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/DataCowMilkSpiral.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/DataCowMilkSpiral.java similarity index 97% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/DataCowMilkSpiral.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/DataCowMilkSpiral.java index f4bb60f93..6026c0f8d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/DataCowMilkSpiral.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/DataCowMilkSpiral.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.smash.perks; +package nautilus.game.arcade.game.games.smash.perks.cow; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; @@ -12,7 +12,6 @@ import mineplex.core.common.util.UtilParticle.ViewDist; import org.bukkit.Location; import org.bukkit.Sound; -import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.util.Vector; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowAngryHerd.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowAngryHerd.java similarity index 63% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowAngryHerd.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowAngryHerd.java index 2c0ac9941..7b802998f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowAngryHerd.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowAngryHerd.java @@ -1,7 +1,8 @@ -package nautilus.game.arcade.game.games.smash.perks; +package nautilus.game.arcade.game.games.smash.perks.cow; import java.util.ArrayList; import java.util.Iterator; +import java.util.List; import org.bukkit.Location; import org.bukkit.Sound; @@ -9,7 +10,6 @@ import org.bukkit.entity.Cow; import org.bukkit.entity.MushroomCow; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.util.Vector; @@ -19,135 +19,149 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.disguise.disguises.DisguiseBase; -import mineplex.core.disguise.disguises.DisguiseMooshroom; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; -public class PerkCowAngryHerd extends SmashPerk +public class PerkCowAngryHerd extends SmashPerk { - private ArrayList _active = new ArrayList(); - public PerkCowAngryHerd() + private static final long COOLDOWN_NORMAL = 13000; + private static final long COOLDOWN_SMASH = 6000; + private static final long MAX_TIME = 1000; + private static final long STUCK_TIME = 300; + private static final long FORCE_MOVE = 350; + private static final float HIT_BOX_RADIUS = 2.2F; + private static final long HIT_FREQUENCY = 600; + private static final int DAMAGE = 5; + + private List _active = new ArrayList<>(); + + public PerkCowAngryHerd() { - super("Angry Herd", new String[] - { - C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Angry Herd" - }); + super("Angry Herd", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Angry Herd" }); } - @EventHandler public void shoot(PlayerInteractEvent event) { if (event.isCancelled()) + { return; + } - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + if (!UtilEvent.isAction(event, ActionType.R)) + { return; + } if (UtilBlock.usable(event.getClickedBlock())) + { return; - - if (event.getPlayer().getItemInHand() == null) - return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) - return; + } Player player = event.getPlayer(); - - if (!Kit.HasKit(player)) - return; - if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? 6000 : 13000, true, true)) + if (!UtilItem.isAxe(player.getItemInHand())) + { return; + } + + if (!hasPerk(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? COOLDOWN_SMASH : COOLDOWN_NORMAL, true, true)) + { + return; + } event.setCancelled(true); - - for (double i=-2 ; i<3 ; i++) + + for (double i = -2; i < 3; i++) { Vector dir = player.getLocation().getDirection(); dir.setY(0); dir.normalize(); - + Location loc = player.getLocation(); - + loc.add(dir); - loc.add(UtilAlg.getLeft(dir).multiply(i*1.5)); - + loc.add(UtilAlg.getLeft(dir).multiply(i * 1.5)); + Manager.GetGame().CreatureAllowOverride = true; Class clazz = isSuperActive(player) ? MushroomCow.class : Cow.class; Cow cow = player.getWorld().spawn(loc, clazz); Manager.GetGame().CreatureAllowOverride = false; - + _active.add(new DataCowCharge(player, cow)); } - //Sound + // Sound player.getWorld().playSound(player.getLocation(), Sound.COW_IDLE, 2f, 0.6f); - - //Inform + + // Inform UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); } - + @EventHandler public void update(UpdateEvent event) { if (event.getType() != UpdateType.TICK) return; - + Iterator activeIter = _active.iterator(); - + while (activeIter.hasNext()) { DataCowCharge data = activeIter.next(); - - //Expire - if (UtilTime.elapsed(data.Time, 3000)) + + // Expire + if (UtilTime.elapsed(data.Time, MAX_TIME)) { if (data.Cow.isValid()) { data.Cow.remove(); - UtilParticle.PlayParticle(ParticleType.EXPLODE, data.Cow.getLocation().add(0, 1, 0), 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); + UtilParticle.PlayParticleToAll(ParticleType.EXPLODE, data.Cow.getLocation().add(0, 1, 0), 0, 0, 0, 0, 1, ViewDist.NORMAL); } activeIter.remove(); continue; } - - //Set Moved + + // Set Moved if (UtilMath.offset(data.Cow.getLocation(), data.LastLoc) > 1) { - data.LastLoc = data.Cow.getLocation(); data.LastMoveTime = System.currentTimeMillis(); } - - //Stuck Remove - if (UtilTime.elapsed(data.LastMoveTime, 1000)) + + // Stuck Remove + if (UtilTime.elapsed(data.LastMoveTime, STUCK_TIME)) { if (data.Cow.isValid()) { data.Cow.remove(); - UtilParticle.PlayParticle(ParticleType.EXPLODE, data.Cow.getLocation().add(0, 1, 0), 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); + UtilParticle.PlayParticleToAll(ParticleType.EXPLODE, data.Cow.getLocation().add(0, 1, 0), 0, 0, 0, 0, 1, ViewDist.NORMAL); } - + activeIter.remove(); continue; } - //Gravity + // Gravity if (UtilEnt.isGrounded(data.Cow)) { data.Direction.setY(-0.1); @@ -156,35 +170,44 @@ public class PerkCowAngryHerd extends SmashPerk { data.Direction.setY(Math.max(-1, data.Direction.getY() - 0.03)); } - - //Move - if (UtilTime.elapsed(data.LastMoveTime, 350) && UtilEnt.isGrounded(data.Cow)) - data.Cow.setVelocity(data.Direction.clone().add(new Vector(0,0.75,0))); + + // Move + if (UtilTime.elapsed(data.LastMoveTime, FORCE_MOVE) && UtilEnt.isGrounded(data.Cow)) + { + data.Cow.setVelocity(data.Direction.clone().add(new Vector(0, 0.75, 0))); + } else + { data.Cow.setVelocity(data.Direction); - + } + if (Math.random() > 0.99) + { data.Cow.getWorld().playSound(data.Cow.getLocation(), Sound.COW_IDLE, 1f, 1f); - + } + if (Math.random() > 0.97) + { data.Cow.getWorld().playSound(data.Cow.getLocation(), Sound.COW_WALK, 1f, 1.2f); + } - //Hit + // Hit for (Player player : Manager.GetGame().GetPlayers(true)) { if (player.equals(data.Player)) - continue; - - if (UtilMath.offset(player, data.Cow) < 2.2) { - if (Recharge.Instance.use(player, "Hit by " + data.Player.getName(), 600, false, false)) + continue; + } + + if (UtilMath.offset(player, data.Cow) < HIT_BOX_RADIUS) + { + if (Recharge.Instance.use(player, "Hit by " + data.Player.getName(), HIT_FREQUENCY, false, false)) { // Damage Event - Manager.GetDamage().NewDamageEvent(player, data.Player, null, data.Cow.getLocation(), DamageCause.CUSTOM, - 5, true, true, false, UtilEnt.getName(data.Player), GetName()); - - UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.Cow.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 12, ViewDist.LONG, UtilServer.getPlayers()); - + Manager.GetDamage().NewDamageEvent(player, data.Player, null, data.Cow.getLocation(), DamageCause.CUSTOM, DAMAGE, true, true, false, UtilEnt.getName(data.Player), GetName()); + + UtilParticle.PlayParticleToAll(ParticleType.LARGE_EXPLODE, data.Cow.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 12, ViewDist.LONG); + data.Cow.getWorld().playSound(data.Cow.getLocation(), Sound.ZOMBIE_WOOD, 0.75f, 0.8f); data.Cow.getWorld().playSound(data.Cow.getLocation(), Sound.COW_HURT, 1.5f, 0.75f); } @@ -192,21 +215,15 @@ public class PerkCowAngryHerd extends SmashPerk } } } - + @EventHandler public void Knockback(CustomDamageEvent event) { if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { return; + } event.AddKnockback(GetName(), 1.25); } - - @Override - public boolean isSuperActive(Player player) - { - DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); - - return disguise != null && disguise instanceof DisguiseMooshroom; - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowMilkSpiral.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowMilkSpiral.java similarity index 56% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowMilkSpiral.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowMilkSpiral.java index 4227aebb5..a538fa73d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowMilkSpiral.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowMilkSpiral.java @@ -1,111 +1,123 @@ -package nautilus.game.arcade.game.games.smash.perks; +package nautilus.game.arcade.game.games.smash.perks.cow; -import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; +import java.util.Set; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.disguise.disguises.DisguiseBase; -import mineplex.core.disguise.disguises.DisguiseMooshroom; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkCowMilkSpiral extends SmashPerk { - private HashMap _active = new HashMap(); - - public PerkCowMilkSpiral() + + private static final long COOLDOWN_NORMAL = 11000; + private static final long COOLDOWN_SMASH = 6000; + private static final int HIT_BOX_RADIUS = 2; + private static final int DAMAGE = 6; + + private Set _active = new HashSet<>(); + + public PerkCowMilkSpiral() { - super("Milk Spiral", new String[] - { - C.cYellow + "Right Click" + C.cGray + " with Spade to " + C.cGreen + "Milk Spiral", - C.cGray + "Crouch to cancel movement for Milk Spiral" - }); + super("Milk Spiral", new String[] { C.cYellow + "Right Click" + C.cGray + " with Spade to " + C.cGreen + "Milk Spiral", C.cGray + "Crouch to cancel movement for Milk Spiral" }); } - + @EventHandler public void activate(PlayerInteractEvent event) { if (event.isCancelled()) + { return; - - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { return; - + } + if (UtilBlock.usable(event.getClickedBlock())) + { return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_SPADE")) - return; - + } + Player player = event.getPlayer(); - - if (!Kit.HasKit(player)) + + if (!UtilItem.isSpade(player.getItemInHand())) + { return; - - if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? 6000 : 11000, true, true)) + } + + if (!hasPerk(player)) + { return; - - _active.put(player, new DataCowMilkSpiral(player, isSuperActive(player))); - - //Inform + } + + if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? COOLDOWN_SMASH : COOLDOWN_NORMAL, true, true)) + { + return; + } + + _active.add(new DataCowMilkSpiral(player, isSuperActive(player))); + + // Inform UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); } - + @EventHandler - public void update(UpdateEvent event) + public void update(UpdateEvent event) { if (event.getType() != UpdateType.TICK) + { return; + } + + Iterator activeIter = _active.iterator(); - Iterator activeIter = _active.values().iterator(); - while (activeIter.hasNext()) { DataCowMilkSpiral data = activeIter.next(); - + if (data.update()) + { activeIter.remove(); - + } + for (Player player : Manager.GetGame().GetPlayers(true)) { if (player.equals(data.Player)) - continue; - - if (UtilMath.offset(player.getLocation().add(0, 1, 0), data.Spiral) < 2) { - Manager.GetDamage().NewDamageEvent(player, data.Player, null, - DamageCause.CUSTOM, 6, true, false, false, - player.getName(), GetName()); - - UtilParticle.PlayParticle(isSuperActive(player) ? ParticleType.RED_DUST : ParticleType.FIREWORKS_SPARK, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0.3f, 30, ViewDist.LONG, UtilServer.getPlayers()); + continue; + } + + if (UtilMath.offset(player.getLocation().add(0, 1, 0), data.Spiral) < HIT_BOX_RADIUS) + { + Manager.GetDamage().NewDamageEvent(player, data.Player, null, DamageCause.CUSTOM, DAMAGE, true, false, false, player.getName(), GetName()); + + UtilParticle.PlayParticle(isSuperActive(player) ? ParticleType.RED_DUST : ParticleType.FIREWORKS_SPARK, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0.3f, 30, + ViewDist.LONG, UtilServer.getPlayers()); player.getWorld().playSound(player.getLocation(), Sound.SPLASH, 0.25f, 2f); } } } } - - @Override - public boolean isSuperActive(Player player) - { - DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); - - return disguise != null && disguise instanceof DisguiseMooshroom; - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowMooshroomMadness.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowMooshroomMadness.java new file mode 100644 index 000000000..d7687b983 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowMooshroomMadness.java @@ -0,0 +1,72 @@ +package nautilus.game.arcade.game.games.smash.perks.cow; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.disguise.disguises.DisguiseCow; +import mineplex.core.disguise.disguises.DisguiseMooshroom; +import mineplex.core.recharge.Recharge; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; + +public class PerkCowMooshroomMadness extends SmashUltimate +{ + + private static final long DURATION = 30000; + private static final int DAMAGE_BUFF = 1; + private static final int HEALTH = 30; + + public PerkCowMooshroomMadness() + { + super("Mooshroom Madness", new String[] {}, Sound.COW_IDLE, DURATION); + } + + @Override + public void activate(Player player) + { + super.activate(player); + + SmashKit2 kit = (SmashKit2) Kit; + + kit.disguise(player, DisguiseMooshroom.class); + + // Health + player.setMaxHealth(HEALTH); + player.setHealth(HEALTH); + + // Sound + player.getWorld().playSound(player.getLocation(), Sound.COW_HURT, 5f, 0.25f); + + // Recharges + Recharge.Instance.recharge(player, "Angry Herd"); + Recharge.Instance.recharge(player, "Milk Spiral"); + } + + @Override + public void cancel(Player player) + { + super.cancel(player); + + SmashKit2 kit = (SmashKit2) Kit; + + kit.disguise(player, DisguiseCow.class); + } + + @EventHandler + public void damageBuff(CustomDamageEvent event) + { + Player player = event.GetDamagerPlayer(true); + + if (player == null) + { + return; + } + + if (isUsingUltimate(player)) + { + event.AddMod(player.getName(), GetName(), DAMAGE_BUFF, false); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowStampede.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowStampede.java similarity index 61% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowStampede.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowStampede.java index 287ba285e..2995dd0eb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowStampede.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowStampede.java @@ -1,28 +1,10 @@ -package nautilus.game.arcade.game.games.smash.perks; +package nautilus.game.arcade.game.games.smash.perks.cow; -import java.util.WeakHashMap; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.disguise.disguises.DisguiseBase; -import mineplex.core.disguise.disguises.DisguiseMooshroom; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; -import mineplex.minecraft.game.classcombat.Skill.SkillFactory; -import mineplex.minecraft.game.classcombat.Skill.ISkill.SkillType; -import mineplex.minecraft.game.classcombat.Skill.event.SkillEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.SmashPerk; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; import org.bukkit.Sound; -import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -31,39 +13,56 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.potion.PotionEffectType; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.classcombat.Skill.event.SkillEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + public class PerkCowStampede extends SmashPerk { - private WeakHashMap _sprintTime = new WeakHashMap(); - private WeakHashMap _sprintStr = new WeakHashMap(); - - public PerkCowStampede() + private Map _sprintTime = new HashMap<>(); + private Map _sprintStr = new HashMap<>(); + + public PerkCowStampede() { - super("Stampede", new String[] - { - C.cGray + "Build up Speed Levels as you sprint.", - C.cGray + "+1 damage for each Speed Level.", - }); - } + super("Stampede", new String[] { C.cGray + "Build up Speed Levels as you sprint.", C.cGray + "+1 damage for each Speed Level.", }); + } @EventHandler public void update(UpdateEvent event) { if (event.getType() != UpdateType.FASTER) + { return; + } for (Player cur : UtilServer.getPlayers()) { - if (!Kit.HasKit(cur)) - continue; - - //Active - Check for Disable - if (_sprintTime.containsKey(cur)) + if (!hasPerk(cur)) { - //Stopped + continue; + } + + UUID key = cur.getUniqueId(); + + // Active - Check for Disable + if (_sprintTime.containsKey(key)) + { + // Stopped if (!cur.isSprinting() || cur.getLocation().getBlock().isLiquid()) { - _sprintTime.remove(cur); - _sprintStr.remove(cur); + _sprintTime.remove(key); + _sprintStr.remove(key); cur.removePotionEffect(PotionEffectType.SPEED); continue; } @@ -71,34 +70,38 @@ public class PerkCowStampede extends SmashPerk long time = _sprintTime.get(cur); int str = _sprintStr.get(cur); - //Apply Speed + // Apply Speed if (str > 0) - Manager.GetCondition().Factory().Speed(GetName(), cur, cur, 1.9, !isSuperActive(cur) ? str-1 : str, false, true, true); + { + Manager.GetCondition().Factory().Speed(GetName(), cur, cur, 1.9, !isSuperActive(cur) ? str - 1 : str, false, true, true); + } - //Upgrade Speed + // Upgrade Speed if (!UtilTime.elapsed(time, 3000)) + { continue; + } - _sprintTime.put(cur, System.currentTimeMillis()); + _sprintTime.put(key, System.currentTimeMillis()); if (str < 3) - { - _sprintStr.put(cur, str+1); + { + _sprintStr.put(key, str + 1); - //Effect + // Effect cur.getWorld().playSound(cur.getLocation(), Sound.COW_HURT, 2f, 0.75f + 0.25f * str); } - - //Event + + // Event UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(cur, GetName(), ClassType.Brute)); } else if (cur.isSprinting() || !cur.getLocation().getBlock().isLiquid()) { - //Start Timer + // Start Timer if (!_sprintTime.containsKey(cur)) { - _sprintTime.put(cur, System.currentTimeMillis()); - _sprintStr.put(cur, 0); + _sprintTime.put(key, System.currentTimeMillis()); + _sprintStr.put(key, 0); } } } @@ -108,16 +111,26 @@ public class PerkCowStampede extends SmashPerk public void particle(UpdateEvent event) { if (event.getType() != UpdateType.TICK) - return; - - for (Player ent : _sprintStr.keySet()) { - if (_sprintStr.get(ent) <= 0) + return; + } + + for (UUID key : _sprintStr.keySet()) + { + if (_sprintStr.get(key) <= 0) + { continue; - - UtilParticle.PlayParticle(isSuperActive(ent) ? ParticleType.RED_DUST : ParticleType.CRIT, ent.getLocation(), - (float)(Math.random() - 0.5), 0.2f + (float)Math.random(), (float)(Math.random() - 0.5), 0, _sprintStr.get(ent) * 2, - ViewDist.NORMAL, UtilServer.getPlayers()); + } + + Player player = UtilPlayer.searchExact(key); + + if (player == null) + { + continue; + } + + UtilParticle.PlayParticle(isSuperActive(player) ? ParticleType.RED_DUST : ParticleType.CRIT, player.getLocation(), (float) (Math.random() - 0.5), 0.2f + (float) Math.random(), + (float) (Math.random() - 0.5), 0, _sprintStr.get(player) * 2, ViewDist.NORMAL, UtilServer.getPlayers()); } } @@ -125,73 +138,87 @@ public class PerkCowStampede extends SmashPerk public void damage(CustomDamageEvent event) { if (event.IsCancelled()) + { return; - + } + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + { return; + } Player damager = event.GetDamagerPlayer(false); - if (damager == null) return; + + if (damager == null) + { + return; + } if (!_sprintStr.containsKey(damager)) + { return; + } if (_sprintStr.get(damager) == 0) + { return; + } LivingEntity damagee = event.GetDamageeEntity(); - if (damagee == null) return; - //Remove + if (damagee == null) + { + return; + } + + // Remove _sprintTime.remove(damager); int str = _sprintStr.remove(damager); damager.removePotionEffect(PotionEffectType.SPEED); - //Damage + // Damage event.AddMod(damager.getName(), GetName(), str, true); event.AddKnockback(GetName(), 1 + (0.1 * str)); - //Inform + // Inform UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill(GetName()) + ".")); - //Effect - damager.getWorld().playSound(damager.getLocation(), Sound.ZOMBIE_WOOD, 1f, 2f); - damager.getWorld().playSound(damager.getLocation(), Sound.COW_HURT, 2f, 2f); - - //Event + // Effect + damager.getWorld().playSound(damager.getLocation(), Sound.ZOMBIE_WOOD, 1f, 2f); + damager.getWorld().playSound(damager.getLocation(), Sound.COW_HURT, 2f, 2f); + + // Event UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(damager, GetName(), ClassType.Brute, damagee)); } - + @EventHandler(priority = EventPriority.HIGH) public void damageCancel(CustomDamageEvent event) { if (event.IsCancelled()) + { return; + } Player damagee = event.GetDamageePlayer(); - if (damagee == null) return; + + if (damagee == null) + { + return; + } clean(damagee); Manager.GetCondition().EndCondition(damagee, null, GetName()); } @EventHandler - public void quit(PlayerQuitEvent event) + public void quit(PlayerQuitEvent event) { clean(event.getPlayer()); } - - public void clean(Player player) + + public void clean(Player player) { - _sprintTime.remove(player); - _sprintStr.remove(player); - } - - @Override - public boolean isSuperActive(Player player) - { - DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); - - return disguise != null && disguise instanceof DisguiseMooshroom; + _sprintTime.remove(player.getUniqueId()); + _sprintStr.remove(player.getUniqueId()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperElectricity.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperElectricity.java new file mode 100644 index 000000000..c4d286214 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperElectricity.java @@ -0,0 +1,204 @@ +package nautilus.game.arcade.game.games.smash.perks.creeper; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseCreeper; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; + +public class PerkCreeperElectricity extends Perk +{ + + private static final long DURATION = 2000; + private static final int SHOCK = 1; + private static final int DAMAGE = 4; + private static final float KNOCKBACK_MAGNITUDE = 2.5F; + + private Map _active = new HashMap<>(); + + public PerkCreeperElectricity() + { + super("Lightning Shield", new String[] { "When hit by a non-melee attack, you gain " + C.cGreen + "Lightning Shield" }); + } + + @EventHandler + public void Shield(CustomDamageEvent event) + { + if (event.IsCancelled()) + { + return; + } + + if (event.GetCause() == DamageCause.ENTITY_ATTACK || event.GetCause() == DamageCause.FIRE_TICK || event.GetCause() == DamageCause.STARVATION) + { + return; + } + + Player damagee = event.GetDamageePlayer(); + + if (damagee == null) + { + return; + } + + if (!hasPerk(damagee)) + { + return; + } + + _active.put(damagee.getUniqueId(), System.currentTimeMillis()); + + SetPowered(damagee, true); + + Manager.GetCondition().Factory().Speed(GetName(), damagee, damagee, 4, 1, false, false, false); + + // Sound + damagee.getWorld().playSound(damagee.getLocation(), Sound.CREEPER_HISS, 3f, 1.25f); + + // Inform + UtilPlayer.message(damagee, F.main("Skill", "You gained " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + Iterator shieldIterator = _active.keySet().iterator(); + + while (shieldIterator.hasNext()) + { + Player player = UtilPlayer.searchExact(shieldIterator.next()); + + if (player == null) + { + shieldIterator.remove(); + } + + if (!IsPowered(player)) + { + shieldIterator.remove(); + SetPowered(player, false); + continue; + } + + if (UtilTime.elapsed(_active.get(player), DURATION)) + { + shieldIterator.remove(); + + SetPowered(player, false); + + // Sound + player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, 3f, 0.75f); + } + } + } + + @EventHandler + public void Damage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damagee = event.GetDamageePlayer(); + if (damagee == null) + return; + + if (!hasPerk(damagee)) + { + return; + } + + if (!IsPowered(damagee)) + { + return; + } + + event.SetCancelled("Lightning Shield"); + + // Inform + UtilPlayer.message(damagee, F.main("Skill", "You hit " + F.elem(UtilEnt.getName(event.GetDamagerPlayer(false))) + " with " + F.skill(GetName()) + ".")); + + // Elec + damagee.getWorld().strikeLightningEffect(damagee.getLocation()); + Manager.GetCondition().Factory().Shock(GetName(), event.GetDamagerEntity(false), event.GetDamageeEntity(), SHOCK, false, false); + + SetPowered(damagee, false); + + // Damage Event + Manager.GetDamage().NewDamageEvent(event.GetDamagerEntity(false), damagee, null, DamageCause.LIGHTNING, DAMAGE, true, true, false, damagee.getName(), GetName()); + } + + public DisguiseCreeper GetDisguise(Player player) + { + DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); + + if (disguise == null) + { + return null; + } + + if (!(disguise instanceof DisguiseCreeper)) + { + return null; + } + + return (DisguiseCreeper) disguise; + } + + public void SetPowered(Player player, boolean powered) + { + DisguiseCreeper creeper = GetDisguise(player); + if (creeper == null) + return; + + creeper.SetPowered(powered); + + Manager.GetDisguise().updateDisguise(creeper); + } + + public boolean IsPowered(Player player) + { + DisguiseCreeper creeper = GetDisguise(player); + + if (creeper == null) + { + return false; + } + + return creeper.IsPowered(); + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperExplode.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperExplode.java new file mode 100644 index 000000000..6deee5676 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperExplode.java @@ -0,0 +1,334 @@ +package nautilus.game.arcade.game.games.smash.perks.creeper; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +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 mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseCreeper; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkCreeperExplode extends SmashPerk +{ + + private static final long COOLDOWN = 8000; + private static final long WARMUP = 1500; + private static final int RADIUS_NORMAL = 8; + private static final int RADIUS_SMASH = 24; + private static final int DAMAGE_NORMAL = 20; + private static final int DAMAGE_SMASH = 30; + private static final int SPAWN_REMOVAL_RADIUS = 14; + private static final float KNOCKBACK_MAGNITUDE = 2.5F; + + private Map _active = new HashMap<>(); + + public PerkCreeperExplode() + { + super("Explode", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Shovel use " + C.cGreen + "Explosive Leap" }); + } + + @EventHandler + public void Activate(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isSpade(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (isSuperActive(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } + + _active.put(player.getUniqueId(), System.currentTimeMillis()); + + IncreaseSize(player); + + UtilPlayer.message(player, F.main("Skill", "You are charging " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + Iterator chargeIterator = _active.keySet().iterator(); + + while (chargeIterator.hasNext()) + { + UUID key = chargeIterator.next(); + Player player = UtilPlayer.searchExact(key); + + if (player == null) + { + chargeIterator.remove(); + continue; + } + + long elapsed = (System.currentTimeMillis() - _active.get(player)); + + // Idle in Air + UtilAction.zeroVelocity(player); + + // Sound + player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, (float) (0.5 + elapsed), (float) (0.5 + elapsed)); + + IncreaseSize(player); + + player.setExp(Math.min(0.99f, (float) (elapsed / (WARMUP / 1000)))); + + // Not Detonated + if (UtilTime.elapsed(_active.get(key), WARMUP)) + { + continue; + } + + chargeIterator.remove(); + + // Unpower + DecreaseSize(player); + + // Explode + if (!isSuperActive(player)) + { + // Effect + UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, player.getLocation(), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); + player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 2f, 1f); + } + else + { + // Particles + UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, player.getLocation(), 5f, 5f, 5f, 0, 20, ViewDist.MAX, UtilServer.getPlayers()); + + // Sound + for (int i = 0; i < 4; i++) + { + player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, (float) (2 + Math.random() * 4), (float) (Math.random() + 0.2)); + } + + // Blocks + Collection blocks = UtilBlock.getInRadius(player.getLocation(), 12).keySet(); + Iterator iter = blocks.iterator(); + + while (iter.hasNext()) + { + Block b = iter.next(); + + if (b.getType() == Material.STATIONARY_LAVA || b.getType() == Material.LAVA || b.getType() == Material.BEDROCK) + { + iter.remove(); + } + } + Manager.GetExplosion().BlockExplosion(blocks, player.getLocation(), false); + + // Remove Spawns + Iterator spawnIterator = Manager.GetGame().GetTeam(player).GetSpawns().iterator(); + while (spawnIterator.hasNext()) + { + Location spawn = spawnIterator.next(); + + if (UtilMath.offset(player.getLocation(), spawn) < SPAWN_REMOVAL_RADIUS) + { + spawnIterator.remove(); + } + } + + // If all spawns have been destroyed revert to using the + // spectator spawn + for (GameTeam team : Manager.GetGame().GetTeamList()) + { + if (team.GetSpawns().isEmpty()) + { + team.GetSpawns().add(Manager.GetGame().GetSpectatorLocation()); + } + } + } + + double maxRange = isSuperActive(player) ? RADIUS_SMASH : RADIUS_NORMAL; + double damage = isSuperActive(player) ? DAMAGE_SMASH : DAMAGE_NORMAL; + + // Damage + for (LivingEntity ent : UtilEnt.getInRadius(player.getLocation(), maxRange).keySet()) + { + if (ent.equals(player)) + { + continue; + } + + double dist = UtilMath.offset(player.getLocation(), ent.getLocation()); + + if (UtilPlayer.isSpectator(player)) + { + continue; + } + + LivingEntity livingEnt = (LivingEntity) ent; + + double scale = 0.1 + 0.9 * ((maxRange - dist) / maxRange); + + // Damage Event + Manager.GetDamage().NewDamageEvent(livingEnt, player, null, DamageCause.CUSTOM, damage * scale, true, true, false, player.getName(), isSuperActive(player) ? "Atomic Blast" : GetName()); + } + + // Velocity + UtilAction.velocity(player, 1.8, 0.2, 1.4, true); + + // Inform + if (!isSuperActive(player)) + { + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + } + } + } + + public DisguiseCreeper GetDisguise(Player player) + { + DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); + + if (disguise == null) + { + return null; + } + + if (!(disguise instanceof DisguiseCreeper)) + { + return null; + } + + return (DisguiseCreeper) disguise; + } + + public int GetSize(Player player) + { + DisguiseCreeper creeper = GetDisguise(player); + + if (creeper == null) + { + return 0; + } + + return creeper.bV(); + } + + public void DecreaseSize(Player player) + { + DisguiseCreeper creeper = GetDisguise(player); + + if (creeper == null) + { + return; + } + + creeper.a(-1); + + Manager.GetDisguise().updateDisguise(creeper); + } + + public void IncreaseSize(Player player) + { + DisguiseCreeper creeper = GetDisguise(player); + + if (creeper == null) + { + return; + } + + creeper.a(1); + + Manager.GetDisguise().updateDisguise(creeper); + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + } + + @EventHandler + public void Death(CombatDeathEvent event) + { + if (!(event.GetEvent().getEntity() instanceof Player)) + { + return; + } + + Player player = (Player) event.GetEvent().getEntity(); + + if (!hasPerk(player)) + { + return; + } + + _active.remove(player.getUniqueId()); + + DecreaseSize(player); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperSulphurBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperSulphurBomb.java new file mode 100644 index 000000000..6e1ce3e6a --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperSulphurBomb.java @@ -0,0 +1,146 @@ +package nautilus.game.arcade.game.games.smash.perks.creeper; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +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 mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown +{ + + private static final long COOLDOWN = 3000; + private static final float DAMAGE = 6.5F; + private static final float KNOCKBACK_MAGNITUDE = 2.5F; + + public PerkCreeperSulphurBomb() + { + super("Sulphur Bomb", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Sulphur Bomb" }); + } + + @EventHandler + public void ShootWeb(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isSword(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (isSuperActive(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } + + event.setCancelled(true); + + UtilInv.Update(player); + + org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.COAL, (byte) 0)); + + UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false); + + Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true, null, 1f, 1f, null, 1, UpdateType.SLOW, 0.6f); + + // Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); + + // Effect + player.getWorld().playSound(player.getLocation(), Sound.CREEPER_DEATH, 2f, 1.5f); + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + Explode(data); + + if (target == null) + { + return; + } + + // Damage Event + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, DAMAGE, true, true, false, UtilEnt.getName(data.getThrower()), GetName()); + } + + @Override + public void Idle(ProjectileUser data) + { + Explode(data); + } + + @Override + public void Expire(ProjectileUser data) + { + Explode(data); + } + + public void Explode(ProjectileUser data) + { + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.getThrown().getLocation(), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.EXPLODE, 1f, 1.5f); + data.getThrown().remove(); + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/SmashCreeper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/SmashCreeper.java new file mode 100644 index 000000000..d97715ed6 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/SmashCreeper.java @@ -0,0 +1,35 @@ +package nautilus.game.arcade.game.games.smash.perks.creeper; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; + +import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; +import nautilus.game.arcade.kit.Perk; + +public class SmashCreeper extends SmashUltimate +{ + + public SmashCreeper(String name, String[] perkDesc, Sound sound, long length) + { + super("Atomic Blast", new String[] {}, Sound.CREEPER_HISS, 50); + } + + @Override + public void activate(Player player) + { + super.activate(player); + + for (Perk perk : Kit.GetPerks()) + { + if (!(perk instanceof PerkCreeperExplode)) + { + continue; + } + + PerkCreeperExplode explode = (PerkCreeperExplode) perk; + + explode.IncreaseSize(player); + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlink.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlink.java new file mode 100644 index 000000000..e96c0535a --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlink.java @@ -0,0 +1,102 @@ +package nautilus.game.arcade.game.games.smash.perks.enderman; + +import org.bukkit.Color; +import org.bukkit.FireworkEffect.Type; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.particles.effects.LineParticle; +import mineplex.core.recharge.Recharge; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkBlink extends SmashPerk +{ + + private static final float INCREMENTAITON = 0.2F; + + private String _name; + private double _range; + private long _recharge; + + public PerkBlink(String name, double range, long recharge) + { + super(name, new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + name }); + + _name = name; + _range = range; + _recharge = recharge; + } + + @EventHandler + public void Blink(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isAxe(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (isSuperActive(player)) + { + return; + } + + if (!Recharge.Instance.use(player, _name, _recharge, true, true)) + { + return; + } + + LineParticle lineParticle = new LineParticle(player.getEyeLocation(), player.getLocation().getDirection(), INCREMENTAITON, _range, null, ParticleType.SMOKE, UtilServer.getPlayers()); + + while (lineParticle.update()) + { + } + + // Firework + UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.BLACK, false, false); + + player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 1f); + player.teleport(lineParticle.getDestination()); + player.setFallDistance(0); + player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 1f); + + // Firework + UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.BLACK, false, false); + + // Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(_name) + ".")); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java new file mode 100644 index 000000000..b57a4c2cf --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java @@ -0,0 +1,269 @@ +package nautilus.game.arcade.game.games.smash.perks.enderman; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.Effect; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.FallingBlock; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityChangeBlockEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; +import nautilus.game.arcade.kit.perks.data.BlockTossData; +import nautilus.game.arcade.kit.perks.event.PerkBlockGrabEvent; +import nautilus.game.arcade.kit.perks.event.PerkBlockThrowEvent; + +public class PerkBlockToss extends SmashPerk implements IThrown +{ + + private static final long COOLDOWN = 2000; + private static final long CHARGE_TIME = 1200; + private static final int DAMAGE = 8; + private static final float KNOCKBACK_MAGNITUDE = 2.5F; + + private Map _hold = new HashMap<>(); + private Map _charge = new HashMap<>(); + private Set _charged = new HashSet<>(); + private Map _falling = new HashMap<>(); + + public PerkBlockToss() + { + super("Block Toss", new String[] { C.cYellow + "Hold Block" + C.cGray + " to " + C.cGreen + "Grab Block", C.cYellow + "Release Block" + C.cGray + " to " + C.cGreen + "Throw Block" }); + } + + @EventHandler + public void Grab(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R_BLOCK)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isSword(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (isSuperActive(player)) + { + return; + } + + if (_hold.containsKey(player.getUniqueId())) + { + return; + } + + Block grab = event.getClickedBlock(); + + if (!Recharge.Instance.usable(player, GetName())) + { + return; + } + + if (!UtilBlock.airFoliage(grab.getRelative(BlockFace.UP)) || Manager.GetBlockRestore().contains(grab.getRelative(BlockFace.UP))) + { + UtilPlayer.message(player, F.main("Game", "You can only pick up blocks with Air above them.")); + return; + } + + // Event + PerkBlockGrabEvent blockEvent = new PerkBlockGrabEvent(player, grab.getTypeId(), grab.getData()); + UtilServer.getServer().getPluginManager().callEvent(blockEvent); + + // Block to Data + int id = grab.getTypeId(); + byte data = grab.getData(); + + // Remove Block + event.getClickedBlock().getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, event.getClickedBlock().getType()); + + _hold.put(player.getUniqueId(), new BlockTossData(id, data)); + + _charge.put(player.getUniqueId(), System.currentTimeMillis()); + + // Effect + player.getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, id); + } + + @EventHandler + public void Throw(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Set throwSet = new HashSet(); + + for (UUID key : _hold.keySet()) + { + Player player = UtilPlayer.searchExact(key); + + if (player == null) + { + continue; + } + + // Throw + if (!player.isBlocking()) + { + throwSet.add(player); + } + + // Charged Tick + if (!_charged.contains(player.getUniqueId())) + { + if (System.currentTimeMillis() - _charge.get(player) > 1200) + { + _charged.add(key); + player.getWorld().playEffect(player.getLocation(), Effect.CLICK1, 0); + } + } + } + + for (Player cur : throwSet) + { + UUID key = cur.getUniqueId(); + + Recharge.Instance.recharge(cur, GetName()); + Recharge.Instance.use(cur, GetName(), COOLDOWN, false, true); + + BlockTossData data = _hold.remove(key); + + FallingBlock block = cur.getWorld().spawnFallingBlock(cur.getEyeLocation().add(cur.getLocation().getDirection()), data.Type, data.Data); + + _falling.put(block, key); + + _charged.remove(key); + + long charge = System.currentTimeMillis() - _charge.remove(key); + + // Throw + double mult = 1.4; + if (charge < CHARGE_TIME) + { + mult = mult * (charge / 1200); + } + + // Action + UtilAction.velocity(block, cur.getLocation().getDirection(), mult, false, 0.2, 0, 1, true); + Manager.GetProjectile().AddThrow(block, cur, this, -1, true, true, true, true, null, 0, 0, null, 0, UpdateType.FASTEST, 1f); + + // Event + PerkBlockThrowEvent blockEvent = new PerkBlockThrowEvent(cur); + UtilServer.getServer().getPluginManager().callEvent(blockEvent); + } + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + if (target == null) + { + return; + } + + // Damage Event + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, data.getThrown().getVelocity().length() * DAMAGE, true, true, false, UtilEnt.getName(data + .getThrower()), GetName()); + + // Block to Item + if (data.getThrown() instanceof FallingBlock) + { + FallingBlock thrown = (FallingBlock) data.getThrown(); + + FallingBlock newThrown = data.getThrown().getWorld().spawnFallingBlock(data.getThrown().getLocation(), thrown.getMaterial(), (byte) 0); + + // Remove Old + _falling.remove(thrown); + thrown.remove(); + + // Add New + if (data.getThrower() instanceof Player) + { + _falling.put(newThrown, data.getThrower().getUniqueId()); + } + } + + } + + @Override + public void Idle(ProjectileUser data) + { + } + + @Override + public void Expire(ProjectileUser data) + { + } + + @EventHandler + public void BlockForm(EntityChangeBlockEvent event) + { + if (!(event.getEntity() instanceof FallingBlock)) + { + return; + } + + FallingBlock falling = (FallingBlock) event.getEntity(); + + falling.getWorld().playEffect(event.getBlock().getLocation(), Effect.STEP_SOUND, falling.getBlockId()); + + _falling.remove(falling); + falling.remove(); + + event.setCancelled(true); + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkEndermanTeleport.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkEndermanTeleport.java similarity index 54% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkEndermanTeleport.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkEndermanTeleport.java index 7a0bf6059..c6c27df8a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkEndermanTeleport.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkEndermanTeleport.java @@ -1,7 +1,8 @@ -package nautilus.game.arcade.game.games.smash.perks; +package nautilus.game.arcade.game.games.smash.perks.enderman; import java.util.HashMap; -import java.util.HashSet; +import java.util.Map; +import java.util.UUID; import org.bukkit.Material; import org.bukkit.Sound; @@ -15,108 +16,116 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkEndermanTeleport extends SmashPerk { - private HashMap _target = new HashMap(); - private HashMap _charge = new HashMap(); - public PerkEndermanTeleport() + private static final long COOLDOWN = 5000; + private static final float CHARGE_PER_TICK = 0.015F; + + private Map _target = new HashMap<>(); + private Map _charge = new HashMap<>(); + + public PerkEndermanTeleport() { - super("Teleport", new String[] - { - C.cYellow + "Hold Sneak" + C.cGray + " to " + C.cGreen + "Teleport" - }); + super("Teleport", new String[] { C.cYellow + "Hold Sneak" + C.cGray + " to " + C.cGreen + "Teleport" }); } @EventHandler public void update(UpdateEvent event) - { + { if (event.getType() != UpdateType.TICK) + { return; - - if(!Manager.GetGame().IsLive()) - return; + } for (Player player : UtilServer.getPlayers()) { - if (!Kit.HasKit(player)) + if (!hasPerk(player)) + { continue; + } + + UUID key = player.getUniqueId(); if (!player.isSneaking() || !Recharge.Instance.usable(player, GetName())) { - _target.remove(player); - _charge.remove(player); + _target.remove(key); + _charge.remove(key); continue; } - Block block = player.getTargetBlock((HashSet) null, 200); - - if (!_target.containsKey(player) || !_charge.containsKey(player)) + Block block = UtilPlayer.getTarget(player, null, 100); + + if (!_target.containsKey(key) || !_charge.containsKey(key)) { if (block == null || block.getType() == Material.AIR) + { continue; - - _target.put(player, block); - _charge.put(player, 0f); + } + + _target.put(key, block); + _charge.put(key, 0f); } - //Invalid Block - End + // Invalid Block - End if (block == null || block.getType() == Material.AIR) { - _target.remove(player); - _charge.remove(player); + _target.remove(key); + _charge.remove(key); } - //Same Block - Increase Charge - else if (block.equals(_target.get(player))) + + // Same Block - Increase Charge + else if (block.equals(_target.get(key))) { - _charge.put(player, _charge.get(player) + 0.015f); - + _charge.put(key, _charge.get(key) + CHARGE_PER_TICK); + UtilTextMiddle.display(null, UtilTextMiddle.progress(_charge.get(player)), 0, 10, 10, player); - - if (_charge.get(player) >= 1f) + + if (_charge.get(key) >= 1f) { UtilTextMiddle.display(null, C.cGreen + "Teleported", 0, 10, 10, player); - Recharge.Instance.useForce(player, GetName(), 5000); - + Recharge.Instance.useForce(player, GetName(), COOLDOWN); + while (block.getRelative(BlockFace.UP).getType() != Material.AIR) { block = block.getRelative(BlockFace.UP); } - + player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 0.5f); player.teleport(block.getLocation().add(0.5, 1, 0.5).setDirection(player.getLocation().getDirection())); player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 0.5f); - - UtilParticle.PlayParticle(ParticleType.WITCH_MAGIC, player.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0.1f, 100, ViewDist.LONG, UtilServer.getPlayers()); + + UtilParticle.PlayParticleToAll(ParticleType.WITCH_MAGIC, player.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0.1f, 100, ViewDist.LONG); } else { - player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 1f + _charge.get(player)); - UtilParticle.PlayParticle(ParticleType.WITCH_MAGIC, player.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0.05f, 10, ViewDist.LONG, UtilServer.getPlayers()); + player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 1f + _charge.get(key)); + UtilParticle.PlayParticleToAll(ParticleType.WITCH_MAGIC, player.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0.05f, 10, ViewDist.LONG); } } - //New Block - Reset + // New Block - Reset else { - _target.put(player, block); - _charge.put(player, 0f); + _target.put(key, block); + _charge.put(key, 0f); } } } - + @EventHandler public void clean(PlayerQuitEvent event) { - _target.remove(event.getPlayer()); - _charge.remove(event.getPlayer()); + UUID key = event.getPlayer().getUniqueId(); + + _target.remove(key); + _charge.remove(key); } } - - diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/SmashEnderman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/SmashEnderman.java new file mode 100644 index 000000000..d06f16ef9 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/SmashEnderman.java @@ -0,0 +1,236 @@ +package nautilus.game.arcade.game.games.smash.perks.enderman; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Color; +import org.bukkit.FireworkEffect.Type; +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEnderDragon; +import org.bukkit.entity.EnderDragon; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityExplodeEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; + +public class SmashEnderman extends SmashUltimate +{ + + private static final long DURATION = 30000; + private static final int DRAGON_VELOCITY_MAGNITUDE = 40; + private static final long HIT_COOLDOWN = 1000; + private static final int DAMAGE_RADIUS = 6; + private static final int DAMAGE = 20; + private static final int KNOCKBACK_MAGNITUDE = 4; + + private Map _dragons = new HashMap<>(); + + public SmashEnderman() + { + super("Ender Dragon", new String[] {}, Sound.ENDERDRAGON_GROWL, DURATION); + } + + @Override + public void activate(Player player) + { + super.activate(player); + + Manager.GetGame().CreatureAllowOverride = true; + EnderDragon dragon = player.getWorld().spawn(player.getLocation().add(0, 5, 0), EnderDragon.class); + UtilEnt.Vegetate(dragon); + Manager.GetGame().CreatureAllowOverride = false; + + dragon.setCustomName(C.cYellow + player.getName() + "'s Dragon"); + + UtilFirework.playFirework(dragon.getLocation(), Type.BALL_LARGE, Color.BLACK, true, true); + + _dragons.put(player.getUniqueId(), dragon); + } + + @Override + public void cancel(Player player) + { + super.cancel(player); + + EnderDragon dragon = _dragons.remove(player.getUniqueId()); + + if (dragon == null) + { + return; + } + + player.leaveVehicle(); + dragon.remove(); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (UUID key : _dragons.keySet()) + { + Player player = UtilPlayer.searchExact(key); + + if (player == null) + { + continue; + } + + EnderDragon dragon = _dragons.get(key); + + // Mount + if (dragon.getPassenger() == null || !dragon.getPassenger().equals(player)) + { + player.leaveVehicle(); + dragon.setPassenger(player); + } + + // Move + Location target = player.getLocation().add(player.getLocation().getDirection().multiply(DRAGON_VELOCITY_MAGNITUDE)); + ((CraftEnderDragon) dragon).getHandle().setTargetBlock(target.getBlockX(), target.getBlockY(), target.getBlockZ()); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void explosionBlocks(EntityExplodeEvent event) + { + event.blockList().clear(); + } + + @EventHandler(priority = EventPriority.LOW) + public void suffocationCancel(CustomDamageEvent event) + { + if (event.GetCause() != DamageCause.SUFFOCATION) + { + return; + } + + if (event.GetDamageePlayer() == null) + { + return; + } + + if (isUsingUltimate(event.GetDamageePlayer())) + { + event.SetCancelled("Enderman Dragon Suffocate"); + } + } + + @EventHandler(priority = EventPriority.LOW) + public void dragonDamageeCancel(CustomDamageEvent event) + { + if (event.GetDamagerEntity(false) == null) + { + return; + } + + if (_dragons.values().contains(event.GetDamagerEntity(false))) + { + event.SetCancelled("Enderman Dragon Damagee"); + } + } + + @EventHandler(priority = EventPriority.LOW) + public void dragonDamagerCancel(CustomDamageEvent event) + { + if (event.GetDamagerEntity(false) == null) + { + return; + } + + if (!_dragons.values().contains(event.GetDamagerEntity(false))) + { + return; + } + + event.SetCancelled("Dragon Damage Cancel"); + } + + @EventHandler + public void updateDamageAoe(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (UUID key : _dragons.keySet()) + { + Player player = UtilPlayer.searchExact(key); + + if (player == null) + { + continue; + } + + EnderDragon dragon = _dragons.get(player); + + UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, dragon.getLocation(), 0, 0, 0, 0, 1, ViewDist.LONGER); + + for (Player other : Manager.GetGame().GetPlayers(true)) + { + if (other.equals(player)) + { + continue; + } + + if (UtilMath.offset(dragon.getLocation().add(0, 4, 0), other.getLocation()) < DAMAGE_RADIUS && Recharge.Instance.use(other, "Hit By Dragon", HIT_COOLDOWN, false, false)) + { + // Damage Event + Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE, true, true, false, player.getName(), GetName()); + } + } + } + } + + @EventHandler + public void knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + } + + @EventHandler(priority = EventPriority.LOW) + public void voidCancel(CustomDamageEvent event) + { + if (event.GetCause() != DamageCause.VOID) + { + return; + } + + Player player = event.GetDamageePlayer(); + + if (player == null) + { + return; + } + + if (!isUsingUltimate(player)) + { + return; + } + + event.SetCancelled("Dragon Void Immunity"); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFissure.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkFissure.java similarity index 66% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFissure.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkFissure.java index 24819a826..30facb8b0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFissure.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkFissure.java @@ -1,16 +1,19 @@ -package nautilus.game.arcade.kit.perks; +package nautilus.game.arcade.game.games.smash.perks.golem; import java.util.HashSet; +import java.util.Set; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEvent; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilPlayer; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; @@ -19,72 +22,87 @@ import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.data.FissureData; public class PerkFissure extends Perk -{ - private HashSet _active = new HashSet(); +{ - public PerkFissure() + private static final long COOLDOWN = 8000; + + private Set _active = new HashSet<>(); + + public PerkFissure() { - super("Fissure", new String[] - { - C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Fissure" - }); + super("Fissure", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Fissure" }); } @EventHandler public void Leap(PlayerInteractEvent event) { if (event.isCancelled()) + { return; + } - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + if (!UtilEvent.isAction(event, ActionType.R)) + { return; + } if (UtilBlock.usable(event.getClickedBlock())) + { return; - - if (event.getPlayer().getItemInHand() == null) - return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) - return; + } Player player = event.getPlayer(); - if (!Kit.HasKit(player)) + if (!UtilItem.isAxe(player.getItemInHand())) + { return; - + } + + if (!hasPerk(player)) + { + return; + } + if (!UtilEnt.isGrounded(player)) { UtilPlayer.message(player, F.main("Game", "You cannot use " + F.skill(GetName()) + " while airborne.")); return; } - if (!Recharge.Instance.use(player, GetName(), 8000, true, true)) + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { return; + } FissureData data = new FissureData(this, player, player.getLocation().getDirection(), player.getLocation().add(0, -0.4, 0)); _active.add(data); - - //Inform + + // Inform UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); } - + @EventHandler public void Update(UpdateEvent event) { if (event.getType() != UpdateType.TICK) + { return; + } - HashSet remove = new HashSet(); - + Set remove = new HashSet<>(); + for (FissureData data : _active) + { if (data.Update()) + { remove.add(data); - + } + } + for (FissureData data : remove) { _active.remove(data); data.Clear(); - } + } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkIronHook.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkIronHook.java new file mode 100644 index 000000000..a1d72f294 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkIronHook.java @@ -0,0 +1,132 @@ +package nautilus.game.arcade.game.games.smash.perks.golem; + +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 mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import nautilus.game.arcade.kit.Perk; + +public class PerkIronHook extends Perk implements IThrown +{ + + private static final long COOLDOWN = 8000; + private static final int DAMAGE = 4; + + public PerkIronHook() + { + super("Iron Hook", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Pickaxe to " + C.cGreen + "Iron Hook" }); + } + + @EventHandler + public void Activate(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isPickaxe(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } + + // Action + Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(131)); + UtilAction.velocity(item, player.getLocation().getDirection(), 1.8, false, 0, 0.2, 10, false); + + Manager.GetProjectile().AddThrow(item, player, this, -1, true, true, true, true, Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.CRIT, null, 0, UpdateType.TICK, 0.6f); + + // Inform + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + + // Effect + item.getWorld().playSound(item.getLocation(), Sound.IRONGOLEM_THROW, 2f, 0.8f); + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + // Remove + double velocity = data.getThrown().getVelocity().length(); + data.getThrown().remove(); + + if (!(data.getThrower() instanceof Player)) + { + return; + } + + Player player = (Player) data.getThrower(); + + if (target == null) + { + return; + } + + // Pull + UtilAction.velocity(target, UtilAlg.getTrajectory(target.getLocation(), player.getLocation()), 2, false, 0, 0.8, 1.5, true); + + // Condition + Manager.GetCondition().Factory().Falling(GetName(), target, player, 10, false, true); + + // Damage Event + Manager.GetDamage().NewDamageEvent(target, player, null, DamageCause.CUSTOM, velocity * DAMAGE, false, true, false, player.getName(), GetName()); + + // Inform + UtilPlayer.message(target, F.main("Skill", F.name(player.getName()) + " hit you with " + F.skill(GetName()) + ".")); + } + + @Override + public void Idle(ProjectileUser data) + { + data.getThrown().remove(); + } + + @Override + public void Expire(ProjectileUser data) + { + data.getThrown().remove(); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkSeismicSlam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkSeismicSlam.java new file mode 100644 index 000000000..1c38d2849 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkSeismicSlam.java @@ -0,0 +1,192 @@ +package nautilus.game.arcade.game.games.smash.perks.golem; + +import java.util.HashMap; +import java.util.Map; + +import org.bukkit.Effect; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +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.entity.PlayerDeathEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; + +public class PerkSeismicSlam extends Perk +{ + + private static final long COOLDOWN = 7000; + private static final long TIME = 1000; + private static final int DAMAGE = 10; + private static final int RADIUS = 8; + private static final float KNOCKBACK_MAGNITUDE = 2.4F; + + private Map _live = new HashMap<>(); + + public PerkSeismicSlam() + { + super("Seismic Slam", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Spade to " + C.cGreen + "Seismic Slam" }); + } + + @EventHandler + public void deactivateDeath(PlayerDeathEvent event) + { + Player player = event.getEntity(); + + if (!hasPerk(player)) + { + return; + } + + if (_live.containsKey(player)) + { + _live.remove(player); + } + } + + @EventHandler + public void Leap(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isSpade(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + return; + + // Action + Vector vec = player.getLocation().getDirection(); + if (vec.getY() < 0) + { + vec.setY(vec.getY() * -1); + } + + UtilAction.velocity(player, vec, 1, true, 1, 0, 1, true); + + // Record + _live.put(player, System.currentTimeMillis()); + + // Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void Slam(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!UtilEnt.isGrounded(player)) + { + continue; + } + + if (!_live.containsKey(player)) + { + continue; + } + + if (!UtilTime.elapsed(_live.get(player), TIME)) + { + continue; + } + + _live.remove(player); + + // Action + + Map targets = UtilEnt.getInRadius(player.getLocation(), RADIUS); + + for (LivingEntity cur : targets.keySet()) + { + if (cur.equals(player)) + { + continue; + } + + if (cur instanceof Player && !UtilPlayer.isSpectator(cur)) + { + continue; + } + + // Damage Event + Manager.GetDamage().NewDamageEvent(cur, player, null, DamageCause.CUSTOM, DAMAGE * targets.get(cur) + 0.5, true, true, false, player.getName(), GetName()); + + // Condition + Manager.GetCondition().Factory().Falling(GetName(), cur, player, 10, false, true); + + // Inform + if (cur instanceof Player) + UtilPlayer.message((Player) cur, F.main("Game", F.name(player.getName()) + " hit you with " + F.skill(GetName()) + ".")); + } + + // Effect + player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_WOOD, 2f, 0.2f); + + for (Block cur : UtilBlock.getInRadius(player.getLocation(), 4).keySet()) + { + if (UtilBlock.airFoliage(cur.getRelative(BlockFace.UP)) && !UtilBlock.airFoliage(cur)) + { + cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getTypeId()); + } + } + } + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashEnderman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashEnderman.java new file mode 100644 index 000000000..e0d290f5b --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashEnderman.java @@ -0,0 +1,123 @@ +package nautilus.game.arcade.game.games.smash.perks.golem; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.bukkit.Effect; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; +import nautilus.game.arcade.kit.perks.data.EarthquakeData; + +public class SmashEnderman extends SmashUltimate +{ + + private static final long DURATION = 16000; + private static final long HIT_FREQUENCY = 400; + private static final int EFFECT_RADIUS = 5; + + private List _data = new ArrayList<>(); + + public SmashEnderman() + { + super("Earthquake", new String[] {}, Sound.IRONGOLEM_HIT, DURATION); + } + + @Override + public void activate(Player player) + { + super.activate(player); + + _data.add(new EarthquakeData(player)); + } + + @Override + public void cancel(Player player) + { + super.cancel(player); + + Iterator quakeIter = _data.iterator(); + + while (quakeIter.hasNext()) + { + EarthquakeData data = quakeIter.next(); + + if (isUsingUltimate(data.Player)) + { + quakeIter.remove(); + } + } + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + Iterator quakeIter = _data.iterator(); + + while (quakeIter.hasNext()) + { + EarthquakeData data = quakeIter.next(); + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + player.playSound(player.getLocation(), Sound.MINECART_BASE, 0.2f, 0.2f); + + if (player.equals(data.Player)) + { + continue; + } + + if (UtilEnt.isGrounded(player)) + { + // Damage Event + Manager.GetDamage().NewDamageEvent(player, data.Player, null, DamageCause.CUSTOM, 1 + 2 * Math.random(), false, false, false, player.getName(), GetName()); + + // Velocity + if (Recharge.Instance.use(player, GetName() + " Hit", HIT_FREQUENCY, false, false)) + { + UtilAction.velocity(player, new Vector(Math.random() - 0.5, Math.random() * 0.2, Math.random() - 0.5), Math.random() * 1 + 1, false, 0, 0.1 + Math.random() * 0.2, 2, true); + } + } + + // Effect + for (Block block : UtilBlock.getInRadius(player.getLocation(), EFFECT_RADIUS).keySet()) + { + if (Math.random() < 0.98) + { + continue; + } + + if (!UtilBlock.solid(block)) + { + continue; + } + + if (!UtilBlock.airFoliage(block.getRelative(BlockFace.UP))) + { + continue; + } + + player.playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType()); + } + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkFlameDash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkFlameDash.java new file mode 100644 index 000000000..0f50c2a2d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkFlameDash.java @@ -0,0 +1,195 @@ +package nautilus.game.arcade.game.games.smash.perks.magmacube; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + +import org.bukkit.Sound; +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.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.data.FireflyData; + +public class PerkFlameDash extends Perk +{ + + private static final long COOLDOWN = 8000; + private static final long TIME = 800; + private static final int DAMAGE_RADIUS = 3; + private static final int KNOCKBACK_MAGNITUDE = 2; + + private Set _data = new HashSet(); + + public PerkFlameDash() + { + super("Flame Dash", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + "Flame Dash" }); + } + + @EventHandler + public void Skill(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isSpade(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (!Recharge.Instance.usable(player, GetName())) + { + boolean done = false; + for (FireflyData data : _data) + { + if (data.Player.equals(player)) + { + data.Time = 0; + done = true; + } + } + + if (done) + { + UtilPlayer.message(player, F.main("Skill", "You ended " + F.skill(GetName()) + ".")); + UpdateMovement(); + } + else + { + Recharge.Instance.use(player, GetName(), COOLDOWN, true, true); + } + + return; + } + + Recharge.Instance.useForce(player, GetName(), COOLDOWN); + + _data.add(new FireflyData(player)); + + Manager.GetCondition().Factory().Cloak(GetName(), player, player, 2.5, false, false); + + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + UpdateMovement(); + } + + public void UpdateMovement() + { + Iterator dataIterator = _data.iterator(); + + while (dataIterator.hasNext()) + { + FireflyData data = dataIterator.next(); + + // Move + if (!UtilTime.elapsed(data.Time, TIME)) + { + Vector vel = data.Location.getDirection(); + vel.setY(0); + vel.normalize(); + vel.setY(0.05); + + UtilAction.velocity(data.Player, vel); + + // Sound + data.Player.getWorld().playSound(data.Player.getLocation(), Sound.FIZZ, 0.6f, 1.2f); + + // Particles + UtilParticle.PlayParticle(ParticleType.FLAME, data.Player.getLocation().add(0, 0.4, 0), 0.2f, 0.2f, 0.2f, 0f, 3, ViewDist.LONGER, UtilServer.getPlayers()); + } + // End + else + { + for (Player other : UtilPlayer.getNearby(data.Player.getLocation(), DAMAGE_RADIUS)) + { + if (other.equals(data.Player)) + { + continue; + } + + if (UtilPlayer.isSpectator(other)) + { + continue; + } + + double dist = UtilMath.offset(data.Player.getLocation(), data.Location) / 2; + + // Damage Event + Manager.GetDamage().NewDamageEvent(other, data.Player, null, DamageCause.CUSTOM, 2 + dist, true, true, false, data.Player.getName(), GetName()); + + UtilPlayer.message(other, F.main("Game", F.elem(Manager.GetColor(data.Player) + data.Player.getName()) + " hit you with " + F.elem(GetName()) + ".")); + } + + // End Invisible + Manager.GetCondition().EndCondition(data.Player, null, GetName()); + + // Sound + data.Player.getWorld().playSound(data.Player.getLocation(), Sound.EXPLODE, 1f, 1.2f); + + // Particles + UtilParticle.PlayParticle(ParticleType.FLAME, data.Player.getLocation(), 0.1f, 0.1f, 0.1f, 0.3f, 100, ViewDist.MAX, UtilServer.getPlayers()); + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.Player.getLocation().add(0, 0.4, 0), 0.2f, 0.2f, 0.2f, 0f, 1, ViewDist.MAX, UtilServer.getPlayers()); + + dataIterator.remove(); + } + } + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBlast.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBlast.java new file mode 100644 index 000000000..c3a2587a7 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBlast.java @@ -0,0 +1,176 @@ +package nautilus.game.arcade.game.games.smash.perks.magmacube; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLargeFireball; +import org.bukkit.entity.LargeFireball; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.kit.Perk; +import net.minecraft.server.v1_8_R3.EntityLargeFireball; + +public class PerkMagmaBlast extends Perk +{ + + private static final int COOLDOWN = 6000; + private static final float FIREBALL_VELOCITY = 0.2F; + private static final int VELOCITY_RADIUS = 8; + private static final int FIRE_TICKS = 40; + + private Map _proj = new HashMap<>(); + + public PerkMagmaBlast() + { + super("Magma Blast", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Magma Blast" }); + } + + @EventHandler + public void Shoot(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isAxe(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } + + event.setCancelled(true); + + // Action + LargeFireball ball = player.launchProjectile(LargeFireball.class); + ball.setShooter(player); + ball.setIsIncendiary(false); + ball.setYield(0); + ball.setBounce(false); + ball.teleport(player.getEyeLocation().add(player.getLocation().getDirection().multiply(1))); + + Vector dir = player.getLocation().getDirection().multiply(FIREBALL_VELOCITY); + + EntityLargeFireball eFireball = ((CraftLargeFireball) ball).getHandle(); + eFireball.dirX = dir.getX(); + eFireball.dirY = dir.getY(); + eFireball.dirZ = dir.getZ(); + + // Knockback + UtilAction.velocity(player, player.getLocation().getDirection().multiply(-1), 1.2, false, 0, 0.2, 1.2, true); + + // Add + _proj.put(ball, player.getLocation()); + + // Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); + + // Effect + player.getWorld().playSound(player.getLocation(), Sound.CREEPER_DEATH, 2f, 1.5f); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + Iterator projIterator = _proj.keySet().iterator(); + + while (projIterator.hasNext()) + { + LargeFireball proj = projIterator.next(); + + if (!proj.isValid()) + { + projIterator.remove(); + proj.remove(); + continue; + } + } + } + + @EventHandler + public void Collide(ProjectileHitEvent event) + { + Projectile proj = event.getEntity(); + + if (!_proj.containsKey(proj)) + { + return; + } + + if (proj.getShooter() == null) + { + return; + } + + if (!(proj.getShooter() instanceof Player)) + { + return; + } + + // Velocity Players + Map hitMap = UtilPlayer.getInRadius(proj.getLocation(), VELOCITY_RADIUS); + + for (Player cur : hitMap.keySet()) + { + double range = hitMap.get(cur); + + // Velocity + UtilAction.velocity(cur, UtilAlg.getTrajectory(proj.getLocation().add(0, -0.5, 0), cur.getEyeLocation()), 1 + 2 * range, false, 0, 0.2 + 0.4 * range, 1.2, true); + + cur.setFireTicks(FIRE_TICKS); + } + + // Particles + UtilParticle.PlayParticleToAll(ParticleType.LAVA, proj.getLocation(), 0.1f, 0.1f, 0.1f, 0.1f, 50, ViewDist.LONG); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBoost.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBoost.java new file mode 100644 index 000000000..c3508a4d3 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBoost.java @@ -0,0 +1,176 @@ +package nautilus.game.arcade.game.games.smash.perks.magmacube; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.disguise.disguises.DisguiseMagmaCube; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; + +public class PerkMagmaBoost extends Perk +{ + + private static final int MAX_STACKS = 3; + + private Map _kills = new HashMap(); + + public PerkMagmaBoost() + { + super("Fuel the Fire", new String[] { C.cGray + "Kills give +1 Damage, -15% Knockback Taken and +1 Size.", C.cGray + "Kill bonuses can stack " + MAX_STACKS + " times, and reset on death.", }); + } + + @EventHandler + public void Kill(CombatDeathEvent event) + { + Player killed = (Player) event.GetEvent().getEntity(); + + _kills.remove(killed); + + if (event.GetLog().GetKiller() == null) + { + return; + } + + Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); + + if (killer == null || killer.equals(killed) || !hasPerk(killer)) + { + return; + } + + DisguiseMagmaCube slime = (DisguiseMagmaCube) Manager.GetDisguise().getActiveDisguise(killer); + UUID key = killed.getUniqueId(); + + if (slime == null) + { + return; + } + + int size = 1; + + if (_kills.containsKey(key)) + { + size += _kills.get(key); + } + + size = Math.min(MAX_STACKS, size); + + _kills.put(key, size); + + slime.SetSize(size + 1); + Manager.GetDisguise().updateDisguise(slime); + + killer.setExp(0.99f * (size / MAX_STACKS)); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void SizeDamage(CustomDamageEvent event) + { + if (event.IsCancelled()) + { + return; + } + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + { + return; + } + + Player damager = event.GetDamagerPlayer(false); + + if (damager == null) + { + return; + } + + if (!hasPerk(damager)) + { + return; + } + + if (!_kills.containsKey(damager.getUniqueId())) + { + return; + } + + int bonus = _kills.get(damager.getUniqueId()); + + event.AddMod(damager.getName(), GetName(), bonus, false); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void SizeKnockback(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damagee = event.GetDamageePlayer(); + + if (damagee == null) + { + return; + } + if (!hasPerk(damagee)) + { + return; + } + + if (!_kills.containsKey(damagee.getUniqueId())) + { + return; + } + + int bonus = _kills.get(damagee.getUniqueId()); + + event.AddKnockback(GetName(), bonus * 0.15d); + } + + @EventHandler + public void EnergyUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC && event.getType() != UpdateType.FAST && event.getType() != UpdateType.FASTER && event.getType() != UpdateType.FASTEST) + { + return; + } + + for (Player player : UtilServer.getPlayers()) + { + if (!hasPerk(player)) + { + continue; + } + + float size = 0; + + if (_kills.containsKey(player.getUniqueId())) + { + size += _kills.get(player.getUniqueId()); + } + + playParticles(player, size); + } + } + + private void playParticles(Player player, float size) + { + UtilParticle.PlayParticleToAll(ParticleType.LAVA, player.getLocation().add(0, 0.4, 0), 0.15f + 0.15f * size, 0.15f + 0.15f * size, 0.15f + 0.15f * size, 0, 1, ViewDist.LONG); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/SmashMagmacube.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/SmashMagmacube.java new file mode 100644 index 000000000..ceaddbe11 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/SmashMagmacube.java @@ -0,0 +1,55 @@ +package nautilus.game.arcade.game.games.smash.perks.magmacube; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; +import nautilus.game.arcade.kit.perks.data.MeteorShowerData; + +public class SmashMagmacube extends SmashUltimate +{ + + private static final long DURATION = 12000; + + private List _meteors = new ArrayList<>(); + + public SmashMagmacube() + { + super("Meteor Shower", new String[] {}, Sound.AMBIENCE_THUNDER, 0); + } + + @Override + public void activate(Player player) + { + _meteors.add(new MeteorShowerData(player, UtilPlayer.getTargetLocation(player, 128), DURATION)); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + Iterator meteorIter = _meteors.iterator(); + + while (meteorIter.hasNext()) + { + MeteorShowerData data = meteorIter.next(); + + if (data.update()) + { + meteorIter.remove(); + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBomb.java new file mode 100644 index 000000000..f85cd3732 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBomb.java @@ -0,0 +1,216 @@ +package nautilus.game.arcade.game.games.smash.perks.pig; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.Sound; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Pig; +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.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguisePigZombie; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkPigBaconBomb extends SmashPerk +{ + + private static final float ENERGY_PER_PIG = 0.35F; + private static final float ENERGY_PER_PIG_DISGUISED_FACTOR = 0.7F; + private static final long COOLDOWN = 100; + private static final int PIG_MAX_TICKS = 80; + private static final float PIG_SPEED = 1.2F; + private static final int PIG_EXPLODE_RADIUS = 2; + private static final int PIG_EXPLODE_DAMAGE = 4; + private static final int PIG_EXPLODE_DAMAGE_RADIUS = 4; + + private Map> _pigs = new HashMap>(); + + public PerkPigBaconBomb() + { + super("Baby Bacon Bomb", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Spade to " + C.cGreen + "Baby Bacon Bomb" }); + } + + @EventHandler + public void Skill(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isSpade(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + float energy = ENERGY_PER_PIG; + + DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); + + if (disguise != null && disguise instanceof DisguisePigZombie) + { + energy = energy * ENERGY_PER_PIG_DISGUISED_FACTOR; + } + + // Energy + if (player.getExp() < energy) + { + UtilPlayer.message(player, F.main("Energy", "Not enough Energy to use " + F.skill(GetName()) + ".")); + return; + } + + // Recharge + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, false, false)) + { + return; + } + + // Use Energy + player.setExp(Math.max(0f, player.getExp() - energy)); + + // Velocity + UtilAction.velocity(player, player.getLocation().getDirection(), 0.8, true, 0.9, 0, 1, true); + + // Sound + player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 2f, 0.75f); + + // Pig + Manager.GetGame().CreatureAllowOverride = true; + Pig pig = player.getWorld().spawn(player.getLocation(), Pig.class); + pig.setHealth(5); + pig.setVelocity(new Vector(0, -0.4, 0)); + Manager.GetGame().CreatureAllowOverride = false; + + pig.setBaby(); + UtilEnt.Vegetate(pig); + UtilEnt.ghost(pig, true, false); + + UUID key = player.getUniqueId(); + + // Store + if (!_pigs.containsKey(key)) + { + _pigs.put(key, new HashSet()); + } + + _pigs.get(key).add(pig); + + // Inform + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void Check(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (UUID key : _pigs.keySet()) + { + Player player = UtilPlayer.searchExact(key); + + if (player == null) + { + continue; + } + + Iterator pigIterator = _pigs.get(key).iterator(); + + while (pigIterator.hasNext()) + { + Pig pig = pigIterator.next(); + + if (!pig.isValid() || pig.getTicksLived() > PIG_MAX_TICKS) + { + PigExplode(pigIterator, pig, player); + continue; + } + + Player target = UtilPlayer.getClosest(pig.getLocation(), player); + + if (target == null) + { + continue; + } + + UtilEnt.CreatureMoveFast(pig, target.getLocation(), PIG_SPEED); + + if (UtilMath.offset(target, pig) < PIG_EXPLODE_RADIUS) + { + PigExplode(pigIterator, pig, player); + } + } + } + } + + public void PigExplode(Iterator pigIterator, Pig pig, Player owner) + { + // Effect + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, pig.getLocation().add(0, 0.5, 0), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); + + // Sound + pig.getWorld().playSound(pig.getLocation(), Sound.EXPLODE, 0.6f, 2f); + pig.getWorld().playSound(pig.getLocation(), Sound.PIG_DEATH, 1f, 2f); + + // Damage + Map targets = UtilEnt.getInRadius(pig.getLocation(), PIG_EXPLODE_DAMAGE_RADIUS); + + for (LivingEntity cur : targets.keySet()) + { + if (cur.equals(owner)) + { + continue; + } + + // Damage Event + Manager.GetDamage().NewDamageEvent(cur, owner, null, DamageCause.CUSTOM, PIG_EXPLODE_DAMAGE, false, true, false, owner.getName(), GetName()); + } + + // Remove + pigIterator.remove(); + pig.remove(); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBounce.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBounce.java new file mode 100644 index 000000000..092deedb8 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBounce.java @@ -0,0 +1,199 @@ +package nautilus.game.arcade.game.games.smash.perks.pig; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Item; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguisePigZombie; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkPigBaconBounce extends SmashPerk implements IThrown +{ + + private static final float ENERGY_PER_BACON = 0.2F; + private static final float ENERGY_PER_BACON_DISGUISED_FACTOR = 0.7F; + private static final long COOLDOWN = 100; + private static final int HEALTH_PER_BACON = 1; + private static final int BACON_DAMAGE = 4; + + public PerkPigBaconBounce() + { + super("Bouncy Bacon", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Bouncy Bacon", }); + } + + @EventHandler + public void Skill(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isAxe(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + float energy = ENERGY_PER_BACON; + + DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); + + if (disguise != null && disguise instanceof DisguisePigZombie) + { + energy = energy * ENERGY_PER_BACON_DISGUISED_FACTOR; + } + + // Energy + if (player.getExp() < energy) + { + UtilPlayer.message(player, F.main("Energy", "Not enough Energy to use " + F.skill(GetName()) + ".")); + return; + } + + // Recharge + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, false, false)) + { + return; + } + + // Use Energy + player.setExp(Math.max(0f, player.getExp() - energy)); + + // Launch + Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.PORK, (byte) 0, 1, "Bacon" + System.currentTimeMillis())); + UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false); + Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 0.4f); + ent.setPickupDelay(9999); + + // Sound + player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 2f, 1.5f); + + // Inform + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + Rebound(data.getThrower(), data.getThrown()); + + if (target == null) + return; + + if (isTeamDamage((Player) target, (Player) data.getThrower())) + { + + } + + // Damage Event + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, BACON_DAMAGE, true, true, false, UtilEnt.getName(data.getThrower()), GetName()); + + Item item = (Item) data.getThrown(); + item.setItemStack(new ItemStack(Material.GRILLED_PORK)); + } + + @Override + public void Idle(ProjectileUser data) + { + Rebound(data.getThrower(), data.getThrown()); + } + + @Override + public void Expire(ProjectileUser data) + { + Rebound(data.getThrower(), data.getThrown()); + } + + public void Rebound(LivingEntity player, Entity ent) + { + ent.getWorld().playSound(ent.getLocation(), Sound.ITEM_PICKUP, 1f, 0.5f); + + double mult = 0.5 + (0.035 * UtilMath.offset(player.getLocation(), ent.getLocation())); + + // Velocity + ent.setVelocity(player.getLocation().toVector().subtract(ent.getLocation().toVector()).normalize().add(new Vector(0, 0.4, 0)).multiply(mult)); + + // Ticks + if (ent instanceof Item) + { + ((Item) ent).setPickupDelay(5); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void Pickup(PlayerPickupItemEvent event) + { + if (!hasPerk(event.getPlayer())) + { + return; + } + + Material type = event.getItem().getItemStack().getType(); + + if (type != Material.PORK && type != Material.GRILLED_PORK) + return; + + // Remove + event.getItem().remove(); + + // Restore Energy + event.getPlayer().setExp(Math.min(0.999f, event.getPlayer().getExp() + 0.05f)); + + // Sound + event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.EAT, 2f, 1f); + + // Heal + if (event.getItem().getItemStack().getType() == Material.GRILLED_PORK) + { + UtilPlayer.health(event.getPlayer(), HEALTH_PER_BACON); + UtilParticle.PlayParticle(ParticleType.HEART, event.getPlayer().getLocation().add(0, 0.5, 0), 0.2f, 0.2f, 0.2f, 0, 4, ViewDist.LONG, UtilServer.getPlayers()); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigZombie.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigZombie.java new file mode 100644 index 000000000..961782928 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigZombie.java @@ -0,0 +1,124 @@ +package nautilus.game.arcade.game.games.smash.perks.pig; + +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.disguise.disguises.DisguisePig; +import mineplex.core.disguise.disguises.DisguisePigZombie; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkPigZombie extends SmashPerk +{ + + private static final int MIN_HEALTH = 6; + + public Set _active = new HashSet<>(); + + public PerkPigZombie() + { + super("Nether Pig", new String[] { C.cGray + "Become Nether Pig when HP is below 6.", C.cGray + "Return to Pig when HP is 10 or higher." }); + } + + @EventHandler + public void Check(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + { + return; + } + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!hasPerk(player)) + { + continue; + } + + // Active + if (_active.contains(player.getUniqueId())) + { + Manager.GetCondition().Factory().Speed("Pig Zombie", player, player, 0.9, 0, false, false, false); + + if (player.getHealth() < 10 || isSuperActive(player)) + { + continue; + } + + // Deactivate + _active.remove(player.getUniqueId()); + + // Armor + player.getInventory().setHelmet(null); + player.getInventory().setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE)); + player.getInventory().setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS)); + player.getInventory().setBoots(new ItemStack(Material.CHAINMAIL_BOOTS)); + + player.getInventory().remove(Material.IRON_HELMET); + player.getInventory().remove(Material.IRON_CHESTPLATE); + player.getInventory().remove(Material.IRON_LEGGINGS); + player.getInventory().remove(Material.IRON_BOOTS); + + SmashKit2 kit = (SmashKit2) Kit; + + kit.disguise(player, DisguisePig.class); + + // Sound + player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 2f, 1f); + player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 2f, 1f); + + // Inform + UtilPlayer.message(player, F.main("Skill", "You returned to " + F.skill("Pig Form") + ".")); + } + // Not Active + else + { + if (player.getHealth() <= 0 || (!isSuperActive(player) && player.getHealth() > MIN_HEALTH)) + { + continue; + } + + // Activate + _active.add(player.getUniqueId()); + + // Armor + player.getInventory().setHelmet(new ItemStack(Material.IRON_HELMET)); + player.getInventory().setChestplate(new ItemStack(Material.IRON_CHESTPLATE)); + player.getInventory().setLeggings(new ItemStack(Material.IRON_LEGGINGS)); + player.getInventory().setBoots(new ItemStack(Material.IRON_BOOTS)); + + SmashKit2 kit = (SmashKit2) Kit; + + kit.disguise(player, DisguisePigZombie.class); + + // Sound + player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_PIG_ANGRY, 2f, 1f); + player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_PIG_ANGRY, 2f, 1f); + + // Inform + UtilPlayer.message(player, F.main("Skill", "You transformed into " + F.skill("Nether Pig Form") + ".")); + + player.setExp(0.99f); + } + } + } + + @EventHandler + public void Clean(PlayerDeathEvent event) + { + _active.remove(event.getEntity()); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/SmashPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/SmashPig.java new file mode 100644 index 000000000..a799b1e41 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/SmashPig.java @@ -0,0 +1,30 @@ +package nautilus.game.arcade.game.games.smash.perks.pig; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; + +import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; + +public class SmashPig extends SmashUltimate +{ + + public SmashPig() + { + super("Pig Stink", new String[] {}, Sound.PIG_IDLE, 0); + } + + @Override + public void activate(Player player) + { + super.activate(player); + + for (Player other : Manager.GetGame().GetPlayers(true)) + { + if (!player.equals(other)) + { + Manager.GetCondition().Factory().Confuse(GetName() + " " + player.getName(), other, player, 40, 0, false, false, false); + } + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkLazer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkLazer.java new file mode 100644 index 000000000..54862f097 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkLazer.java @@ -0,0 +1,244 @@ +package nautilus.game.arcade.game.games.smash.perks.sheep; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.Color; +import org.bukkit.DyeColor; +import org.bukkit.FireworkEffect.Type; +import org.bukkit.Location; +import org.bukkit.Sound; +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 mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.particles.effects.LineParticle; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseSheep; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; + +public class PerkLazer extends Perk +{ + + private static final float MAX_CHARGE = 0.99F; + private static final float CHARGE_PER_TICK = 0.035F; + private static final float INCREMENTATION = 0.2F; + private static final float HIT_BOX_RADIUS = 2.5F; + private static final int DAMAGE_RADIUS = 3; + private static final int DAMAGE = 7; + private static final int KNOCKBACK_MAGNITUDE = 3; + + private double _range; + private long _recharge; + + private Set _active = new HashSet<>(); + + public PerkLazer(double range, long recharge) + { + super("Static Lazer", new String[] { C.cYellow + "Hold Block" + C.cGray + " with Sword to use " + C.cGreen + "Static Lazer" }); + + _range = range; + _recharge = recharge; + } + + @EventHandler + public void skill(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isSword(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), _recharge, true, true)) + { + return; + } + + _active.add(player.getUniqueId()); + } + + @EventHandler + public void chargeFire(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + Iterator playerIterator = _active.iterator(); + + while (playerIterator.hasNext()) + { + UUID uuid = playerIterator.next(); + Player player = UtilPlayer.searchExact(uuid); + + if (player == null) + { + playerIterator.remove(); + } + + if (player.isBlocking()) + { + player.setExp(Math.min(MAX_CHARGE, player.getExp() + CHARGE_PER_TICK)); + + player.getWorld().playSound(player.getLocation(), Sound.FIZZ, 0.25f + player.getExp(), 0.75f + player.getExp()); + + // Wool + DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); + if (disguise != null && disguise instanceof DisguiseSheep) + { + DisguiseSheep sheep = (DisguiseSheep) disguise; + + if (Math.random() > 0.5) + { + sheep.setColor(DyeColor.YELLOW); + } + else + { + sheep.setColor(DyeColor.BLACK); + } + + sheep.setSheared(false); + + sheep.UpdateDataWatcher(); + Manager.GetDisguise().updateDisguise(disguise); + } + + if (player.getExp() >= MAX_CHARGE) + { + playerIterator.remove(); + fire(player); + } + } + else + { + playerIterator.remove(); + fire(player); + } + } + } + + public void fire(Player player) + { + if (player.getExp() <= 0.2) + { + setWoolColor(player, DyeColor.WHITE); + player.setExp(0f); + return; + } + + LineParticle lineParticle = new LineParticle(player.getEyeLocation(), player.getLocation().getDirection(), INCREMENTATION, _range * player.getExp(), null, ParticleType.FIREWORKS_SPARK, + UtilServer.getPlayers()); + + particleLoop: while (lineParticle.update()) + { + for (Player other : UtilPlayer.getNearby(lineParticle.getLastLocation(), HIT_BOX_RADIUS)) + { + if (player.equals(other)) + { + continue; + } + + break particleLoop; + } + } + + Location target = lineParticle.getDestination(); + + UtilParticle.PlayParticle(ParticleType.EXPLODE, target, 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); + + // Firework + UtilFirework.playFirework(target, Type.BURST, Color.YELLOW, false, false); + + for (LivingEntity other : UtilEnt.getInRadius(target, DAMAGE_RADIUS).keySet()) + { + if (other.equals(player)) + { + continue; + } + + // Damage Event + Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, player.getExp() * DAMAGE, true, true, false, player.getName(), GetName()); + } + + // Inform + UtilPlayer.message(player, F.main("Game", "You fired " + F.skill(GetName()) + ".")); + + // Sound + player.getWorld().playSound(player.getEyeLocation(), Sound.ZOMBIE_REMEDY, 0.5f + player.getExp(), 1.75f - player.getExp()); + player.getWorld().playSound(player.getLocation(), Sound.SHEEP_IDLE, 2f, 1.5f); + + // Wool + setWoolColor(player, DyeColor.WHITE); + player.setExp(0f); + } + + @EventHandler + public void knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + } + + public void setWoolColor(Player player, DyeColor color) + { + DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); + + if (disguise != null && disguise instanceof DisguiseSheep) + { + DisguiseSheep sheep = (DisguiseSheep) disguise; + sheep.setSheared(false); + sheep.setColor(color); + + sheep.UpdateDataWatcher(); + Manager.GetDisguise().updateDisguise(disguise); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolBomb.java new file mode 100644 index 000000000..b5af795c2 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolBomb.java @@ -0,0 +1,364 @@ +package nautilus.game.arcade.game.games.smash.perks.sheep; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.Effect; +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 mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseSheep; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; +import mineplex.core.recharge.RechargedEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.data.WoolBombData; + +public class PerkWoolBomb extends Perk implements IThrown +{ + + private static final long RATE = 800; + private static final long COOLDOWN = 8000; + private static final int DAMAGE_RADIUS = 9; + private static final int DAMAGE_EXPLODE = 14; + private static final int DAMAGE_COLLIDE = 4; + private static final int KNOCKBACK_MAGNITUDE = 2; + + private Map _thrown = new HashMap<>(); + private Map _active = new HashMap<>(); + + public PerkWoolBomb() + { + super("Wool Mine", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Wool Mine" }); + } + + @EventHandler + public void skill(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isAxe(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (!Recharge.Instance.usable(player, GetName() + " Rate")) + { + return; + } + + if (_active.containsKey(player)) + { + if (detonate(player, true)) + { + return; + } + } + + if (_thrown.containsKey(player)) + { + if (solidify(player, true)) + { + return; + } + } + + launch(player); + + event.setCancelled(true); + } + + private void launch(Player player) + { + if (!Recharge.Instance.usable(player, GetName(), true)) + { + return; + } + + Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.WOOL, (byte) 0)); + + UtilAction.velocity(ent, player.getLocation().getDirection(), 1, false, 0, 0.2, 10, false); + + Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true, null, 1f, 1f, null, 1, UpdateType.SLOW, 0.5f); + + _thrown.put(player.getUniqueId(), ent); + + // Inform + UtilPlayer.message(player, F.main("Game", "You launched " + F.skill(GetName()) + ".")); + + // Effect + player.getWorld().playSound(player.getLocation(), Sound.SHEEP_IDLE, 2f, 1.5f); + + // Rate + Recharge.Instance.useForce(player, GetName() + " Rate", RATE); + + // Disguise + DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); + + if (disguise != null && disguise instanceof DisguiseSheep) + { + DisguiseSheep sheep = (DisguiseSheep) disguise; + sheep.setSheared(true); + + sheep.UpdateDataWatcher(); + Manager.GetDisguise().updateDisguise(disguise); + } + } + + @EventHandler + public void rechargeWool(RechargedEvent event) + { + if (event.GetAbility().equals(GetName())) + { + DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(event.GetPlayer()); + + if (disguise != null && disguise instanceof DisguiseSheep) + { + DisguiseSheep sheep = (DisguiseSheep) disguise; + sheep.setSheared(false); + + sheep.UpdateDataWatcher(); + Manager.GetDisguise().updateDisguise(disguise); + } + } + } + + private boolean solidify(LivingEntity ent, boolean inform) + { + if (!(ent instanceof Player)) + { + return false; + } + + Player player = (Player) ent; + + Item thrown = _thrown.remove(player.getUniqueId()); + + if (thrown == null) + { + return false; + } + + // Make Block + Block block = thrown.getLocation().getBlock(); + + Manager.GetBlockRestore().restore(block); + + _active.put(player.getUniqueId(), new WoolBombData(block)); + + block.setType(Material.WOOL); + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType()); + + // Clean + thrown.remove(); + + // Rate + Recharge.Instance.useForce(player, GetName() + " Rate", RATE); + + // Inform + if (inform) + { + player.getWorld().playSound(player.getLocation(), Sound.SHEEP_IDLE, 2f, 1.5f); + + UtilPlayer.message(player, F.main("Game", "You armed " + F.skill(GetName()) + ".")); + } + + return true; + } + + private boolean detonate(Player player, boolean inform) + { + WoolBombData data = _active.remove(player); + + if (data == null) + { + return false; + } + + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return false; + } + + // Restore + data.restore(); + + // Explode + UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, data.Block.getLocation().add(0.5, 0.5, 0.5), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); + data.Block.getWorld().playSound(data.Block.getLocation(), Sound.EXPLODE, 3f, 0.8f); + + // Damage + Map targets = UtilEnt.getInRadius(data.Block.getLocation().add(0.5, 0.5, 0.5), DAMAGE_RADIUS); + + for (LivingEntity cur : targets.keySet()) + { + // Damage Event + Manager.GetDamage().NewDamageEvent(cur, player, null, DamageCause.CUSTOM, DAMAGE_EXPLODE * targets.get(cur) + 0.5, false, true, false, player.getName(), GetName()); + + // Condition + Manager.GetCondition().Factory().Falling(GetName(), cur, player, 10, false, true); + + // Knockback + UtilAction.velocity(cur, UtilAlg.getTrajectory2d(data.Block.getLocation().add(0.5, 0.5, 0.5), cur.getEyeLocation()), 0.5 + 2.5 * targets.get(cur), true, 0.8, 0, 10, true); + + // Inform + if (cur instanceof Player && !player.equals(cur)) + { + UtilPlayer.message((Player) cur, F.main("Game", F.name(player.getName()) + " hit you with " + F.skill(GetName()) + ".")); + } + + } + + // Rate + Recharge.Instance.useForce(player, GetName() + " Rate", RATE); + + // Inform + if (inform) + { + player.getWorld().playSound(player.getLocation(), Sound.SHEEP_IDLE, 2f, 1.5f); + + UtilPlayer.message(player, F.main("Game", "You detonated " + F.skill(GetName()) + ".")); + } + + return true; + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + solidify(data.getThrower(), false); + + if (target == null) + { + return; + } + + // Damage Event + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, DAMAGE_COLLIDE, true, true, false, UtilEnt.getName(data.getThrower()), GetName()); + } + + @Override + public void Idle(ProjectileUser data) + { + solidify(data.getThrower(), false); + } + + @Override + public void Expire(ProjectileUser data) + { + solidify(data.getThrower(), false); + } + + @EventHandler + public void colorExpireUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + { + return; + } + + Set detonate = new HashSet(); + Iterator playerIterator = _active.keySet().iterator(); + + while (playerIterator.hasNext()) + { + UUID key = playerIterator.next(); + + Player player = UtilPlayer.searchExact(key); + + if (player == null) + { + playerIterator.remove(); + continue; + } + + WoolBombData data = _active.get(key); + + if (UtilTime.elapsed(data.Time, COOLDOWN)) + { + detonate.add(player); + continue; + } + + if (Recharge.Instance.usable(player, GetName() + " Rate")) + { + if (data.Block.getData() == 14) + { + data.Block.setData((byte) 0); + } + else + { + data.Block.setData((byte) 14); + } + } + } + + for (Player player : detonate) + { + detonate(player, false); + } + } + + @EventHandler + public void knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolCloud.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolCloud.java new file mode 100644 index 000000000..43b85ace2 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolCloud.java @@ -0,0 +1,189 @@ +package nautilus.game.arcade.game.games.smash.perks.sheep; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.DyeColor; +import org.bukkit.Effect; +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.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseSheep; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; + +public class PerkWoolCloud extends Perk +{ + + private static final long COOLDOWN = 10000; + private static final long MIN_VELOCITY_TIME = 200; + private static final long MAX_VELOCITY_TIME = 1200; + private static final int DAMAGE_RADIUS = 2; + private static final int DAMAGE = 8; + private static final float KNOCKBACK_MAGNITUDE = 2.5F; + + private Map _active = new HashMap<>(); + + public PerkWoolCloud() + { + super("Wooly Rocket", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Spade to " + C.cGreen + "Wooly Rocket" }); + } + + @EventHandler + public void Leap(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isSpade(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + // Recharge + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } + + UtilAction.velocity(player, new Vector(0, 1, 0), 1, false, 0, 0, 2, true); + + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + + player.getWorld().playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0); + + // Allow double jump + player.setAllowFlight(true); + + setWoolColor(player, DyeColor.RED); + + _active.put(player.getUniqueId(), System.currentTimeMillis()); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + if (!Manager.GetGame().IsLive()) + { + return; + } + + Iterator playerIterator = _active.keySet().iterator(); + + while (playerIterator.hasNext()) + { + UUID key = playerIterator.next(); + Player player = UtilPlayer.searchExact(key); + + if (player == null) + { + playerIterator.remove(); + continue; + } + + UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation(), 0.2f, 0.2f, 0.2f, 0, 4, ViewDist.LONGER, UtilServer.getPlayers()); + + if (!UtilTime.elapsed(_active.get(player), MIN_VELOCITY_TIME)) + { + continue; + } + + for (Player other : Manager.GetGame().GetPlayers(true)) + { + if (player.equals(other)) + { + continue; + } + + if (UtilMath.offset(player, other) < DAMAGE_RADIUS) + { + // Damage Event + Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE, true, false, false, player.getName(), GetName()); + + UtilParticle.PlayParticle(ParticleType.EXPLODE, other.getLocation(), 0f, 0f, 0f, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); + UtilParticle.PlayParticle(ParticleType.LAVA, player.getLocation(), 0.2f, 0.2f, 0.2f, 0, 10, ViewDist.MAX, UtilServer.getPlayers()); + } + } + + if (UtilEnt.isGrounded(player) || UtilTime.elapsed(_active.get(player), MAX_VELOCITY_TIME)) + { + playerIterator.remove(); + setWoolColor(player, DyeColor.WHITE); + } + } + } + + public void setWoolColor(Player player, DyeColor color) + { + DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); + + if (disguise != null && disguise instanceof DisguiseSheep) + { + DisguiseSheep sheep = (DisguiseSheep) disguise; + sheep.setSheared(false); + sheep.setColor(color); + + sheep.UpdateDataWatcher(); + Manager.GetDisguise().updateDisguise(disguise); + } + } + + @EventHandler + public void knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/SmashSheep.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/SmashSheep.java new file mode 100644 index 000000000..61e49baba --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/SmashSheep.java @@ -0,0 +1,123 @@ +package nautilus.game.arcade.game.games.smash.perks.sheep; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.entity.Sheep; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; +import nautilus.game.arcade.kit.perks.data.HomingSheepData; + +public class SmashSheep extends SmashUltimate +{ + + private static final int DAMAGE_RADIUS = 10; + private static final int DAMAGE = 20; + private static final int KNOCKBACK_MAGNITUDE = 3; + + private List _sheep = new ArrayList<>(); + + public SmashSheep() + { + super("Homing Sheeples", new String[] {}, Sound.SHEEP_IDLE, 0); + } + + @Override + public void activate(Player player) + { + super.activate(player); + + Game game = Manager.GetGame(); + + game.CreatureAllowOverride = true; + + // Fire Sheep + for (Player target : Manager.GetGame().GetPlayers(true)) + { + if (target.equals(player)) + { + continue; + } + + Sheep sheep = player.getWorld().spawn(player.getEyeLocation(), Sheep.class); + + sheep.setBaby(); + + _sheep.add(new HomingSheepData(player, target, sheep)); + } + + game.CreatureAllowOverride = false; + } + + @EventHandler + public void sheepUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + Iterator sheepIter = _sheep.iterator(); + + while (sheepIter.hasNext()) + { + HomingSheepData data = sheepIter.next(); + + if (data.update()) + { + sheepIter.remove(); + explode(data); + } + } + } + + private void explode(HomingSheepData data) + { + double scale = 0.4 + 0.6 * Math.min(1, data.Sheep.getTicksLived() / 60d); + + // Players + Map players = UtilPlayer.getInRadius(data.Sheep.getLocation(), DAMAGE_RADIUS); + + for (Player player : players.keySet()) + { + if (UtilPlayer.isSpectator(player)) + { + continue; + } + + // Damage Event + Manager.GetDamage().NewDamageEvent(player, data.Shooter, null, DamageCause.CUSTOM, DAMAGE * scale, true, true, false, data.Shooter.getName(), GetName()); + } + + UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, data.Sheep.getLocation(), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); + data.Sheep.getWorld().playSound(data.Sheep.getLocation(), Sound.EXPLODE, 2f, 1f); + + data.Sheep.remove(); + } + + @EventHandler + public void knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkBoneRush.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkBoneRush.java new file mode 100644 index 000000000..4106bb52b --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkBoneRush.java @@ -0,0 +1,241 @@ +package nautilus.game.arcade.game.games.smash.perks.skeletalhorse; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.UUID; + +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.entity.PlayerDeathEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkBoneRush extends SmashPerk implements IThrown +{ + + private static final long COOLDOWN = 10000; + private static final float DAMAGE_NORMAL = 0.7F; + private static final int DAMAGE_SMASH = 3; + private static final int KNOCKBACK_NORMAL = 10; + private static final int KNOCKBACK_SMASH = 6; + private static final long EXPIRE_TIME = 2000; + private static final float Y_LIMIT = 0.25F; + + private Map _active = new HashMap<>(); + + public PerkBoneRush() + { + super("Bone Rush", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + "Bone Rush", C.cGray + "Crouch to avoid movement with " + C.cGreen + "Bone Rush" }); + } + + @EventHandler + public void Skill(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isSpade(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (isSuperActive(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } + + activate(player); + + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + } + + public void activate(Player player) + { + _active.put(player.getUniqueId(), System.currentTimeMillis()); + } + + public void deactivate(Player player) + { + _active.remove(player.getUniqueId()); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + Iterator playerIterator = _active.keySet().iterator(); + + while (playerIterator.hasNext()) + { + UUID key = playerIterator.next(); + Player player = UtilPlayer.searchExact(key); + + if (player == null) + { + playerIterator.remove(); + continue; + } + + if (!player.isValid() || (UtilTime.elapsed(_active.get(key), 1500) && !isSuperActive(player))) + { + playerIterator.remove(); + continue; + } + + // Sound + player.getWorld().playSound(player.getLocation(), Sound.SKELETON_HURT, 0.4f, (float) (Math.random() + 1)); + + // Velocity + Vector dir = player.getLocation().getDirection(); + double limit = isSuperActive(player) ? Y_LIMIT + 0.1 : Y_LIMIT; + + if (dir.getY() > limit) + { + dir.setY(limit); + } + + // Player + if (!player.isSneaking()) + { + UtilAction.velocity(player, dir, 0.6, false, 0, 0.1, 0.3, false); + } + + // Bones + for (int i = 0; i < 6; i++) + { + Item bone = player.getWorld().dropItem(player.getLocation().add(Math.random() * 5 - 2.5, Math.random() * 3, Math.random() * 5 - 2.5), new ItemStack(Material.BONE)); + UtilAction.velocity(bone, dir, 0.6 + 0.3 * Math.random(), false, 0, 0.1 + Math.random() * 0.05, 0.3, false); + Manager.GetProjectile().AddThrow(bone, player, this, EXPIRE_TIME, true, true, true, true, 0.5f); + } + } + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() == null) + { + return; + } + + if (event.GetReason().contains(GetName())) + { + event.AddKnockback(GetName(), KNOCKBACK_NORMAL); + } + + if (event.GetReason().contains("Bone Storm")) + { + event.AddKnockback(GetName(), KNOCKBACK_SMASH); + } + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + data.getThrown().remove(); + + if (target == null) + { + return; + } + + if (!(target instanceof Player || data.getThrower() instanceof Player)) + { + return; + } + + target = (Player) target; + Player damager = (Player) data.getThrower(); + String reason = GetName(); + + if (target instanceof Player && damager instanceof Player) + { + if (isTeamDamage((Player) target, damager)) + { + return; + } + } + + if (isSuperActive(damager)) + { + reason = "Bone Storm"; + } + + // Damage Event + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, isSuperActive(damager) ? DAMAGE_SMASH : DAMAGE_NORMAL, false, true, false, UtilEnt.getName(data.getThrower()), reason); + + UtilAction.velocity(target, data.getThrown().getVelocity()); + } + + @Override + public void Idle(ProjectileUser data) + { + data.getThrown().remove(); + } + + @Override + public void Expire(ProjectileUser data) + { + data.getThrown().remove(); + } + + @EventHandler + public void Clean(PlayerDeathEvent event) + { + _active.remove(event.getEntity().getUniqueId()); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkDeadlyBones.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkDeadlyBones.java new file mode 100644 index 000000000..a8bdca3b3 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkDeadlyBones.java @@ -0,0 +1,140 @@ +package nautilus.game.arcade.game.games.smash.perks.skeletalhorse; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Material; +import org.bukkit.Sound; +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 mineplex.core.common.util.C; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkDeadlyBones extends SmashPerk +{ + + private static final int RATE = 400; + private static final int TICKS = 50; + private static final int DAMAGE_RADIUS = 4; + private static final int DAMAGE = 4; + private static final float KNOCKBACK_MAGNITUDE = 2.5F; + + private Map _active = new HashMap<>(); + + public PerkDeadlyBones() + { + super("Deadly Bones", new String[] { C.cGray + "Drop explosive bones when you take damage." }); + } + + @EventHandler + public void damageActivate(CustomDamageEvent event) + { + if (event.IsCancelled()) + { + return; + } + + Player player = event.GetDamageePlayer(); + + if (player == null) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), RATE, false, false)) + { + return; + } + + _active.put(player.getWorld().dropItemNaturally(player.getLocation().add(0, 0.5, 0), ItemStackFactory.Instance.CreateStack(Material.BONE, (byte) 0, 1, "Explosive Bone " + System + .currentTimeMillis())), player.getUniqueId()); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + // Using copy to prevent concurrency issues for when an explosion + // damages + // another player with this perk active adding a new item to the list + // while + // we are still in the loop + List itemListCopy = new ArrayList<>(_active.keySet()); + + for (Item item : itemListCopy) + { + // Not Ready + if (item.isValid() && item.getTicksLived() < TICKS) + { + continue; + } + + // Effect + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, item.getLocation(), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); + item.getWorld().playSound(item.getLocation(), Sound.EXPLODE, 0.8f, 1.4f); + + UUID key = _active.get(item); + Player player = UtilPlayer.searchExact(key); + + if (player == null) + { + continue; + } + + // Damage + Map targets = UtilEnt.getInRadius(item.getLocation(), DAMAGE_RADIUS); + + for (LivingEntity cur : targets.keySet()) + { + if (cur.equals(player)) + { + continue; + } + + Manager.GetDamage().NewDamageEvent(cur, player, null, DamageCause.CUSTOM, DAMAGE * targets.get(key) + 1, true, true, false, player.getName(), GetName()); + } + + // Remove + item.remove(); + _active.remove(item); + } + } + + @EventHandler + public void knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkHorseKick.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkHorseKick.java new file mode 100644 index 000000000..52c60f119 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkHorseKick.java @@ -0,0 +1,197 @@ +package nautilus.game.arcade.game.games.smash.perks.skeletalhorse; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Location; +import org.bukkit.Sound; +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 mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseHorse; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkHorseKick extends SmashPerk +{ + + private static final long COOLDOWN = 6000; + private static final float DAMAGE = 6.5F; + private static final long KICK_TIME = 1000; + private static final int KNOCKBACK_MAGNITUDE = 4; + + private Map _active = new HashMap<>(); + + public PerkHorseKick() + { + super("Bone Kick", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Bone Kick" }); + } + + @EventHandler + public void Activate(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isAxe(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (isSuperActive(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } + + // Horse Animation + DisguiseBase horse = Manager.GetDisguise().getActiveDisguise(player); + + if (horse != null && horse instanceof DisguiseHorse) + { + ((DisguiseHorse) horse).kick(); + Manager.GetDisguise().updateDisguise(horse); + } + + // Animation + _active.put(player.getUniqueId(), System.currentTimeMillis()); + + // AoE Area + Location loc = player.getLocation(); + loc.add(player.getLocation().getDirection().setY(0).normalize().multiply(1.5)); + loc.add(0, 0.8, 0); + + for (LivingEntity other : UtilEnt.getInRadius(loc, 2.5).keySet()) + { + if (UtilPlayer.isSpectator(other)) + { + continue; + } + + if (other.equals(player)) + { + continue; + } + + // Damage Event + Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE, true, true, false, player.getName(), GetName()); + + // Sound + player.getWorld().playSound(player.getLocation(), Sound.SKELETON_HURT, 4f, 0.6f); + player.getWorld().playSound(player.getLocation(), Sound.SKELETON_HURT, 4f, 0.6f); + + // Inform + UtilPlayer.message(other, F.main("Skill", F.name(player.getName()) + " hit you with " + F.skill(GetName()) + ".")); + } + + // Inform + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + + // Slow + Manager.GetCondition().Factory().Slow(GetName(), player, player, 0.8, 3, false, false, true, false); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + // Player + Iterator playerIterator = _active.keySet().iterator(); + + while (playerIterator.hasNext()) + { + UUID key = playerIterator.next(); + Player player = UtilPlayer.searchExact(key); + + if (player == null) + { + playerIterator.remove(); + continue; + } + + if (!player.isValid() || player.getHealth() <= 0 || UtilTime.elapsed(_active.get(player), KICK_TIME)) + { + playerIterator.remove(); + + // Horse Animation + DisguiseBase horse = Manager.GetDisguise().getActiveDisguise(player); + + if (horse != null && horse instanceof DisguiseHorse) + { + ((DisguiseHorse) horse).stopKick(); + Manager.GetDisguise().updateDisguise(horse); + } + + Manager.GetCondition().EndCondition(player, null, GetName()); + } + else + { + Location loc = player.getLocation(); + loc.add(player.getLocation().getDirection().setY(0).normalize().multiply(1.5)); + loc.add(0, 0.8, 0); + + UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, loc, 0.3f, 0.3f, 0.3f, 0, 2, ViewDist.LONG, UtilServer.getPlayers()); + } + } + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/SmashSkeletalHorse.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/SmashSkeletalHorse.java new file mode 100644 index 000000000..4769f77ac --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/SmashSkeletalHorse.java @@ -0,0 +1,55 @@ +package nautilus.game.arcade.game.games.smash.perks.skeletalhorse; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; + +import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; +import nautilus.game.arcade.kit.Perk; + +public class SmashSkeletalHorse extends SmashUltimate +{ + + private static final int DURATION = 20000; + + public SmashSkeletalHorse(String name, String[] perkDesc) + { + super("Bone Storm", new String[] {}, Sound.HORSE_SKELETON_DEATH, DURATION); + } + + @Override + public void activate(Player player) + { + super.activate(player); + + player.getInventory().remove(Material.IRON_SPADE); + player.getInventory().remove(Material.IRON_AXE); + + for (Perk perk : Kit.GetPerks()) + { + if (perk instanceof PerkBoneRush) + { + PerkBoneRush boneRush = (PerkBoneRush) perk; + + boneRush.activate(player); + } + } + } + + @Override + public void cancel(Player player) + { + super.cancel(player); + + for (Perk perk : Kit.GetPerks()) + { + if (perk instanceof PerkBoneRush) + { + PerkBoneRush boneRush = (PerkBoneRush) perk; + + boneRush.deactivate(player); + } + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBarrage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBarrage.java new file mode 100644 index 000000000..2271d1cb0 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBarrage.java @@ -0,0 +1,322 @@ +package nautilus.game.arcade.game.games.smash.perks.skeleton; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkBarrage extends SmashPerk +{ + private Map _charge = new HashMap<>(); + private Map _chargeLast = new HashMap<>(); + + private Set _firing = new HashSet<>(); + private Set _arrows = new HashSet(); + + private int _max; + private long _tick; + private boolean _remove; + private boolean _noDelay; + private boolean _useExp; + + public PerkBarrage(int max, long tick, boolean remove, boolean noDelay) + { + this(max, tick, remove, noDelay, false); + } + + public PerkBarrage(int max, long tick, boolean remove, boolean noDelay, boolean useExpAndBar) + { + super("Barrage", new String[] { C.cYellow + "Charge" + C.cGray + " your Bow to use " + C.cGreen + "Barrage" }); + _useExp = useExpAndBar; + _max = max; + _tick = tick; + _remove = remove; + _noDelay = noDelay; + } + + @EventHandler + public void BarrageDrawBow(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (player.getItemInHand() == null || player.getItemInHand().getType() == Material.BOW) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (isSuperActive(player)) + { + return; + } + + if (!player.getInventory().contains(Material.ARROW)) + return; + + if (event.getClickedBlock() != null) + if (UtilBlock.usable(event.getClickedBlock())) + return; + + // Start Charge + _charge.put(player, 0); + _chargeLast.put(player, System.currentTimeMillis()); + _firing.remove(player); + } + + @EventHandler + public void BarrageCharge(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : UtilServer.getPlayers()) + { + // Not Charging + if (!_charge.containsKey(cur)) + continue; + + if (_firing.contains(cur)) + continue; + + // Max Charge + if (_charge.get(cur) >= _max) + continue; + + // Charge Interval + if (_charge.get(cur) == 0) + { + if (!UtilTime.elapsed(_chargeLast.get(cur), 1000)) + continue; + } + else + { + if (!UtilTime.elapsed(_chargeLast.get(cur), _tick)) + continue; + } + + // No Longer Holding Bow + if (cur.getItemInHand() == null || cur.getItemInHand().getType() != Material.BOW) + { + if (_useExp) + { + cur.setExp(0f); + } + _charge.remove(cur); + _chargeLast.remove(cur); + continue; + } + + // Increase Charge + _charge.put(cur, _charge.get(cur) + 1); + + if (_useExp) + { + cur.setExp(Math.min(0.9999f, (float) _charge.get(cur) / (float) _max)); + } + _chargeLast.put(cur, System.currentTimeMillis()); + + // Effect + cur.playSound(cur.getLocation(), Sound.CLICK, 1f, 1f + (0.1f * _charge.get(cur))); + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void BarrageFireBow(EntityShootBowEvent event) + { + if (event.isCancelled()) + return; + + if (!Manager.GetGame().IsLive()) + return; + + if (!(event.getEntity() instanceof Player)) + return; + + if (!(event.getProjectile() instanceof Arrow)) + return; + + Player player = (Player) event.getEntity(); + + if (!_charge.containsKey(player)) + return; + + // Start Barrage + _firing.add(player); + _chargeLast.put(player, System.currentTimeMillis()); + } + + @EventHandler + public void BarrageArrows(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + HashSet remove = new HashSet(); + + for (Player cur : _firing) + { + if (!_charge.containsKey(cur) || !_chargeLast.containsKey(cur)) + { + remove.add(cur); + continue; + } + + if (cur.getItemInHand() == null || cur.getItemInHand().getType() != Material.BOW) + { + remove.add(cur); + continue; + } + + int arrows = _charge.get(cur); + if (arrows <= 0) + { + remove.add(cur); + continue; + } + + _charge.put(cur, arrows - 1); + if (_useExp) + { + cur.setExp(Math.min(0.9999f, (float) _charge.get(cur) / (float) _max)); + } + + // Fire Arrow + Vector random = new Vector((Math.random() - 0.5) / 10, (Math.random() - 0.5) / 10, (Math.random() - 0.5) / 10); + Projectile arrow = cur.launchProjectile(Arrow.class); + arrow.setVelocity(cur.getLocation().getDirection().add(random).multiply(3)); + _arrows.add(arrow); + cur.getWorld().playSound(cur.getLocation(), Sound.SHOOT_ARROW, 1f, 1f); + } + + for (Player cur : remove) + { + if (_useExp) + { + cur.setExp(0f); + } + _charge.remove(cur); + _chargeLast.remove(cur); + _firing.remove(cur); + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void BarrageDamageTime(CustomDamageEvent event) + { + if (!_noDelay) + return; + + if (event.GetProjectile() == null) + return; + + if (event.GetDamagerPlayer(true) == null) + return; + + if (!(event.GetProjectile() instanceof Arrow)) + return; + + Player damager = event.GetDamagerPlayer(true); + + if (!Kit.HasKit(damager)) + return; + + event.SetCancelled("Barrage Cancel"); + + event.GetProjectile().remove(); + + // Damage Event + Manager.GetDamage().NewDamageEvent(event.GetDamageeEntity(), damager, null, DamageCause.THORNS, event.GetDamage(), true, true, false, damager.getName(), GetName()); + } + + @EventHandler + public void BarrageProjectileHit(ProjectileHitEvent event) + { + if (_remove) + if (_arrows.remove(event.getEntity())) + event.getEntity().remove(); + } + + @EventHandler + public void BarrageClean(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + for (Iterator arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) + { + Projectile arrow = arrowIterator.next(); + + if (arrow.isDead() || !arrow.isValid()) + arrowIterator.remove(); + } + } + + @EventHandler + public void Quit(PlayerQuitEvent event) + { + Player player = event.getPlayer(); + + clean(player); + } + + @Override + public void addSuperCustom(Player player) + { + clean(player); + } + + public void clean(Player player) + { + _charge.remove(player); + _chargeLast.remove(player); + _firing.remove(player); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBoneExplosion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBoneExplosion.java new file mode 100644 index 000000000..1f195daaf --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBoneExplosion.java @@ -0,0 +1,109 @@ +package nautilus.game.arcade.game.games.smash.perks.skeleton; + +import java.util.Map; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.recharge.Recharge; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkBoneExplosion extends SmashPerk +{ + + private static final long COOLDOWN = 10000; + private static final int DAMAGE_RADIUS = 7; + private static final int DAMAGE = 6; + private static final float KNOCKBACK_MAGNITUDE = 2.5F; + + public PerkBoneExplosion() + { + super("Bone Explosion", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Bone Explosion" }); + } + + @EventHandler + public void Skill(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isAxe(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (isSuperActive(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } + + Map nearby = UtilPlayer.getInRadius(player.getLocation(), DAMAGE_RADIUS); + + for (Player other : nearby.keySet()) + { + if (player.equals(other)) + { + continue; + } + + // Inform + UtilPlayer.message(other, F.main("Game", F.elem(Manager.GetColor(player) + player.getName()) + " used " + F.skill(GetName()) + ".")); + + // Damage Event + Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE * nearby.get(other), true, true, false, player.getName(), GetName()); + } + + // Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); + + // Effect + Manager.GetBlood().Effects(null, player.getLocation().add(0, 0.5, 0), 48, 0.8, Sound.SKELETON_HURT, 2f, 1.2f, Material.BONE, (byte) 0, 40, false); + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Perk.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Perk.java index 51c9f2959..111503930 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Perk.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Perk.java @@ -30,6 +30,11 @@ public abstract class Perk implements Listener public boolean hasPerk(Player player) { + if (Manager.GetGame() == null) + { + return false; + } + if (!Manager.GetGame().IsLive()) { return false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/SmashPerk.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/SmashPerk.java deleted file mode 100644 index 2c7dfa0ee..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/SmashPerk.java +++ /dev/null @@ -1,48 +0,0 @@ -package nautilus.game.arcade.kit; - -import java.util.HashSet; - -import org.bukkit.entity.Player; - -public abstract class SmashPerk extends Perk -{ - private HashSet _superActive = new HashSet(); - - public SmashPerk(String name, String[] perkDesc) - { - super(name, perkDesc); - } - - public SmashPerk(String name, String[] perkDesc, boolean display) - { - super(name, perkDesc, display); - } - - public void addSuperActive(Player player) - { - _superActive.add(player); - - addSuperCustom(player); - } - - public void addSuperCustom(Player player) - { - - } - - public void removeSuperActive(Player player) - { - if (_superActive.remove(player)) - removeSuperCustom(player); - } - - public void removeSuperCustom(Player player) - { - - } - - public boolean isSuperActive(Player player) - { - return _superActive.contains(player); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBarrage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBarrage.java index 2542e5b3b..de6563837 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBarrage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBarrage.java @@ -26,7 +26,7 @@ import mineplex.core.common.util.UtilTime; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkBarrage extends SmashPerk { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatForm.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatForm.java index cdbe1d699..02c26ba8a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatForm.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatForm.java @@ -32,8 +32,8 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.SmashKit; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; import nautilus.game.arcade.kit.perks.data.SonicBoomData; public class PerkBatForm extends SmashPerk diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatWave.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatWave.java index b0366e539..a31827c08 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatWave.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatWave.java @@ -32,7 +32,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkBatWave extends SmashPerk { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java index dfbc490a4..570498779 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java @@ -1,39 +1,38 @@ package nautilus.game.arcade.kit.perks; import org.bukkit.Color; -import org.bukkit.Effect; -import org.bukkit.Location; -import org.bukkit.Sound; import org.bukkit.FireworkEffect.Type; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; +import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.util.Vector; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilFirework; -import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.particles.effects.LineParticle; import mineplex.core.recharge.Recharge; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkBlink extends SmashPerk { - private String _name = ""; + + private static final float INCREMENTAITON = 0.2F; + + private String _name; private double _range; private long _recharge; - public PerkBlink(String name, double range, long recharge) + public PerkBlink(String name, double range, long recharge) { - super("name", new String[] - { - C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + name - }); + super(name, new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + name }); _name = name; _range = range; @@ -44,79 +43,60 @@ public class PerkBlink extends SmashPerk public void Blink(PlayerInteractEvent event) { if (event.isCancelled()) + { return; + } - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) - return; + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } if (UtilBlock.usable(event.getClickedBlock())) + { return; - - if (!UtilGear.isAxe(event.getPlayer().getItemInHand())) - return; + } Player player = event.getPlayer(); - - if (!Kit.HasKit(player)) + + if (!UtilItem.isAxe(player.getItemInHand())) + { return; - + } + + if (!hasPerk(player)) + { + return; + } + if (isSuperActive(player)) + { return; + } if (!Recharge.Instance.use(player, _name, _recharge, true, true)) + { return; - - //Smoke Trail - Block lastSmoke = player.getLocation().getBlock(); - - double curRange = 0; - while (curRange <= _range) - { - Location newTarget = player.getLocation().add(new Vector(0,0.2,0)).add(player.getLocation().getDirection().multiply(curRange)); - - if (!UtilBlock.airFoliage(newTarget.getBlock()) || - !UtilBlock.airFoliage(newTarget.getBlock().getRelative(BlockFace.UP))) - break; - - //Progress Forwards - curRange += 0.2; - - //Smoke Trail - if (!lastSmoke.equals(newTarget.getBlock())) - { - lastSmoke.getWorld().playEffect(lastSmoke.getLocation(), Effect.SMOKE, 4); - } - - lastSmoke = newTarget.getBlock(); } - //Modify Range - curRange -= 0.4; - if (curRange < 0) - curRange = 0; + LineParticle lineParticle = new LineParticle(player.getEyeLocation(), player.getLocation().getDirection(), INCREMENTAITON, _range, null, ParticleType.SMOKE, UtilServer.getPlayers()); - //Destination - Location loc = player.getLocation().add(player.getLocation().getDirection().multiply(curRange).add(new Vector(0, 0.4, 0))); - - if (curRange > 0) + while (lineParticle.update()) { - //Firework - UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.BLACK, false, false); - - player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 1f); - player.teleport(loc); - player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 1f); - - //Firework - UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.BLACK, false, false); } - + // Firework + UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.BLACK, false, false); + + player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 1f); + player.teleport(lineParticle.getDestination()); player.setFallDistance(0); + player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 1f); - //Inform + // Firework + UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.BLACK, false, false); + + // Inform UtilPlayer.message(player, F.main("Game", "You used " + F.skill(_name) + ".")); } } - - diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockToss.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockToss.java index 067d88734..bc0943f7a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockToss.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockToss.java @@ -2,27 +2,9 @@ package nautilus.game.arcade.kit.perks; import java.util.HashMap; import java.util.HashSet; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilGear; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.projectile.IThrown; -import mineplex.core.projectile.ProjectileUser; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.SmashPerk; -import nautilus.game.arcade.kit.perks.data.BlockTossData; -import nautilus.game.arcade.kit.perks.event.PerkBlockGrabEvent; -import nautilus.game.arcade.kit.perks.event.PerkBlockThrowEvent; +import java.util.Map; +import java.util.Set; +import java.util.UUID; import org.bukkit.Effect; import org.bukkit.block.Block; @@ -35,49 +17,91 @@ import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; +import nautilus.game.arcade.kit.perks.data.BlockTossData; +import nautilus.game.arcade.kit.perks.event.PerkBlockGrabEvent; +import nautilus.game.arcade.kit.perks.event.PerkBlockThrowEvent; + public class PerkBlockToss extends SmashPerk implements IThrown { - private HashMap _hold = new HashMap(); - private HashMap _charge = new HashMap(); - private HashSet _charged = new HashSet(); - private HashMap _falling = new HashMap(); - public PerkBlockToss() + private static final long COOLDOWN = 2000; + private static final long CHARGE_TIME = 1200; + private static final int DAMAGE = 8; + private static final float KNOCKBACK_MAGNITUDE = 2.5F; + + private Map _hold = new HashMap<>(); + private Map _charge = new HashMap<>(); + private Set _charged = new HashSet<>(); + private Map _falling = new HashMap<>(); + + public PerkBlockToss() { - super("Block Toss", new String[] - { - C.cYellow + "Hold Block" + C.cGray + " to " + C.cGreen + "Grab Block", - C.cYellow + "Release Block" + C.cGray + " to " + C.cGreen + "Throw Block" - }); + super("Block Toss", new String[] { C.cYellow + "Hold Block" + C.cGray + " to " + C.cGreen + "Grab Block", C.cYellow + "Release Block" + C.cGray + " to " + C.cGreen + "Throw Block" }); } @EventHandler public void Grab(PlayerInteractEvent event) - { - Player player = event.getPlayer(); + { + if (event.isCancelled()) + { + return; + } if (!UtilEvent.isAction(event, ActionType.R_BLOCK)) + { return; - + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isSword(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + if (isSuperActive(player)) + { return; + } - if (!Kit.HasKit(player)) - return; - - if (!UtilGear.isSword(player.getItemInHand())) - return; - - if (_hold.containsKey(player)) + if (_hold.containsKey(player.getUniqueId())) + { return; + } Block grab = event.getClickedBlock(); - if (UtilBlock.usable(grab)) - return; - if (!Recharge.Instance.usable(player, GetName())) + { return; + } if (!UtilBlock.airFoliage(grab.getRelative(BlockFace.UP)) || Manager.GetBlockRestore().contains(grab.getRelative(BlockFace.UP))) { @@ -85,23 +109,22 @@ public class PerkBlockToss extends SmashPerk implements IThrown return; } - //Event + // Event PerkBlockGrabEvent blockEvent = new PerkBlockGrabEvent(player, grab.getTypeId(), grab.getData()); UtilServer.getServer().getPluginManager().callEvent(blockEvent); - //Block to Data + // Block to Data int id = grab.getTypeId(); byte data = grab.getData(); - - //Remove Block - //Manager.GetBlockRestore().Add(event.getClickedBlock(), 0, (byte)0, 10000); - event.getClickedBlock().getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, event.getClickedBlock().getType()); - - _hold.put(player, new BlockTossData(id, data)); - - _charge.put(player, System.currentTimeMillis()); - //Effect + // Remove Block + event.getClickedBlock().getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, event.getClickedBlock().getType()); + + _hold.put(player.getUniqueId(), new BlockTossData(id, data)); + + _charge.put(player.getUniqueId(), System.currentTimeMillis()); + + // Effect player.getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, id); } @@ -111,102 +134,119 @@ public class PerkBlockToss extends SmashPerk implements IThrown if (event.getType() != UpdateType.TICK) return; - HashSet throwSet = new HashSet(); + Set throwSet = new HashSet(); - for (Player cur : _hold.keySet()) + for (UUID key : _hold.keySet()) { - //Throw - if (!cur.isBlocking()) - throwSet.add(cur); + Player player = UtilPlayer.searchExact(key); - //Charged Tick - if (!_charged.contains(cur)) - if (System.currentTimeMillis() - _charge.get(cur) > 1200) + if (player == null) + { + continue; + } + + // Throw + if (!player.isBlocking()) + { + throwSet.add(player); + } + + // Charged Tick + if (!_charged.contains(player.getUniqueId())) + { + if (System.currentTimeMillis() - _charge.get(player) > 1200) { - _charged.add(cur); - cur.playEffect(cur.getLocation(), Effect.CLICK1, 0); + _charged.add(key); + player.getWorld().playEffect(player.getLocation(), Effect.CLICK1, 0); } + } } for (Player cur : throwSet) { + UUID key = cur.getUniqueId(); + Recharge.Instance.recharge(cur, GetName()); - Recharge.Instance.use(cur, GetName(), 2000, false, true); - - BlockTossData data = _hold.remove(cur); - - FallingBlock block = cur.getWorld().spawnFallingBlock(cur.getEyeLocation().add(cur.getLocation().getDirection()), data.Type, data.Data); - - _falling.put(block, cur); - - _charged.remove(cur); - - long charge = System.currentTimeMillis() - _charge.remove(cur); + Recharge.Instance.use(cur, GetName(), COOLDOWN, false, true); - //Throw + BlockTossData data = _hold.remove(key); + + FallingBlock block = cur.getWorld().spawnFallingBlock(cur.getEyeLocation().add(cur.getLocation().getDirection()), data.Type, data.Data); + + _falling.put(block, key); + + _charged.remove(key); + + long charge = System.currentTimeMillis() - _charge.remove(key); + + // Throw double mult = 1.4; - if (charge < 1200) - mult = mult * ((double)charge/1200d); - - //Action - UtilAction.velocity(block, cur.getLocation().getDirection(), mult, false, 0.2, 0, 1, true); - Manager.GetProjectile().AddThrow(block, cur, this, -1, true, true, true, true, - null, 0, 0, null, 0, UpdateType.FASTEST, 1f); + if (charge < CHARGE_TIME) + { + mult = mult * (charge / 1200); + } - //Event + // Action + UtilAction.velocity(block, cur.getLocation().getDirection(), mult, false, 0.2, 0, 1, true); + Manager.GetProjectile().AddThrow(block, cur, this, -1, true, true, true, true, null, 0, 0, null, 0, UpdateType.FASTEST, 1f); + + // Event PerkBlockThrowEvent blockEvent = new PerkBlockThrowEvent(cur); UtilServer.getServer().getPluginManager().callEvent(blockEvent); } } @Override - public void Collide(LivingEntity target, Block block, ProjectileUser data) + public void Collide(LivingEntity target, Block block, ProjectileUser data) { if (target == null) + { return; + } - //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, - DamageCause.PROJECTILE, data.getThrown().getVelocity().length() * 8, true, true, false, - UtilEnt.getName(data.getThrower()), GetName()); + // Damage Event + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, data.getThrown().getVelocity().length() * DAMAGE, true, true, false, UtilEnt.getName(data + .getThrower()), GetName()); - //Block to Item + // Block to Item if (data.getThrown() instanceof FallingBlock) { FallingBlock thrown = (FallingBlock) data.getThrown(); - FallingBlock newThrown = data.getThrown().getWorld().spawnFallingBlock(data.getThrown().getLocation(), thrown.getMaterial(), (byte)0); + FallingBlock newThrown = data.getThrown().getWorld().spawnFallingBlock(data.getThrown().getLocation(), thrown.getMaterial(), (byte) 0); - //Remove Old + // Remove Old _falling.remove(thrown); thrown.remove(); - //Add New + // Add New if (data.getThrower() instanceof Player) - _falling.put(newThrown, (Player)data.getThrower()); + { + _falling.put(newThrown, data.getThrower().getUniqueId()); + } } - } - - @Override - public void Idle(ProjectileUser data) - { } @Override - public void Expire(ProjectileUser data) + public void Idle(ProjectileUser data) { + } - } - + @Override + public void Expire(ProjectileUser data) + { + } @EventHandler public void BlockForm(EntityChangeBlockEvent event) { if (!(event.getEntity() instanceof FallingBlock)) + { return; - - FallingBlock falling = (FallingBlock)event.getEntity(); + } + + FallingBlock falling = (FallingBlock) event.getEntity(); falling.getWorld().playEffect(event.getBlock().getLocation(), Effect.STEP_SOUND, falling.getBlockId()); @@ -220,8 +260,10 @@ public class PerkBlockToss extends SmashPerk implements IThrown public void Knockback(CustomDamageEvent event) { if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { return; + } - event.AddKnockback(GetName(), 2.5); + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneExplosion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneExplosion.java index 5a388d7ae..18a3a1fea 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneExplosion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneExplosion.java @@ -16,7 +16,7 @@ import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilPlayer; import mineplex.core.recharge.Recharge; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkBoneExplosion extends SmashPerk { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneRush.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneRush.java index bdef9e25b..934228464 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneRush.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneRush.java @@ -31,7 +31,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.smash.TeamSuperSmash; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkBoneRush extends SmashPerk implements IThrown { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChickenRocket.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChickenRocket.java index 5b34be0b8..39314b2ce 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChickenRocket.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChickenRocket.java @@ -4,7 +4,6 @@ import java.util.HashSet; import java.util.Iterator; import org.bukkit.Color; -import org.bukkit.FireworkEffect; import org.bukkit.FireworkEffect.Type; import org.bukkit.Sound; import org.bukkit.entity.Arrow; @@ -26,16 +25,15 @@ import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; import nautilus.game.arcade.kit.perks.data.ChickenMissileData; public class PerkChickenRocket extends SmashPerk diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperElectricity.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperElectricity.java index 0b6ae7d62..c47ec7d60 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperElectricity.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperElectricity.java @@ -2,6 +2,8 @@ package nautilus.game.arcade.kit.perks; import java.util.HashMap; import java.util.Iterator; +import java.util.Map; +import java.util.UUID; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -22,57 +24,75 @@ import nautilus.game.arcade.kit.Perk; public class PerkCreeperElectricity extends Perk { - private HashMap _active = new HashMap(); - public PerkCreeperElectricity() - { - super("Lightning Shield", new String[] - { - "When hit by a non-melee attack, you gain " + C.cGreen + "Lightning Shield" - }); - } + private static final long DURATION = 2000; + private static final int SHOCK = 1; + private static final int DAMAGE = 4; + private static final float KNOCKBACK_MAGNITUDE = 2.5F; + + private Map _active = new HashMap<>(); + public PerkCreeperElectricity() + { + super("Lightning Shield", new String[] { "When hit by a non-melee attack, you gain " + C.cGreen + "Lightning Shield" }); + } @EventHandler public void Shield(CustomDamageEvent event) { if (event.IsCancelled()) + { return; - + } + if (event.GetCause() == DamageCause.ENTITY_ATTACK || event.GetCause() == DamageCause.FIRE_TICK || event.GetCause() == DamageCause.STARVATION) + { return; - + } + Player damagee = event.GetDamageePlayer(); - if (damagee == null) return; - - if (!Kit.HasKit(damagee)) + + if (damagee == null) + { return; + } - _active.put(damagee, System.currentTimeMillis()); + if (!hasPerk(damagee)) + { + return; + } + _active.put(damagee.getUniqueId(), System.currentTimeMillis()); + SetPowered(damagee, true); - + Manager.GetCondition().Factory().Speed(GetName(), damagee, damagee, 4, 1, false, false, false); - - //Sound + + // Sound damagee.getWorld().playSound(damagee.getLocation(), Sound.CREEPER_HISS, 3f, 1.25f); - - //Inform + + // Inform UtilPlayer.message(damagee, F.main("Skill", "You gained " + F.skill(GetName()) + ".")); } - @EventHandler - public void Update(UpdateEvent event) + public void Update(UpdateEvent event) { if (event.getType() != UpdateType.TICK) + { return; - - Iterator shieldIterator = _active.keySet().iterator(); + } + + Iterator shieldIterator = _active.keySet().iterator(); while (shieldIterator.hasNext()) { - Player player = shieldIterator.next(); + Player player = UtilPlayer.searchExact(shieldIterator.next()); + + if (player == null) + { + shieldIterator.remove(); + } if (!IsPowered(player)) { @@ -80,14 +100,14 @@ public class PerkCreeperElectricity extends Perk SetPowered(player, false); continue; } - - if (UtilTime.elapsed(_active.get(player), 2000)) + + if (UtilTime.elapsed(_active.get(player), DURATION)) { shieldIterator.remove(); SetPowered(player, false); - - //Sound + + // Sound player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, 3f, 0.75f); } } @@ -98,63 +118,76 @@ public class PerkCreeperElectricity extends Perk { if (event.IsCancelled()) return; - + if (event.GetCause() != DamageCause.ENTITY_ATTACK) return; - + Player damagee = event.GetDamageePlayer(); - if (damagee == null) return; - - if (!Kit.HasKit(damagee)) + if (damagee == null) return; + + if (!hasPerk(damagee)) + { + return; + } if (!IsPowered(damagee)) + { return; + } event.SetCancelled("Lightning Shield"); - - //Inform + + // Inform UtilPlayer.message(damagee, F.main("Skill", "You hit " + F.elem(UtilEnt.getName(event.GetDamagerPlayer(false))) + " with " + F.skill(GetName()) + ".")); - - //Elec + + // Elec damagee.getWorld().strikeLightningEffect(damagee.getLocation()); - Manager.GetCondition().Factory().Shock(GetName(), event.GetDamagerEntity(false), event.GetDamageeEntity(), 1, false, false); - + Manager.GetCondition().Factory().Shock(GetName(), event.GetDamagerEntity(false), event.GetDamageeEntity(), SHOCK, false, false); + SetPowered(damagee, false); - - //Damage Event - Manager.GetDamage().NewDamageEvent(event.GetDamagerEntity(false), damagee, null, - DamageCause.LIGHTNING, 4, true, true, false, - damagee.getName(), GetName()); + + // Damage Event + Manager.GetDamage().NewDamageEvent(event.GetDamagerEntity(false), damagee, null, DamageCause.LIGHTNING, DAMAGE, true, true, false, damagee.getName(), GetName()); } - + public DisguiseCreeper GetDisguise(Player player) { - DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); + DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); + if (disguise == null) + { return null; + } if (!(disguise instanceof DisguiseCreeper)) + { return null; + } - return (DisguiseCreeper)disguise; + return (DisguiseCreeper) disguise; } - + public void SetPowered(Player player, boolean powered) { DisguiseCreeper creeper = GetDisguise(player); - if (creeper == null) return; - + if (creeper == null) + return; + creeper.SetPowered(powered); - + Manager.GetDisguise().updateDisguise(creeper); } - + public boolean IsPowered(Player player) { DisguiseCreeper creeper = GetDisguise(player); - if (creeper == null) return false; - + + if (creeper == null) + { + return false; + } + return creeper.IsPowered(); } @@ -162,8 +195,10 @@ public class PerkCreeperElectricity extends Perk public void Knockback(CustomDamageEvent event) { if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { return; - - event.AddKnockback(GetName(), 2.5); + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperExplode.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperExplode.java index fee25dd52..500c9aee3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperExplode.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperExplode.java @@ -9,12 +9,16 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseCreeper; import mineplex.core.recharge.Recharge; @@ -22,7 +26,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.GameTeam; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -41,42 +45,60 @@ import org.bukkit.util.Vector; public class PerkCreeperExplode extends SmashPerk { + + private static final long COOLDOWN = 8000; + private static final int RADIUS_NORMAL = 8; + private static final int RADIUS_SMASH = 24; + private static final int DAMAGE_NORMAL = 20; + private static final int DAMAGE_SMASH = 30; + private HashMap _active = new HashMap(); private HashSet _super = new HashSet(); - - public PerkCreeperExplode() + + public PerkCreeperExplode() { - super("Explode", new String[] - { - C.cYellow + "Right-Click" + C.cGray + " with Shovel use " + C.cGreen + "Explosive Leap" - }); + super("Explode", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Shovel use " + C.cGreen + "Explosive Leap" }); } @EventHandler public void Activate(PlayerInteractEvent event) { if (event.isCancelled()) + { return; + } - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + if (!UtilEvent.isAction(event, ActionType.R)) + { return; + } if (UtilBlock.usable(event.getClickedBlock())) + { return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_SPADE")) - return; + } Player player = event.getPlayer(); - + + if (!UtilItem.isSpade(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + if (isSuperActive(player)) + { return; + } - if (!Kit.HasKit(player)) - return; - - if (!Recharge.Instance.use(player, GetName(), 8000, true, true)) + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { return; + } _active.put(player, System.currentTimeMillis()); @@ -93,12 +115,14 @@ public class PerkCreeperExplode extends SmashPerk IncreaseSize(player); } - + @EventHandler - public void Update(UpdateEvent event) + public void Update(UpdateEvent event) { if (event.getType() != UpdateType.TICK) + { return; + } Iterator chargeIterator = _active.keySet().iterator(); @@ -106,69 +130,72 @@ public class PerkCreeperExplode extends SmashPerk { Player player = chargeIterator.next(); - double elapsed = (System.currentTimeMillis() - _active.get(player))/1000d; + double elapsed = (System.currentTimeMillis() - _active.get(player)) / 1000d; - //Idle in Air + // Idle in Air UtilAction.zeroVelocity(player); - - //Sound - player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, (float)(0.5 + elapsed), (float)(0.5 + elapsed)); + + // Sound + player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, (float) (0.5 + elapsed), (float) (0.5 + elapsed)); IncreaseSize(player); - - player.setExp(Math.min(0.99f, (float)(elapsed/1.5))); - //Not Detonated + player.setExp(Math.min(0.99f, (float) (elapsed / 1.5))); + + // Not Detonated if (elapsed < 1.5) + { continue; + } chargeIterator.remove(); - //Unpower + // Unpower DecreaseSize(player); boolean isSuper = _super.remove(player); - - //Explode + + // Explode if (!isSuper) { - //Effect - UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, player.getLocation(), 0, 0, 0, 0, 1, - ViewDist.MAX, UtilServer.getPlayers()); + // Effect + UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, player.getLocation(), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 2f, 1f); } else { - //Particles - UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, player.getLocation(), 5f, 5f, 5f, 0, 20, - ViewDist.MAX, UtilServer.getPlayers()); - - //Sound - for (int i=0 ; i<4 ; i++) - player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, (float)(2 + Math.random()*4), (float)(Math.random() + 0.2)); - - //Blocks + // Particles + UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, player.getLocation(), 5f, 5f, 5f, 0, 20, ViewDist.MAX, UtilServer.getPlayers()); + + // Sound + for (int i = 0; i < 4; i++) + player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, (float) (2 + Math.random() * 4), (float) (Math.random() + 0.2)); + + // Blocks Collection blocks = UtilBlock.getInRadius(player.getLocation(), 12).keySet(); Iterator iter = blocks.iterator(); - while (iter.hasNext()) { - Block b = iter.next(); + while (iter.hasNext()) + { + Block b = iter.next(); - if(b.getType() == Material.STATIONARY_LAVA || b.getType() == Material.LAVA || b.getType() == Material.BEDROCK) iter.remove();; + if (b.getType() == Material.STATIONARY_LAVA || b.getType() == Material.LAVA || b.getType() == Material.BEDROCK) + iter.remove(); } Manager.GetExplosion().BlockExplosion(blocks, player.getLocation(), false); - - //Remove Spawns + + // Remove Spawns Iterator spawnIterator = Manager.GetGame().GetTeam(player).GetSpawns().iterator(); while (spawnIterator.hasNext()) { Location spawn = spawnIterator.next(); - + if (UtilMath.offset(player.getLocation(), spawn) < 14) spawnIterator.remove(); } - - //If all spawns have been destroyed revert to using the spectator spawn + + // If all spawns have been destroyed revert to using the + // spectator spawn for (GameTeam team : Manager.GetGame().GetTeamList()) { if (team.GetSpawns().isEmpty()) @@ -177,47 +204,38 @@ public class PerkCreeperExplode extends SmashPerk } } } - - //Damage - for (Entity ent : player.getWorld().getEntities()) + + double maxRange = isSuper ? RADIUS_SMASH : RADIUS_NORMAL; + double damage = isSuper ? DAMAGE_SMASH : DAMAGE_NORMAL; + + // Damage + for (LivingEntity ent : UtilEnt.getInRadius(player.getLocation(), maxRange).keySet()) { - if (!(ent instanceof LivingEntity)) - continue; - + if (ent.equals(player)) + { continue; + } double dist = UtilMath.offset(player.getLocation(), ent.getLocation()); - - double maxRange = 8; - if (isSuper) - maxRange = 24; - - double damage = 20; - if (isSuper) - damage = 30; - - if (dist > maxRange) + + if (UtilPlayer.isSpectator(player)) + { continue; + } - if (ent instanceof Player) - if (!Manager.GetGame().IsAlive((Player)ent)) - continue; + LivingEntity livingEnt = (LivingEntity) ent; - LivingEntity livingEnt = (LivingEntity)ent; - - double scale = 0.1 + 0.9 * ((maxRange-dist)/maxRange); - - //Damage Event - Manager.GetDamage().NewDamageEvent(livingEnt, player, null, - DamageCause.CUSTOM, damage * scale, true, true, false, - player.getName(), isSuper ? "Atomic Blast" : GetName()); + double scale = 0.1 + 0.9 * ((maxRange - dist) / maxRange); + + // Damage Event + Manager.GetDamage().NewDamageEvent(livingEnt, player, null, DamageCause.CUSTOM, damage * scale, true, true, false, player.getName(), isSuper ? "Atomic Blast" : GetName()); } - - //Velocity + + // Velocity UtilAction.velocity(player, 1.8, 0.2, 1.4, true); - - //Inform + + // Inform if (!isSuper) UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); } @@ -225,62 +243,79 @@ public class PerkCreeperExplode extends SmashPerk public DisguiseCreeper GetDisguise(Player player) { - DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); + DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); + if (disguise == null) + { return null; + } if (!(disguise instanceof DisguiseCreeper)) + { return null; + } - return (DisguiseCreeper)disguise; + return (DisguiseCreeper) disguise; } - + public int GetSize(Player player) { DisguiseCreeper creeper = GetDisguise(player); - if (creeper == null) return 0; - + + if (creeper == null) + { + return 0; + } + return creeper.bV(); } - + public void DecreaseSize(Player player) { DisguiseCreeper creeper = GetDisguise(player); - if (creeper == null) return; - + + if (creeper == null) + { + return; + } + creeper.a(-1); - + Manager.GetDisguise().updateDisguise(creeper); } - + public void IncreaseSize(Player player) { DisguiseCreeper creeper = GetDisguise(player); - if (creeper == null) return; - + + if (creeper == null) + { + return; + } + creeper.a(1); - + Manager.GetDisguise().updateDisguise(creeper); } - + @EventHandler public void Knockback(CustomDamageEvent event) { if (event.GetReason() == null || !event.GetReason().contains(GetName())) return; - + event.AddKnockback(GetName(), 2.5); } - + @EventHandler public void Death(PlayerDeathEvent event) { if (!Kit.HasKit(event.getEntity())) return; - + _active.remove(event.getEntity()); _super.remove(event.getEntity()); - + DecreaseSize(event.getEntity()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperSulphurBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperSulphurBomb.java index 942b5b34d..cf5f53cd5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperSulphurBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperSulphurBomb.java @@ -6,7 +6,6 @@ import org.bukkit.block.Block; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; @@ -15,110 +14,121 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown { - public PerkCreeperSulphurBomb() - { - super("Sulphur Bomb", new String[] - { - C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Sulphur Bomb" - }); - } + + private static final long COOLDOWN = 3000; + private static final float DAMAGE = 6.5F; + private static final float KNOCKBACK_MAGNITUDE = 2.5F; + public PerkCreeperSulphurBomb() + { + super("Sulphur Bomb", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Sulphur Bomb" }); + } @EventHandler public void ShootWeb(PlayerInteractEvent event) { if (event.isCancelled()) + { return; + } - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + if (!UtilEvent.isAction(event, ActionType.R)) + { return; + } if (UtilBlock.usable(event.getClickedBlock())) + { return; - - if (event.getPlayer().getItemInHand() == null) - return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) - return; + } Player player = event.getPlayer(); - if (isSuperActive(player)) + if (!UtilItem.isSword(player.getItemInHand())) + { return; + } + + if (!hasPerk(player)) + { + return; + } - if (!Kit.HasKit(player)) + if (isSuperActive(player)) + { return; + } - if (!Recharge.Instance.use(player, GetName(), 3000, true, true)) + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { return; - + } + event.setCancelled(true); UtilInv.Update(player); - org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.COAL, (byte)0)); + org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.COAL, (byte) 0)); - UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false); + UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false); - Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true, - null, 1f, 1f, - null, 1, UpdateType.SLOW, - 0.6f); + Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true, null, 1f, 1f, null, 1, UpdateType.SLOW, 0.6f); - //Inform + // Inform UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); - //Effect + // Effect player.getWorld().playSound(player.getLocation(), Sound.CREEPER_DEATH, 2f, 1.5f); } @Override - public void Collide(LivingEntity target, Block block, ProjectileUser data) + public void Collide(LivingEntity target, Block block, ProjectileUser data) { Explode(data); if (target == null) + { return; - - //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, - DamageCause.PROJECTILE, 6.5, true, true, false, - UtilEnt.getName(data.getThrower()), GetName()); + } + + // Damage Event + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, DAMAGE, true, true, false, UtilEnt.getName(data.getThrower()), GetName()); } @Override - public void Idle(ProjectileUser data) + public void Idle(ProjectileUser data) { Explode(data); } @Override - public void Expire(ProjectileUser data) + public void Expire(ProjectileUser data) { Explode(data); } public void Explode(ProjectileUser data) { - UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.getThrown().getLocation(), 0, 0, 0, 0, 1, - ViewDist.MAX, UtilServer.getPlayers()); + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.getThrown().getLocation(), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.EXPLODE, 1f, 1.5f); data.getThrown().remove(); } @@ -127,8 +137,10 @@ public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown public void Knockback(CustomDamageEvent event) { if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { return; - - event.AddKnockback(GetName(), 2); + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeadlyBones.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeadlyBones.java index a7db37726..eab8530ec 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeadlyBones.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeadlyBones.java @@ -2,7 +2,6 @@ package nautilus.game.arcade.kit.perks; import java.util.ArrayList; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import org.bukkit.Material; @@ -24,7 +23,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkDeadlyBones extends SmashPerk { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEarthquake.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEarthquake.java index 36fc5f6ed..9041a63ed 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEarthquake.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEarthquake.java @@ -27,7 +27,7 @@ import mineplex.core.common.util.UtilTime; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; import nautilus.game.arcade.kit.perks.data.EarthquakeData; import nautilus.game.arcade.kit.perks.data.NightLivingDeadData; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEggGun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEggGun.java index 727a2bfc2..110e4c671 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEggGun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEggGun.java @@ -24,8 +24,8 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashPerk; public class PerkEggGun extends SmashPerk { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEndermanDragon.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEndermanDragon.java index 4d430ad0b..1db72be55 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEndermanDragon.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEndermanDragon.java @@ -25,7 +25,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkEndermanDragon extends SmashPerk { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java index eee658ecc..3803730cd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java @@ -2,12 +2,12 @@ package nautilus.game.arcade.kit.perks; import java.util.HashSet; import java.util.Iterator; +import java.util.Set; import org.bukkit.EntityEffect; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.util.Vector; @@ -16,145 +16,162 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.games.smash.TeamSuperSmash; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; import nautilus.game.arcade.kit.perks.data.FireflyData; public class PerkFirefly extends SmashPerk { - private HashSet _data = new HashSet(); + private Set _data = new HashSet(); private int _tick = 0; - - public PerkFirefly() + + public PerkFirefly() { - super("Firefly", new String[] - { - C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Firefly" - }); + super("Firefly", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Firefly" }); } @EventHandler public void Skill(PlayerInteractEvent event) { if (event.isCancelled()) + { return; - - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { return; - + } + if (UtilBlock.usable(event.getClickedBlock())) + { return; - - if (event.getPlayer().getItemInHand() == null) - return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) - return; - + } + Player player = event.getPlayer(); - - if (isSuperActive(event.getPlayer())) + + if (!UtilItem.isAxe(player.getItemInHand().getType())) + { return; - - if (!Kit.HasKit(player)) + } + + if (!hasPerk(player)) + { return; - + } + + if (isSuperActive(player)) + { + return; + } + if (!Recharge.Instance.use(player, GetName(), 12000, true, true)) + { return; - - _data.add(new FireflyData(player)); - - UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + } + + activate(player); } - - @Override - public void addSuperCustom(Player player) + + /* + * It is split like this so Blaze's Smash can be called without the need to + * copy code. + */ + public void activate(Player player) { _data.add(new FireflyData(player)); + + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); } - + @EventHandler public void Update(UpdateEvent event) { if (event.getType() != UpdateType.TICK) + { return; - + } + _tick++; - + Iterator dataIterator = _data.iterator(); - + while (dataIterator.hasNext()) { FireflyData data = dataIterator.next(); - + + Player player = data.Player; boolean superActive = isSuperActive(data.Player); - - //Teleport + + // Teleport if (!UtilTime.elapsed(data.Time, 1500) && !superActive) { - UtilAction.zeroVelocity(data.Player); - data.Player.getWorld().playSound(data.Player.getLocation(), Sound.EXPLODE, 0.2f, 0.6f); - data.Location = data.Player.getLocation(); - - //Sound and Effect - UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, data.Player.getLocation().add(0, 1, 0), 0.6f, 0.6f, 0.6f, 0, 10, ViewDist.LONG, UtilServer.getPlayers()); - - float progress = (float)(System.currentTimeMillis()-data.Time)/1500f; - - data.Player.getWorld().playSound(data.Player.getLocation(), Sound.BLAZE_BREATH, 0.5f, 1f + progress); + UtilAction.zeroVelocity(player); + player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 0.2f, 0.6f); + data.Location = player.getLocation(); + + // Sound and Effect + UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, player.getLocation().add(0, 1, 0), 0.6f, 0.6f, 0.6f, 0, 10, ViewDist.LONG, UtilServer.getPlayers()); + + float progress = (float) (System.currentTimeMillis() - data.Time) / 1500f; + + player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 0.5f, 1f + progress); } - //Velocity + // Velocity else if (!UtilTime.elapsed(data.Time, 2750) || superActive) { - UtilAction.velocity(data.Player, data.Player.getLocation().getDirection().multiply(superActive ? 0.9 : 0.7).add(new Vector(0,0.15,0))); - data.Player.getWorld().playSound(data.Player.getLocation(), Sound.EXPLODE, 0.6f, 1.2f); - - //Sound and Effect - if (!isSuperActive(data.Player)) + UtilAction.velocity(player, player.getLocation().getDirection().multiply(superActive ? 0.9 : 0.7).add(new Vector(0, 0.15, 0))); + player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 0.6f, 1.2f); + + // Sound and Effect + if (!isSuperActive(player)) { - UtilParticle.PlayParticle(ParticleType.FLAME, data.Player.getLocation().add(0, 1, 0), 0.6f, 0.6f, 0.6f, 0, 40, ViewDist.LONG, UtilServer.getPlayers()); - - data.Player.getWorld().playSound(data.Player.getLocation(), Sound.EXPLODE, 0.5f, 1.25f); + UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation().add(0, 1, 0), 0.6f, 0.6f, 0.6f, 0, 40, ViewDist.LONG, UtilServer.getPlayers()); + + player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 0.5f, 1.25f); } else { - UtilParticle.PlayParticle(ParticleType.FLAME, data.Player.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 60, ViewDist.LONG, UtilServer.getPlayers()); - UtilParticle.PlayParticle(ParticleType.LAVA, data.Player.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 40, ViewDist.LONG, UtilServer.getPlayers()); - - data.Player.getWorld().playSound(data.Player.getLocation(), Sound.EXPLODE, 0.75f, 0.75f); + UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 60, ViewDist.LONG, UtilServer.getPlayers()); + UtilParticle.PlayParticle(ParticleType.LAVA, player.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 40, ViewDist.LONG, UtilServer.getPlayers()); + + player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 0.75f, 0.75f); } - - for (Player other : UtilPlayer.getNearby(data.Player.getLocation(), isSuperActive(data.Player) ? 7 : 4)) + + for (Player other : UtilPlayer.getNearby(player.getLocation(), superActive ? 7 : 4)) { - if (other.equals(data.Player)) + if (other.equals(player)) + { continue; - + } + if (!Manager.GetGame().IsAlive(other)) + { continue; - + } + other.playEffect(EntityEffect.HURT); - + if (_tick % 12 == 0) { - if (Recharge.Instance.use(other, GetName() + " hit by " + data.Player.getName(), 2000, false, false)) + if (Recharge.Instance.use(other, GetName() + " hit by " + player.getName(), 2000, false, false)) { - //Damage Event - Manager.GetDamage().NewDamageEvent(other, data.Player, null, - DamageCause.CUSTOM, 7, true, true, false, - data.Player.getName(), isSuperActive(data.Player) ? "Phoenix" : GetName()); - - UtilPlayer.message(other, F.main("Game", F.elem(Manager.GetColor(data.Player) + data.Player.getName()) + " hit you with " + F.elem(GetName()) + ".")); + // Damage Event + Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, 7, true, true, false, player.getName(), isSuperActive(player) ? "Phoenix" : GetName()); + + UtilPlayer.message(other, F.main("Game", F.elem(Manager.GetColor(player) + player.getName()) + " hit you with " + F.elem(GetName()) + ".")); } } } @@ -165,40 +182,34 @@ public class PerkFirefly extends SmashPerk } } } - + @EventHandler public void FireflyDamage(CustomDamageEvent event) { if (event.GetDamage() <= 4) return; - + if (!(event.GetDamagerEntity(true) instanceof Player)) { return; } - + Iterator dataIterator = _data.iterator(); - + while (dataIterator.hasNext()) { FireflyData data = dataIterator.next(); - + if (!data.Player.equals(event.GetDamageeEntity())) continue; - - if (!UtilTime.elapsed(data.Time, 1250) && !isSuperActive(data.Player))// && event.GetCause() == DamageCause.PROJECTILE) + + if (!UtilTime.elapsed(data.Time, 1250) && !isSuperActive(data.Player)) { - Game game = Manager.GetGame(); - - if (game instanceof TeamSuperSmash) + if (isTeamDamage(data.Player, event.GetDamagerPlayer(true))) { - if (game.GetTeam(data.Player).equals(game.GetTeam(event.GetDamagerPlayer(true)))) - { - event.SetCancelled("Team Damage"); - return; - } + continue; } - + dataIterator.remove(); } else @@ -207,13 +218,13 @@ public class PerkFirefly extends SmashPerk } } } - + @EventHandler public void Knockback(CustomDamageEvent event) { if (event.GetReason() == null || !event.GetReason().contains(GetName())) return; - + event.AddKnockback(GetName(), 2); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameDash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameDash.java index 969e5120b..e099b91dd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameDash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameDash.java @@ -2,11 +2,11 @@ package nautilus.game.arcade.kit.perks; import java.util.HashSet; import java.util.Iterator; +import java.util.Set; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.util.Vector; @@ -15,13 +15,16 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -31,38 +34,48 @@ import nautilus.game.arcade.kit.perks.data.FireflyData; public class PerkFlameDash extends Perk { - private HashSet _data = new HashSet(); + + private static final long COOLDOWN = 8000; + private static final long TIME = 800; + private static final int DAMAGE_RADIUS = 3; + private static final int KNOCKBACK_MAGNITUDE = 2; + + private Set _data = new HashSet(); - public PerkFlameDash() + public PerkFlameDash() { - super("Flame Dash", new String[] - { - C.cYellow + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + "Flame Dash" - }); + super("Flame Dash", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + "Flame Dash" }); } @EventHandler public void Skill(PlayerInteractEvent event) { if (event.isCancelled()) + { return; + } - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + if (!UtilEvent.isAction(event, ActionType.R)) + { return; + } if (UtilBlock.usable(event.getClickedBlock())) + { return; - - if (event.getPlayer().getItemInHand() == null) - return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_SPADE")) - return; + } Player player = event.getPlayer(); - if (!Kit.HasKit(player)) + if (!UtilItem.isSpade(player.getItemInHand())) + { return; + } + + if (!hasPerk(player)) + { + return; + } if (!Recharge.Instance.usable(player, GetName())) { @@ -75,7 +88,7 @@ public class PerkFlameDash extends Perk done = true; } } - + if (done) { UtilPlayer.message(player, F.main("Skill", "You ended " + F.skill(GetName()) + ".")); @@ -83,18 +96,17 @@ public class PerkFlameDash extends Perk } else { - Recharge.Instance.use(player, GetName(), 8000, true, true); + Recharge.Instance.use(player, GetName(), COOLDOWN, true, true); } - + return; } - Recharge.Instance.useForce(player, GetName(), 8000); + Recharge.Instance.useForce(player, GetName(), COOLDOWN); _data.add(new FireflyData(player)); Manager.GetCondition().Factory().Cloak(GetName(), player, player, 2.5, false, false); - //Manager.GetCondition().Factory().Invisible(getName(), player, player, 2.5, 0, false, false, true); UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); } @@ -116,9 +128,8 @@ public class PerkFlameDash extends Perk { FireflyData data = dataIterator.next(); - - //Move - if (!UtilTime.elapsed(data.Time, 800)) + // Move + if (!UtilTime.elapsed(data.Time, TIME)) { Vector vel = data.Location.getDirection(); vel.setY(0); @@ -126,58 +137,59 @@ public class PerkFlameDash extends Perk vel.setY(0.05); UtilAction.velocity(data.Player, vel); - - //Sound + + // Sound data.Player.getWorld().playSound(data.Player.getLocation(), Sound.FIZZ, 0.6f, 1.2f); - - //Particles - UtilParticle.PlayParticle(ParticleType.FLAME, data.Player.getLocation().add(0, 0.4, 0), 0.2f, 0.2f, 0.2f, 0f, 3, - ViewDist.LONGER, UtilServer.getPlayers()); + + // Particles + UtilParticle.PlayParticle(ParticleType.FLAME, data.Player.getLocation().add(0, 0.4, 0), 0.2f, 0.2f, 0.2f, 0f, 3, ViewDist.LONGER, UtilServer.getPlayers()); } - //End + // End else { - for (Player other : UtilPlayer.getNearby(data.Player.getLocation(), 3)) + for (Player other : UtilPlayer.getNearby(data.Player.getLocation(), DAMAGE_RADIUS)) { if (other.equals(data.Player)) + { continue; - - if (!Manager.GetGame().IsAlive(other)) - continue; + } - double dist = UtilMath.offset(data.Player.getLocation(), data.Location)/2d; + if (UtilPlayer.isSpectator(other)) + { + continue; + } + + double dist = UtilMath.offset(data.Player.getLocation(), data.Location) / 2; - //Damage Event - Manager.GetDamage().NewDamageEvent(other, data.Player, null, - DamageCause.CUSTOM, 2 + dist, true, true, false, - data.Player.getName(), GetName()); + // Damage Event + Manager.GetDamage().NewDamageEvent(other, data.Player, null, DamageCause.CUSTOM, 2 + dist, true, true, false, data.Player.getName(), GetName()); UtilPlayer.message(other, F.main("Game", F.elem(Manager.GetColor(data.Player) + data.Player.getName()) + " hit you with " + F.elem(GetName()) + ".")); } - //End Invisible + // End Invisible Manager.GetCondition().EndCondition(data.Player, null, GetName()); - //Sound + // Sound data.Player.getWorld().playSound(data.Player.getLocation(), Sound.EXPLODE, 1f, 1.2f); - - //Particles - UtilParticle.PlayParticle(ParticleType.FLAME, data.Player.getLocation(), 0.1f, 0.1f, 0.1f, 0.3f, 100, - ViewDist.MAX, UtilServer.getPlayers()); - UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.Player.getLocation().add(0, 0.4, 0), 0.2f, 0.2f, 0.2f, 0f, 1, - ViewDist.MAX, UtilServer.getPlayers()); + + // Particles + UtilParticle.PlayParticle(ParticleType.FLAME, data.Player.getLocation(), 0.1f, 0.1f, 0.1f, 0.3f, 100, ViewDist.MAX, UtilServer.getPlayers()); + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.Player.getLocation().add(0, 0.4, 0), 0.2f, 0.2f, 0.2f, 0f, 1, ViewDist.MAX, UtilServer.getPlayers()); dataIterator.remove(); } - } + } } @EventHandler public void Knockback(CustomDamageEvent event) { if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { return; - - event.AddKnockback(GetName(), 2); + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlap.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlap.java index 8150a1d4a..f5faa41b1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlap.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlap.java @@ -15,8 +15,8 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashPerk; public class PerkFlap extends SmashPerk { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFleshArrow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFleshArrow.java index e0eb24ebd..e98337f2e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFleshArrow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFleshArrow.java @@ -25,7 +25,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkFleshArrow extends SmashPerk { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorseKick.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorseKick.java index c686b2abe..75f51451b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorseKick.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorseKick.java @@ -2,26 +2,29 @@ package nautilus.game.arcade.kit.perks; import java.util.HashMap; import java.util.Iterator; +import java.util.Map; +import java.util.UUID; import org.bukkit.Location; import org.bukkit.Sound; -import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseHorse; @@ -29,123 +32,145 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkHorseKick extends SmashPerk { - private HashMap _active = new HashMap(); - - public PerkHorseKick() - { - super("Bone Kick", new String[] - { - C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Bone Kick" - }); - } + private static final long COOLDOWN = 6000; + private static final float DAMAGE = 6.5F; + private static final long KICK_TIME = 1000; + private static final int KNOCKBACK_MAGNITUDE = 4; + + private Map _active = new HashMap<>(); + + public PerkHorseKick() + { + super("Bone Kick", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Bone Kick" }); + } + @EventHandler public void Activate(PlayerInteractEvent event) { if (event.isCancelled()) + { return; + } - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + if (!UtilEvent.isAction(event, ActionType.R)) + { return; + } if (UtilBlock.usable(event.getClickedBlock())) + { return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) - return; + } Player player = event.getPlayer(); - + + if (!UtilItem.isAxe(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + if (isSuperActive(player)) + { return; + } - if (!Kit.HasKit(player)) + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { return; + } - if (!Recharge.Instance.use(player, GetName(), 6000, true, true)) - return; + // Horse Animation + DisguiseBase horse = Manager.GetDisguise().getActiveDisguise(player); - //Horse Animation - DisguiseBase horse = Manager.GetDisguise().getDisguise(player); if (horse != null && horse instanceof DisguiseHorse) { - ((DisguiseHorse)horse).kick(); + ((DisguiseHorse) horse).kick(); Manager.GetDisguise().updateDisguise(horse); } - //Animation - _active.put(player, System.currentTimeMillis()); + // Animation + _active.put(player.getUniqueId(), System.currentTimeMillis()); - - //AoE Area + // AoE Area Location loc = player.getLocation(); loc.add(player.getLocation().getDirection().setY(0).normalize().multiply(1.5)); loc.add(0, 0.8, 0); - for (Entity other : player.getWorld().getEntities()) + for (LivingEntity other : UtilEnt.getInRadius(loc, 2.5).keySet()) { - if (!(other instanceof LivingEntity)) + if (UtilPlayer.isSpectator(other)) + { continue; - - if (other instanceof Player) - if (!Manager.GetGame().IsAlive((Player)other)) - continue; + } if (other.equals(player)) + { continue; + } - if (UtilMath.offset(loc, other.getLocation()) > 2.5) - continue; + // Damage Event + Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE, true, true, false, player.getName(), GetName()); - //Damage Event - Manager.GetDamage().NewDamageEvent((LivingEntity)other, player, null, - DamageCause.CUSTOM, 6.5, true, true, false, - player.getName(), GetName()); - - //Sound + // Sound player.getWorld().playSound(player.getLocation(), Sound.SKELETON_HURT, 4f, 0.6f); player.getWorld().playSound(player.getLocation(), Sound.SKELETON_HURT, 4f, 0.6f); - //Inform - UtilPlayer.message(other, F.main("Skill", F.name(player.getName()) + " hit you with " + F.skill(GetName()) + ".")); + // Inform + UtilPlayer.message(other, F.main("Skill", F.name(player.getName()) + " hit you with " + F.skill(GetName()) + ".")); } - //Inform + // Inform UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); - - //Slow + + // Slow Manager.GetCondition().Factory().Slow(GetName(), player, player, 0.8, 3, false, false, true, false); } @EventHandler - public void Update(UpdateEvent event) + public void Update(UpdateEvent event) { if (event.getType() != UpdateType.TICK) + { return; - - //Player - Iterator playerIterator = _active.keySet().iterator(); + } + // Player + Iterator playerIterator = _active.keySet().iterator(); + while (playerIterator.hasNext()) { - Player player = playerIterator.next(); + UUID key = playerIterator.next(); + Player player = UtilPlayer.searchExact(key); - if (!player.isValid() || player.getHealth() <= 0 || UtilTime.elapsed(_active.get(player), 1000)) + if (player == null) { playerIterator.remove(); + continue; + } + + if (!player.isValid() || player.getHealth() <= 0 || UtilTime.elapsed(_active.get(player), KICK_TIME)) + { + playerIterator.remove(); + + // Horse Animation + DisguiseBase horse = Manager.GetDisguise().getActiveDisguise(player); - //Horse Animation - DisguiseBase horse = Manager.GetDisguise().getDisguise(player); if (horse != null && horse instanceof DisguiseHorse) { - ((DisguiseHorse)horse).stopKick(); + ((DisguiseHorse) horse).stopKick(); Manager.GetDisguise().updateDisguise(horse); } - + Manager.GetCondition().EndCondition(player, null, GetName()); } else @@ -153,9 +178,8 @@ public class PerkHorseKick extends SmashPerk Location loc = player.getLocation(); loc.add(player.getLocation().getDirection().setY(0).normalize().multiply(1.5)); loc.add(0, 0.8, 0); - - UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, loc, 0.3f, 0.3f, 0.3f, 0, 2, - ViewDist.LONG, UtilServer.getPlayers()); + + UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, loc, 0.3f, 0.3f, 0.3f, 0, 2, ViewDist.LONG, UtilServer.getPlayers()); } } } @@ -163,9 +187,11 @@ public class PerkHorseKick extends SmashPerk @EventHandler public void Knockback(CustomDamageEvent event) { - if (event.GetReason() == null || (!event.GetReason().contains(GetName()) && !event.GetReason().contains("Flame Kick"))) + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { return; - - event.AddKnockback(GetName(), 4); + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInfernalHorror.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInfernalHorror.java index 5e67dbcec..8b472984d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInfernalHorror.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInfernalHorror.java @@ -19,7 +19,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.events.PlayerGameRespawnEvent; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkInfernalHorror extends SmashPerk { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInferno.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInferno.java deleted file mode 100644 index 645d9c305..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInferno.java +++ /dev/null @@ -1,142 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashMap; - -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.Item; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.util.Vector; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.TeamSuperSmash; -import nautilus.game.arcade.kit.SmashPerk; - -public class PerkInferno extends SmashPerk -{ - private HashMap _active = new HashMap(); - - public PerkInferno() - { - super("Inferno", new String[] - { - C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Inferno" - }); - } - - @EventHandler - public void EnergyUpdate(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - for (Player player : Manager.GetGame().GetPlayers(true)) - { - if (!Kit.HasKit(player)) - continue; - - if (!player.isBlocking()) - player.setExp((float) Math.min(0.999, player.getExp()+0.025)); - } - } - - @EventHandler - public void Activate(PlayerInteractEvent event) - { - if (event.isCancelled()) - return; - - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) - return; - - if (UtilBlock.usable(event.getClickedBlock())) - return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_SWORD")) - return; - - Player player = event.getPlayer(); - - if (isSuperActive(player)) - return; - - if (!Kit.HasKit(player)) - return; - - _active.put(player, System.currentTimeMillis()); - - UtilPlayer.message(player, F.main("Skill", "You used " + F.skill("Inferno") + ".")); - } - - @EventHandler - public void Update(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - for (Player cur : UtilServer.getPlayers()) - { - if (!_active.containsKey(cur)) - continue; - - if (!cur.isBlocking()) - { - _active.remove(cur); - continue; - } - - cur.setExp(cur.getExp()-0.035f); - - if (cur.getExp() <= 0) - { - _active.remove(cur); - continue; - } - - //Fire - Item fire = cur.getWorld().dropItem(cur.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER)); - Manager.GetFire().Add(fire, cur, 0.7, 0, 0.5, 0.95, "Inferno", false); - - fire.teleport(cur.getEyeLocation()); - double x = 0.07 - (UtilMath.r(14)/100d); - double y = 0.07 - (UtilMath.r(14)/100d); - double z = 0.07 - (UtilMath.r(14)/100d); - fire.setVelocity(cur.getLocation().getDirection().add(new Vector(x,y,z)).multiply(1.6)); - - //Effect - cur.getWorld().playSound(cur.getLocation(), Sound.GHAST_FIREBALL, 0.1f, 1f); - } - } - - @EventHandler - public void onCustomDamage(CustomDamageEvent event) - { - if (Manager.GetGame() instanceof TeamSuperSmash) - { - TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); - - if (event.GetDamagerPlayer(true) == null) - { - return; - } - - if (smash.GetTeam(event.GetDamagerPlayer(true)).equals(smash.GetTeam(event.GetDamageePlayer()))) - { - event.GetDamageeEntity().setFireTicks(0); - event.SetCancelled("Team Damage"); - } - } - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java index 35c3e3855..0c62875b9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java @@ -28,7 +28,7 @@ import mineplex.core.projectile.ProjectileUser; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkInkBlast extends SmashPerk implements IThrown { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java index d938dd3d9..62b1f5a9c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java @@ -6,7 +6,6 @@ import org.bukkit.entity.Item; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; @@ -15,6 +14,9 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilPlayer; import mineplex.core.itemstack.ItemStackFactory; @@ -22,100 +24,108 @@ import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; - import nautilus.game.arcade.kit.Perk; public class PerkIronHook extends Perk implements IThrown { - public PerkIronHook() + + private static final long COOLDOWN = 8000; + private static final int DAMAGE = 4; + + public PerkIronHook() { - super("Iron Hook", new String[] - { - C.cYellow + "Right-Click" + C.cGray + " with Pickaxe to " + C.cGreen + "Iron Hook" - }); + super("Iron Hook", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Pickaxe to " + C.cGreen + "Iron Hook" }); } @EventHandler public void Activate(PlayerInteractEvent event) { if (event.isCancelled()) + { return; + } - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + if (!UtilEvent.isAction(event, ActionType.R)) + { return; + } if (UtilBlock.usable(event.getClickedBlock())) + { return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_PICKAXE")) - return; + } Player player = event.getPlayer(); - if (!Kit.HasKit(player)) + if (!UtilItem.isPickaxe(player.getItemInHand())) + { return; + } - if (!Recharge.Instance.use(player, GetName(), 8000, true, true)) + if (!hasPerk(player)) + { return; + } - //Action + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } + + // Action Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(131)); - UtilAction.velocity(item, player.getLocation().getDirection(), - 1.8, false, 0, 0.2, 10, false); + UtilAction.velocity(item, player.getLocation().getDirection(), 1.8, false, 0, 0.2, 10, false); - Manager.GetProjectile().AddThrow(item, player, this, -1, true, true, true, true, - Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.CRIT, null, 0, UpdateType.TICK, 0.6f); + Manager.GetProjectile().AddThrow(item, player, this, -1, true, true, true, true, Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.CRIT, null, 0, UpdateType.TICK, 0.6f); - //Inform + // Inform UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); - //Effect + // Effect item.getWorld().playSound(item.getLocation(), Sound.IRONGOLEM_THROW, 2f, 0.8f); } @Override - public void Collide(LivingEntity target, Block block, ProjectileUser data) - { - //Remove + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + // Remove double velocity = data.getThrown().getVelocity().length(); data.getThrown().remove(); if (!(data.getThrower() instanceof Player)) + { return; - - Player player = (Player)data.getThrower(); + } + + Player player = (Player) data.getThrower(); if (target == null) + { return; + } + + // Pull + UtilAction.velocity(target, UtilAlg.getTrajectory(target.getLocation(), player.getLocation()), 2, false, 0, 0.8, 1.5, true); - //Pull - UtilAction.velocity(target, - UtilAlg.getTrajectory(target.getLocation(), player.getLocation()), - 2, false, 0, 0.8, 1.5, true); - - //Condition + // Condition Manager.GetCondition().Factory().Falling(GetName(), target, player, 10, false, true); - //Damage Event - Manager.GetDamage().NewDamageEvent(target, player, null, - DamageCause.CUSTOM, velocity * 4, false, true, false, - player.getName(), GetName()); + // Damage Event + Manager.GetDamage().NewDamageEvent(target, player, null, DamageCause.CUSTOM, velocity * DAMAGE, false, true, false, player.getName(), GetName()); - //Inform + // Inform UtilPlayer.message(target, F.main("Skill", F.name(player.getName()) + " hit you with " + F.skill(GetName()) + ".")); } @Override - public void Idle(ProjectileUser data) + public void Idle(ProjectileUser data) { - //Remove data.getThrown().remove(); } @Override - public void Expire(ProjectileUser data) + public void Expire(ProjectileUser data) { - //Remove data.getThrown().remove(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLazer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLazer.java index 34fdec4b0..6fcdbbe1c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLazer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLazer.java @@ -2,17 +2,17 @@ package nautilus.game.arcade.kit.perks; import java.util.HashSet; import java.util.Iterator; +import java.util.Set; +import java.util.UUID; import org.bukkit.Color; import org.bukkit.DyeColor; -import org.bukkit.FireworkEffect; +import org.bukkit.FireworkEffect.Type; import org.bukkit.Location; import org.bukkit.Sound; -import org.bukkit.FireworkEffect.Type; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; @@ -20,13 +20,16 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilFirework; -import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.particles.effects.LineParticle; +import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseSheep; import mineplex.core.recharge.Recharge; @@ -37,17 +40,23 @@ import nautilus.game.arcade.kit.Perk; public class PerkLazer extends Perk { + + private static final float MAX_CHARGE = 0.99F; + private static final float CHARGE_PER_TICK = 0.035F; + private static final float INCREMENTATION = 0.2F; + private static final float HIT_BOX_RADIUS = 2.5F; + private static final int DAMAGE_RADIUS = 3; + private static final int DAMAGE = 7; + private static final int KNOCKBACK_MAGNITUDE = 3; + private double _range; private long _recharge; - - private HashSet _active = new HashSet(); - public PerkLazer(double range, long recharge) + private Set _active = new HashSet<>(); + + public PerkLazer(double range, long recharge) { - super("Static Lazer", new String[] - { - C.cYellow + "Hold Block" + C.cGray + " with Sword to use " + C.cGreen + "Static Lazer" - }); + super("Static Lazer", new String[] { C.cYellow + "Hold Block" + C.cGray + " with Sword to use " + C.cGreen + "Static Lazer" }); _range = range; _recharge = recharge; @@ -57,66 +66,88 @@ public class PerkLazer extends Perk public void skill(PlayerInteractEvent event) { if (event.isCancelled()) + { return; + } - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + if (!UtilEvent.isAction(event, ActionType.R)) + { return; + } if (UtilBlock.usable(event.getClickedBlock())) + { return; - - if (event.getPlayer().getItemInHand() == null) - return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_SWORD")) - return; + } Player player = event.getPlayer(); - if (!Kit.HasKit(player)) + if (!UtilItem.isSword(player.getItemInHand())) + { return; - + } + + if (!hasPerk(player)) + { + return; + } + if (!Recharge.Instance.use(player, GetName(), _recharge, true, true)) + { return; - - _active.add(player); + } + + _active.add(player.getUniqueId()); } - + @EventHandler public void chargeFire(UpdateEvent event) { if (event.getType() != UpdateType.TICK) + { return; + } - Iterator playerIterator = _active.iterator(); - + Iterator playerIterator = _active.iterator(); + while (playerIterator.hasNext()) { - Player player = playerIterator.next(); - + UUID uuid = playerIterator.next(); + Player player = UtilPlayer.searchExact(uuid); + + if (player == null) + { + playerIterator.remove(); + } + if (player.isBlocking()) { - player.setExp(Math.min(0.999f, player.getExp() + 0.035f)); - + player.setExp(Math.min(MAX_CHARGE, player.getExp() + CHARGE_PER_TICK)); + player.getWorld().playSound(player.getLocation(), Sound.FIZZ, 0.25f + player.getExp(), 0.75f + player.getExp()); - - //Wool - DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); + + // Wool + DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); if (disguise != null && disguise instanceof DisguiseSheep) { - DisguiseSheep sheep = (DisguiseSheep)disguise; + DisguiseSheep sheep = (DisguiseSheep) disguise; + if (Math.random() > 0.5) + { sheep.setColor(DyeColor.YELLOW); + } else + { sheep.setColor(DyeColor.BLACK); - + } + sheep.setSheared(false); - + sheep.UpdateDataWatcher(); Manager.GetDisguise().updateDisguise(disguise); } - - if (player.getExp() >= 0.999f) + + if (player.getExp() >= MAX_CHARGE) { playerIterator.remove(); fire(player); @@ -129,106 +160,83 @@ public class PerkLazer extends Perk } } } - + public void fire(Player player) - { - if (player.getExp() <= 0.2f) + { + if (player.getExp() <= 0.2) { setWoolColor(player, DyeColor.WHITE); player.setExp(0f); return; } - - double curRange = 0; - while (curRange <= _range * player.getExp()) + + LineParticle lineParticle = new LineParticle(player.getEyeLocation(), player.getLocation().getDirection(), INCREMENTATION, _range * player.getExp(), null, ParticleType.FIREWORKS_SPARK, + UtilServer.getPlayers()); + + particleLoop: while (lineParticle.update()) { - Location newTarget = player.getEyeLocation().add(player.getLocation().getDirection().multiply(curRange)); - - //Hit Player - boolean hitPlayer = false; - for (Player other : Manager.GetGame().GetPlayers(true)) + for (Player other : UtilPlayer.getNearby(lineParticle.getLastLocation(), HIT_BOX_RADIUS)) { - if (other.equals(player)) - continue; - - if (UtilMath.offset(newTarget, other.getLocation().add(0, 1, 0)) < 2.5) + if (player.equals(other)) { - hitPlayer = true; - break; + continue; } - } - if (hitPlayer) - break; - - //Hit Block - if (!UtilBlock.airFoliage(newTarget.getBlock())) - { - break; - } - //Progress Forwards - curRange += 0.2; - - //Smoke Trail - UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, newTarget, 0, 0, 0, 0, 1, - ViewDist.MAX, UtilServer.getPlayers()); + break particleLoop; + } } - //Destination - Location target = player.getLocation().add(player.getLocation().getDirection().multiply(curRange)); - - UtilParticle.PlayParticle(ParticleType.EXPLODE, target, 0, 0, 0, 0, 1, - ViewDist.MAX, UtilServer.getPlayers()); - - //Firework - UtilFirework.playFirework(player.getLocation().add(player.getLocation().getDirection().multiply(Math.max(0, curRange - 0.6))), Type.BURST, Color.YELLOW, false, false); - - for (LivingEntity other : UtilEnt.getInRadius(target, 5).keySet()) + Location target = lineParticle.getDestination(); + + UtilParticle.PlayParticle(ParticleType.EXPLODE, target, 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); + + // Firework + UtilFirework.playFirework(target, Type.BURST, Color.YELLOW, false, false); + + for (LivingEntity other : UtilEnt.getInRadius(target, DAMAGE_RADIUS).keySet()) { if (other.equals(player)) - continue; - - //Do from center - if (UtilMath.offset(target, other.getLocation().add(0, 1, 0)) < 3) { - //Damage Event - Manager.GetDamage().NewDamageEvent(other, player, null, - DamageCause.CUSTOM, player.getExp() * 7, true, true, false, - player.getName(), GetName()); + continue; } + + // Damage Event + Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, player.getExp() * DAMAGE, true, true, false, player.getName(), GetName()); } - - //Inform + + // Inform UtilPlayer.message(player, F.main("Game", "You fired " + F.skill(GetName()) + ".")); - - //Sound + + // Sound player.getWorld().playSound(player.getEyeLocation(), Sound.ZOMBIE_REMEDY, 0.5f + player.getExp(), 1.75f - player.getExp()); player.getWorld().playSound(player.getLocation(), Sound.SHEEP_IDLE, 2f, 1.5f); - - //Wool + + // Wool setWoolColor(player, DyeColor.WHITE); player.setExp(0f); } - + @EventHandler public void knockback(CustomDamageEvent event) { if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { return; + } - event.AddKnockback(GetName(), 3); + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); } - - + public void setWoolColor(Player player, DyeColor color) { - DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); + DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); + if (disguise != null && disguise instanceof DisguiseSheep) { - DisguiseSheep sheep = (DisguiseSheep)disguise; + DisguiseSheep sheep = (DisguiseSheep) disguise; sheep.setSheared(false); sheep.setColor(color); - + sheep.UpdateDataWatcher(); Manager.GetDisguise().updateDisguise(disguise); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMeteorShower.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMeteorShower.java index 29fa5cda1..949d5c76c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMeteorShower.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMeteorShower.java @@ -9,7 +9,7 @@ import org.bukkit.event.EventHandler; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; import nautilus.game.arcade.kit.perks.data.MeteorShowerData; public class PerkMeteorShower extends SmashPerk diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNeedler.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNeedler.java index 4c39ea23d..442dde4bb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNeedler.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNeedler.java @@ -21,8 +21,8 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashPerk; public class PerkNeedler extends SmashPerk { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java index 9f0bcc8c7..719fa9588 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java @@ -21,7 +21,7 @@ import mineplex.core.common.util.UtilTime; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.game.games.smash.TeamSuperSmash; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; import nautilus.game.arcade.kit.perks.data.NightLivingDeadData; public class PerkNightLivingDead extends SmashPerk diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNotFinished.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNotFinished.java deleted file mode 100644 index b4bbf8f94..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNotFinished.java +++ /dev/null @@ -1,15 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import mineplex.core.common.util.C; -import nautilus.game.arcade.kit.Perk; - -public class PerkNotFinished extends Perk -{ - public PerkNotFinished() - { - super("Not Completed", new String[] - { - C.cRed + C.Bold + "KIT IS NOT FINISHED", - }); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkOvercharge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkOvercharge.java index b90f487d6..e3ce2434e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkOvercharge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkOvercharge.java @@ -25,7 +25,7 @@ import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkOvercharge extends SmashPerk { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBomb.java index 9c616a588..d89a735de 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBomb.java @@ -31,7 +31,7 @@ import mineplex.core.disguise.disguises.DisguisePigZombie; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkPigBaconBomb extends SmashPerk { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBounce.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBounce.java index 195717459..f2660d71d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBounce.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBounce.java @@ -34,7 +34,7 @@ import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; import mineplex.core.recharge.Recharge; import nautilus.game.arcade.game.games.smash.TeamSuperSmash; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkPigBaconBounce extends SmashPerk implements IThrown { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigZombie.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigZombie.java index f12182cf1..1c2461fd7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigZombie.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigZombie.java @@ -17,7 +17,7 @@ import mineplex.core.disguise.disguises.DisguisePigZombie; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkPigZombie extends SmashPerk { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRopedArrow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRopedArrow.java index 51e694be7..3d0d4b759 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRopedArrow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRopedArrow.java @@ -24,7 +24,7 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkRopedArrow extends SmashPerk { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlam.java index 4b41a42e4..0109e984e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlam.java @@ -1,19 +1,7 @@ package nautilus.game.arcade.kit.perks; import java.util.HashMap; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.Perk; +import java.util.Map; import org.bukkit.Effect; import org.bukkit.Sound; @@ -22,36 +10,56 @@ import org.bukkit.block.BlockFace; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.util.Vector; -public class PerkSeismicSlam extends Perk -{ - private HashMap _live = new HashMap(); +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; - public PerkSeismicSlam() +public class PerkSeismicSlam extends Perk +{ + + private static final long COOLDOWN = 7000; + private static final long TIME = 1000; + private static final int DAMAGE = 10; + private static final int RADIUS = 8; + private static final float KNOCKBACK_MAGNITUDE = 2.4F; + + private Map _live = new HashMap<>(); + + public PerkSeismicSlam() { - super("Seismic Slam", new String[] - { - C.cYellow + "Right-Click" + C.cGray + " with Spade to " + C.cGreen + "Seismic Slam" - }); + super("Seismic Slam", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Spade to " + C.cGreen + "Seismic Slam" }); } - + @EventHandler public void deactivateDeath(PlayerDeathEvent event) { - if (!Manager.GetGame().IsLive()) - return; + Player player = event.getEntity(); - if (!Kit.HasKit(event.getEntity())) - return; - - if (_live.containsKey(event.getEntity())) + if (!hasPerk(player)) { - _live.remove(event.getEntity()); + return; + } + + if (_live.containsKey(player)) + { + _live.remove(player); } } @@ -59,101 +67,126 @@ public class PerkSeismicSlam extends Perk public void Leap(PlayerInteractEvent event) { if (event.isCancelled()) + { return; + } - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + if (!UtilEvent.isAction(event, ActionType.R)) + { return; + } if (UtilBlock.usable(event.getClickedBlock())) + { return; - - if (event.getPlayer().getItemInHand() == null) - return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_SPADE")) - return; + } Player player = event.getPlayer(); - if (!Kit.HasKit(player)) + if (!UtilItem.isSpade(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) return; - if (!Recharge.Instance.use(player, GetName(), 7000, true, true)) - return; - - //Action + // Action Vector vec = player.getLocation().getDirection(); if (vec.getY() < 0) + { vec.setY(vec.getY() * -1); + } UtilAction.velocity(player, vec, 1, true, 1, 0, 1, true); - //Record + // Record _live.put(player, System.currentTimeMillis()); - //Inform + // Inform UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); } - + @EventHandler public void Slam(UpdateEvent event) { if (event.getType() != UpdateType.TICK) + { return; + } for (Player player : Manager.GetGame().GetPlayers(true)) { if (!UtilEnt.isGrounded(player)) + { continue; + } if (!_live.containsKey(player)) + { continue; + } - if (!UtilTime.elapsed(_live.get(player), 1000)) + if (!UtilTime.elapsed(_live.get(player), TIME)) + { continue; + } _live.remove(player); - - //Action - int damage = 10; - double range = 8; - - HashMap targets = UtilEnt.getInRadius(player.getLocation(), range); + + // Action + + Map targets = UtilEnt.getInRadius(player.getLocation(), RADIUS); + for (LivingEntity cur : targets.keySet()) { if (cur.equals(player)) + { continue; + } - if (cur instanceof Player && !Manager.IsAlive((Player) cur)) + if (cur instanceof Player && !UtilPlayer.isSpectator(cur)) + { continue; - - //Damage Event - Manager.GetDamage().NewDamageEvent(cur, player, null, - DamageCause.CUSTOM, damage * targets.get(cur) + 0.5, true, true, false, - player.getName(), GetName()); + } - //Condition + // Damage Event + Manager.GetDamage().NewDamageEvent(cur, player, null, DamageCause.CUSTOM, DAMAGE * targets.get(cur) + 0.5, true, true, false, player.getName(), GetName()); + + // Condition Manager.GetCondition().Factory().Falling(GetName(), cur, player, 10, false, true); - //Inform + // Inform if (cur instanceof Player) - UtilPlayer.message((Player)cur, F.main("Game", F.name(player.getName()) +" hit you with " + F.skill(GetName()) + ".")); + UtilPlayer.message((Player) cur, F.main("Game", F.name(player.getName()) + " hit you with " + F.skill(GetName()) + ".")); } - - //Effect + + // Effect player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_WOOD, 2f, 0.2f); - for (Block cur : UtilBlock.getInRadius(player.getLocation(), 4d).keySet()) + + for (Block cur : UtilBlock.getInRadius(player.getLocation(), 4).keySet()) + { if (UtilBlock.airFoliage(cur.getRelative(BlockFace.UP)) && !UtilBlock.airFoliage(cur)) + { cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getTypeId()); - } + } + } + } } - + @EventHandler public void Knockback(CustomDamageEvent event) { if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { return; + } - event.AddKnockback(GetName(), 2.4); + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSheepHoming.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSheepHoming.java index eea416543..2ff903baf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSheepHoming.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSheepHoming.java @@ -19,7 +19,7 @@ import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; import nautilus.game.arcade.kit.perks.data.HomingSheepData; public class PerkSheepHoming extends SmashPerk diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletonArrowStorm.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletonArrowStorm.java index a58a42b81..e2cf525b6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletonArrowStorm.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletonArrowStorm.java @@ -14,8 +14,8 @@ import org.bukkit.util.Vector; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; -import nautilus.game.arcade.kit.SmashKit; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkSkeletonArrowStorm extends SmashPerk { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java index 0bf4780f1..609448ec2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java @@ -34,7 +34,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.smash.TeamSuperSmash; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkSlimeRocket extends SmashPerk implements IThrown { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeSlam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeSlam.java index ecb0e67ab..eb5924ca0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeSlam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeSlam.java @@ -22,8 +22,8 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashPerk; public class PerkSlimeSlam extends SmashPerk { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSnowTurret.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSnowTurret.java index 710589904..75e9e5d0d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSnowTurret.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSnowTurret.java @@ -31,7 +31,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; import net.minecraft.server.v1_8_R3.EntityInsentient; public class PerkSnowTurret extends SmashPerk diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpidersNest.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpidersNest.java index 0bd72c5a9..c31eac12b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpidersNest.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpidersNest.java @@ -17,7 +17,7 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkSpidersNest extends SmashPerk { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkStormSquid.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkStormSquid.java index a355bb013..392e11c4f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkStormSquid.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkStormSquid.java @@ -28,8 +28,8 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.SmashKit; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkStormSquid extends SmashPerk { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSuperSquid.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSuperSquid.java index 385cb0d51..49375f65c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSuperSquid.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSuperSquid.java @@ -23,7 +23,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkSuperSquid extends SmashPerk { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWebShot.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWebShot.java index 7103f5ca7..c5955f148 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWebShot.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWebShot.java @@ -22,7 +22,7 @@ import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; import mineplex.core.recharge.Recharge; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkWebShot extends SmashPerk implements IThrown { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitchPotion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitchPotion.java index 54963e81e..4b7ac44aa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitchPotion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitchPotion.java @@ -28,7 +28,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkWitchPotion extends SmashPerk { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherForm.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherForm.java index fee83f056..cdebce00e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherForm.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherForm.java @@ -19,8 +19,8 @@ import mineplex.core.disguise.disguises.DisguiseWither; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.SmashKit; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkWitherForm extends SmashPerk { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java index aacf75746..d43939c46 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java @@ -12,7 +12,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.smash.TeamSuperSmash; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; import org.bukkit.Location; import org.bukkit.Material; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherSkull.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherSkull.java index de3505cc3..086732aeb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherSkull.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherSkull.java @@ -34,7 +34,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkWitherSkull extends SmashPerk { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java index 526906a05..c11724c09 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java @@ -33,7 +33,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; import net.minecraft.server.v1_8_R3.EntityCreature; import net.minecraft.server.v1_8_R3.Navigation; import net.minecraft.server.v1_8_R3.NavigationAbstract; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java index 27f62a7ae..155fdf212 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java @@ -3,6 +3,9 @@ package nautilus.game.arcade.kit.perks; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.UUID; import org.bukkit.Effect; import org.bukkit.Material; @@ -12,7 +15,6 @@ import org.bukkit.entity.Item; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; @@ -22,12 +24,15 @@ import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseSheep; import mineplex.core.itemstack.ItemStackFactory; @@ -43,55 +48,73 @@ import nautilus.game.arcade.kit.perks.data.WoolBombData; public class PerkWoolBomb extends Perk implements IThrown { - private HashMap _thrown = new HashMap(); - private HashMap _active = new HashMap(); - public PerkWoolBomb() + private static final long RATE = 800; + private static final long COOLDOWN = 8000; + private static final int DAMAGE_RADIUS = 9; + private static final int DAMAGE_EXPLODE = 14; + private static final int DAMAGE_COLLIDE = 4; + private static final int KNOCKBACK_MAGNITUDE = 2; + + private Map _thrown = new HashMap<>(); + private Map _active = new HashMap<>(); + + public PerkWoolBomb() { - super("Wool Mine", new String[] - { - C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Wool Mine" - }); + super("Wool Mine", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Wool Mine" }); } @EventHandler public void skill(PlayerInteractEvent event) { if (event.isCancelled()) + { return; + } - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + if (!UtilEvent.isAction(event, ActionType.R)) + { return; + } if (UtilBlock.usable(event.getClickedBlock())) + { return; - - if (event.getPlayer().getItemInHand() == null) - return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) - return; + } Player player = event.getPlayer(); - if (!Kit.HasKit(player)) + if (!UtilItem.isAxe(player.getItemInHand())) + { return; - + } + + if (!hasPerk(player)) + { + return; + } + if (!Recharge.Instance.usable(player, GetName() + " Rate")) + { return; - + } + if (_active.containsKey(player)) { if (detonate(player, true)) + { return; + } } - + if (_thrown.containsKey(player)) { if (solidify(player, true)) + { return; + } } - + launch(player); event.setCancelled(true); @@ -100,143 +123,152 @@ public class PerkWoolBomb extends Perk implements IThrown private void launch(Player player) { if (!Recharge.Instance.usable(player, GetName(), true)) + { return; - - org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.WOOL, (byte)0)); - - UtilAction.velocity(ent, player.getLocation().getDirection(), 1, false, 0, 0.2, 10, false); - - Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true, - null, 1f, 1f, - null, 1, UpdateType.SLOW, - 0.5f); + } - _thrown.put(player, ent); + Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.WOOL, (byte) 0)); - //Inform + UtilAction.velocity(ent, player.getLocation().getDirection(), 1, false, 0, 0.2, 10, false); + + Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true, null, 1f, 1f, null, 1, UpdateType.SLOW, 0.5f); + + _thrown.put(player.getUniqueId(), ent); + + // Inform UtilPlayer.message(player, F.main("Game", "You launched " + F.skill(GetName()) + ".")); - //Effect + // Effect player.getWorld().playSound(player.getLocation(), Sound.SHEEP_IDLE, 2f, 1.5f); + + // Rate + Recharge.Instance.useForce(player, GetName() + " Rate", RATE); + + // Disguise + DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); - //Rate - Recharge.Instance.useForce(player, GetName() + " Rate", 800); - - //Disguise - DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); if (disguise != null && disguise instanceof DisguiseSheep) { - DisguiseSheep sheep = (DisguiseSheep)disguise; + DisguiseSheep sheep = (DisguiseSheep) disguise; sheep.setSheared(true); - + sheep.UpdateDataWatcher(); Manager.GetDisguise().updateDisguise(disguise); } } - + @EventHandler public void rechargeWool(RechargedEvent event) { if (event.GetAbility().equals(GetName())) { - DisguiseBase disguise = Manager.GetDisguise().getDisguise(event.GetPlayer()); + DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(event.GetPlayer()); + if (disguise != null && disguise instanceof DisguiseSheep) { - DisguiseSheep sheep = (DisguiseSheep)disguise; + DisguiseSheep sheep = (DisguiseSheep) disguise; sheep.setSheared(false); - + sheep.UpdateDataWatcher(); Manager.GetDisguise().updateDisguise(disguise); } } } - + private boolean solidify(LivingEntity ent, boolean inform) { if (!(ent instanceof Player)) + { return false; + } - Player player = (Player)ent; + Player player = (Player) ent; + + Item thrown = _thrown.remove(player.getUniqueId()); - Item thrown = _thrown.remove(player); if (thrown == null) + { return false; + } - //Make Block + // Make Block Block block = thrown.getLocation().getBlock(); - + Manager.GetBlockRestore().restore(block); - - _active.put(player, new WoolBombData(block)); - - block.setTypeIdAndData(35, (byte)0, true); + + _active.put(player.getUniqueId(), new WoolBombData(block)); + + block.setType(Material.WOOL); block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType()); - - //Clean + + // Clean thrown.remove(); - - //Rate - Recharge.Instance.useForce(player, GetName() + " Rate", 1000); - - //Inform + + // Rate + Recharge.Instance.useForce(player, GetName() + " Rate", RATE); + + // Inform if (inform) { player.getWorld().playSound(player.getLocation(), Sound.SHEEP_IDLE, 2f, 1.5f); - + UtilPlayer.message(player, F.main("Game", "You armed " + F.skill(GetName()) + ".")); } - + return true; } private boolean detonate(Player player, boolean inform) { WoolBombData data = _active.remove(player); - + if (data == null) - return false; - - if (!Recharge.Instance.use(player, GetName(), 8000, true, true)) { return false; } - //Restore + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return false; + } + + // Restore data.restore(); - - //Explode - UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, data.Block.getLocation().add(0.5, 0.5, 0.5), 0, 0, 0, 0, 1, - ViewDist.MAX, UtilServer.getPlayers()); + + // Explode + UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, data.Block.getLocation().add(0.5, 0.5, 0.5), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); data.Block.getWorld().playSound(data.Block.getLocation(), Sound.EXPLODE, 3f, 0.8f); + + // Damage + Map targets = UtilEnt.getInRadius(data.Block.getLocation().add(0.5, 0.5, 0.5), DAMAGE_RADIUS); - //Damage - HashMap targets = UtilEnt.getInRadius(data.Block.getLocation().add(0.5, 0.5, 0.5), 9); for (LivingEntity cur : targets.keySet()) { - //Damage Event - Manager.GetDamage().NewDamageEvent(cur, player, null, - DamageCause.CUSTOM, 14 * targets.get(cur) + 0.5, false, true, false, - player.getName(), GetName()); - - //Condition + // Damage Event + Manager.GetDamage().NewDamageEvent(cur, player, null, DamageCause.CUSTOM, DAMAGE_EXPLODE * targets.get(cur) + 0.5, false, true, false, player.getName(), GetName()); + + // Condition Manager.GetCondition().Factory().Falling(GetName(), cur, player, 10, false, true); - - //Knockback + + // Knockback UtilAction.velocity(cur, UtilAlg.getTrajectory2d(data.Block.getLocation().add(0.5, 0.5, 0.5), cur.getEyeLocation()), 0.5 + 2.5 * targets.get(cur), true, 0.8, 0, 10, true); - //Inform + // Inform if (cur instanceof Player && !player.equals(cur)) - UtilPlayer.message((Player)cur, F.main("Game", F.name(player.getName()) +" hit you with " + F.skill(GetName()) + ".")); + { + UtilPlayer.message((Player) cur, F.main("Game", F.name(player.getName()) + " hit you with " + F.skill(GetName()) + ".")); + } + } - - //Rate - Recharge.Instance.useForce(player, GetName() + " Rate", 800); - - //Inform + + // Rate + Recharge.Instance.useForce(player, GetName() + " Rate", RATE); + + // Inform if (inform) { player.getWorld().playSound(player.getLocation(), Sound.SHEEP_IDLE, 2f, 1.5f); - + UtilPlayer.message(player, F.main("Game", "You detonated " + F.skill(GetName()) + ".")); } @@ -244,52 +276,62 @@ public class PerkWoolBomb extends Perk implements IThrown } @Override - public void Collide(LivingEntity target, Block block, ProjectileUser data) + public void Collide(LivingEntity target, Block block, ProjectileUser data) { solidify(data.getThrower(), false); if (target == null) + { return; - - //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, - DamageCause.PROJECTILE, 4, true, true, false, - UtilEnt.getName(data.getThrower()), GetName()); + } + + // Damage Event + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, DAMAGE_COLLIDE, true, true, false, UtilEnt.getName(data.getThrower()), GetName()); } @Override - public void Idle(ProjectileUser data) + public void Idle(ProjectileUser data) { solidify(data.getThrower(), false); } @Override - public void Expire(ProjectileUser data) + public void Expire(ProjectileUser data) { solidify(data.getThrower(), false); } - + @EventHandler public void colorExpireUpdate(UpdateEvent event) { if (event.getType() != UpdateType.FASTER) + { return; + } - HashSet detonate = new HashSet(); - - Iterator playerIterator = _active.keySet().iterator(); - + Set detonate = new HashSet(); + Iterator playerIterator = _active.keySet().iterator(); + while (playerIterator.hasNext()) { - Player player = playerIterator.next(); - WoolBombData data = _active.get(player); + UUID key = playerIterator.next(); - if (UtilTime.elapsed(data.Time, 8000)) + Player player = UtilPlayer.searchExact(key); + + if (player == null) + { + playerIterator.remove(); + continue; + } + + WoolBombData data = _active.get(key); + + if (UtilTime.elapsed(data.Time, COOLDOWN)) { detonate.add(player); continue; } - + if (Recharge.Instance.usable(player, GetName() + " Rate")) { if (data.Block.getData() == 14) @@ -302,7 +344,7 @@ public class PerkWoolBomb extends Perk implements IThrown } } } - + for (Player player : detonate) { detonate(player, false); @@ -313,8 +355,10 @@ public class PerkWoolBomb extends Perk implements IThrown public void knockback(CustomDamageEvent event) { if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { return; - - event.AddKnockback(GetName(), 2); + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolCloud.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolCloud.java index 76b51ee71..9c5694a6b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolCloud.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolCloud.java @@ -2,14 +2,13 @@ package nautilus.game.arcade.kit.perks; import java.util.HashMap; import java.util.Iterator; +import java.util.Map; +import java.util.UUID; import org.bukkit.DyeColor; import org.bukkit.Effect; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Horse; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.util.Vector; @@ -17,14 +16,18 @@ import org.bukkit.util.Vector; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseSheep; import mineplex.core.recharge.Recharge; @@ -35,121 +38,152 @@ import nautilus.game.arcade.kit.Perk; public class PerkWoolCloud extends Perk { - private HashMap _active = new HashMap(); - public PerkWoolCloud() + private static final long COOLDOWN = 10000; + private static final long MIN_VELOCITY_TIME = 200; + private static final long MAX_VELOCITY_TIME = 1200; + private static final int DAMAGE_RADIUS = 2; + private static final int DAMAGE = 8; + private static final float KNOCKBACK_MAGNITUDE = 2.5F; + + private Map _active = new HashMap<>(); + + public PerkWoolCloud() { - super("Wooly Rocket", new String[] - { - C.cYellow + "Right-Click" + C.cGray + " with Spade to " + C.cGreen + "Wooly Rocket" - }); + super("Wooly Rocket", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Spade to " + C.cGreen + "Wooly Rocket" }); } - + @EventHandler public void Leap(PlayerInteractEvent event) { if (event.isCancelled()) + { return; - - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) - return; + } - if (event.getPlayer().getItemInHand() == null) + if (!UtilEvent.isAction(event, ActionType.R)) + { return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_SPADE")) + } + + if (UtilBlock.usable(event.getClickedBlock())) + { return; - + } + Player player = event.getPlayer(); - - if (!Kit.HasKit(player)) + + if (!UtilItem.isSpade(player.getItemInHand())) + { return; - - //Recharge - if (!Recharge.Instance.use(player, GetName(), 10000, true, true)) + } + + if (!hasPerk(player)) + { return; + } + + // Recharge + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } - UtilAction.velocity(player, new Vector(0,1,0), 1, false, 0, 0, 2, true); - + UtilAction.velocity(player, new Vector(0, 1, 0), 1, false, 0, 0, 2, true); + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); - + player.getWorld().playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0); - - //Allow double jump + + // Allow double jump player.setAllowFlight(true); - + setWoolColor(player, DyeColor.RED); - - _active.put(player, System.currentTimeMillis()); + + _active.put(player.getUniqueId(), System.currentTimeMillis()); } - + @EventHandler public void update(UpdateEvent event) { if (event.getType() != UpdateType.TICK) + { return; + } - if (Manager.GetGame() == null) + if (!Manager.GetGame().IsLive()) + { return; + } + + Iterator playerIterator = _active.keySet().iterator(); - Iterator playerIterator = _active.keySet().iterator(); while (playerIterator.hasNext()) { - Player player = playerIterator.next(); - - UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation(), 0.2f, 0.2f, 0.2f, 0, 4, - ViewDist.LONGER, UtilServer.getPlayers()); - - if (!UtilTime.elapsed(_active.get(player), 200)) + UUID key = playerIterator.next(); + Player player = UtilPlayer.searchExact(key); + + if (player == null) + { + playerIterator.remove(); continue; + } + + UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation(), 0.2f, 0.2f, 0.2f, 0, 4, ViewDist.LONGER, UtilServer.getPlayers()); + + if (!UtilTime.elapsed(_active.get(player), MIN_VELOCITY_TIME)) + { + continue; + } for (Player other : Manager.GetGame().GetPlayers(true)) { if (player.equals(other)) - continue; - - if (UtilMath.offset(player, other) < 2) { - //Damage Event - Manager.GetDamage().NewDamageEvent(other, player, null, - DamageCause.CUSTOM, 8, true, false, false, - player.getName(), GetName()); - - UtilParticle.PlayParticle(ParticleType.EXPLODE, other.getLocation(), 0f, 0f, 0f, 0, 1, - ViewDist.MAX, UtilServer.getPlayers()); - UtilParticle.PlayParticle(ParticleType.LAVA, player.getLocation(), 0.2f, 0.2f, 0.2f, 0, 10, - ViewDist.MAX, UtilServer.getPlayers()); + continue; + } + + if (UtilMath.offset(player, other) < DAMAGE_RADIUS) + { + // Damage Event + Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE, true, false, false, player.getName(), GetName()); + + UtilParticle.PlayParticle(ParticleType.EXPLODE, other.getLocation(), 0f, 0f, 0f, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); + UtilParticle.PlayParticle(ParticleType.LAVA, player.getLocation(), 0.2f, 0.2f, 0.2f, 0, 10, ViewDist.MAX, UtilServer.getPlayers()); } } - - if (UtilEnt.isGrounded(player) || UtilTime.elapsed(_active.get(player), 1200)) + + if (UtilEnt.isGrounded(player) || UtilTime.elapsed(_active.get(player), MAX_VELOCITY_TIME)) { playerIterator.remove(); setWoolColor(player, DyeColor.WHITE); } } } - + public void setWoolColor(Player player, DyeColor color) { - DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); + DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); + if (disguise != null && disguise instanceof DisguiseSheep) { - DisguiseSheep sheep = (DisguiseSheep)disguise; + DisguiseSheep sheep = (DisguiseSheep) disguise; sheep.setSheared(false); sheep.setColor(color); - + sheep.UpdateDataWatcher(); Manager.GetDisguise().updateDisguise(disguise); } } - + @EventHandler public void knockback(CustomDamageEvent event) { if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { return; - - event.AddKnockback(GetName(), 2.5); + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java index 4d6bbbbc2..23dbc93d5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java @@ -17,7 +17,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; import org.bukkit.Material; import org.bukkit.Sound; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieNightDead.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieNightDead.java index 61effab98..8c41a4576 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieNightDead.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieNightDead.java @@ -1,6 +1,6 @@ package nautilus.game.arcade.kit.perks; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkZombieNightDead extends SmashPerk { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieRot.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieRot.java index a3869f76f..87e8b8d0d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieRot.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieRot.java @@ -12,7 +12,7 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.UtilBlock; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.kit.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkZombieRot extends SmashPerk { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/FissureData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/FissureData.java index c603782f7..2d66b8e93 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/FissureData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/FissureData.java @@ -3,14 +3,6 @@ package nautilus.game.arcade.kit.perks.data; import java.util.ArrayList; import java.util.HashSet; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; -import nautilus.game.arcade.kit.perks.PerkFissure; - import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.block.Block; @@ -19,6 +11,14 @@ import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.util.Vector; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import nautilus.game.arcade.game.games.smash.perks.golem.PerkFissure; + public class FissureData { private PerkFissure Host; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/HomingSheepData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/HomingSheepData.java index fb17b9a25..cb23bb935 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/HomingSheepData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/HomingSheepData.java @@ -5,13 +5,17 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import org.bukkit.DyeColor; -import org.bukkit.GameMode; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.entity.Sheep; public class HomingSheepData { + + private static final int MAX_LIFE_TICKS = 300; + private static final int TARGET_RADIUS = 2; + private static final float VELOCITY = 0.36F; + public Player Shooter; public Player Target; public Sheep Sheep; @@ -28,15 +32,21 @@ public class HomingSheepData public boolean update() { if (!Sheep.isValid() || !Target.isValid() || UtilPlayer.isSpectator(Target)) + { return true; + } - if (Sheep.getTicksLived() > 300) + if (Sheep.getTicksLived() > MAX_LIFE_TICKS) + { return true; + } - if (UtilMath.offset(Sheep.getLocation(), Target.getEyeLocation()) < 2) + if (UtilMath.offset(Sheep.getLocation(), Target.getEyeLocation()) < TARGET_RADIUS) + { return true; + } - Sheep.setVelocity(UtilAlg.getTrajectory(Sheep.getLocation(), Target.getEyeLocation()).multiply(0.36)); + Sheep.setVelocity(UtilAlg.getTrajectory(Sheep.getLocation(), Target.getEyeLocation()).multiply(VELOCITY)); Sheep.getWorld().playSound(Sheep.getLocation(), Sound.SHEEP_IDLE, 1.5f, 1.5f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/MeteorShowerData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/MeteorShowerData.java index 09edaeadd..ce6171251 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/MeteorShowerData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/MeteorShowerData.java @@ -12,20 +12,23 @@ import org.bukkit.util.Vector; public class MeteorShowerData { + public Player Shooter; public Location Target; public long Time; + private long _maxTime; - public MeteorShowerData(Player shooter, Location target) + public MeteorShowerData(Player shooter, Location target, long maxTime) { Shooter = shooter; Target = target; Time = System.currentTimeMillis(); + _maxTime = maxTime; } public boolean update() { - if (UtilTime.elapsed(Time, 12000)) + if (UtilTime.elapsed(Time, _maxTime)) return true; LargeFireball ball = Target.getWorld().spawn(Target.clone().add(Math.random() * 24 - 12, 32 + Math.random() * 16, Math.random() * 24 - 12), LargeFireball.class); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/WoolBombData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/WoolBombData.java index 9699b9972..c94cd1e08 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/WoolBombData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/WoolBombData.java @@ -21,6 +21,7 @@ public class WoolBombData public void restore() { - Block.setTypeIdAndData(Material.getId(), Data, true); + Block.setType(Material); + Block.setData(Data); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/RecoveryMasterStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/RecoveryMasterStatTracker.java index d3e9f4447..f97b006a8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/RecoveryMasterStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/RecoveryMasterStatTracker.java @@ -7,6 +7,7 @@ import java.util.UUID; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import mineplex.core.common.util.UtilPlayer; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; @@ -46,6 +47,11 @@ public class RecoveryMasterStatTracker extends StatTracker { if (getGame().GetState() != Game.GameState.Live) return; + + if (event.GetCause() == DamageCause.VOID) + { + return; + } Player damagee = event.GetDamageePlayer(); if (damagee == null) From f5a7f35d9427212363f245d1865298be42562224 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 23 Sep 2016 18:58:14 +0100 Subject: [PATCH 003/147] More kits --- .../game/games/smash/kits/KitSkySquid.java | 82 ++---- .../smash/perks/skeleton/PerkBarrage.java | 152 +++++++---- .../smash/perks/skeleton/SmashSkeleton.java | 77 ++++++ .../perks/{ => squid}/DataSquidGeyser.java | 8 +- .../perks/{ => squid}/PerkFishFlurry.java | 169 +++++++------ .../games/smash/perks/squid/PerkInkBlast.java | 169 +++++++++++++ .../smash/perks/squid/PerkStormSquid.java | 236 ++++++++++++++++++ .../smash/perks/squid/PerkSuperSquid.java | 136 ++++++++++ .../src/nautilus/game/arcade/kit/Perk.java | 4 +- .../game/arcade/kit/perks/PerkInkBlast.java | 116 +++++---- .../kit/perks/PerkSkeletonArrowStorm.java | 82 +++--- .../arcade/kit/perks/PerkSlimeRocket.java | 186 +++++++------- .../game/arcade/kit/perks/PerkSlimeSlam.java | 174 ++++++++----- .../game/arcade/kit/perks/PerkSuperSquid.java | 104 +++++--- 14 files changed, 1214 insertions(+), 481 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/SmashSkeleton.java rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/{ => squid}/DataSquidGeyser.java (57%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/{ => squid}/PerkFishFlurry.java (62%) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkInkBlast.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkStormSquid.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkSuperSquid.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java index 9533837d8..f741e8db8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java @@ -1,29 +1,30 @@ package nautilus.game.arcade.game.games.smash.kits; +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.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseSquid; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; -import nautilus.game.arcade.game.games.smash.perks.PerkFishFlurry; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.game.games.smash.perks.squid.PerkFishFlurry; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import nautilus.game.arcade.kit.perks.PerkInkBlast; +import nautilus.game.arcade.kit.perks.PerkStormSquid; +import nautilus.game.arcade.kit.perks.PerkSuperSquid; -public class KitSkySquid extends SmashKit +public class KitSkySquid extends SmashKit2 { - private static final String[] DESCRIPTION = { - }; - + private static final Perk[] PERKS = { new PerkSmashStats(6, 1.5, 0.25, 5), new PerkDoubleJump("Double Jump", 0.9, 0.9, false), @@ -74,33 +75,19 @@ public class KitSkySquid extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + new ItemStack(Material.CHAINMAIL_BOOTS), + new ItemStack(Material.CHAINMAIL_LEGGINGS), + new ItemStack(Material.CHAINMAIL_CHESTPLATE), null }; public KitSkySquid(ArcadeManager manager) { - super(manager, "Sky Squid", KitAvailability.Gem, 3000, DESCRIPTION, PERKS, EntityType.SQUID, IN_HAND, "Storm Squid", 24000, Sound.SPLASH2); + super(manager, "Sky Squid", KitAvailability.Gem, 3000, PERKS, EntityType.SQUID, IN_HAND, DisguiseSquid.class); } - @Override - public void giveCoreItems(Player player) - { - UtilInv.Clear(player); - - player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1], PLAYER_ITEMS[2]); - - if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(PLAYER_ITEMS[3]); - - player.getInventory().setArmorContents(PLAYER_ARMOR); - } - - @Override - public void giveSuperItems(Player player) + public void giveSmashItems(Player player) { player.getInventory().remove(Material.IRON_SWORD); player.getInventory().remove(Material.IRON_AXE); @@ -113,32 +100,15 @@ public class KitSkySquid extends SmashKit @Override public void GiveItems(Player player) { - giveCoreItems(player); + disguise(player); + + UtilInv.Clear(player); - //Disguise - DisguiseSquid disguise = new DisguiseSquid(player); + player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1], PLAYER_ITEMS[2]); - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else - disguise.setName(player.getName()); + if (Manager.GetGame().GetState() == GameState.Recruit) + player.getInventory().addItem(PLAYER_ITEMS[3]); - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); - } - - @Override - public void activateSuperCustom(Player player) - { - Manager.GetGame().WorldWeatherEnabled = true; - Manager.GetGame().WorldData.World.setStorm(true); - Manager.GetGame().WorldData.World.setThundering(true); - Manager.GetGame().WorldData.World.setThunderDuration(9999); - } - - @Override - public void deactivateSuperCustom(Player player) - { - Manager.GetGame().WorldWeatherEnabled = false; + player.getInventory().setArmorContents(PLAYER_ARMOR); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBarrage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBarrage.java index 2271d1cb0..819afe86b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBarrage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBarrage.java @@ -14,7 +14,6 @@ import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityShootBowEvent; import org.bukkit.event.entity.ProjectileHitEvent; @@ -25,10 +24,10 @@ import org.bukkit.util.Vector; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; @@ -36,8 +35,8 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkBarrage extends SmashPerk { - private Map _charge = new HashMap<>(); - private Map _chargeLast = new HashMap<>(); + private Map _charge = new HashMap<>(); + private Map _chargeLast = new HashMap<>(); private Set _firing = new HashSet<>(); private Set _arrows = new HashSet(); @@ -102,13 +101,17 @@ public class PerkBarrage extends SmashPerk return; if (event.getClickedBlock() != null) + { if (UtilBlock.usable(event.getClickedBlock())) + { return; - + } + } + // Start Charge - _charge.put(player, 0); - _chargeLast.put(player, System.currentTimeMillis()); - _firing.remove(player); + _charge.put(player.getUniqueId(), 0); + _chargeLast.put(player.getUniqueId(), System.currentTimeMillis()); + _firing.remove(player.getUniqueId()); } @EventHandler @@ -119,27 +122,39 @@ public class PerkBarrage extends SmashPerk for (Player cur : UtilServer.getPlayers()) { + UUID key = cur.getUniqueId(); + // Not Charging - if (!_charge.containsKey(cur)) + if (!_charge.containsKey(key)) + { continue; - - if (_firing.contains(cur)) + } + + if (_firing.contains(key)) + { continue; - + } + // Max Charge - if (_charge.get(cur) >= _max) + if (_charge.get(key) >= _max) + { continue; - + } + // Charge Interval - if (_charge.get(cur) == 0) + if (_charge.get(key) == 0) { if (!UtilTime.elapsed(_chargeLast.get(cur), 1000)) + { continue; - } + } + } else { if (!UtilTime.elapsed(_chargeLast.get(cur), _tick)) + { continue; + } } // No Longer Holding Bow @@ -155,13 +170,13 @@ public class PerkBarrage extends SmashPerk } // Increase Charge - _charge.put(cur, _charge.get(cur) + 1); + _charge.put(key, _charge.get(key) + 1); if (_useExp) { - cur.setExp(Math.min(0.9999f, (float) _charge.get(cur) / (float) _max)); + cur.setExp(Math.min(0.9999f, (float) _charge.get(key) / (float) _max)); } - _chargeLast.put(cur, System.currentTimeMillis()); + _chargeLast.put(key, System.currentTimeMillis()); // Effect cur.playSound(cur.getLocation(), Sound.CLICK, 1f, 1f + (0.1f * _charge.get(cur))); @@ -172,25 +187,35 @@ public class PerkBarrage extends SmashPerk public void BarrageFireBow(EntityShootBowEvent event) { if (event.isCancelled()) + { return; + } if (!Manager.GetGame().IsLive()) + { return; - + } + if (!(event.getEntity() instanceof Player)) + { return; - + } + if (!(event.getProjectile() instanceof Arrow)) + { return; - + } + Player player = (Player) event.getEntity(); - if (!_charge.containsKey(player)) + if (!_charge.containsKey(player.getUniqueId())) + { return; - + } + // Start Barrage - _firing.add(player); - _chargeLast.put(player, System.currentTimeMillis()); + _firing.add(player.getUniqueId()); + _chargeLast.put(player.getUniqueId(), System.currentTimeMillis()); } @EventHandler @@ -199,11 +224,18 @@ public class PerkBarrage extends SmashPerk if (event.getType() != UpdateType.TICK) return; - HashSet remove = new HashSet(); + Set remove = new HashSet(); - for (Player cur : _firing) + for (UUID key : _firing) { - if (!_charge.containsKey(cur) || !_chargeLast.containsKey(cur)) + Player cur = UtilPlayer.searchExact(key); + + if (cur == null) + { + continue; + } + + if (!_charge.containsKey(key) || !_chargeLast.containsKey(key)) { remove.add(cur); continue; @@ -215,17 +247,17 @@ public class PerkBarrage extends SmashPerk continue; } - int arrows = _charge.get(cur); + int arrows = _charge.get(key); if (arrows <= 0) { remove.add(cur); continue; } - _charge.put(cur, arrows - 1); + _charge.put(key, arrows - 1); if (_useExp) { - cur.setExp(Math.min(0.9999f, (float) _charge.get(cur) / (float) _max)); + cur.setExp(Math.min(0.9999f, _charge.get(key) / _max)); } // Fire Arrow @@ -237,14 +269,14 @@ public class PerkBarrage extends SmashPerk } for (Player cur : remove) - { + { if (_useExp) { cur.setExp(0f); } - _charge.remove(cur); - _chargeLast.remove(cur); - _firing.remove(cur); + _charge.remove(cur.getUniqueId()); + _chargeLast.remove(cur.getUniqueId()); + _firing.remove(cur.getUniqueId()); } } @@ -252,22 +284,32 @@ public class PerkBarrage extends SmashPerk public void BarrageDamageTime(CustomDamageEvent event) { if (!_noDelay) + { return; - + } + if (event.GetProjectile() == null) + { return; - + } + if (event.GetDamagerPlayer(true) == null) + { return; - + } + if (!(event.GetProjectile() instanceof Arrow)) + { return; - + } + Player damager = event.GetDamagerPlayer(true); - if (!Kit.HasKit(damager)) + if (!hasPerk(damager)) + { return; - + } + event.SetCancelled("Barrage Cancel"); event.GetProjectile().remove(); @@ -280,22 +322,30 @@ public class PerkBarrage extends SmashPerk public void BarrageProjectileHit(ProjectileHitEvent event) { if (_remove) - if (_arrows.remove(event.getEntity())) + { + if (_arrows.remove(event.getEntity().getUniqueId())) + { event.getEntity().remove(); + } + } } @EventHandler public void BarrageClean(UpdateEvent event) { if (event.getType() != UpdateType.SEC) + { return; - + } + for (Iterator arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) { Projectile arrow = arrowIterator.next(); if (arrow.isDead() || !arrow.isValid()) + { arrowIterator.remove(); + } } } @@ -307,16 +357,10 @@ public class PerkBarrage extends SmashPerk clean(player); } - @Override - public void addSuperCustom(Player player) - { - clean(player); - } - public void clean(Player player) { - _charge.remove(player); - _chargeLast.remove(player); - _firing.remove(player); + _charge.remove(player.getUniqueId()); + _chargeLast.remove(player.getUniqueId()); + _firing.remove(player.getUniqueId()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/SmashSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/SmashSkeleton.java new file mode 100644 index 000000000..6dad090ab --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/SmashSkeleton.java @@ -0,0 +1,77 @@ +package nautilus.game.arcade.game.games.smash.perks.skeleton; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + +import org.bukkit.Sound; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.util.Vector; + +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; + +public class SmashSkeleton extends SmashUltimate +{ + + private static final long DURATION = 8000; + + private Set _arrows = new HashSet(); + + public SmashSkeleton() + { + super("Arrow Storm", new String[] {}, Sound.SKELETON_HURT, DURATION); + } + + @EventHandler + public void fireArrows(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + for (Player cur : ((SmashKit) Kit).getSuperActive()) + { + Vector random = new Vector((Math.random() - 0.5) / 5, (Math.random() - 0.5) / 5, (Math.random() - 0.5) / 5); + Projectile arrow = cur.launchProjectile(Arrow.class); + arrow.setVelocity(cur.getLocation().getDirection().add(random).multiply(3)); + _arrows.add(arrow); + cur.getWorld().playSound(cur.getLocation(), Sound.SHOOT_ARROW, 1f, 1f); + } + } + + @EventHandler + public void projectileHit(ProjectileHitEvent event) + { + if (_arrows.remove(event.getEntity())) + { + event.getEntity().remove(); + } + } + + @EventHandler + public void clean(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + { + return; + } + + for (Iterator arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) + { + Projectile arrow = arrowIterator.next(); + + if (arrow.isDead() || !arrow.isValid()) + { + arrowIterator.remove(); + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/DataSquidGeyser.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/DataSquidGeyser.java similarity index 57% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/DataSquidGeyser.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/DataSquidGeyser.java index 298a40fe3..c0446fc03 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/DataSquidGeyser.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/DataSquidGeyser.java @@ -1,6 +1,6 @@ -package nautilus.game.arcade.game.games.smash.perks; +package nautilus.game.arcade.game.games.smash.perks.squid; -import java.util.HashSet; +import java.util.Set; import org.bukkit.block.Block; import org.bukkit.entity.Player; @@ -8,10 +8,10 @@ import org.bukkit.entity.Player; public class DataSquidGeyser { public Player Player; - public HashSet Blocks; + public Set Blocks; public long StartTime; - public DataSquidGeyser(Player player, HashSet blocks) + public DataSquidGeyser(Player player, Set blocks) { StartTime = System.currentTimeMillis(); Player = player; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkFishFlurry.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkFishFlurry.java similarity index 62% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkFishFlurry.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkFishFlurry.java index 52e4002dc..c28aa56dc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkFishFlurry.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkFishFlurry.java @@ -1,8 +1,10 @@ -package nautilus.game.arcade.game.games.smash.perks; +package nautilus.game.arcade.game.games.smash.perks.squid; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; +import java.util.List; +import java.util.Set; import org.bukkit.Material; import org.bukkit.Sound; @@ -12,7 +14,6 @@ import org.bukkit.entity.Item; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.util.Vector; @@ -23,13 +24,16 @@ import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; @@ -37,129 +41,140 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkFishFlurry extends SmashPerk implements IThrown { - private ArrayList _active = new ArrayList(); - public PerkFishFlurry() + private static final long COOLDOWN = 24000; + private static final int DAMAGE = 3; + private static final int START_TIME = 2000; + private static final int END_TIME = 6000; + private static final float KNOCKBACK_MAGNITUDE = 1.5F; + + private List _active = new ArrayList<>(); + + public PerkFishFlurry() { - super("Fish Flurry", new String[] - { - C.cYellow + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + "Fish Flurry" - }); + super("Fish Flurry", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + "Fish Flurry" }); } - @EventHandler public void shoot(PlayerInteractEvent event) { if (event.isCancelled()) + { return; + } - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + if (!UtilEvent.isAction(event, ActionType.R)) + { return; + } if (UtilBlock.usable(event.getClickedBlock())) + { return; - - if (event.getPlayer().getItemInHand() == null) - return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_SPADE")) - return; + } Player player = event.getPlayer(); - - if (isSuperActive(player)) - return; - if (!Kit.HasKit(player)) + if (!UtilItem.isSpade(player.getItemInHand())) + { return; - - Block block = player.getTargetBlock((HashSet) null, 64); - + } + + if (!hasPerk(player)) + { + return; + } + + if (isSuperActive(player)) + { + return; + } + + Block block = UtilPlayer.getTargetLocation(player, 64).getBlock(); + if (block == null || block.getType() == Material.AIR) { UtilPlayer.message(player, F.main("Game", "You must target a block.")); return; } - if (!Recharge.Instance.use(player, GetName(), 24000, true, true)) + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { return; + } event.setCancelled(true); - HashSet blocks = new HashSet(); - + Set blocks = new HashSet<>(); + for (Block cur : UtilBlock.getInRadius(block, 3.5d).keySet()) { - if(cur == null) + if (cur == null) + { continue; - + } + if (UtilBlock.airFoliage(cur)) + { continue; - + } + if (!UtilBlock.airFoliage(cur.getRelative(BlockFace.UP))) + { continue; - + } + blocks.add(cur); } - + _active.add(new DataSquidGeyser(player, blocks)); - //Inform + // Inform UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); } - + @EventHandler public void update(UpdateEvent event) { if (event.getType() != UpdateType.TICK) + { return; - + } + Iterator activeIter = _active.iterator(); - + while (activeIter.hasNext()) { DataSquidGeyser data = activeIter.next(); - - //particles + + // particles for (Block block : data.Blocks) + { UtilParticle.PlayParticle(ParticleType.SPLASH, block.getLocation().add(0.5, 1, 0.5), 0.25f, 0, 0.25f, 0, 3, ViewDist.LONG, UtilServer.getPlayers()); - - //sound + } + + // sound Block block = UtilAlg.Random(data.Blocks); if (Math.random() > 0.5) + { block.getWorld().playSound(block.getLocation(), Math.random() > 0.5 ? Sound.SPLASH : Sound.SPLASH2, 0.5f, 1f); - - //Fish - if (!UtilTime.elapsed(data.StartTime, 2000)) - { - } - else if (!UtilTime.elapsed(data.StartTime, 6000)) + + if (UtilTime.elapsed(data.StartTime, START_TIME) && !UtilTime.elapsed(data.StartTime, END_TIME)) { - for (int i=0 ; i<1 ; i++) - { - Item fish = block.getWorld().dropItem(block.getLocation().add(0.5, 1.5, 0.5), - ItemStackFactory.Instance.CreateStack(Material.RAW_FISH, (byte)UtilMath.r(4), 1, "Fish" + System.currentTimeMillis())); - - Vector random = new Vector( - Math.random() - 0.5, - 1 + Math.random() * 1, - Math.random() - 0.5); - - - UtilAction.velocity(fish, random, 0.25 + 0.4 * Math.random(), false, 0, 0.2, 10, false); - - Manager.GetProjectile().AddThrow(fish, data.Player, this, - -1, true, false, true, true, - null, 1f, 1f, - null, UpdateType.TICK, 1f); - } + Item fish = block.getWorld().dropItem(block.getLocation().add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.RAW_FISH, (byte) UtilMath.r(4), 1, "Fish" + Math.random())); + + Vector random = new Vector(Math.random() - 0.5, 1 + Math.random() * 1, Math.random() - 0.5); + + UtilAction.velocity(fish, random, 0.25 + 0.4 * Math.random(), false, 0, 0.2, 10, false); + + Manager.GetProjectile().AddThrow(fish, data.Player, this, -1, true, false, true, true, null, 1f, 1f, null, UpdateType.TICK, 1f); } - else + else { activeIter.remove(); } @@ -167,15 +182,13 @@ public class PerkFishFlurry extends SmashPerk implements IThrown } @Override - public void Collide(LivingEntity target, Block block, ProjectileUser data) + public void Collide(LivingEntity target, Block block, ProjectileUser data) { if (target != null) { - //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, - DamageCause.PROJECTILE, 3, true, false, false, - UtilEnt.getName(data.getThrower()), GetName()); - + // Damage Event + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, DAMAGE, true, false, false, UtilEnt.getName(data.getThrower()), GetName()); + UtilParticle.PlayParticle(ParticleType.EXPLODE, target.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 12, ViewDist.LONG, UtilServer.getPlayers()); } @@ -183,26 +196,26 @@ public class PerkFishFlurry extends SmashPerk implements IThrown } @Override - public void Idle(ProjectileUser data) + public void Idle(ProjectileUser data) { data.getThrown().remove(); } @Override - public void Expire(ProjectileUser data) + public void Expire(ProjectileUser data) { data.getThrown().remove(); } - @EventHandler public void Knockback(CustomDamageEvent event) { if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { return; + } - event.AddKnockback(GetName(), 1.5); - - event.setKnockbackOrigin(event.GetDamageeEntity().getLocation().add(Math.random()-0.5, -0.1, Math.random()-0.5)); + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + event.setKnockbackOrigin(event.GetDamageeEntity().getLocation().add(Math.random() - 0.5, -0.1, Math.random() - 0.5)); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkInkBlast.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkInkBlast.java new file mode 100644 index 000000000..eb9def768 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkInkBlast.java @@ -0,0 +1,169 @@ +package nautilus.game.arcade.game.games.smash.perks.squid; + +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.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkInkBlast extends SmashPerk implements IThrown +{ + + private static final long COOLDOWN = 6000; + private static final float PROJECTILE_VELOCITY = 0.15F; + private static final int KNOCKBACK_MAGNITUDE = 3; + + private int _bullets; + private double _damagePerBullet; + + public PerkInkBlast(int bullets, double damagePerBullet) + { + super("Ink Shotgun", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Ink Shotgun" }); + + _bullets = bullets; + _damagePerBullet = damagePerBullet; + } + + @EventHandler + public void shoot(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isAxe(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (isSuperActive(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } + + event.setCancelled(true); + + UtilInv.Update(player); + + for (int i = 0; i < _bullets; i++) + { + Item ent = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(Material.INK_SACK, (byte) 0, 1, "Ink" + Math + .random())); + + Vector random = new Vector(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5); + random.normalize(); + random.multiply(PROJECTILE_VELOCITY); + + if (i == 0) + { + random.multiply(0); + } + + UtilAction.velocity(ent, player.getLocation().getDirection().add(random), 1 + 0.4 * Math.random(), false, 0, 0.2, 10, false); + + Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true, null, 1f, 1f, ParticleType.EXPLODE, UpdateType.FASTEST, 0.5f); + } + + // Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); + + // Effect + player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 1.5f, 0.75f); + player.getWorld().playSound(player.getLocation(), Sound.SPLASH, 0.75f, 1f); + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + Explode(data); + + if (target == null) + { + return; + } + + // Damage Event + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, _damagePerBullet, true, true, false, UtilEnt.getName(data.getThrower()), GetName()); + + UtilParticle.PlayParticle(ParticleType.EXPLODE, target.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 12, ViewDist.LONG, UtilServer.getPlayers()); + } + + @Override + public void Idle(ProjectileUser data) + { + Explode(data); + } + + @Override + public void Expire(ProjectileUser data) + { + Explode(data); + } + + public void Explode(ProjectileUser data) + { + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.EXPLODE, 0.75f, 1.25f); + data.getThrown().remove(); + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkStormSquid.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkStormSquid.java new file mode 100644 index 000000000..03afbb943 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkStormSquid.java @@ -0,0 +1,236 @@ +package nautilus.game.arcade.game.games.smash.perks.squid; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.recharge.Recharge; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.games.smash.kits.KitSkySquid; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; + +public class PerkStormSquid extends SmashUltimate +{ + + private static final int DURATION = 24000; + private static final int RATE = 1600; + private static final int MAX_RANGE = 100; + private static final int DAMAGE = 16; + private static final int DAMAGE_RADIUS = 8; + private static final int KNOCKBACK_MAGNITUDE = 3; + + public PerkStormSquid() + { + super("Storm Squid", new String[] {}, Sound.SPLASH2, DURATION); + } + + @Override + public void activate(Player player) + { + super.activate(player); + + Game game = Manager.GetGame(); + + game.WorldWeatherEnabled = true; + game.WorldData.World.setStorm(true); + game.WorldData.World.setThundering(true); + game.WorldData.World.setThunderDuration(9999); + + if (Kit instanceof KitSkySquid) + { + KitSkySquid squid = (KitSkySquid) Kit; + + squid.giveSmashItems(player); + } + } + + @Override + public void cancel(Player player) + { + super.cancel(player); + + Game game = Manager.GetGame(); + + game.WorldWeatherEnabled = false; + + player.setFlying(false); + } + + @EventHandler(priority = EventPriority.LOW) // Happen before activation of + // Super + public void lightningStrike(PlayerInteractEvent event) + { + final Player player = event.getPlayer(); + + if (!isUsingUltimate(player)) + { + return; + } + + if (event.getAction() == Action.PHYSICAL) + { + return; + } + + Block block = UtilPlayer.getTargetLocation(player, MAX_RANGE).getBlock(); + + if (block == null) + { + return; + } + + final Location loc = block.getLocation().add(0.5, 0.5, 0.5); + + if (!Recharge.Instance.use(player, GetName() + " Strike", RATE, false, false)) + { + return; + } + + // Warning + UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, loc.clone().add(0, 0.5, 0), 1f, 1f, 1f, 0.1f, 40, ViewDist.MAX, UtilServer.getPlayers()); + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, loc.clone().add(0, 0.5, 0), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); + + Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable() + { + @Override + public void run() + { + // Warning + player.getWorld().spigot().strikeLightningEffect(loc, false); + + Map targets = UtilEnt.getInRadius(loc, DAMAGE_RADIUS); + + for (LivingEntity cur : targets.keySet()) + { + if (cur.equals(player)) + { + continue; + } + + // Damage Event + Manager.GetDamage().NewDamageEvent(cur, player, null, DamageCause.CUSTOM, DAMAGE * targets.get(cur), false, true, false, player.getName(), GetName()); + + // Velocity + UtilAction.velocity(cur, UtilAlg.getTrajectory(loc, cur.getLocation()), 3 * targets.get(cur), false, 0, 1 * targets.get(cur), 2, true); + } + } + }, 10); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void attackCancel(CustomDamageEvent event) + { + if (event.IsCancelled()) + { + return; + } + + Player player = event.GetDamagerPlayer(true); + + if (player == null) + { + return; + } + + if (!isUsingUltimate(player)) + { + return; + } + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + { + return; + } + + event.SetCancelled("Wither Form Melee Cancel"); + } + + @EventHandler + public void flight(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + for (Player player : ((SmashKit) Kit).getSuperActive()) + { + if (player.isFlying()) + { + continue; + } + + player.setAllowFlight(true); + player.setFlying(true); + } + } + + @EventHandler + public void flightBump(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + { + return; + } + + for (Player player : ((SmashKit) Kit).getSuperActive()) + { + List collisions = new ArrayList<>(); + + // Bump + for (Block block : UtilBlock.getInRadius(player.getLocation().add(0, 0.5, 0), 1.5d).keySet()) + { + if (!UtilBlock.airFoliage(block)) + { + collisions.add(block.getLocation().add(0.5, 0.5, 0.5)); + } + } + + Vector vec = UtilAlg.getAverageBump(player.getLocation(), collisions); + + if (vec == null) + { + continue; + } + + UtilAction.velocity(player, vec, 0.6, false, 0, 0.4, 10, true); + } + } + + @EventHandler + public void knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkSuperSquid.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkSuperSquid.java new file mode 100644 index 000000000..5f1d54bae --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkSuperSquid.java @@ -0,0 +1,136 @@ +package nautilus.game.arcade.game.games.smash.perks.squid; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkSuperSquid extends SmashPerk +{ + + private static final long COOLDOWN = 8000; + private static final long VELOCITY_TIME = 1100; + + private Map _active = new HashMap<>(); + + public PerkSuperSquid() + { + super("Super Squid", new String[] { C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Super Squid", }); + } + + @EventHandler + public void Activate(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isSword(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (isSuperActive(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } + + _active.put(player.getUniqueId(), System.currentTimeMillis()); + + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + for (Player cur : UtilServer.getPlayers()) + { + if (!_active.containsKey(cur.getUniqueId())) + { + continue; + } + + if (isSuperActive(cur)) + { + continue; + } + + if (!cur.isBlocking()) + { + _active.remove(cur.getUniqueId()); + continue; + } + + if (UtilTime.elapsed(_active.get(cur.getUniqueId()), VELOCITY_TIME)) + { + _active.remove(cur.getUniqueId()); + continue; + } + + UtilAction.velocity(cur, 0.6, 0.1, 1, true); + + cur.getWorld().playSound(cur.getLocation(), Sound.SPLASH2, 0.5f, 1f); + UtilParticle.PlayParticle(ParticleType.SPLASH, cur.getLocation().add(0, 0.5, 0), 0.3f, 0.3f, 0.3f, 0, 60, ViewDist.LONG, UtilServer.getPlayers()); + } + } + + @EventHandler + public void DamageCancel(CustomDamageEvent event) + { + if (_active.containsKey(event.GetDamageeEntity().getUniqueId())) + { + event.SetCancelled("Super Squid"); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Perk.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Perk.java index 111503930..18a51d276 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Perk.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Perk.java @@ -1,6 +1,8 @@ package nautilus.game.arcade.kit; import nautilus.game.arcade.ArcadeManager; + +import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.Listener; @@ -46,7 +48,7 @@ public abstract class Perk implements Listener } ProgressingKit progressingKit = (ProgressingKit) Kit; - + return Kit.HasKit(player) && progressingKit.getUpgradeLevel(player.getUniqueId()) == _upgradeLevel; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java index 0c62875b9..f2bcd0c40 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java @@ -3,10 +3,10 @@ package nautilus.game.arcade.kit.perks; 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.block.Action; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.util.Vector; @@ -16,12 +16,15 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; @@ -32,106 +35,117 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkInkBlast extends SmashPerk implements IThrown { + + private static final long COOLDOWN = 6000; + private static final float PROJECTILE_VELOCITY = 0.15F; + private static final int KNOCKBACK_MAGNITUDE = 3; + private int _bullets; private double _damagePerBullet; public PerkInkBlast(int bullets, double damagePerBullet) { - super("Ink Shotgun", new String[] - { - C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Ink Shotgun" - }); + super("Ink Shotgun", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Ink Shotgun" }); _bullets = bullets; _damagePerBullet = damagePerBullet; } - @EventHandler public void shoot(PlayerInteractEvent event) { if (event.isCancelled()) + { return; + } - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + if (!UtilEvent.isAction(event, ActionType.R)) + { return; + } if (UtilBlock.usable(event.getClickedBlock())) + { return; - - if (event.getPlayer().getItemInHand() == null) - return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) - return; + } Player player = event.getPlayer(); - + + if (!UtilItem.isAxe(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + if (isSuperActive(player)) + { return; + } - if (!Kit.HasKit(player)) - return; - - if (!Recharge.Instance.use(player, GetName(), 6000, true, true)) + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { return; + } event.setCancelled(true); UtilInv.Update(player); - for (int i=0 ; i < _bullets ; i++) + for (int i = 0; i < _bullets; i++) { - org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), - ItemStackFactory.Instance.CreateStack(Material.INK_SACK, (byte)0, 1, "Ink" + Math.random())); - + Item ent = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(Material.INK_SACK, (byte) 0, 1, "Ink" + Math + .random())); + Vector random = new Vector(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5); random.normalize(); - random.multiply(0.15); - - if (i==0) + random.multiply(PROJECTILE_VELOCITY); + + if (i == 0) + { random.multiply(0); - - UtilAction.velocity(ent, player.getLocation().getDirection().add(random), 1 + 0.4 * Math.random(), false, 0, 0.2, 10, false); - - Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true, - null, 1f, 1f, - ParticleType.EXPLODE, UpdateType.TICK, - 0.5f); + } + + UtilAction.velocity(ent, player.getLocation().getDirection().add(random), 1 + 0.4 * Math.random(), false, 0, 0.2, 10, false); + + Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true, null, 1f, 1f, ParticleType.EXPLODE, UpdateType.FASTEST, 0.5f); } - //Inform + // Inform UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); - //Effect + // Effect player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 1.5f, 0.75f); player.getWorld().playSound(player.getLocation(), Sound.SPLASH, 0.75f, 1f); } @Override - public void Collide(LivingEntity target, Block block, ProjectileUser data) + public void Collide(LivingEntity target, Block block, ProjectileUser data) { Explode(data); - - if (target == null) - return; - //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, - DamageCause.PROJECTILE, _damagePerBullet, true, true, false, - UtilEnt.getName(data.getThrower()), GetName()); - + if (target == null) + { + return; + } + + // Damage Event + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, _damagePerBullet, true, true, false, UtilEnt.getName(data.getThrower()), GetName()); + UtilParticle.PlayParticle(ParticleType.EXPLODE, target.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 12, ViewDist.LONG, UtilServer.getPlayers()); } @Override - public void Idle(ProjectileUser data) + public void Idle(ProjectileUser data) { Explode(data); } @Override - public void Expire(ProjectileUser data) + public void Expire(ProjectileUser data) { Explode(data); } @@ -141,13 +155,15 @@ public class PerkInkBlast extends SmashPerk implements IThrown data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.EXPLODE, 0.75f, 1.25f); data.getThrown().remove(); } - + @EventHandler public void Knockback(CustomDamageEvent event) { if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { return; - - event.AddKnockback(GetName(), 3); + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletonArrowStorm.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletonArrowStorm.java index e2cf525b6..5b8a8f72a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletonArrowStorm.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletonArrowStorm.java @@ -11,7 +11,6 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.util.Vector; - import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; import nautilus.game.arcade.game.games.smash.perks.SmashKit; @@ -19,51 +18,50 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkSkeletonArrowStorm extends SmashPerk { - private HashSet _arrows = new HashSet(); + private HashSet _arrows = new HashSet(); - public PerkSkeletonArrowStorm() - { - super("Arrow Storm", new String[] - { - - }, false); - } + public PerkSkeletonArrowStorm() + { + super("Arrow Storm", new String[] { - @EventHandler - public void fireArrows(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; + }, false); + } - for (Player cur : ((SmashKit)Kit).getSuperActive()) - { - Vector random = new Vector((Math.random() - 0.5) / 5, (Math.random() - 0.5) / 5, (Math.random() - 0.5) / 5); - Projectile arrow = cur.launchProjectile(Arrow.class); - arrow.setVelocity(cur.getLocation().getDirection().add(random).multiply(3)); - _arrows.add(arrow); - cur.getWorld().playSound(cur.getLocation(), Sound.SHOOT_ARROW, 1f, 1f); - } - } - - @EventHandler - public void projectileHit(ProjectileHitEvent event) - { - if (_arrows.remove(event.getEntity())) - event.getEntity().remove(); - } + @EventHandler + public void fireArrows(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; - @EventHandler - public void clean(UpdateEvent event) - { - if (event.getType() != UpdateType.SEC) - return; + for (Player cur : ((SmashKit) Kit).getSuperActive()) + { + Vector random = new Vector((Math.random() - 0.5) / 5, (Math.random() - 0.5) / 5, (Math.random() - 0.5) / 5); + Projectile arrow = cur.launchProjectile(Arrow.class); + arrow.setVelocity(cur.getLocation().getDirection().add(random).multiply(3)); + _arrows.add(arrow); + cur.getWorld().playSound(cur.getLocation(), Sound.SHOOT_ARROW, 1f, 1f); + } + } - for (Iterator arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) - { - Projectile arrow = arrowIterator.next(); + @EventHandler + public void projectileHit(ProjectileHitEvent event) + { + if (_arrows.remove(event.getEntity())) + event.getEntity().remove(); + } - if (arrow.isDead() || !arrow.isValid()) - arrowIterator.remove(); - } - } + @EventHandler + public void clean(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + for (Iterator arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) + { + Projectile arrow = arrowIterator.next(); + + if (arrow.isDead() || !arrow.isValid()) + arrowIterator.remove(); + } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java index 609448ec2..f71dc6aca 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java @@ -2,6 +2,8 @@ package nautilus.game.arcade.kit.perks; import java.util.HashMap; import java.util.Iterator; +import java.util.Map; +import java.util.UUID; import org.bukkit.Material; import org.bukkit.Sound; @@ -11,8 +13,8 @@ import org.bukkit.entity.Player; import org.bukkit.entity.Slime; import org.bukkit.event.EventHandler; import org.bukkit.event.block.Action; -import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.player.PlayerInteractEvent; import mineplex.core.common.util.C; @@ -21,11 +23,11 @@ import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.disguise.disguises.DisguiseSlime; import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; @@ -38,38 +40,43 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkSlimeRocket extends SmashPerk implements IThrown { - private HashMap _charge = new HashMap(); - private HashMap _owner = new HashMap(); - private HashMap _lastAttack = new HashMap(); - - public PerkSlimeRocket() + private Map _charge = new HashMap<>(); + private Map _owner = new HashMap<>(); + private Map _lastAttack = new HashMap<>(); + + public PerkSlimeRocket() { - super("Slime Rocket", new String[] - { - C.cYellow + "Hold/Release Block" + C.cGray + " to use " + C.cGreen + "Slime Rocket" - }); + super("Slime Rocket", new String[] { C.cYellow + "Hold/Release Block" + C.cGray + " to use " + C.cGreen + "Slime Rocket" }); } @EventHandler public void EnergyUpdate(UpdateEvent event) { if (event.getType() != UpdateType.TICK) + { return; + } for (Player player : Manager.GetGame().GetPlayers(true)) { - if (!Kit.HasKit(player)) + if (!hasPerk(player)) continue; - + if (isSuperActive(player)) continue; - + int size = 1; - if (player.getExp() > 0.8) size = 3; - else if (player.getExp() > 0.55) size = 2; - - - DisguiseSlime slime = (DisguiseSlime)Manager.GetDisguise().getDisguise(player); + if (player.getExp() > 0.8) + { + size = 3; + } + else if (player.getExp() > 0.55) + { + size = 2; + } + + DisguiseSlime slime = (DisguiseSlime) Manager.GetDisguise().getActiveDisguise(player); + if (slime != null && slime.GetSize() != size) { slime.SetSize(size); @@ -79,7 +86,7 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown if (player.isBlocking()) continue; - player.setExp((float) Math.min(0.999, player.getExp()+0.004)); + player.setExp((float) Math.min(0.999, player.getExp() + 0.004)); } } @@ -102,7 +109,7 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown if (isSuperActive(player)) return; - + if (!Kit.HasKit(player)) return; @@ -110,12 +117,12 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown return; UtilPlayer.message(player, F.main("Skill", "You are charging " + F.skill(GetName()) + ".")); - + _charge.put(player, System.currentTimeMillis()); } @EventHandler - public void ChargeRelease(UpdateEvent event) + public void ChargeRelease(UpdateEvent event) { if (event.getType() != UpdateType.TICK) return; @@ -127,11 +134,11 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown Player player = chargeIterator.next(); long time = _charge.get(player); - - //Charge + + // Charge if (player.isBlocking()) { - //Energy Depleted + // Energy Depleted if (player.getExp() < 0.1) { FireRocket(player); @@ -139,29 +146,28 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown } else { - double elapsed = Math.min(3, (double)(System.currentTimeMillis() - time)/1000d); - - //Use Energy + double elapsed = Math.min(3, (double) (System.currentTimeMillis() - time) / 1000d); + + // Use Energy if (!UtilTime.elapsed(time, 3000)) { - player.setExp((float) Math.max(0, player.getExp()-0.01f)); + player.setExp((float) Math.max(0, player.getExp() - 0.01f)); } - - //AutoFire + + // AutoFire if (UtilTime.elapsed(time, 5000)) { FireRocket(player); chargeIterator.remove(); } - - //Effect - player.getWorld().playSound(player.getLocation(), Sound.SLIME_WALK, 0.5f, (float)(0.5 + 1.5*(elapsed/3d))); - UtilParticle.PlayParticle(ParticleType.SLIME, player.getLocation().add(0, 1, 0), - (float)(elapsed/6d), (float)(elapsed/6d), (float)(elapsed/6d), 0, (int)(elapsed * 5), + + // Effect + player.getWorld().playSound(player.getLocation(), Sound.SLIME_WALK, 0.5f, (float) (0.5 + 1.5 * (elapsed / 3d))); + UtilParticle.PlayParticle(ParticleType.SLIME, player.getLocation().add(0, 1, 0), (float) (elapsed / 6d), (float) (elapsed / 6d), (float) (elapsed / 6d), 0, (int) (elapsed * 5), ViewDist.LONGER, UtilServer.getPlayers()); } } - //Release + // Release else { FireRocket(player); @@ -172,32 +178,31 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown public void FireRocket(Player player) { - double charge = Math.min(3, (double)(System.currentTimeMillis() - _charge.get(player))/1000d); + double charge = Math.min(3, (double) (System.currentTimeMillis() - _charge.get(player)) / 1000d); - //Spawn Slime + // Spawn Slime Manager.GetGame().CreatureAllowOverride = true; Slime slime = player.getWorld().spawn(player.getEyeLocation(), Slime.class); slime.setSize(1); Manager.GetGame().CreatureAllowOverride = false; - //Size - slime.setSize(Math.max(1, (int)charge)); - + // Size + slime.setSize(Math.max(1, (int) charge)); + slime.setMaxHealth(5 + charge * 7); slime.setHealth(slime.getMaxHealth()); - + _owner.put(slime, player); - - //Inform + + // Inform UtilPlayer.message(player, F.main("Skill", "You released " + F.skill(GetName()) + ".")); slime.leaveVehicle(); player.eject(); - UtilAction.velocity(slime, player.getLocation().getDirection(), 1 + charge/2d, false, 0, 0.2, 10, true); - - Manager.GetProjectile().AddThrow(slime, player, this, -1, true, true, true, true, - null, 0, 0, null, 0, UpdateType.FASTEST, 1f); + UtilAction.velocity(slime, player.getLocation().getDirection(), 1 + charge / 2d, false, 0, 0.2, 10, true); + + Manager.GetProjectile().AddThrow(slime, player, this, -1, true, true, true, true, null, 0, 0, null, 0, UpdateType.FASTEST, 1f); } @EventHandler @@ -213,13 +218,13 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown { TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); Player targetPlayer = (Player) event.getTarget(); - + if (smash.GetTeam(_owner.get(event.getEntity())).equals(smash.GetTeam(targetPlayer))) { event.setCancelled(true); } } - + if (_owner.get(event.getEntity()).equals(event.getTarget())) { event.setCancelled(true); @@ -231,85 +236,82 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown { if (target == null) return; - + if (!(data.getThrown() instanceof Slime)) return; - - Slime slime = (Slime)data.getThrown(); + + Slime slime = (Slime) data.getThrown(); if (Manager.GetGame() instanceof TeamSuperSmash && target instanceof Player && data.getThrower() instanceof Player) { TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); Player targetPlayer = (Player) target; Player throwerPlayer = (Player) data.getThrower(); - - if(smash.GetTeam(targetPlayer).equals(smash.GetTeam(throwerPlayer))) + + if (smash.GetTeam(targetPlayer).equals(smash.GetTeam(throwerPlayer))) { return; } } - - //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, - DamageCause.PROJECTILE, 3 + slime.getSize() * 3, true, true, false, - UtilEnt.getName(data.getThrower()), GetName()); + + // Damage Event + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 3 + slime.getSize() * 3, true, true, false, UtilEnt.getName(data.getThrower()), GetName()); } - + @EventHandler public void Knockback(CustomDamageEvent event) { if (event.GetReason() == null || !event.GetReason().contains(GetName())) return; - + event.AddKnockback(GetName(), 3.0); } @Override public void Idle(ProjectileUser data) { - + } @Override public void Expire(ProjectileUser data) { - + } - + @EventHandler public void SlimeDamage(CustomDamageEvent event) { if (!(event.GetDamagerEntity(false) instanceof Slime)) return; - - Slime slime = (Slime)event.GetDamagerEntity(false); - - - //Attack Rate + + Slime slime = (Slime) event.GetDamagerEntity(false); + + // Attack Rate if (_lastAttack.containsKey(slime) && !UtilTime.elapsed(_lastAttack.get(slime), 500)) { event.SetCancelled("Slime Attack Rate"); return; } - + _lastAttack.put(slime, System.currentTimeMillis()); - - //Get Owner + + // Get Owner Player owner = _owner.get(slime); - //if (owner != null) - // event.SetDamager(owner); This gives knockback from wrong direction :( - + // if (owner != null) + // event.SetDamager(owner); This gives knockback from wrong direction :( + if (Manager.GetGame() instanceof TeamSuperSmash) { TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); - + if (smash.GetTeam(owner).equals(smash.GetTeam(event.GetDamageePlayer()))) { event.SetCancelled("Team Damage"); return; } } - + if (owner != null && owner.equals(event.GetDamageeEntity())) { event.SetCancelled("Owner Damage"); @@ -319,11 +321,11 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown event.AddMod("Slime Damage", "Negate", -event.GetDamageInitial(), false); event.AddMod("Slime Damage", "Attack", 2 * slime.getSize(), true); event.AddKnockback("Slime Knockback", 2); - } + } } - + @EventHandler - public void SlimeClean(UpdateEvent event) + public void SlimeClean(UpdateEvent event) { if (event.getType() != UpdateType.SEC) return; @@ -333,27 +335,27 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown while (slimeIterator.hasNext()) { Slime slime = slimeIterator.next(); - - //Shrink + + // Shrink if (slime.getVehicle() == null) { if (slime.getTicksLived() > 120) { slime.setTicksLived(1); - - Manager.GetBlood().Effects(null, slime.getLocation(), 6 + 6 * slime.getSize(), 0.2 + 0.1 * slime.getSize(), null, 1f, 1f, Material.SLIME_BALL, (byte)0, 15, false); - + + Manager.GetBlood().Effects(null, slime.getLocation(), 6 + 6 * slime.getSize(), 0.2 + 0.1 * slime.getSize(), null, 1f, 1f, Material.SLIME_BALL, (byte) 0, 15, false); + if (slime.getSize() <= 1) slime.remove(); else - slime.setSize(slime.getSize()-1); + slime.setSize(slime.getSize() - 1); } } - + if (!slime.isValid()) slimeIterator.remove(); } - + slimeIterator = _lastAttack.keySet().iterator(); while (slimeIterator.hasNext()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeSlam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeSlam.java index eb5924ca0..6b6aba795 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeSlam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeSlam.java @@ -1,12 +1,13 @@ package nautilus.game.arcade.kit.perks; import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; -import org.bukkit.GameMode; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; @@ -15,6 +16,9 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTime; @@ -23,55 +27,69 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.smash.perks.SmashPerk; -import nautilus.game.arcade.kit.Perk; public class PerkSlimeSlam extends SmashPerk { - private HashMap _live = new HashMap(); - public PerkSlimeSlam() + private static final int COOLDOWN = 6000; + private static final int HIT_BOX = 2; + private static final int START_TIME = 1000; + private static final int DAMAGE = 7; + private static final int KNOCKBACK_MAGNITUDE = 2; + + private Map _live = new HashMap<>(); + + public PerkSlimeSlam() { - super("Slime Slam", new String[] - { - C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Slime Slam" - }); + super("Slime Slam", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Slime Slam" }); } @EventHandler public void Leap(PlayerInteractEvent event) { if (event.isCancelled()) + { return; + } - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + if (!UtilEvent.isAction(event, ActionType.R)) + { return; + } if (UtilBlock.usable(event.getClickedBlock())) + { return; - - if (event.getPlayer().getItemInHand() == null) - return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) - return; + } Player player = event.getPlayer(); - - if (isSuperActive(player)) - return; - - if (!Kit.HasKit(player)) - return; - if (!Recharge.Instance.use(player, GetName(), 6000, true, true)) + if (!UtilItem.isAxe(player.getItemInHand())) + { return; + } + + if (!hasPerk(player)) + { + return; + } + + if (isSuperActive(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } UtilAction.velocity(player, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 1.2, true); - //Record - _live.put(player, System.currentTimeMillis()); + // Record + _live.put(player.getUniqueId(), System.currentTimeMillis()); - //Inform + // Inform UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); } @@ -79,63 +97,89 @@ public class PerkSlimeSlam extends SmashPerk public void End(UpdateEvent event) { if (event.getType() != UpdateType.TICK) - return; - - //Collide - for (Player player : Manager.GetGame().GetPlayers(true)) - if (_live.containsKey(player)) - for (Player other : Manager.GetGame().GetPlayers(true)) - if (!Manager.isSpectator(other)) - if (!other.equals(player)) - if (UtilMath.offset(player, other) < 2) - { - DoSlam(player, other); - _live.remove(player); - return; - } - - //End - for (Player player : Manager.GetGame().GetPlayers(true)) { - if (!UtilEnt.isGrounded(player)) - continue; + return; + } + List alivePlayers = Manager.GetGame().GetPlayers(true); + + // Collide + for (Player player : alivePlayers) + { if (!_live.containsKey(player)) + { continue; + } - if (!UtilTime.elapsed(_live.get(player), 1000)) + for (Player other : alivePlayers) + { + if (UtilPlayer.isSpectator(other)) + { + continue; + } + + if (other.equals(player)) + { + continue; + } + + if (UtilMath.offset(player, other) < HIT_BOX) + { + doSlam(player, other); + _live.remove(player); + return; + } + } + } + + // End + for (Player player : alivePlayers) + { + UUID key = player.getUniqueId(); + + if (!UtilEnt.isGrounded(player)) + { continue; - - _live.remove(player); - } + } + + if (!_live.containsKey(key)) + { + continue; + } + + if (!UtilTime.elapsed(_live.get(key), START_TIME)) + { + continue; + } + + _live.remove(key); + } } - - public void DoSlam(Player damager, LivingEntity damagee) + + public void doSlam(Player damager, LivingEntity damagee) { - int damage = 7; - - //Recoil Event + // Recoil Event if (!isSuperActive(damager)) - Manager.GetDamage().NewDamageEvent(damager, damagee, null, - DamageCause.CUSTOM, damage/4d, true, true, false, - damager.getName(), GetName() + " Recoil"); + { + Manager.GetDamage().NewDamageEvent(damager, damagee, null, DamageCause.CUSTOM, DAMAGE / 4, true, true, false, damager.getName(), GetName() + " Recoil"); + } + + // Damage Event + Manager.GetDamage().NewDamageEvent(damagee, damager, null, DamageCause.CUSTOM, DAMAGE, true, true, false, damager.getName(), GetName()); - //Damage Event - Manager.GetDamage().NewDamageEvent(damagee, damager, null, - DamageCause.CUSTOM, damage, true, true, false, - damager.getName(), GetName()); - - //Inform + // Inform UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName()) + ".")); UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill(GetName()) + ".")); } - + @EventHandler public void Knockback(CustomDamageEvent event) { if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { return; + } - event.AddKnockback(GetName(), 2); + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSuperSquid.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSuperSquid.java index 49375f65c..3d8fc7fa5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSuperSquid.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSuperSquid.java @@ -1,24 +1,27 @@ package nautilus.game.arcade.kit.perks; import java.util.HashMap; +import java.util.Map; +import java.util.UUID; -import org.bukkit.Effect; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEvent; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -27,75 +30,96 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkSuperSquid extends SmashPerk { - private HashMap _active = new HashMap(); - public PerkSuperSquid() + private static final long COOLDOWN = 8000; + private static final long VELOCITY_TIME = 1100; + + private Map _active = new HashMap<>(); + + public PerkSuperSquid() { - super("Super Squid", new String[] - { - C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Super Squid", - }); + super("Super Squid", new String[] { C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Super Squid", }); } - + @EventHandler public void Activate(PlayerInteractEvent event) { if (event.isCancelled()) + { return; - - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { return; - + } + if (UtilBlock.usable(event.getClickedBlock())) + { return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_SWORD")) - return; - + } + Player player = event.getPlayer(); + + if (!UtilItem.isSword(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } if (isSuperActive(player)) + { return; - - if (!Kit.HasKit(player)) + } + + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { return; + } - if (!Recharge.Instance.use(player, GetName(), 8000, true, true)) - return; - - _active.put(player, System.currentTimeMillis()); + _active.put(player.getUniqueId(), System.currentTimeMillis()); UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); } - + @EventHandler - public void Update(UpdateEvent event) + public void Update(UpdateEvent event) { if (event.getType() != UpdateType.TICK) + { return; - + } + for (Player cur : UtilServer.getPlayers()) { - if (!_active.containsKey(cur)) - continue; - - if (isSuperActive(cur)) - return; - - if (!cur.isBlocking()) + if (!_active.containsKey(cur.getUniqueId())) { - _active.remove(cur); continue; } - if (UtilTime.elapsed(_active.get(cur), 1100)) + if (isSuperActive(cur)) { - _active.remove(cur); + continue; + } + + if (!cur.isBlocking()) + { + _active.remove(cur.getUniqueId()); + continue; + } + + if (UtilTime.elapsed(_active.get(cur.getUniqueId()), VELOCITY_TIME)) + { + _active.remove(cur.getUniqueId()); continue; } UtilAction.velocity(cur, 0.6, 0.1, 1, true); - + cur.getWorld().playSound(cur.getLocation(), Sound.SPLASH2, 0.5f, 1f); UtilParticle.PlayParticle(ParticleType.SPLASH, cur.getLocation().add(0, 0.5, 0), 0.3f, 0.3f, 0.3f, 0, 60, ViewDist.LONG, UtilServer.getPlayers()); } @@ -104,7 +128,9 @@ public class PerkSuperSquid extends SmashPerk @EventHandler public void DamageCancel(CustomDamageEvent event) { - if (_active.containsKey(event.GetDamageeEntity())) + if (_active.containsKey(event.GetDamageeEntity().getUniqueId())) + { event.SetCancelled("Super Squid"); + } } } From baafa62713222c31f35c23337122d652ddb8086f Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 24 Sep 2016 21:09:25 +0100 Subject: [PATCH 004/147] Just more converting --- .../arcade/game/games/smash/kits/KitCow.java | 4 +- .../game/games/smash/kits/KitSlime.java | 146 +---- .../game/games/smash/kits/KitSnowman.java | 61 +- .../game/games/smash/kits/KitSpider.java | 76 +-- .../game/games/smash/kits/KitWitch.java | 80 +-- .../game/games/smash/kits/KitWither.java | 143 ----- .../games/smash/kits/KitWitherSkeleton.java | 90 +-- .../arcade/game/games/smash/kits/KitWolf.java | 79 +-- .../game/games/smash/kits/KitZombie.java | 63 +- .../games/smash/perks/blaze/PerkInferno.java | 4 +- ...CowMooshroomMadness.java => SmashCow.java} | 4 +- .../smash/perks/slime/PerkSlimeRocket.java | 422 +++++++++++++ .../smash/perks/slime/PerkSlimeSlam.java | 185 ++++++ .../games/smash/perks/slime/SmashSlime.java | 138 +++++ .../smash/perks/snowman/PerkArcticAura.java | 56 ++ .../smash/perks/snowman/PerkBlizzard.java | 173 ++++++ .../smash/perks/snowman/PerkDamageSnow.java | 49 ++ .../smash/perks/snowman/PerkIcePath.java | 112 ++++ .../smash/perks/snowman/SmashSnowman.java | 202 +++++++ .../games/smash/perks/spider/PerkNeedler.java | 186 ++++++ .../smash/perks/spider/PerkSpiderLeap.java | 170 ++++++ .../games/smash/perks/spider/PerkWebShot.java | 143 +++++ .../games/smash/perks/spider/SmashSpider.java | 154 +++++ .../games/smash/perks/witch/PerkBatWave.java | 312 ++++++++++ .../smash/perks/witch/PerkWitchPotion.java | 185 ++++++ .../games/smash/perks/witch/SmashBat.java | 312 ++++++++++ .../perks/witherskeleton/PerkWitherImage.java | 291 +++++++++ .../perks/witherskeleton/PerkWitherSkull.java | 229 +++++++ .../witherskeleton/SmashWitherSkeleton.java | 136 +++++ .../games/smash/perks/wolf/SmashWolf.java | 561 ++++++++++++++++++ .../smash/perks/zombie/PerkDeathsGrasp.java | 193 ++++++ .../perks/zombie/PerkNightLivingDead.java | 150 +++++ .../smash/perks/zombie/PerkOvercharge.java | 252 ++++++++ .../smash/perks/zombie/PerkZombieBile.java | 189 ++++++ .../arcade/kit/perks/PerkSlimeRocket.java | 141 +++-- .../game/arcade/kit/perks/PerkSpiderLeap.java | 109 ++-- 36 files changed, 5147 insertions(+), 653 deletions(-) delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWither.java rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/{PerkCowMooshroomMadness.java => SmashCow.java} (94%) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeRocket.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeSlam.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/SmashSlime.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkArcticAura.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkBlizzard.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkDamageSnow.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkIcePath.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkNeedler.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkWebShot.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/SmashBat.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherSkull.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/SmashWitherSkeleton.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/SmashWolf.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkDeathsGrasp.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkNightLivingDead.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkOvercharge.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkZombieBile.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java index 87d62ed0e..ca09f3e87 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java @@ -16,7 +16,7 @@ import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; import nautilus.game.arcade.game.games.smash.perks.SmashKit2; import nautilus.game.arcade.game.games.smash.perks.cow.PerkCowAngryHerd; import nautilus.game.arcade.game.games.smash.perks.cow.PerkCowMilkSpiral; -import nautilus.game.arcade.game.games.smash.perks.cow.PerkCowMooshroomMadness; +import nautilus.game.arcade.game.games.smash.perks.cow.SmashCow; import nautilus.game.arcade.game.games.smash.perks.cow.PerkCowStampede; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; @@ -31,7 +31,7 @@ public class KitCow extends SmashKit2 new PerkCowStampede(), new PerkCowAngryHerd(), new PerkCowMilkSpiral(), - new PerkCowMooshroomMadness() + new SmashCow() }; private static final ItemStack IN_HAND = new ItemStack(Material.MILK_BUCKET); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java index a33ce5f77..eb8c7a5f2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java @@ -1,38 +1,27 @@ package nautilus.game.arcade.game.games.smash.kits; -import mineplex.core.common.util.*; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.disguise.disguises.DisguiseBase; +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.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseSlime; import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.condition.Condition.ConditionType; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.SmashKit2; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkDoubleJump; import nautilus.game.arcade.kit.perks.PerkSlimeRocket; import nautilus.game.arcade.kit.perks.PerkSlimeSlam; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.inventory.ItemStack; - -public class KitSlime extends SmashKit +public class KitSlime extends SmashKit2 { - private static final String[] DESCRIPTION = { - }; private static final Perk[] PERKS = { new PerkSmashStats(6, 1.75, 0.35, 3), @@ -77,18 +66,24 @@ public class KitSlime extends SmashKit private static final ItemStack[] PLAYER_ARMOR = { null, null, - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + new ItemStack(Material.CHAINMAIL_CHESTPLATE), + new ItemStack(Material.CHAINMAIL_HELMET), }; public KitSlime(ArcadeManager manager) { - super(manager, "Slime", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SLIME, IN_HAND, "Giga Slime", 24000, Sound.SLIME_ATTACK); + super(manager, "Slime", KitAvailability.Free, PERKS, EntityType.SLIME, IN_HAND, DisguiseSlime.class); } - + @Override - public void giveCoreItems(Player player) + public void GiveItems(Player player) { + disguise(player); + + DisguiseSlime disguise = (DisguiseSlime) Manager.GetDisguise().getActiveDisguise(player); + + disguise.SetSize(3); + UtilInv.Clear(player); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); @@ -99,103 +94,4 @@ public class KitSlime extends SmashKit player.getInventory().setArmorContents(PLAYER_ARMOR); } - @Override - public void giveSuperItems(Player player) - { - player.getInventory().remove(Material.IRON_SWORD); - player.getInventory().remove(Material.IRON_AXE); - - UtilInv.Update(player); - } - - @Override - public void GiveItems(Player player) - { - giveCoreItems(player); - - //Disguise - DisguiseSlime disguise = new DisguiseSlime(player); - - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else - disguise.setName(player.getName()); - - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); - - disguise.SetSize(3); - } - - @Override - public void activateSuperCustom(Player player) - { - DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); - if (disguise != null && disguise instanceof DisguiseSlime) - { - DisguiseSlime slime = (DisguiseSlime) disguise; - - slime.SetSize(14); - Manager.GetDisguise().updateDisguise(slime); - } - - player.setExp(0.99f); - - Manager.GetCondition().Factory().Speed("Giga Slime", player, player, 20, 2, false, false, false); - } - - @Override - public void deactivateSuperCustom(Player player) - { - Manager.GetCondition().EndCondition(player, ConditionType.SPEED, "Giga Slime"); - } - - @EventHandler(priority = EventPriority.LOW) - public void immunityDamagee(CustomDamageEvent event) - { - if (event.GetDamageePlayer() == null || event.GetDamagerEntity(true) == null) - return; - - if (this.isSuperActive(event.GetDamageePlayer())) - event.SetCancelled(getSuperName()); - } - - @EventHandler(priority = EventPriority.LOW) - public void immunityDamager(CustomDamageEvent event) - { - if (event.GetCause() != DamageCause.ENTITY_ATTACK) - return; - - if (event.GetDamagerPlayer(true) == null) - return; - - if (isSuperActive(event.GetDamagerPlayer(true))) - event.SetCancelled(getSuperName()); - } - - @EventHandler - public void collide(UpdateEvent event) - { - for (Player player : getSuperActive()) - for (Player other : Manager.GetGame().GetPlayers(true)) - { - if (player.equals(other)) - continue; - - if (Manager.isSpectator(other)) - continue; - - if (UtilMath.offset(player.getLocation().add(0, 3, 0), other.getLocation()) < 5) - { - Manager.GetDamage().NewDamageEvent(other, player, null, - DamageCause.CUSTOM, 8, true, false, false, - player.getName(), GetName()); - - UtilParticle.PlayParticle(ParticleType.SLIME, other.getLocation().add(0, 0.6, 0), 1f, 1f, 1f, 0, 20, - ViewDist.LONG, UtilServer.getPlayers()); - - player.getWorld().playSound(other.getLocation(), Sound.SLIME_ATTACK, 3f, 1f); - } - } - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java index a9c90dc1d..49e508d07 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java @@ -1,5 +1,11 @@ package nautilus.game.arcade.game.games.smash.kits; +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.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseSnowman; @@ -7,21 +13,18 @@ import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.SmashKit2; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; +import nautilus.game.arcade.kit.perks.PerkArcticAura; +import nautilus.game.arcade.kit.perks.PerkBlizzard; +import nautilus.game.arcade.kit.perks.PerkDamageSnow; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import nautilus.game.arcade.kit.perks.PerkIcePath; +import nautilus.game.arcade.kit.perks.PerkSnowTurret; -public class KitSnowman extends SmashKit +public class KitSnowman extends SmashKit2 { - private static final String[] DESCRIPTION = { - }; private static final Perk[] PERKS = { new PerkSmashStats(6, 1.4, 0.3, 6), @@ -69,33 +72,22 @@ public class KitSnowman extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + new ItemStack(Material.CHAINMAIL_BOOTS), + new ItemStack(Material.CHAINMAIL_LEGGINGS), + new ItemStack(Material.CHAINMAIL_CHESTPLATE), + new ItemStack(Material.CHAINMAIL_HELMET), }; public KitSnowman(ArcadeManager manager) { - super(manager, "Snowman", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, EntityType.SNOWMAN, IN_HAND, "Snow Turret", 0, Sound.STEP_SNOW); - setSuperCharges(3); - } - - @Override - public void giveCoreItems(Player player) - { - - } - - @Override - public void giveSuperItems(Player player) - { - + super(manager, "Snowman", KitAvailability.Gem, 5000, PERKS, EntityType.SNOWMAN, IN_HAND, DisguiseSnowman.class); } @Override public void GiveItems(Player player) { + disguise(player); + UtilInv.Clear(player); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); @@ -103,16 +95,5 @@ public class KitSnowman extends SmashKit player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]); player.getInventory().setArmorContents(PLAYER_ARMOR); - - //Disguise - DisguiseSnowman disguise = new DisguiseSnowman(player); - - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else - disguise.setName(player.getName()); - - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java index 3569d5168..b41eb323b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java @@ -1,5 +1,11 @@ package nautilus.game.arcade.game.games.smash.kits; +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.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseSpider; @@ -7,21 +13,16 @@ import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.SmashKit2; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; +import nautilus.game.arcade.kit.perks.PerkNeedler; +import nautilus.game.arcade.kit.perks.PerkSpiderLeap; +import nautilus.game.arcade.kit.perks.PerkSpidersNest; +import nautilus.game.arcade.kit.perks.PerkWebShot; -public class KitSpider extends SmashKit +public class KitSpider extends SmashKit2 { - private static final String[] DESCRIPTION = { - }; private static final Perk[] PERKS = { new PerkSmashStats(6, 1.5, 0.25, 6), @@ -78,55 +79,32 @@ public class KitSpider extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + new ItemStack(Material.CHAINMAIL_BOOTS), + new ItemStack(Material.CHAINMAIL_LEGGINGS), + new ItemStack(Material.CHAINMAIL_CHESTPLATE), + new ItemStack(Material.CHAINMAIL_HELMET), }; public KitSpider(ArcadeManager manager) { - super(manager, "Spider", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SPIDER, IN_HAND, "Spider Nest", 30000, Sound.SPIDER_DEATH); - } - - @Override - public void giveCoreItems(Player player) - { - UtilInv.Clear(player); - - player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); - - if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3], PLAYER_ITEMS[4]); - - player.getInventory().setArmorContents(PLAYER_ARMOR); - } - - @Override - public void giveSuperItems(Player player) - { - + super(manager, "Spider", KitAvailability.Free, PERKS, EntityType.SPIDER, IN_HAND, DisguiseSpider.class); } @Override public void GiveItems(Player player) { - giveCoreItems(player); - - //Disguise - DisguiseSpider disguise = new DisguiseSpider(player); - - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else - disguise.setName(player.getName()); - - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); + disguise(player); - if (Manager.GetGame().GetState() == GameState.Prepare) + UtilInv.Clear(player); + + player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); + + if (Manager.GetGame().GetState() == GameState.Recruit) { - player.setExp(0.99F); + player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3], PLAYER_ITEMS[4]); } + + player.getInventory().setArmorContents(PLAYER_ARMOR); + player.setExp(0.99F); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java index 077cb52de..6c8999905 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java @@ -1,5 +1,12 @@ package nautilus.game.arcade.game.games.smash.kits; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseWitch; @@ -7,21 +14,16 @@ import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.SmashKit2; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; +import nautilus.game.arcade.kit.perks.PerkBatForm; +import nautilus.game.arcade.kit.perks.PerkBatWave; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import nautilus.game.arcade.kit.perks.PerkWitchPotion; -public class KitWitch extends SmashKit +public class KitWitch extends SmashKit2 { - private static final String[] DESCRIPTION = { - }; private static final Perk[] PERKS = { new PerkSmashStats(6, 1.5, 0.3, 5), @@ -74,20 +76,22 @@ public class KitWitch extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + new ItemStack(Material.CHAINMAIL_BOOTS), + new ItemStack(Material.CHAINMAIL_LEGGINGS), + new ItemStack(Material.CHAINMAIL_CHESTPLATE), null }; public KitWitch(ArcadeManager manager) { - super(manager, "Witch", KitAvailability.Gem, 6000, DESCRIPTION, PERKS, EntityType.WITCH, IN_HAND, "Bat Form", 20000, Sound.BAT_HURT); + super(manager, "Witch", KitAvailability.Gem, 6000, PERKS, EntityType.WITCH, IN_HAND, DisguiseWitch.class); } @Override - public void giveCoreItems(Player player) + public void GiveItems(Player player) { + disguise(player); + UtilInv.Clear(player); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); @@ -97,48 +101,4 @@ public class KitWitch extends SmashKit player.getInventory().setArmorContents(PLAYER_ARMOR); } - - @Override - public void giveSuperItems(Player player) - { - player.getInventory().remove(Material.IRON_SPADE); - player.getInventory().remove(Material.IRON_AXE); - - player.getInventory().addItem(PLAYER_ITEMS[4]); - - UtilInv.Update(player); - } - - @Override - public void GiveItems(Player player) - { - giveCoreItems(player); - - //Disguise - DisguiseWitch disguise = new DisguiseWitch(player); - - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else - disguise.setName(player.getName()); - - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); - } - - @Override - public void activateSuperCustom(Player player) - { - for (Perk perk : GetPerks()) - if (perk instanceof PerkDoubleJump) - ((PerkDoubleJump) perk).disableForPlayer(player); - } - - @Override - public void deactivateSuperCustom(Player player) - { - for (Perk perk : GetPerks()) - if (perk instanceof PerkDoubleJump) - ((PerkDoubleJump) perk).enableForPlayer(player); - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWither.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWither.java deleted file mode 100644 index c0bc1f970..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWither.java +++ /dev/null @@ -1,143 +0,0 @@ -package nautilus.game.arcade.game.games.smash.kits; - -import org.bukkit.Color; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.LeatherArmorMeta; - -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilServer; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkDoubleJump; -import nautilus.game.arcade.kit.perks.PerkSkullShot; - -public class KitWither extends SmashKit -{ - public KitWither(ArcadeManager manager) - { - super(manager, "Wither", KitAvailability.Gem, 5000, - - new String[] - { - }, - - new Perk[] - { - new PerkSmashStats(6, 1.2, 0.3, 6), - new PerkDoubleJump("Double Jump", 0.9, 0.9, false), - new PerkSkullShot(), - }, - EntityType.ZOMBIE, - new ItemStack(Material.BOW), - "", 0, null); - } - - @Override - public void giveCoreItems(Player player) - { - UtilInv.Clear(player); - - player.getInventory().addItem(new ItemStack(Material.ARROW)); - - ItemStack head = ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM, (byte)1, 1); - player.getInventory().setHelmet(head); - - ItemStack armor = new ItemStack(Material.LEATHER_CHESTPLATE); - LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta(); - meta.setColor(Color.BLACK); - armor.setItemMeta(meta); - player.getInventory().setChestplate(armor); - - ItemStack legs = new ItemStack(Material.LEATHER_LEGGINGS); - LeatherArmorMeta metaLegs = (LeatherArmorMeta)armor.getItemMeta(); - metaLegs.setColor(Color.BLACK); - armor.setItemMeta(metaLegs); - player.getInventory().setLeggings(legs); - - ItemStack boots = new ItemStack(Material.LEATHER_BOOTS); - LeatherArmorMeta metaBoots = (LeatherArmorMeta)armor.getItemMeta(); - metaBoots.setColor(Color.BLACK); - boots.setItemMeta(metaBoots); - player.getInventory().setBoots(boots); - } - - @Override - public void giveSuperItems(Player player) - { - - } - - @Override - public void GiveItems(Player player) - { - giveCoreItems(player); - } - - @EventHandler - public void InvisibilityUpdate(UpdateEvent event) - { - if (event.getType() != UpdateType.FAST) - return; - - for (Player player : UtilServer.getPlayers()) - { - if (!HasKit(player)) - continue; - - if (player.getInventory().getChestplate() == null) - continue; - - Manager.GetCondition().Factory().Invisible("Wither Invis", player, player, 1.9, 0, false, false, false); - } - } - - @Override - public Entity SpawnEntity(Location loc) - { - EntityType type = _entityType; - if (type == EntityType.PLAYER) - type = EntityType.ZOMBIE; - - LivingEntity entity = (LivingEntity) Manager.GetCreature().SpawnEntity(loc, type); - - entity.setRemoveWhenFarAway(false); - entity.setCustomName(GetAvailability().GetColor() + GetName() + " Kit"); - entity.setCustomNameVisible(true); - entity.getEquipment().setItemInHand(_itemInHand); - - Manager.GetCondition().Factory().Invisible("Kit Invis", entity, entity, 7777, 0, false, false, false); - - UtilEnt.Vegetate(entity); - - SpawnCustom(entity); - - return entity; - } - - @Override - public void SpawnCustom(LivingEntity ent) - { - ItemStack head = ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM, (byte)1, 1); - ent.getEquipment().setHelmet(head); - - ItemStack armor = new ItemStack(Material.LEATHER_CHESTPLATE); - LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta(); - meta.setColor(Color.BLACK); - armor.setItemMeta(meta); - ent.getEquipment().setChestplate(armor); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java index 05df3d898..6787c436f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java @@ -1,16 +1,5 @@ package nautilus.game.arcade.game.games.smash.kits; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilInv; -import mineplex.core.disguise.disguises.DisguiseSkeleton; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.game.Game.GameState; -import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Sound; @@ -19,10 +8,25 @@ import org.bukkit.entity.Player; import org.bukkit.entity.Skeleton.SkeletonType; import org.bukkit.inventory.ItemStack; -public class KitWitherSkeleton extends SmashKit +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilInv; +import mineplex.core.disguise.disguises.DisguiseSkeleton; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; +import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import nautilus.game.arcade.kit.perks.PerkWitherForm; +import nautilus.game.arcade.kit.perks.PerkWitherImage; +import nautilus.game.arcade.kit.perks.PerkWitherSkull; +import net.minecraft.server.v1_8_R3.MobSpawnerAbstract.a; + +public class KitWitherSkeleton extends SmashKit2 { - private static final String[] DESCRIPTION = { - }; private static final Perk[] PERKS = { new PerkSmashStats(6, 1.2, 0.3, 6), @@ -68,21 +72,33 @@ public class KitWitherSkeleton extends SmashKit private static final ItemStack[] PLAYER_ARMOR = { - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET) + new ItemStack(Material.CHAINMAIL_BOOTS), + new ItemStack(Material.CHAINMAIL_LEGGINGS), + new ItemStack(Material.CHAINMAIL_CHESTPLATE), + new ItemStack(Material.CHAINMAIL_HELMET) }; - public KitWitherSkeleton(ArcadeManager manager) { - super(manager, "Wither Skeleton", KitAvailability.Gem, 6000, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND, "Wither Form", 18000, Sound.WITHER_SPAWN); + super(manager, "Wither Skeleton", KitAvailability.Gem, 6000, PERKS, EntityType.SKELETON, IN_HAND, DisguiseSkeleton.class); } +// @Override +// public void giveSuperItems(Player player) +// { +// player.getInventory().remove(Material.IRON_SWORD); +// player.getInventory().remove(Material.IRON_AXE); +// +// player.getInventory().addItem(PLAYER_ITEMS[3]); +// +// UtilInv.Update(player); +// } + @Override - public void giveCoreItems(Player player) + public void GiveItems(Player player) { + disguise(player); + UtilInv.Clear(player); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); @@ -92,31 +108,23 @@ public class KitWitherSkeleton extends SmashKit player.getInventory().setArmorContents(PLAYER_ARMOR); } - + @Override - public void giveSuperItems(Player player) - { - player.getInventory().remove(Material.IRON_SWORD); - player.getInventory().remove(Material.IRON_AXE); - - player.getInventory().addItem(PLAYER_ARMOR[3]); - - UtilInv.Update(player); - } - - @Override - public void GiveItems(Player player) - { - giveCoreItems(player); - + public void disguise(Player player) + { //Disguise DisguiseSkeleton disguise = new DisguiseSkeleton(player); - - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); + GameTeam gameTeam = Manager.GetGame().GetTeam(player); + + if (gameTeam != null) + { + disguise.setName(gameTeam.GetColor() + player.getName()); + } else + { disguise.setName(player.getName()); - + } + disguise.setCustomNameVisible(true); disguise.SetSkeletonType(SkeletonType.WITHER); disguise.hideArmor(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java index 11e9d18d0..bededf3e2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java @@ -1,29 +1,26 @@ package nautilus.game.arcade.game.games.smash.kits; +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.common.util.UtilInv; -import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseWolf; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.SmashKit2; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkDoubleJump; import nautilus.game.arcade.kit.perks.PerkWolf; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -public class KitWolf extends SmashKit +public class KitWolf extends SmashKit2 { - private static final String[] DESCRIPTION = { - }; private static final Perk[] PERKS = { new PerkSmashStats(5, 1.6, 0.25, 5), @@ -66,23 +63,24 @@ public class KitWolf extends SmashKit }) }; - private static final ItemStack[] PLAYER_ARMOR = { null, - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), - ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE), + new ItemStack(Material.CHAINMAIL_LEGGINGS), + new ItemStack(Material.IRON_CHESTPLATE), null }; public KitWolf(ArcadeManager manager) { - super(manager, "Wolf", KitAvailability.Gem, 4000, DESCRIPTION, PERKS, EntityType.WOLF, IN_HAND, "Frenzy", 30000, Sound.WOLF_HOWL); + super(manager, "Wolf", KitAvailability.Gem, 4000, PERKS, EntityType.WOLF, IN_HAND, DisguiseWolf.class); } @Override - public void giveCoreItems(Player player) + public void GiveItems(Player player) { + disguise(player); + UtilInv.Clear(player); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); @@ -92,53 +90,4 @@ public class KitWolf extends SmashKit player.getInventory().setArmorContents(PLAYER_ARMOR); } - - @Override - public void giveSuperItems(Player player) - { - - } - - @Override - public void GiveItems(Player player) - { - giveCoreItems(player); - - //Disguise - DisguiseWolf disguise = new DisguiseWolf(player); - - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else - disguise.setName(player.getName()); - - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); - } - - @Override - public void activateSuperCustom(Player player) - { - Manager.GetCondition().Factory().Strength(GetName(), player, player, 30, 1, false, false, false); - Manager.GetCondition().Factory().Speed(GetName(), player, player, 30, 2, false, false, false); - Manager.GetCondition().Factory().Regen(GetName(), player, player, 30, 2, false, false, false); - - DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); - if (disguise instanceof DisguiseWolf) - { - ((DisguiseWolf) disguise).setAngry(true); - Manager.GetDisguise().updateDisguise(disguise); - } - } - - @Override - public void deactivateSuperCustom(Player player) - { - DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); - if (disguise instanceof DisguiseWolf) - { - ((DisguiseWolf) disguise).setAngry(false); - Manager.GetDisguise().updateDisguise(disguise); - } - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java index 2edb8d1c2..7e73d6410 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java @@ -1,16 +1,5 @@ package nautilus.game.arcade.game.games.smash.kits; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilInv; -import mineplex.core.disguise.disguises.DisguiseZombie; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.game.Game.GameState; -import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Sound; @@ -18,7 +7,24 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -public class KitZombie extends SmashKit +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilInv; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; +import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkDeathsGrasp; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import nautilus.game.arcade.kit.perks.PerkFletcher; +import nautilus.game.arcade.kit.perks.PerkKnockbackArrow; +import nautilus.game.arcade.kit.perks.PerkNightLivingDead; +import nautilus.game.arcade.kit.perks.PerkOvercharge; +import nautilus.game.arcade.kit.perks.PerkZombieBile; + +public class KitZombie extends SmashKit2 { private static final String[] DESCRIPTION = { }; @@ -69,9 +75,9 @@ public class KitZombie extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + new ItemStack(Material.CHAINMAIL_BOOTS), + new ItemStack(Material.CHAINMAIL_LEGGINGS), + new ItemStack(Material.CHAINMAIL_CHESTPLATE), null, }; @@ -82,8 +88,10 @@ public class KitZombie extends SmashKit } @Override - public void giveCoreItems(Player player) + public void GiveItems(Player player) { + disguise(player); + UtilInv.Clear(player); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); @@ -94,27 +102,4 @@ public class KitZombie extends SmashKit player.getInventory().setArmorContents(PLAYER_ARMOR); } - - @Override - public void giveSuperItems(Player player) - { - - } - - @Override - public void GiveItems(Player player) - { - giveCoreItems(player); - - //Disguise - DisguiseZombie disguise = new DisguiseZombie(player); - - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else - disguise.setName(player.getName()); - - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkInferno.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkInferno.java index 36f108068..7eb44eca3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkInferno.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkInferno.java @@ -49,8 +49,10 @@ public class PerkInferno extends SmashPerk public void EnergyUpdate(UpdateEvent event) { if (event.getType() != UpdateType.TICK) + { return; - + } + for (Player player : Manager.GetGame().GetPlayers(true)) { if (!hasPerk(player)) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowMooshroomMadness.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/SmashCow.java similarity index 94% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowMooshroomMadness.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/SmashCow.java index d7687b983..04519fc8e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowMooshroomMadness.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/SmashCow.java @@ -11,14 +11,14 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.smash.perks.SmashKit2; import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; -public class PerkCowMooshroomMadness extends SmashUltimate +public class SmashCow extends SmashUltimate { private static final long DURATION = 30000; private static final int DAMAGE_BUFF = 1; private static final int HEALTH = 30; - public PerkCowMooshroomMadness() + public SmashCow() { super("Mooshroom Madness", new String[] {}, Sound.COW_IDLE, DURATION); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeRocket.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeRocket.java new file mode 100644 index 000000000..6b2d92b4d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeRocket.java @@ -0,0 +1,422 @@ +package nautilus.game.arcade.game.games.smash.perks.slime; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Slime; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.disguise.disguises.DisguiseSlime; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkSlimeRocket extends SmashPerk implements IThrown +{ + + private static final long COOLDOWN = 6000; + private static final float ENERGY_PER_TICK = 0.004F; + private static final int KNOCKBACK_MAGNITUDE = 3; + + private Map _charge = new HashMap<>(); + private Map _owner = new HashMap<>(); + private Map _lastAttack = new HashMap<>(); + + public PerkSlimeRocket() + { + super("Slime Rocket", new String[] { C.cYellow + "Hold/Release Block" + C.cGray + " to use " + C.cGreen + "Slime Rocket" }); + } + + @EventHandler + public void EnergyUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!hasPerk(player)) + { + continue; + } + + if (isSuperActive(player)) + { + continue; + } + + int size = 1; + if (player.getExp() > 0.8) + { + size = 3; + } + else if (player.getExp() > 0.55) + { + size = 2; + } + + DisguiseSlime slime = (DisguiseSlime) Manager.GetDisguise().getActiveDisguise(player); + + if (slime != null && slime.GetSize() != size) + { + slime.SetSize(size); + Manager.GetDisguise().updateDisguise(slime); + } + + if (player.isBlocking()) + { + continue; + } + + player.setExp((float) Math.min(0.999, player.getExp() + ENERGY_PER_TICK)); + } + } + + @EventHandler + public void Activate(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isSword(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (isSuperActive(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } + + UtilPlayer.message(player, F.main("Skill", "You are charging " + F.skill(GetName()) + ".")); + + _charge.put(player.getUniqueId(), System.currentTimeMillis()); + } + + @EventHandler + public void ChargeRelease(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + Iterator chargeIterator = _charge.keySet().iterator(); + + while (chargeIterator.hasNext()) + { + UUID key = chargeIterator.next(); + Player player = UtilPlayer.searchExact(key); + + if (player == null) + { + chargeIterator.remove(); + continue; + } + + long time = _charge.get(key); + + // Charge + if (player.isBlocking()) + { + // Energy Depleted + if (player.getExp() < 0.1) + { + FireRocket(player); + chargeIterator.remove(); + } + else + { + double elapsed = Math.min(3, (double) (System.currentTimeMillis() - time) / 1000d); + + // Use Energy + if (!UtilTime.elapsed(time, 3000)) + { + player.setExp((float) Math.max(0, player.getExp() - 0.01f)); + } + + // AutoFire + if (UtilTime.elapsed(time, 5000)) + { + FireRocket(player); + chargeIterator.remove(); + } + + // Effect + player.getWorld().playSound(player.getLocation(), Sound.SLIME_WALK, 0.5f, (float) (0.5 + 1.5 * (elapsed / 3d))); + UtilParticle.PlayParticle(ParticleType.SLIME, player.getLocation().add(0, 1, 0), (float) (elapsed / 6d), (float) (elapsed / 6d), (float) (elapsed / 6d), 0, (int) (elapsed * 5), + ViewDist.LONGER, UtilServer.getPlayers()); + } + } + // Release + else + { + FireRocket(player); + chargeIterator.remove(); + } + } + } + + public void FireRocket(Player player) + { + double charge = Math.min(3, (double) (System.currentTimeMillis() - _charge.get(player.getUniqueId())) / 1000d); + + // Spawn Slime + Manager.GetGame().CreatureAllowOverride = true; + Slime slime = player.getWorld().spawn(player.getEyeLocation(), Slime.class); + slime.setSize(1); + Manager.GetGame().CreatureAllowOverride = false; + + // Size + slime.setSize(Math.max(1, (int) charge)); + + slime.setMaxHealth(5 + charge * 7); + slime.setHealth(slime.getMaxHealth()); + + _owner.put(slime, player.getUniqueId()); + + // Inform + UtilPlayer.message(player, F.main("Skill", "You released " + F.skill(GetName()) + ".")); + + slime.leaveVehicle(); + player.eject(); + + UtilAction.velocity(slime, player.getLocation().getDirection(), 1 + charge / 2d, false, 0, 0.2, 10, true); + + Manager.GetProjectile().AddThrow(slime, player, this, -1, true, true, true, true, null, 0, 0, null, 0, UpdateType.FASTEST, 1f); + } + + @EventHandler + public void SlimeTarget(EntityTargetEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!_owner.containsKey(event.getEntity())) + { + return; + } + + if (event.getTarget() instanceof Player) + { + if (isTeamDamage((Player) event.getTarget(), UtilPlayer.searchExact(_owner.get(event.getEntity().getUniqueId())))) + { + event.setCancelled(true); + return; + } + } + + if (_owner.get(event.getEntity()).equals(event.getTarget())) + { + event.setCancelled(true); + } + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + if (target == null) + { + return; + } + + if (!(data.getThrown() instanceof Slime)) + { + return; + } + + Slime slime = (Slime) data.getThrown(); + + if (target instanceof Player && data.getThrower() instanceof Player) + { + Player targetPlayer = (Player) target; + Player throwerPlayer = (Player) data.getThrower(); + + if (isTeamDamage(targetPlayer, throwerPlayer)) + { + return; + } + } + + // Damage Event + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 3 + slime.getSize() * 3, true, true, false, UtilEnt.getName(data.getThrower()), GetName()); + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + } + + @Override + public void Idle(ProjectileUser data) + { + + } + + @Override + public void Expire(ProjectileUser data) + { + + } + + @EventHandler + public void SlimeDamage(CustomDamageEvent event) + { + if (!(event.GetDamagerEntity(false) instanceof Slime)) + { + return; + } + + Slime slime = (Slime) event.GetDamagerEntity(false); + + // Attack Rate + if (_lastAttack.containsKey(slime) && !UtilTime.elapsed(_lastAttack.get(slime), 500)) + { + event.SetCancelled("Slime Attack Rate"); + return; + } + + _lastAttack.put(slime, System.currentTimeMillis()); + + // Get Owner + UUID key = _owner.get(slime); + Player owner = UtilPlayer.searchExact(key); + + if (owner == null) + { + return; + } + + if (isTeamDamage(owner, event.GetDamageePlayer())) + { + event.SetCancelled("Team Damage"); + return; + } + + if (owner != null && owner.equals(event.GetDamageeEntity())) + { + event.SetCancelled("Owner Damage"); + } + else + { + event.AddMod("Slime Damage", "Negate", -event.GetDamageInitial(), false); + event.AddMod("Slime Damage", "Attack", 2 * slime.getSize(), true); + event.AddKnockback("Slime Knockback", 2); + } + } + + @EventHandler + public void SlimeClean(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + { + return; + } + + Iterator slimeIterator = _owner.keySet().iterator(); + + while (slimeIterator.hasNext()) + { + Slime slime = slimeIterator.next(); + + // Shrink + if (slime.getVehicle() == null) + { + if (slime.getTicksLived() > 120) + { + slime.setTicksLived(1); + + Manager.GetBlood().Effects(null, slime.getLocation(), 6 + 6 * slime.getSize(), 0.2 + 0.1 * slime.getSize(), null, 1f, 1f, Material.SLIME_BALL, (byte) 0, 15, false); + + if (slime.getSize() <= 1) + { + slime.remove(); + } + else + { + slime.setSize(slime.getSize() - 1); + } + } + } + + if (!slime.isValid()) + { + slimeIterator.remove(); + } + } + + slimeIterator = _lastAttack.keySet().iterator(); + + while (slimeIterator.hasNext()) + { + Slime slime = slimeIterator.next(); + + if (!slime.isValid()) + { + slimeIterator.remove(); + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeSlam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeSlam.java new file mode 100644 index 000000000..2bc39bb17 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeSlam.java @@ -0,0 +1,185 @@ +package nautilus.game.arcade.game.games.smash.perks.slime; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +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 mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkSlimeSlam extends SmashPerk +{ + + private static final int COOLDOWN = 6000; + private static final int HIT_BOX = 2; + private static final int START_TIME = 1000; + private static final int DAMAGE = 7; + private static final int KNOCKBACK_MAGNITUDE = 2; + + private Map _live = new HashMap<>(); + + public PerkSlimeSlam() + { + super("Slime Slam", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Slime Slam" }); + } + + @EventHandler + public void Leap(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isAxe(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (isSuperActive(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } + + UtilAction.velocity(player, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 1.2, true); + + // Record + _live.put(player.getUniqueId(), System.currentTimeMillis()); + + // Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void End(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + List alivePlayers = Manager.GetGame().GetPlayers(true); + + // Collide + for (Player player : alivePlayers) + { + if (!_live.containsKey(player)) + { + continue; + } + + for (Player other : alivePlayers) + { + if (UtilPlayer.isSpectator(other)) + { + continue; + } + + if (other.equals(player)) + { + continue; + } + + if (UtilMath.offset(player, other) < HIT_BOX) + { + doSlam(player, other); + _live.remove(player); + return; + } + } + } + + // End + for (Player player : alivePlayers) + { + UUID key = player.getUniqueId(); + + if (!UtilEnt.isGrounded(player)) + { + continue; + } + + if (!_live.containsKey(key)) + { + continue; + } + + if (!UtilTime.elapsed(_live.get(key), START_TIME)) + { + continue; + } + + _live.remove(key); + } + } + + public void doSlam(Player damager, LivingEntity damagee) + { + // Recoil Event + if (!isSuperActive(damager)) + { + Manager.GetDamage().NewDamageEvent(damager, damagee, null, DamageCause.CUSTOM, DAMAGE / 4, true, true, false, damager.getName(), GetName() + " Recoil"); + } + + // Damage Event + Manager.GetDamage().NewDamageEvent(damagee, damager, null, DamageCause.CUSTOM, DAMAGE, true, true, false, damager.getName(), GetName()); + + // Inform + UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName()) + ".")); + UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/SmashSlime.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/SmashSlime.java new file mode 100644 index 000000000..7c41af96f --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/SmashSlime.java @@ -0,0 +1,138 @@ +package nautilus.game.arcade.game.games.smash.perks.slime; + +import java.util.List; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseSlime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; + +public class SmashSlime extends SmashUltimate +{ + + private static final long DURATION = 24000; + private static final int HIT_BOX = 5; + private static final int DAMAGE = 8; + + public SmashSlime() + { + super("Giga Slime", new String[] {}, Sound.SLIME_ATTACK, DURATION); + } + + @Override + public void activate(Player player) + { + super.activate(player); + + player.getInventory().remove(Material.IRON_SWORD); + player.getInventory().remove(Material.IRON_AXE); + + DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); + if (disguise != null && disguise instanceof DisguiseSlime) + { + DisguiseSlime slime = (DisguiseSlime) disguise; + + slime.SetSize(14); + Manager.GetDisguise().updateDisguise(slime); + } + + player.setExp(0.99f); + + Manager.GetCondition().Factory().Speed(GetName(), player, player, 20, 2, false, false, false); + + } + + @Override + public void cancel(Player player) + { + super.cancel(player); + + Manager.GetCondition().EndCondition(player, ConditionType.SPEED, GetName()); + } + + @EventHandler(priority = EventPriority.LOW) + public void immunityDamagee(CustomDamageEvent event) + { + if (event.GetDamageePlayer() == null || event.GetDamagerEntity(true) == null) + { + return; + } + + if (isUsingUltimate(event.GetDamageePlayer())) + { + event.SetCancelled(GetName()); + } + } + + @EventHandler(priority = EventPriority.LOW) + public void immunityDamager(CustomDamageEvent event) + { + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + { + return; + } + + if (event.GetDamagerPlayer(true) == null) + { + return; + } + + if (isUsingUltimate(event.GetDamagerPlayer(true))) + { + event.SetCancelled(GetName()); + } + } + + @EventHandler + public void collide(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + List alivePlayers = Manager.GetGame().GetPlayers(true); + + for (Player player : alivePlayers) + { + for (Player other : alivePlayers) + { + if (player.equals(other)) + { + continue; + } + + if (UtilPlayer.isSpectator(other)) + { + continue; + } + + if (UtilMath.offset(player.getLocation().add(0, 3, 0), other.getLocation()) < HIT_BOX) + { + Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE, true, false, false, player.getName(), GetName()); + + UtilParticle.PlayParticle(ParticleType.SLIME, other.getLocation().add(0, 0.6, 0), 1f, 1f, 1f, 0, 20, ViewDist.LONG, UtilServer.getPlayers()); + + player.getWorld().playSound(other.getLocation(), Sound.SLIME_ATTACK, 3f, 1f); + } + } + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkArcticAura.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkArcticAura.java new file mode 100644 index 000000000..d02695389 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkArcticAura.java @@ -0,0 +1,56 @@ +package nautilus.game.arcade.game.games.smash.perks.snowman; + +import java.util.Map; + +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.kit.Perk; + +public class PerkArcticAura extends Perk +{ + + private static final int DURATION = 2000; + private static final int RANGE = 5; + + public PerkArcticAura() + { + super("Arctic Aura", new String[] { "You freeze things around you, slowing enemies." }); + } + + @EventHandler + public void SnowAura(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!hasPerk(player)) + { + continue; + } + + if (UtilPlayer.isSpectator(player)) + { + continue; + } + + double range = RANGE * player.getExp(); + + Map blocks = UtilBlock.getInRadius(player.getLocation(), range); + + for (Block block : blocks.keySet()) + { + Manager.GetBlockRestore().snow(block, (byte) 1, (byte) 1, (long) (DURATION * (1 + blocks.get(block))), 250, 0); + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkBlizzard.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkBlizzard.java new file mode 100644 index 000000000..7a2690bcf --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkBlizzard.java @@ -0,0 +1,173 @@ +package nautilus.game.arcade.game.games.smash.perks.snowman; + +import java.util.HashMap; +import java.util.Map; + +import org.bukkit.Sound; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.entity.Snowball; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; + +public class PerkBlizzard extends Perk +{ + + private static final float MAX_ENERGY = 0.99F; + private static final float ENERGY_PER_TICK = 1 / 60; + private static final float ENERGY_PER_USE = 1 / 9; + private static final int SNOWBALL_PER_USE = 4; + + private Map _snowball = new HashMap<>(); + + public PerkBlizzard() + { + super("Blizzard", new String[] { C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Blizzard" }); + } + + @EventHandler + public void EnergyUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!hasPerk(player)) + { + continue; + } + + if (player.isBlocking()) + { + continue; + } + + player.setExp(Math.min(MAX_ENERGY, player.getExp() + ENERGY_PER_TICK)); + } + } + + @EventHandler + public void Snow(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTEST) + { + return; + } + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!player.isBlocking()) + { + continue; + } + + if (!hasPerk(player)) + { + continue; + } + + // Energy + if (player.getExp() < 0.1) + { + continue; + } + + player.setExp(Math.max(0, player.getExp() - ENERGY_PER_USE)); + + for (int i = 0; i < SNOWBALL_PER_USE; i++) + { + Snowball snow = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Snowball.class); + double x = 0.1 - (UtilMath.r(20) / 100d); + double y = UtilMath.r(20) / 100d; + double z = 0.1 - (UtilMath.r(20) / 100d); + snow.setShooter(player); + snow.setVelocity(player.getLocation().getDirection().add(new Vector(x, y, z)).multiply(2)); + _snowball.put(snow, player); + } + + // Effect + player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 0.1f, 0.5f); + } + } + + @EventHandler(priority = EventPriority.LOW) + public void Snowball(CustomDamageEvent event) + { + if (event.GetCause() != DamageCause.PROJECTILE) + { + return; + } + + Projectile proj = event.GetProjectile(); + + if (proj == null) + { + return; + } + + if (!(proj instanceof Snowball)) + { + return; + } + + if (!_snowball.containsKey(proj)) + { + return; + } + + LivingEntity damagee = event.GetDamageeEntity(); + + if (damagee == null) + { + return; + } + + event.SetCancelled("Blizzard"); + + UtilAction.velocity(damagee, proj.getVelocity().multiply(0.15).add(new Vector(0, 0.15, 0))); + + // Damage Event + if (damagee instanceof Player) + { + if (Recharge.Instance.use((Player) damagee, GetName(), 200, false, false)) + { + Manager.GetDamage().NewDamageEvent(damagee, event.GetDamagerEntity(true), null, DamageCause.CUSTOM, 1, false, true, false, UtilEnt.getName(event.GetDamagerEntity(true)), GetName()); + } + } + } + + @EventHandler + public void SnowballForm(ProjectileHitEvent event) + { + Projectile proj = event.getEntity(); + + if (!(proj instanceof Snowball)) + { + return; + } + + if (_snowball.remove(proj) == null) + { + return; + } + + Manager.GetBlockRestore().snow(proj.getLocation().getBlock(), (byte) 1, (byte) 7, 2000, 250, 0); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkDamageSnow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkDamageSnow.java new file mode 100644 index 000000000..3fd58b90e --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkDamageSnow.java @@ -0,0 +1,49 @@ +package nautilus.game.arcade.game.games.smash.perks.snowman; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; +import nautilus.game.arcade.kit.Perk; + +public class PerkDamageSnow extends Perk +{ + private int _damage; + private double _knockback; + + public PerkDamageSnow(int damage, double knockback) + { + super("Snow Attack", new String[] { C.cGray + "+" + damage + " Damage and " + (int) ((knockback - 1) * 100) + "% Knockback to enemies on snow.", }); + + _damage = damage; + _knockback = knockback; + } + + @EventHandler(priority = EventPriority.HIGH) + public void Knockback(CustomDamageEvent event) + { + if (event.GetDamageeEntity().getLocation().getBlock().getType() != Material.SNOW) + { + return; + } + + Player damager = event.GetDamagerPlayer(true); + + if (damager == null) + { + return; + } + + if (!hasPerk(damager) || UtilPlayer.isSpectator(damager)) + { + return; + } + + event.AddMod(damager.getName(), GetName(), _damage, false); + event.AddKnockback("Knockback Snow", _knockback); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkIcePath.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkIcePath.java new file mode 100644 index 000000000..b11a3472c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkIcePath.java @@ -0,0 +1,112 @@ +package nautilus.game.arcade.game.games.smash.perks.snowman; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + +import org.bukkit.Effect; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.data.IcePathData; + +public class PerkIcePath extends Perk +{ + + private static final long COOLDOWN = 12000; + private static final long MELT_TIME = 6000; + + private Set _data = new HashSet<>(); + + public PerkIcePath() + { + super("Ice Path", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Ice Path" }); + } + + @EventHandler + public void Skill(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isAxe(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } + + player.teleport(player.getLocation().add(0, 1, 0)); + UtilAction.velocity(player, new Vector(0, 0.5, 0)); + + _data.add(new IcePathData(player)); + + // Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void Freeze(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + Iterator dataIterator = _data.iterator(); + + while (dataIterator.hasNext()) + { + IcePathData data = dataIterator.next(); + + Block block = data.GetNextBlock(); + + if (block == null) + { + dataIterator.remove(); + } + else + { + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 79); + Manager.GetBlockRestore().add(block, 79, (byte) 0, MELT_TIME); + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java new file mode 100644 index 000000000..381d3968d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java @@ -0,0 +1,202 @@ +package nautilus.game.arcade.game.games.smash.perks.snowman; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.bukkit.Sound; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.entity.Snowball; +import org.bukkit.entity.Snowman; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; + +public class SmashSnowman extends SmashUltimate +{ + + private static final int TURRET_HEALTH = 40; + private static final int MAX_TICKS = 400; + private static final int RATE = 250; + private static final float KNOCKBACK_MAGNITUDE = 2.5F; + + private Map _snowball = new HashMap<>(); + + private Map _turret = new HashMap<>(); + + public SmashSnowman() + { + super("Snow Turret", new String[] {}, Sound.STEP_SNOW, 0); + } + + @Override + public void activate(Player player) + { + super.activate(player); + + Game game = Manager.GetGame(); + + game.CreatureAllowOverride = true; + Snowman ent = player.getWorld().spawn(player.getEyeLocation(), Snowman.class); + game.CreatureAllowOverride = false; + + UtilEnt.Vegetate(ent); + UtilEnt.ghost(ent, true, false); + + ent.setMaxHealth(TURRET_HEALTH); + ent.setHealth(TURRET_HEALTH); + + UtilAction.velocity(ent, player.getLocation().getDirection(), 1, false, 0, 0.2, 1, false); + + _turret.put(ent, player); + } + + @EventHandler + public void updateSnowman(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + { + return; + } + + Iterator turretIter = _turret.keySet().iterator(); + + while (turretIter.hasNext()) + { + Snowman snowman = turretIter.next(); + Player player = _turret.get(snowman); + + if (snowman.getTicksLived() > MAX_TICKS) + { + UtilParticle.PlayParticle(ParticleType.SNOWBALL_POOF, snowman.getLocation().add(0, 1, 0), 0.4f, 0.4f, 0.4f, 0, 12, ViewDist.LONG, UtilServer.getPlayers()); + turretIter.remove(); + snowman.remove(); + continue; + } + + Player target = UtilPlayer.getClosest(snowman.getLocation(), player); + + if (target == null) + { + continue; + } + + snowman.setTarget(target); + + // Snowball + double mult = 1 + Math.min(3, UtilMath.offset(snowman, target) / 16); + double heightBonus = UtilMath.offset(snowman, target) / 140; + Vector rand = new Vector((Math.random() - 0.5) * 0.2, (Math.random() - 0.5) * 0.2, (Math.random() - 0.5) * 0.2); + + _snowball.put(snowman.launchProjectile(Snowball.class, UtilAlg.getTrajectory(snowman.getLocation(), target.getLocation()).multiply(mult).add(rand).add(new Vector(0, heightBonus, 0))), + player); + + // Look dir + UtilEnt.CreatureMoveFast(snowman, target.getLocation(), 0.1f); + + // Sound + snowman.getWorld().playSound(snowman.getLocation(), Sound.STEP_SNOW, 0.6f, 1f); + } + } + + @EventHandler(priority = EventPriority.LOW) + public void snowballHit(CustomDamageEvent event) + { + if (event.GetCause() != DamageCause.PROJECTILE) + { + return; + } + + Projectile proj = event.GetProjectile(); + + if (proj == null) + { + return; + } + + if (!(proj instanceof Snowball)) + { + return; + } + + if (!_snowball.containsKey(proj)) + { + return; + } + + LivingEntity damagee = event.GetDamageeEntity(); + + if (damagee == null) + { + return; + } + + event.SetCancelled("Turret"); + + if (damagee.equals(_snowball.get(proj))) + { + return; + } + + UtilAction.velocity(damagee, proj.getVelocity().multiply(0.3).add(new Vector(0, 0.3, 0))); + + // Damage Event + if (!(damagee instanceof LivingEntity)) + { + return; + } + + if (!Recharge.Instance.use((Player) damagee, GetName() + " Hit", RATE, false, false)) + { + return; + } + + Manager.GetDamage().NewDamageEvent(damagee, _snowball.get(proj), null, DamageCause.PROJECTILE, 2, false, true, false, UtilEnt.getName(_snowball.get(proj)), GetName()); + } + + @EventHandler + public void damageCancel(CustomDamageEvent event) + { + if (_turret.containsKey(event.GetDamageeEntity())) + { + event.SetCancelled("Turret Immunity"); + } + } + + @EventHandler + public void clean(ProjectileHitEvent event) + { + _snowball.remove(event.getEntity()); + } + + @EventHandler + public void knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkNeedler.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkNeedler.java new file mode 100644 index 000000000..4153fca46 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkNeedler.java @@ -0,0 +1,186 @@ +package nautilus.game.arcade.game.games.smash.perks.spider; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.Sound; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkNeedler extends SmashPerk +{ + + private static final long COOLDOWN_NORMAL = 2000; + private static final long COOLDOWN_SMASH = 600; + private static final float DAMAGE = 1.1F; + private static final int MAX_TICKS = 300; + + private Map _active = new HashMap<>(); + private Set _arrows = new HashSet<>(); + + public PerkNeedler() + { + super("Needler", new String[] { C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Needler" }); + } + + @EventHandler + public void Activate(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isSword(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? COOLDOWN_SMASH : COOLDOWN_NORMAL, !isSuperActive(player), !isSuperActive(player))) + { + return; + } + + _active.put(player.getUniqueId(), 8); + + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : UtilServer.getPlayers()) + { + UUID key = cur.getUniqueId(); + + if (!_active.containsKey(key)) + { + continue; + } + + if (!cur.isBlocking()) + { + _active.remove(key); + continue; + } + + int count = _active.get(key) - 1; + + if (count <= 0) + { + _active.remove(key); + continue; + } + else + { + _active.put(key, count); + } + + Arrow arrow = cur.getWorld().spawnArrow(cur.getEyeLocation().add(cur.getLocation().getDirection()), cur.getLocation().getDirection(), 1.2f, 6); + arrow.setShooter(cur); + _arrows.add(arrow); + + // Sound + cur.getWorld().playSound(cur.getLocation(), Sound.SPIDER_IDLE, 0.8f, 2f); + } + } + + @EventHandler + public void ArrowDamamge(CustomDamageEvent event) + { + if (event.GetProjectile() == null) + { + return; + } + + if (event.GetDamagerPlayer(true) == null) + { + return; + } + + if (!(event.GetProjectile() instanceof Arrow)) + { + return; + } + + Player damager = event.GetDamagerPlayer(true); + + if (!hasPerk(damager)) + { + return; + } + + event.SetCancelled("Needler Cancel"); + + event.GetProjectile().remove(); + + // Damage Event + Manager.GetDamage().NewDamageEvent(event.GetDamageeEntity(), damager, null, DamageCause.THORNS, DAMAGE, true, true, false, damager.getName(), GetName()); + + if (!isTeamDamage(damager, event.GetDamageePlayer())) + { + Manager.GetCondition().Factory().Poison(GetName(), event.GetDamageeEntity(), damager, 2, 0, false, false, false); + } + } + + @EventHandler + public void Clean(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + { + return; + } + + for (Iterator arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) + { + Arrow arrow = arrowIterator.next(); + + if (arrow.isOnGround() || !arrow.isValid() || arrow.getTicksLived() > MAX_TICKS) + { + arrowIterator.remove(); + arrow.remove(); + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java new file mode 100644 index 000000000..0eb494eae --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java @@ -0,0 +1,170 @@ +package nautilus.game.arcade.game.games.smash.perks.spider; + +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.GameMode; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerToggleFlightEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.kit.Perk; + +public class PerkSpiderLeap extends Perk +{ + + private static final float ENERGY_PER_TICK = 1 / 80; + private static final float ENERGY_PER_LEAP = 1 / 6; + + private Set _secondJump = new HashSet<>(); + + public PerkSpiderLeap() + { + super("Spider Leap", new String[] { C.cYellow + "Tap Jump Twice" + C.cGray + " to " + C.cGreen + "Spider Leap", C.cYellow + "Hold Crouch" + C.cGray + " to " + C.cGreen + "Wall Climb", C.cWhite + + "Wall Climb requires Energy (Experience Bar)." + }); + } + + @EventHandler + public void WallClimb(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + for (Player player : UtilServer.getPlayers()) + { + if (UtilPlayer.isSpectator(player)) + { + continue; + } + + if (!hasPerk(player)) + { + continue; + } + + if (!player.isSneaking()) + { + if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) + { + player.setExp((float) Math.min(0.999, player.getExp() + ENERGY_PER_TICK)); + _secondJump.remove(player.getUniqueId()); + } + + continue; + } + + player.setExp((float) Math.max(0, player.getExp() - ENERGY_PER_TICK)); + + if (player.getExp() <= 0) + { + continue; + } + + if (!Recharge.Instance.usable(player, GetName())) + { + continue; + } + + for (Block block : UtilBlock.getSurrounding(player.getLocation().getBlock(), true)) + { + if (!UtilBlock.airFoliage(block) && !block.isLiquid()) + { + UtilAction.velocity(player, new Vector(0, 0.2, 0)); + + if (!_secondJump.contains(player.getUniqueId())) + { + player.setAllowFlight(true); + _secondJump.add(player.getUniqueId()); + } + + continue; + } + } + } + } + + @EventHandler + public void FlightHop(PlayerToggleFlightEvent event) + { + Player player = event.getPlayer(); + + if (!hasPerk(player)) + { + return; + } + + if (UtilPlayer.isSpectator(player)) + { + return; + } + + if (player.getGameMode() == GameMode.CREATIVE) + { + return; + } + + event.setCancelled(true); + player.setFlying(false); + + // Disable Flight + player.setAllowFlight(false); + + if (player.getExp() < ENERGY_PER_LEAP) + { + return; + } + + // Velocity + UtilAction.velocity(player, 1.0, 0.2, 1.0, true); + + // Energy + player.setExp((float) Math.max(0, player.getExp() - ENERGY_PER_LEAP)); + + // Sound + player.getWorld().playSound(player.getLocation(), Sound.SPIDER_IDLE, 1f, 1.5f); + + Recharge.Instance.use(player, GetName(), 500, false, false); + } + + @EventHandler + public void FlightUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player player : UtilServer.getPlayers()) + { + if (UtilPlayer.isSpectator(player)) + { + continue; + } + + if (!hasPerk(player)) + { + continue; + } + + if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) + { + player.setAllowFlight(true); + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkWebShot.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkWebShot.java new file mode 100644 index 000000000..faf02aebd --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkWebShot.java @@ -0,0 +1,143 @@ +package nautilus.game.arcade.game.games.smash.perks.spider; + +import org.bukkit.Location; +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.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkWebShot extends SmashPerk implements IThrown +{ + + private static final long COOLDOWN_NORMAL = 10000; + private static final long COOLDOWN_SMASH = 1000; + private static final int WEBS = 20; + + public PerkWebShot() + { + super("Spin Web", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Spin Web" }); + } + + @EventHandler + public void ShootWeb(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isAxe(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? COOLDOWN_SMASH : COOLDOWN_NORMAL, !isSuperActive(player), !isSuperActive(player))) + { + return; + } + + event.setCancelled(true); + + // Boost + UtilAction.velocity(player, 1.2, 0.2, 1.2, true); + + for (int i = 0; i < WEBS; i++) + { + Item ent = player.getWorld().dropItem(player.getLocation().add(0, 0.5, 0), ItemStackFactory.Instance.CreateStack(Material.WEB, (byte) 0, 1, "Web " + player.getName() + " " + i)); + + Vector random = new Vector(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5); + random.normalize(); + random.multiply(0.2); + + UtilAction.velocity(ent, player.getLocation().getDirection().multiply(-1).add(random), 1 + Math.random() * 0.4, false, 0, 0.2, 10, false); + Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true, 0.5f); + } + + // Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); + + // Effect + player.getWorld().playSound(player.getLocation(), Sound.SPIDER_IDLE, 2f, 0.6f); + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + if (target != null) + { + data.getThrown().remove(); + + Manager.GetBlockRestore().add(target.getLocation().getBlock(), 30, (byte) 0, 3000); + + // Damage Event + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 6, false, false, false, UtilEnt.getName(data.getThrower()), GetName()); + + UtilAction.zeroVelocity(target); + + return; + } + + Web(data); + } + + @Override + public void Idle(ProjectileUser data) + { + Web(data); + } + + @Override + public void Expire(ProjectileUser data) + { + Web(data); + } + + public void Web(ProjectileUser data) + { + Location loc = data.getThrown().getLocation(); + data.getThrown().remove(); + + if (data.getThrown().getTicksLived() > 3) + { + Manager.GetBlockRestore().add(loc.getBlock(), 30, (byte) 0, 2000); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java new file mode 100644 index 000000000..2549dd73c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java @@ -0,0 +1,154 @@ +package nautilus.game.arcade.game.games.smash.perks.spider; + +import java.util.HashMap; +import java.util.Map; + +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilServer; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; + +public class SmashSpider extends SmashUltimate +{ + private static final long DURATION = 30000; + + private Map _preHealth = new HashMap<>(); + + public SmashSpider() + { + super("Spider Nest", new String[] {}, Sound.SPIDER_DEATH, DURATION); + } + + @Override + public void activate(Player player) + { + super.activate(player); + + // Nest + Map blocks = UtilBlock.getInRadius(player.getLocation().getBlock(), 16); + + for (Block block : blocks.keySet()) + { + if (blocks.get(block) > 0.07) + { + continue; + } + + if (!UtilBlock.airFoliage(block)) + { + continue; + } + + if (block.getY() > player.getLocation().getY() + 10) + { + continue; + } + + if (block.getY() < player.getLocation().getY() - 10) + { + continue; + } + + Manager.GetBlockRestore().add(block, 30, (byte) 0, (long) (DURATION + 5000 * Math.random())); + } + + // Regen + Manager.GetCondition().Factory().Regen(GetName(), player, player, 30, 0, false, false, false); + } + + @EventHandler(priority = EventPriority.HIGH) + public void damagePre(CustomDamageEvent event) + { + if (event.IsCancelled()) + { + return; + } + + if (event.GetCause() != DamageCause.ENTITY_ATTACK && event.GetCause() != DamageCause.PROJECTILE && event.GetCause() != DamageCause.CUSTOM) + { + return; + } + + Player damager = event.GetDamagerPlayer(true); + + if (damager == null) + { + return; + } + + LivingEntity damagee = event.GetDamageeEntity(); + + if (damagee == null) + { + return; + } + + if (!isUsingUltimate(damager)) + { + return; + } + + _preHealth.put(damagee, damagee.getHealth()); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void damagePost(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + Player damager = event.GetDamagerPlayer(true); + + if (damager == null) + { + return; + } + + LivingEntity damagee = event.GetDamageeEntity(); + + if (damagee == null) + { + return; + } + + if (!isUsingUltimate(damager)) + { + return; + + } + if (!_preHealth.containsKey(damagee)) + { + return; + } + + double diff = (_preHealth.remove(damagee) - damagee.getHealth()) / 2d; + + if (diff <= 0) + { + return; + } + + damager.setMaxHealth(Math.min(60, damager.getMaxHealth() + diff)); + damager.setHealth(damager.getHealth() + diff); + + UtilParticle.PlayParticle(ParticleType.HEART, damager.getLocation().add(0, 1, 0), 0, 0, 0, 0, 1, ViewDist.LONG, UtilServer.getPlayers()); + + UtilParticle.PlayParticle(ParticleType.RED_DUST, damagee.getLocation().add(0, 1, 0), 0.4f, 0.4f, 0.4f, 0, 12, ViewDist.LONG, UtilServer.getPlayers()); + + if (event.GetCause() == DamageCause.ENTITY_ATTACK) + { + damager.getWorld().playSound(damager.getLocation(), Sound.SPIDER_IDLE, 1.5f, 1f); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java new file mode 100644 index 000000000..2c6f48e0f --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java @@ -0,0 +1,312 @@ +package nautilus.game.arcade.game.games.smash.perks.witch; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.entity.Bat; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkBatWave extends SmashPerk +{ + + private static final long COOLDOWN = 8000; + private static final long LEASH_COOLDOWN = 500; + private static final long HIT_COOLDOWN = 200; + private static final int HIT_BOX = 2; + private static final int DAMAGE = 3; + private static final float KNOCKBACK_MAGNITUDE = 1.75F; + + private static final String LEASH = "Leash Bats"; + private static final String HIT = "Hit By Bat"; + + private Map _active = new HashMap<>(); + private Map _direction = new HashMap<>(); + private Map> _bats = new HashMap<>(); + private Set _pulling = new HashSet<>(); + private Set _allowLeash = new HashSet<>(); + + public PerkBatWave() + { + super("Bat Wave", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + "Bat Wave", C.cYellow + "Double Right-Click" + C.cGray + " with Spade to use " + + C.cGreen + "Bat Leash" }); + } + + @EventHandler + public void Deactivate(CustomDamageEvent event) + { + Player player = event.GetDamageePlayer(); + + if (player == null) + { + return; + } + + if (_pulling.remove(player.getUniqueId())) + { + for (Bat bat : _bats.get(player.getUniqueId())) + { + bat.setLeashHolder(null); + } + } + } + + @EventHandler + public void Activate(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isSpade(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (isSuperActive(player)) + { + return; + } + + UUID key = player.getUniqueId(); + + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, false, true)) + { + if (_active.containsKey(key)) + { + if (!Recharge.Instance.use(player, LEASH, LEASH_COOLDOWN, false, false)) + { + return; + } + + if (!_pulling.remove(key)) + { + if (_allowLeash.remove(key)) + { + _pulling.add(key); + + for (Bat bat : _bats.get(key)) + { + bat.setLeashHolder(player); + } + } + } + else + { + for (Bat bat : _bats.get(key)) + { + bat.setLeashHolder(null); + } + } + } + else + { + // Inform + Recharge.Instance.use(player, GetName(), COOLDOWN, true, true); + } + } + else + { + // Start + _direction.put(key, player.getEyeLocation()); + _active.put(key, System.currentTimeMillis()); + _allowLeash.add(key); + + _bats.put(key, new ArrayList()); + + Manager.GetGame().CreatureAllowOverride = true; + + for (int i = 0; i < 32; i++) + { + Bat bat = player.getWorld().spawn(player.getEyeLocation(), Bat.class); + _bats.get(key).add(bat); + } + + Manager.GetGame().CreatureAllowOverride = false; + + // Inform + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + } + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + for (Player cur : UtilServer.getPlayers()) + { + UUID key = cur.getUniqueId(); + + if (!_active.containsKey(key)) + { + continue; + } + + if (UtilTime.elapsed(_active.get(key), 2500)) + { + Clear(cur); + continue; + } + + Location loc = _direction.get(key); + + Vector batVec = new Vector(0, 0, 0); + double batCount = 0; + + // Bat Movement + for (Bat bat : _bats.get(key)) + { + if (!bat.isValid()) + { + continue; + } + + batVec.add(bat.getLocation().toVector()); + batCount++; + + Vector rand = new Vector((Math.random() - 0.5) / 2, (Math.random() - 0.5) / 2, (Math.random() - 0.5) / 2); + bat.setVelocity(loc.getDirection().clone().multiply(0.5).add(rand)); + + for (Player other : Manager.GetGame().GetPlayers(true)) + { + if (other.equals(cur)) + { + continue; + } + + if (!Recharge.Instance.usable(other, HIT)) + { + continue; + } + + if (UtilEnt.hitBox(bat.getLocation(), other, HIT_BOX, null)) + { + // Damage Event + Manager.GetDamage().NewDamageEvent(other, cur, null, DamageCause.CUSTOM, DAMAGE, true, true, false, cur.getName(), GetName()); + + // Effect + bat.getWorld().playSound(bat.getLocation(), Sound.BAT_HURT, 1f, 1f); + UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, bat.getLocation(), 0, 0, 0, 0, 3, ViewDist.LONG, UtilServer.getPlayers()); + + bat.remove(); + + // Recharge on hit + Recharge.Instance.useForce(other, HIT, HIT_COOLDOWN); + } + } + } + + // Player Pull + if (_pulling.contains(key)) + { + batVec.multiply(1 / batCount); + + Location batLoc = batVec.toLocation(cur.getWorld()); + + UtilAction.velocity(cur, UtilAlg.getTrajectory(cur.getLocation(), batLoc), 0.35, false, 0, 0, 10, false); + } + } + } + + @EventHandler + public void PlayerQuit(PlayerQuitEvent event) + { + Clear(event.getPlayer()); + } + + @EventHandler + public void PlayerDeath(PlayerDeathEvent event) + { + Clear(event.getEntity()); + } + + public void Clear(Player player) + { + UUID key = player.getUniqueId(); + + _active.remove(key); + _direction.remove(key); + _pulling.remove(key); + + if (_bats.containsKey(key)) + { + for (Bat bat : _bats.get(key)) + { + if (bat.isValid()) + { + UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, bat.getLocation(), 0, 0, 0, 0, 3, ViewDist.LONG, UtilServer.getPlayers()); + } + + bat.remove(); + } + + _bats.remove(player); + } + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java new file mode 100644 index 000000000..8c37318fc --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java @@ -0,0 +1,185 @@ +package nautilus.game.arcade.game.games.smash.perks.witch; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.entity.ThrownPotion; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkWitchPotion extends SmashPerk +{ + + private static final long COOLDOWN = 2000; + private static final int RANGE_NOMRAL = 3; + private static final int RANGE_SMASH = 4; + private static final int DAMAGE_NORMAL = 7; + private static final int DAMAGE_SMASH = 10; + private static final int KNOCKBACK_MAGNITUDE = 2; + + private List _proj = new ArrayList<>(); + + public PerkWitchPotion() + { + super("Daze Potion", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Daze Potion" }); + } + + @EventHandler + public void Activate(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isAxe(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (isSuperActive(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } + + // Start + ThrownPotion potion = player.launchProjectile(ThrownPotion.class); + UtilAction.velocity(potion, player.getLocation().getDirection(), 1, false, 0, 0.2, 10, false); + + _proj.add(potion); + + // Inform + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void Hit(ProjectileHitEvent event) + { + if (!_proj.remove(event.getEntity())) + { + return; + } + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (player.equals(event.getEntity().getShooter())) + { + continue; + } + + if (!(event.getEntity().getShooter() instanceof Player)) + { + continue; + } + + Player thrower = (Player) event.getEntity().getShooter(); + + if (UtilMath.offset(player.getLocation().add(0, 1, 0), event.getEntity().getLocation()) > (isSuperActive(thrower) ? RANGE_SMASH : RANGE_NOMRAL)) + { + continue; + } + + String name = UtilEnt.getName((LivingEntity) event.getEntity().getShooter()); + + // Standard + if (!isSuperActive(thrower)) + { + // Damage Event + Manager.GetDamage().NewDamageEvent(player, thrower, null, DamageCause.CUSTOM, DAMAGE_NORMAL, true, true, false, name, GetName()); + + Manager.GetCondition().Factory().Slow(GetName(), player, null, 3, 1, true, false, false, false); + } + // Super Effect + else + { + // Damage Event + Manager.GetDamage().NewDamageEvent(player, thrower, null, DamageCause.CUSTOM, DAMAGE_SMASH, true, true, false, name, GetName()); + + Manager.GetCondition().Factory().Slow(GetName(), player, null, 7, 2, true, false, false, false); + } + } + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + Iterator potionIterator = _proj.iterator(); + + while (potionIterator.hasNext()) + { + Projectile proj = potionIterator.next(); + + if (!proj.isValid()) + { + potionIterator.remove(); + continue; + } + + UtilParticle.PlayParticle(ParticleType.MOB_SPELL, proj.getLocation(), 0, 0, 0, 0, 1, ViewDist.LONGER, UtilServer.getPlayers()); + } + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/SmashBat.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/SmashBat.java new file mode 100644 index 000000000..94e898356 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/SmashBat.java @@ -0,0 +1,312 @@ +package nautilus.game.arcade.game.games.smash.perks.witch; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerToggleFlightEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.disguise.disguises.DisguiseBat; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import nautilus.game.arcade.kit.perks.data.SonicBoomData; + +public class SmashBat extends SmashUltimate +{ + + private static final long DURATION = 20000; + private static final long COOLDOWN = 1200; + private static final long MAX_TIME = 12000; + private static final int HIT_BOX = 4; + private static final int DAMAGE_RADIUS = 10; + private static final int DAMAGE = 12; + private static final int FLAP_COOLDOWN = 40; + private static final int KNOCKBACK_MAGNITUDE = 2; + + private List _sonic = new ArrayList<>(); + + public SmashBat() + { + super("Bat Form", new String[] {}, Sound.BAT_HURT, DURATION); + } + + @Override + public void activate(Player player) + { + super.activate(player); + + player.getInventory().remove(Material.IRON_SPADE); + player.getInventory().remove(Material.IRON_AXE); + + player.getInventory().addItem(new ItemStack(Material.DIAMOND_AXE)); + + for (Perk perk : Kit.GetPerks()) + { + if (perk instanceof PerkDoubleJump) + { + ((PerkDoubleJump) perk).disableForPlayer(player); + } + } + + Manager.GetDisguise().undisguise(Manager.GetDisguise().getActiveDisguise(player)); + + SmashKit2 kit = (SmashKit2) Kit; + kit.disguise(player, DisguiseBat.class); + } + + @Override + public void cancel(Player player) + { + super.cancel(player); + + for (Perk perk : Kit.GetPerks()) + { + if (perk instanceof PerkDoubleJump) + { + ((PerkDoubleJump) perk).enableForPlayer(player); + } + } + + Manager.GetDisguise().undisguise(Manager.GetDisguise().getActiveDisguise(player)); + + SmashKit2 kit = (SmashKit2) Kit; + kit.disguise(player); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void attackCancel(CustomDamageEvent event) + { + if (event.IsCancelled()) + { + return; + } + + Player player = event.GetDamagerPlayer(true); + + if (player == null) + { + return; + } + + if (!isUsingUltimate(player)) + { + return; + } + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + { + return; + } + + event.SetCancelled("Bat Form Melee Cancel"); + } + + @EventHandler(priority = EventPriority.LOW) // Happen before activation of + // Super + public void sonicBoom(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (!isUsingUltimate(player)) + { + return; + } + + if (event.getAction() == Action.PHYSICAL) + { + return; + } + + if (!Recharge.Instance.use(player, GetName() + " Screech", COOLDOWN, false, false)) + { + return; + } + + // Effect + player.getWorld().playSound(player.getLocation(), Sound.BAT_HURT, 1f, 0.75f); + + _sonic.add(new SonicBoomData(player)); + } + + @EventHandler + public void sonicBoomUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + Iterator sonicIter = _sonic.iterator(); + + while (sonicIter.hasNext()) + { + SonicBoomData data = sonicIter.next(); + + // Time Boom + if (UtilTime.elapsed(data.Time, MAX_TIME)) + { + sonicIter.remove(); + explode(data); + continue; + } + + // Block Boom + if (!UtilBlock.airFoliage(data.Location.getBlock())) + { + sonicIter.remove(); + explode(data); + continue; + } + + // Proxy Boom + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (Manager.isSpectator(player)) + { + continue; + } + + if (player.equals(data.Shooter)) + { + continue; + } + + if (UtilMath.offset(player.getLocation().add(0, 1, 0), data.Location) < HIT_BOX) + { + sonicIter.remove(); + explode(data); + continue; + } + } + + // Move + data.Location.add(data.Direction.clone().multiply(1)); + + // Effect + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.Location, 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); + data.Location.getWorld().playSound(data.Location, Sound.FIZZ, 1f, 2f); + } + } + + private void explode(SonicBoomData data) + { + // Effect + UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, data.Location, 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); + data.Location.getWorld().playSound(data.Location, Sound.EXPLODE, 1f, 1.5f); + + // Damage + Map targets = UtilEnt.getInRadius(data.Location, DAMAGE_RADIUS); + + for (LivingEntity cur : targets.keySet()) + { + if (cur.equals(data.Shooter)) + { + continue; + } + + Manager.GetDamage().NewDamageEvent(cur, data.Shooter, null, DamageCause.CUSTOM, DAMAGE * targets.get(cur) + 0.5, true, false, false, data.Shooter.getName(), GetName()); + } + } + + @EventHandler + public void flap(PlayerToggleFlightEvent event) + { + Player player = event.getPlayer(); + + if (Manager.isSpectator(player)) + { + return; + } + + if (!isUsingUltimate(player)) + { + return; + } + + if (player.getGameMode() == GameMode.CREATIVE) + { + return; + } + + event.setCancelled(true); + player.setFlying(false); + + // Disable Flight + player.setAllowFlight(false); + + // Velocity + UtilAction.velocity(player, player.getLocation().getDirection(), 0.8, false, 0, 0.8, 1, true); + + // Sound + player.getWorld().playSound(player.getLocation(), Sound.BAT_TAKEOFF, (float) (0.3 + player.getExp()), (float) (Math.random() / 2 + 0.5)); + + // Set Recharge + Recharge.Instance.use(player, GetName() + " Flap", FLAP_COOLDOWN, false, false); + } + + @EventHandler + public void flapRecharge(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + for (Player player : ((SmashKit) Kit).getSuperActive()) + { + if (Manager.isSpectator(player)) + { + continue; + } + + if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) + { + player.setAllowFlight(true); + } + else if (Recharge.Instance.usable(player, GetName() + " Flap")) + { + player.setAllowFlight(true); + } + } + } + + @EventHandler + public void knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java new file mode 100644 index 000000000..49d800c70 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java @@ -0,0 +1,291 @@ +package nautilus.game.arcade.game.games.smash.perks.witherskeleton; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Skeleton; +import org.bukkit.entity.Skeleton.SkeletonType; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.TeamSuperSmash; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkWitherImage extends SmashPerk +{ + + private static final long COOLDOWN = 12000; + private static final long SWAP_COOLDOWN = 2000; + + private Map _skeletons = new HashMap<>(); + + public PerkWitherImage() + { + super("Wither Image", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Wither Image", C.cYellow + "Double Right-Click" + C.cGray + " with Axe to " + C.cGreen + + "Wither Swap" }); + } + + @EventHandler + public void activate(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isAxe(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (isSuperActive(player)) + { + return; + } + + if (!_skeletons.containsKey(player.getUniqueId())) + { + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } + + // Spawn + Manager.GetGame().CreatureAllowOverride = true; + Skeleton skel = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Skeleton.class); + Manager.GetGame().CreatureAllowOverride = false; + + skel.setSkeletonType(SkeletonType.WITHER); + + skel.getEquipment().setItemInHand(player.getItemInHand()); + skel.setMaxHealth(20); + skel.setHealth(skel.getMaxHealth()); + + if (Manager.GetGame().GetTeamList().size() > 1) + { + skel.setCustomName(Manager.GetColor(player) + player.getName()); + } + else + { + skel.setCustomName(C.cYellow + player.getName()); + } + + skel.setCustomNameVisible(true); + + UtilAction.velocity(skel, player.getLocation().getDirection(), 1.6, false, 0, 0.2, 10, true); + + _skeletons.put(player.getUniqueId(), skel); + + Recharge.Instance.use(player, "Wither Swap", SWAP_COOLDOWN, false, false); + + // Sound + player.getWorld().playSound(player.getLocation(), Sound.WITHER_SPAWN, 1f, 1f); + + // Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); + } + else + { + if (!Recharge.Instance.use(player, "Wither Swap", SWAP_COOLDOWN, true, false)) + { + return; + } + + Skeleton skel = _skeletons.get(player.getUniqueId()); + + Location loc = skel.getLocation(); + skel.teleport(player.getLocation()); + player.teleport(loc); + + // Sound + player.getWorld().playSound(player.getLocation(), Sound.WITHER_SPAWN, 1f, 2f); + + // Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill("Wither Swap") + ".")); + } + } + + @EventHandler + public void entityTarget(EntityTargetEvent event) + { + if (_skeletons.containsValue(event.getEntity())) + { + if (event.getTarget() instanceof Player) + { + if (isTeamDamage((Player) event.getTarget(), getOwner((Skeleton) event.getEntity()))) + { + event.setCancelled(true); + } + } + + if (_skeletons.get(event.getTarget().getUniqueId()).equals(event.getEntity())) + { + event.setCancelled(true); + } + } + } + + @EventHandler + public void damage(CustomDamageEvent event) + { + Player damagee = event.GetDamageePlayer(); + + if (damagee == null) + { + return; + } + + if (!_skeletons.containsKey(damagee.getUniqueId())) + { + return; + } + + LivingEntity damager = event.GetDamagerEntity(false); + + if (damager == null) + { + return; + } + + if (_skeletons.get(damagee.getUniqueId()).equals(damager)) + { + event.SetCancelled("Wither Image"); + } + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void minionDamageTransfer(CustomDamageEvent event) + { + LivingEntity damager = event.GetDamagerEntity(true); + + if (damager == null) + return; + + if (!_skeletons.containsValue(damager)) + { + return; + } + + for (UUID uuid : _skeletons.keySet()) + { + Player player = UtilPlayer.searchExact(uuid); + + if (player == null) + { + return; + } + + if (_skeletons.get(uuid).equals(damager)) + { + event.SetDamager(player); + event.setKnockbackOrigin(damager.getLocation()); + event.AddMod(GetName(), "Wither Image", -5.5, true); + } + } + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + { + return; + + } + Iterator playerIterator = _skeletons.keySet().iterator(); + + while (playerIterator.hasNext()) + { + UUID uuid = playerIterator.next(); + Player player = UtilPlayer.searchExact(uuid); + + if (player == null) + { + playerIterator.remove(); + continue; + } + + Skeleton skel = _skeletons.get(uuid); + + if (!player.isValid() || !skel.isValid() || skel.getTicksLived() > 160 || UtilBlock.liquid(skel.getLocation().getBlock())) + { + // Effect + Manager.GetBlood().Effects(null, skel.getLocation().add(0, 0.5, 0), 12, 0.3, Sound.WITHER_HURT, 1f, 0.75f, Material.BONE, (byte) 0, 40, false); + + playerIterator.remove(); + skel.remove(); + continue; + } + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void clean(PlayerDeathEvent event) + { + Skeleton skel = _skeletons.remove(event.getEntity().getUniqueId()); + + if (skel != null) + { + // Effect + Manager.GetBlood().Effects(null, skel.getLocation().add(0, 0.5, 0), 12, 0.3, Sound.WITHER_HURT, 1f, 0.75f, Material.BONE, (byte) 0, 40, false); + + skel.remove(); + } + } + + private Player getOwner(Skeleton skel) + { + for (UUID uuid : _skeletons.keySet()) + { + Skeleton other = _skeletons.get(uuid); + + if (other.equals(skel)) + { + return UtilPlayer.searchExact(uuid); + } + } + + return null; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherSkull.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherSkull.java new file mode 100644 index 000000000..8f6845044 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherSkull.java @@ -0,0 +1,229 @@ +package nautilus.game.arcade.game.games.smash.perks.witherskeleton; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.WitherSkull; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkWitherSkull extends SmashPerk +{ + + private static final int COOLDOWN_NORMAL = 6000; + private static final int COOLDOWN_SMASH = 1000; + private static final int DAMAGE = 12; + private static final float KNOCKBACK_MAGNITUDE = 1.5F; + + private Map _active = new HashMap<>(); + private Set _ignoreControl = new HashSet<>(); + + public PerkWitherSkull() + { + super("Wither Skull", new String[] { C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Wither Skull" }); + } + + @EventHandler(priority = EventPriority.LOW) // Happen BEFORE super is + // triggered + public void activate(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + boolean smash = isSuperActive(player); + + if (!smash) + { + if (!UtilItem.isSword(player.getItemInHand())) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + } + + if (!hasPerk(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), smash ? COOLDOWN_SMASH : COOLDOWN_NORMAL, !smash, !smash)) + { + return; + } + + // Fire + WitherSkull skull = player.launchProjectile(WitherSkull.class); + + if (!smash) + { + skull.setDirection(player.getLocation().getDirection()); + } + + _active.put(skull, player.getLocation().getDirection().multiply(0.6)); + + // Sound + player.getWorld().playSound(player.getLocation(), Sound.WITHER_SHOOT, 1f, 1f); + + // Inform + if (!smash) + { + UtilPlayer.message(player, F.main("Skill", "You launched " + F.skill(GetName()) + ".")); + } + + // Control + if (!smash) + { + _ignoreControl.remove(player.getUniqueId()); + } + else + { + _ignoreControl.add(player.getUniqueId()); + } + } + + @EventHandler + public void cleanAndControl(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + Iterator skullIterator = _active.keySet().iterator(); + + while (skullIterator.hasNext()) + { + WitherSkull skull = skullIterator.next(); + Player player = (Player) skull.getShooter(); + + if (!skull.isValid()) + { + skullIterator.remove(); + skull.remove(); + continue; + } + + if (_ignoreControl.contains(player.getUniqueId())) + { + continue; + } + + if (player.isBlocking() && !_ignoreControl.contains(player.getUniqueId())) + { + skull.setDirection(player.getLocation().getDirection()); + skull.setVelocity(player.getLocation().getDirection().multiply(0.6)); + _active.put(skull, player.getLocation().getDirection().multiply(0.6)); + } + else + { + _ignoreControl.add(player.getUniqueId()); + skull.setDirection(_active.get(skull)); + skull.setVelocity(_active.get(skull)); + } + } + } + + @EventHandler + public void explode(EntityExplodeEvent event) + { + if (!_active.containsKey(event.getEntity())) + { + return; + } + + event.setCancelled(true); + + WitherSkull skull = (WitherSkull) event.getEntity(); + + UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, skull.getLocation(), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); + + explode(skull, event.getLocation(), (LivingEntity) skull.getShooter()); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void explodeDamage(CustomDamageEvent event) + { + if (event.IsCancelled()) + { + return; + } + + if (event.GetProjectile() != null && event.GetProjectile() instanceof WitherSkull) + { + event.SetCancelled("Wither Skull Cancel"); + } + } + + private void explode(WitherSkull skull, Location loc, LivingEntity shooter) + { + double scale = 0.4 + 0.6 * Math.min(1, skull.getTicksLived() / 20d); + + // Players + Map players = UtilPlayer.getInRadius(skull.getLocation(), 6); + + for (Player player : players.keySet()) + { + if (Manager.isSpectator(player)) + { + continue; + } + + // Damage Event + Manager.GetDamage().NewDamageEvent(player, (LivingEntity) skull.getShooter(), null, DamageCause.CUSTOM, DAMAGE * players.get(player) * scale, true, true, false, UtilEnt.getName( + (LivingEntity) skull.getShooter()), GetName()); + } + } + + @EventHandler + public void knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { + return; + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/SmashWitherSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/SmashWitherSkeleton.java new file mode 100644 index 000000000..5711820e7 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/SmashWitherSkeleton.java @@ -0,0 +1,136 @@ +package nautilus.game.arcade.game.games.smash.perks.witherskeleton; + +import java.util.ArrayList; + +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.disguise.disguises.DisguiseWither; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; + +public class SmashWitherSkeleton extends SmashUltimate +{ + + private static final long DURAITON = 18000; + + public SmashWitherSkeleton() + { + super("Wither Form", new String[] {}, Sound.WITHER_SPAWN, DURAITON); + } + + @Override + public void activate(Player player) + { + super.activate(player); + + Manager.GetDisguise().undisguise(Manager.GetDisguise().getActiveDisguise(player)); + + SmashKit2 kit = (SmashKit2) Kit; + kit.disguise(player, DisguiseWither.class); + } + + @Override + public void cancel(Player player) + { + super.cancel(player); + + Manager.GetDisguise().undisguise(Manager.GetDisguise().getActiveDisguise(player)); + + SmashKit2 kit = (SmashKit2) Kit; + kit.disguise(player); + + player.setFlying(false); + } + + @EventHandler + public void witherBump(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + { + return; + } + + for (Player player : ((SmashKit) Kit).getSuperActive()) + { + ArrayList collisions = new ArrayList(); + + // Bump + for (Block block : UtilBlock.getInRadius(player.getLocation().add(0, 0.5, 0), 1.5d).keySet()) + { + if (!UtilBlock.airFoliage(block)) + { + collisions.add(block.getLocation().add(0.5, 0.5, 0.5)); + } + } + + Vector vec = UtilAlg.getAverageBump(player.getLocation(), collisions); + + if (vec == null) + continue; + + UtilAction.velocity(player, vec, 0.6, false, 0, 0.4, 10, true); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void witherMeleeCancel(CustomDamageEvent event) + { + if (event.IsCancelled()) + { + return; + } + + Player player = event.GetDamagerPlayer(true); + + if (player == null) + { + return; + } + + if (!isUsingUltimate(player)) + { + return; + } + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + { + return; + } + + event.SetCancelled("Wither Form Melee Cancel"); + } + + @EventHandler + public void witherFlight(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + for (Player player : ((SmashKit) Kit).getSuperActive()) + { + if (player.isFlying()) + { + continue; + } + + player.setAllowFlight(true); + player.setFlying(true); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/SmashWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/SmashWolf.java new file mode 100644 index 000000000..af0145b89 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/SmashWolf.java @@ -0,0 +1,561 @@ +package nautilus.game.arcade.game.games.smash.perks.wolf; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Wolf; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseWolf; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.condition.ConditionFactory; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; + +public class SmashWolf extends SmashUltimate +{ + + private static final int DURATION = 30000; + private static final int TACKLE_COOLDOWN_NORMAL = 8000; + private static final int TACKLE_COOLDOWN_SMASH = 1600; + private static final int WOLF_HEALTH = 30; + private static final float WOLF_HIT_BOX = 2.5F; + private static final int WOLF_MAX_TICKS = 70; + private static final int TACKLE_DAMAGE = 5; + private static final int STRIKE_DAMAGE = 7; + + private static final String CUB_TACKLE = "Cub Tackle"; + private static final String WOLF_STRIKE = "Wolf Strike"; + + private Map _owner = new HashMap<>(); + private Map _tackle = new HashMap<>(); + + private Map _strike = new HashMap<>(); + + private Map> _repeat = new HashMap<>(); + + private Map _tacklestrike = new HashMap<>(); + + public SmashWolf() + { + super("Frenzy", new String[] { C.cGray + "Attacks give +1 Damage for 3 seconds. Stacks.", C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + CUB_TACKLE, C.cYellow + + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + WOLF_STRIKE, C.cGray + "Wolf Strike deals 300% Knockback to tackled opponents.", }, Sound.WOLF_HOWL, DURATION); + } + + @EventHandler + public void tackleTrigger(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isAxe(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + boolean smash = isUsingUltimate(player); + + if (!Recharge.Instance.use(player, CUB_TACKLE, smash ? TACKLE_COOLDOWN_SMASH : TACKLE_COOLDOWN_NORMAL, !smash, !smash)) + { + return; + } + + // Get Nearest Wolf + Manager.GetGame().CreatureAllowOverride = true; + Wolf wolf = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Wolf.class); + Manager.GetGame().CreatureAllowOverride = false; + + wolf.setBaby(); + + wolf.setAngry(true); + + UtilEnt.Vegetate(wolf); + + wolf.setMaxHealth(WOLF_HEALTH); + wolf.setHealth(wolf.getMaxHealth()); + + UtilAction.velocity(wolf, player.getLocation().getDirection(), 1.8, false, 0, 0.2, 1.2, true); + + player.getWorld().playSound(wolf.getLocation(), Sound.WOLF_BARK, 1f, 1.8f); + + // Record + _owner.put(wolf, player.getUniqueId()); + + // Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(CUB_TACKLE) + ".")); + } + + @EventHandler + public void tackleCollide(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + // Collide + Iterator wolfIterator = _owner.keySet().iterator(); + + while (wolfIterator.hasNext()) + { + Wolf wolf = wolfIterator.next(); + + // Hit Player + for (Player other : Manager.GetGame().GetPlayers(true)) + { + if (Manager.isSpectator(other)) + { + continue; + } + + if (UtilEnt.hitBox(wolf.getLocation(), other, WOLF_HIT_BOX, null)) + { + if (other.equals(tackleGetOwner(wolf))) + { + continue; + + } + + tackleCollideAction(tackleGetOwner(wolf), other, wolf); + wolfIterator.remove(); + return; + } + + if (!wolf.isValid() || (UtilEnt.isGrounded(wolf) && wolf.getTicksLived() > WOLF_MAX_TICKS)) + { + wolf.remove(); + wolfIterator.remove(); + } + } + } + } + + public void tackleCollideAction(Player damager, LivingEntity damagee, Wolf wolf) + { + if (damager == null) + { + return; + } + + _tackle.put(wolf, damagee); + + wolf.setVelocity(new Vector(0, -0.6, 0)); + UtilAction.zeroVelocity(damagee); + + // Damage + Manager.GetDamage().NewDamageEvent(damagee, damager, null, DamageCause.CUSTOM, TACKLE_DAMAGE, false, true, false, damager.getName(), CUB_TACKLE); + + // Sound + damagee.getWorld().playSound(damagee.getLocation(), Sound.WOLF_GROWL, 1.5f, 1.5f); + + // Inform + UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(CUB_TACKLE) + ".")); + UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill(CUB_TACKLE) + ".")); + } + + @EventHandler + public void tackleUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + Iterator wolfIterator = _tackle.keySet().iterator(); + + while (wolfIterator.hasNext()) + { + Wolf wolf = wolfIterator.next(); + LivingEntity ent = _tackle.get(wolf); + + if (!wolf.isValid() || !ent.isValid() || wolf.getTicksLived() > WOLF_MAX_TICKS) + { + wolf.remove(); + wolfIterator.remove(); + continue; + } + + if (UtilMath.offset(wolf, ent) < WOLF_HIT_BOX) + { + Manager.GetCondition().Factory().Slow(CUB_TACKLE, ent, wolf, 0.9, 1, false, false, false, false); + UtilAction.velocity(ent, new Vector(0, -0.3, 0)); + } + + // Move + Location loc = ent.getLocation(); + loc.add(UtilAlg.getTrajectory2d(ent, wolf).multiply(1)); + + UtilEnt.CreatureMove(wolf, loc, 1); + } + } + + public Player tackleGetOwner(Wolf wolf) + { + if (_owner.containsKey(wolf)) + { + return UtilPlayer.searchExact(_owner.get(wolf)); + } + + return null; + } + + @EventHandler + public void tackleTargetCancel(EntityTargetEvent event) + { + if (_owner.containsKey(event.getEntity())) + { + if (_owner.get(event.getEntity()).equals(event.getTarget())) + { + event.setCancelled(true); + } + } + } + + @EventHandler + public void tackleDamage(CustomDamageEvent event) + { + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + { + return; + } + + LivingEntity damager = event.GetDamagerEntity(false); + + if (damager == null) + { + return; + } + + if (damager instanceof Wolf) + { + event.SetCancelled("Wolf Cub"); + } + } + + @EventHandler + public void strikeTrigger(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isSpade(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + boolean smash = isUsingUltimate(player); + + if (!Recharge.Instance.use(player, WOLF_STRIKE, smash ? 1600 : 8000, !smash, !smash)) + { + return; + } + + // Velocity + UtilAction.velocity(player, player.getLocation().getDirection(), 1.6, false, 1, 0.2, 1.2, true); + + // Record + _strike.put(player.getUniqueId(), System.currentTimeMillis()); + + player.getWorld().playSound(player.getLocation(), Sound.WOLF_BARK, 1f, 1.2f); + + // Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(WOLF_STRIKE) + ".")); + } + + @EventHandler + public void strikeEnd(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + // Collide + Iterator playerIterator = _strike.keySet().iterator(); + + while (playerIterator.hasNext()) + { + UUID uuid = playerIterator.next(); + Player player = UtilPlayer.searchExact(uuid); + + if (player == null) + { + playerIterator.remove(); + continue; + } + + for (Player other : Manager.GetGame().GetPlayers(true)) + { + if (player.equals(other)) + { + continue; + } + + if (Manager.isSpectator(other)) + { + continue; + } + + if (UtilEnt.hitBox(player.getLocation().add(0, 1, 0), other, WOLF_HIT_BOX, null)) + { + strikeHit(player, other); + playerIterator.remove(); + return; + } + } + + if (!UtilEnt.isGrounded(player)) + { + continue; + } + + if (!UtilTime.elapsed(_strike.get(uuid), 1500)) + { + continue; + } + + playerIterator.remove(); + } + } + + public void strikeHit(Player damager, LivingEntity damagee) + { + UtilAction.zeroVelocity(damager); + + // Remove tackle + Iterator wolfIterator = _tackle.keySet().iterator(); + + while (wolfIterator.hasNext()) + { + Wolf wolf = wolfIterator.next(); + + if (_tackle.get(wolf).equals(damagee)) + { + wolf.remove(); + wolfIterator.remove(); + + _tacklestrike.put(damagee, System.currentTimeMillis()); + } + } + + Manager.GetDamage().NewDamageEvent(damagee, damager, null, DamageCause.CUSTOM, STRIKE_DAMAGE, true, true, false, damager.getName(), WOLF_STRIKE); + + // Sound + damagee.getWorld().playSound(damagee.getLocation(), Sound.WOLF_BARK, 1.5f, 1f); + + // Inform + UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(WOLF_STRIKE) + ".")); + UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill(WOLF_STRIKE) + ".")); + } + + @EventHandler + public void strikeKnockback(CustomDamageEvent event) + { + if (event.GetReason() != null && event.GetReason().contains(WOLF_STRIKE)) + { + if (_tacklestrike.containsKey(event.GetDamageeEntity()) && !UtilTime.elapsed(_tacklestrike.get(event.GetDamageeEntity()), 100)) + { + event.AddKnockback(GetName(), 3.0); + + // Blood + event.GetDamageeEntity().getWorld().playEffect(event.GetDamageeEntity().getLocation(), Effect.STEP_SOUND, 55); + + // Double Sound + event.GetDamageeEntity().getWorld().playSound(event.GetDamageeEntity().getLocation(), Sound.WOLF_BARK, 2f, 1.5f); + } + else + { + event.AddKnockback(GetName(), 1.5); + } + } + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void RepeatDamage(CustomDamageEvent event) + { + if (event.IsCancelled()) + { + return; + } + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + { + return; + } + + Player damager = event.GetDamagerPlayer(false); + + if (damager == null) + { + return; + } + + if (!hasPerk(damager)) + { + return; + } + + if (!_repeat.containsKey(damager.getUniqueId())) + { + _repeat.put(damager.getUniqueId(), new ArrayList()); + _repeat.get(damager.getUniqueId()).add(System.currentTimeMillis()); + + // Exp + damager.setExp(Math.min(0.99F, _repeat.get(damager.getUniqueId()).size() / 9f)); + + return; + } + + int count = _repeat.get(damager.getUniqueId()).size(); + + if (count > 0) + { + event.AddMod(damager.getName(), "Ravage", Math.min(2, count), false); + + // Sound + damager.getWorld().playSound(damager.getLocation(), Sound.WOLF_BARK, (float) (0.5 + count * 0.25), (float) (1 + count * 0.25)); + } + + _repeat.get(damager.getUniqueId()).add(System.currentTimeMillis()); + + // Exp + damager.setExp(Math.min(0.9999f, _repeat.get(damager.getUniqueId()).size() / 9f)); + } + + @EventHandler + public void RepeatExpire(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + Iterator playerIterator = _repeat.keySet().iterator(); + + while (playerIterator.hasNext()) + { + UUID uuid = playerIterator.next(); + Player player = UtilPlayer.searchExact(uuid); + + Iterator timeIterator = _repeat.get(uuid).iterator(); + + while (timeIterator.hasNext()) + { + long time = timeIterator.next(); + + if (UtilTime.elapsed(time, 3000)) + { + timeIterator.remove(); + } + } + + // Exp + player.setExp(Math.min(0.9999f, _repeat.get(player).size() / 9f)); + } + } + + @Override + public void activate(Player player) + { + super.activate(player); + + ConditionFactory factory = Manager.GetCondition().Factory(); + + factory.Strength(GetName(), player, player, 30, 1, false, false, false); + factory.Speed(GetName(), player, player, 30, 2, false, false, false); + factory.Regen(GetName(), player, player, 30, 2, false, false, false); + + DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); + + if (disguise instanceof DisguiseWolf) + { + ((DisguiseWolf) disguise).setAngry(true); + Manager.GetDisguise().updateDisguise(disguise); + } + + Recharge.Instance.recharge(player, WOLF_STRIKE); + Recharge.Instance.recharge(player, CUB_TACKLE); + } + + @Override + public void cancel(Player player) + { + super.cancel(player); + + DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); + + if (disguise instanceof DisguiseWolf) + { + ((DisguiseWolf) disguise).setAngry(false); + Manager.GetDisguise().updateDisguise(disguise); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkDeathsGrasp.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkDeathsGrasp.java new file mode 100644 index 000000000..a659a2ee2 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkDeathsGrasp.java @@ -0,0 +1,193 @@ +package nautilus.game.arcade.game.games.smash.perks.zombie; + +import java.time.temporal.WeekFields; +import java.util.HashMap; +import java.util.Iterator; + +import org.bukkit.GameMode; +import org.bukkit.Sound; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; + +public class PerkDeathsGrasp extends Perk +{ + private HashMap _live = new HashMap(); + private HashMap _weakness = new HashMap(); + + public PerkDeathsGrasp() + { + super("Deaths Grasp", new String[] + { + C.cYellow + "Left-Click" + C.cGray + " with Bow to use " + C.cGreen + "Deaths Grasp", + C.cGray + "+100% Arrow Damage to enemies thrown by Deaths Grasp" + }); + } + + @EventHandler + public void leap(PlayerInteractEvent event) + { + if (event.isCancelled()) + return; + + if (event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.LEFT_CLICK_BLOCK) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + if (!UtilGear.isBow(event.getPlayer().getItemInHand())) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (!Recharge.Instance.use(player, GetName(), 12000, true, true)) + return; + + UtilAction.velocity(player, player.getLocation().getDirection(), 1.4, false, 0, 0.2, 1.2, true); + + //Record + _live.put(player, System.currentTimeMillis()); + + //Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_HURT, 1f, 1.4f); + } + + @EventHandler + public void end(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + //Collide + for (Player player : Manager.GetGame().GetPlayers(true)) + if (_live.containsKey(player)) + for (Player other : Manager.GetGame().GetPlayers(true)) + if (!Manager.isSpectator(other)) + if (!other.equals(player)) + if (UtilMath.offset(player, other) < 2) + { + collide(player, other); + _live.remove(player); + return; + } + + //Leap End + Iterator leapIter = _live.keySet().iterator(); + + while (leapIter.hasNext()) + { + LivingEntity ent = leapIter.next(); + + if (!UtilEnt.isGrounded(ent)) + continue; + + if (!UtilTime.elapsed(_live.get(ent), 1000)) + continue; + + leapIter.remove(); + } + + //Weakness End + Iterator weaknessIter = _weakness.keySet().iterator(); + + while (weaknessIter.hasNext()) + { + LivingEntity ent = weaknessIter.next(); + + if (!UtilEnt.isGrounded(ent)) + continue; + + if (!UtilTime.elapsed(_weakness.get(ent), 1000)) + continue; + + weaknessIter.remove(); + } + } + + public void collide(Player damager, LivingEntity damagee) + { + //Damage Event + Manager.GetDamage().NewDamageEvent(damagee, damager, null, + DamageCause.CUSTOM, 6, false, true, false, + damager.getName(), GetName()); + + UtilAction.velocity(damagee, UtilAlg.getTrajectory2d(damagee, damager), 1.6, false, 0, 1.2, 1.8, true); + + UtilAction.zeroVelocity(damager); + + damager.getWorld().playSound(damager.getLocation(), Sound.ZOMBIE_HURT, 1f, 0.7f); + + _weakness.put(damagee, System.currentTimeMillis()); + + //Inform + UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName()) + ".")); + UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill(GetName()) + ".")); + + Recharge.Instance.recharge(damager, GetName()); + Recharge.Instance.use(damager, GetName(), 2000, true, true); + } + + @EventHandler(priority = EventPriority.HIGH) + public void arrowDamage(CustomDamageEvent event) + { + if (event.GetProjectile() == null) + return; + + if (!(event.GetProjectile() instanceof Arrow)) + return; + + if (!_weakness.containsKey(event.GetDamageeEntity())) + return; + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) return; + + if (!Kit.HasKit(damager)) + return; + + if (!Manager.IsAlive(damager)) + return; + + event.AddMult(GetName(), GetName() + " Combo", 2, true); + + UtilParticle.PlayParticle(ParticleType.RED_DUST, event.GetDamageeEntity().getLocation(), 0.5f, 0.5f, 0.5f, 0, 20, + ViewDist.MAX, UtilServer.getPlayers()); + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, event.GetDamageeEntity().getLocation(), 0, 0, 0, 0, 1, + ViewDist.MAX, UtilServer.getPlayers()); + + damager.getWorld().playSound(damager.getLocation(), Sound.ZOMBIE_HURT, 1f, 2f); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkNightLivingDead.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkNightLivingDead.java new file mode 100644 index 000000000..46c7fa2bd --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkNightLivingDead.java @@ -0,0 +1,150 @@ +package nautilus.game.arcade.game.games.smash.perks.zombie; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.entity.Zombie; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.games.smash.TeamSuperSmash; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; +import nautilus.game.arcade.kit.perks.data.NightLivingDeadData; + +public class PerkNightLivingDead extends SmashPerk +{ + private ArrayList _night = new ArrayList(); + + private HashSet _ignoreList = new HashSet();; + + public PerkNightLivingDead() + { + super("Night of the Living Dead", new String[] + { + }, false); + } + + @Override + public void addSuperCustom(Player player) + { + _night.add(new NightLivingDeadData(player)); + } + + @EventHandler + public void timeUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (_night.isEmpty() && Manager.GetGame().WorldTimeSet != 12000) + { + Manager.GetGame().WorldTimeSet = (Manager.GetGame().WorldTimeSet + 50)%24000; + } + else if (!_night.isEmpty() && Manager.GetGame().WorldTimeSet != 18000) + { + Manager.GetGame().WorldTimeSet = (Manager.GetGame().WorldTimeSet + 50)%24000; + } + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Iterator nightIter = _night.iterator(); + + while (nightIter.hasNext()) + { + NightLivingDeadData data = nightIter.next(); + + //Expire + if (UtilTime.elapsed(data.Time, 30000)) + { + nightIter.remove(); + + for (Zombie zombie : data.Zombies) + zombie.damage(1000); + continue; + } + + //Spawn + if (UtilTime.elapsed(data.LastSpawn, 1000)) + { + Location origin = UtilAlg.Random(Manager.GetGame().GetPlayers(true)).getLocation(); + Location loc = findSpawn(origin); + + if (Math.abs(loc.getY() - origin.getY()) > 6) + continue; + + if (!UtilBlock.airFoliage(loc.getBlock()) || !UtilBlock.airFoliage(loc.getBlock().getRelative(BlockFace.UP))) + continue; + + //Set Spawned + data.LastSpawn = System.currentTimeMillis(); + + //Move Down + loc.subtract(0, 1, 0); + + //Spawn + Manager.GetGame().CreatureAllowOverride = true; + Zombie zombie = loc.getWorld().spawn(loc, Zombie.class); + Manager.GetGame().CreatureAllowOverride = false; + + data.Zombies.add(zombie); + + //Pop up + zombie.setVelocity(new Vector(0,0.4,0)); + //zombie.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 9999, 1, true)); + + //Effect + zombie.getWorld().playSound(zombie.getLocation(), Sound.ZOMBIE_IDLE, 1f, 0.75f); + + loc.getWorld().playEffect(loc, Effect.STEP_SOUND, loc.getBlock().getType()); + } + } + } + + @EventHandler + public void update(EntityTargetEvent event) + { + for (NightLivingDeadData data : _night) + { + if (data.Zombies.contains(event.getEntity())) + { + if (Manager.GetGame() instanceof TeamSuperSmash && event.getTarget() instanceof Player) + { + TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); + Player targetPlayer = (Player) event.getTarget(); + + if (smash.GetTeam(data.Player).equals(smash.GetTeam(targetPlayer))) + { + event.setCancelled(true); + } + } + if (data.Player.equals(event.getTarget())) + { + event.setCancelled(true); + } + } + } + } + + public Location findSpawn(Location area) + { + return UtilBlock.getHighest(area.getWorld(), (int)(area.getX() + Math.random() * 24 - 12), (int)(area.getZ() + Math.random() * 24 - 12), _ignoreList).getLocation().add(0.5, 0.5, 0.5); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkOvercharge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkOvercharge.java new file mode 100644 index 000000000..fa61a59ff --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkOvercharge.java @@ -0,0 +1,252 @@ +package nautilus.game.arcade.game.games.smash.perks.zombie; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerQuitEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkOvercharge extends SmashPerk +{ + private Map _charge = new HashMap<>(); + private Map _chargeLast = new HashMap<>(); + + private Map _arrows = new HashMap<>(); + + private int _max; + private long _tick; + private boolean _useExp; + + public PerkOvercharge(int max, long tick, boolean useExpBar) + { + super("Corrupted Arrow", new String[] { C.cYellow + "Charge" + C.cGray + " your Bow to use " + C.cGreen + "Corrupted Arrow" }); + + _useExp = useExpBar; + _max = max; + _tick = tick; + } + + @EventHandler + public void drawBow(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (player.getItemInHand() == null || player.getItemInHand().getType() != Material.BOW) + { + return; + } + + if (!player.getInventory().contains(Material.ARROW)) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + // Start Charge + _charge.put(player.getUniqueId(), 0); + _chargeLast.put(player.getUniqueId(), System.currentTimeMillis()); + } + + @EventHandler + public void charge(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + for (Player cur : UtilServer.getPlayers()) + { + UUID uuid = cur.getUniqueId(); + + // Not Charging + if (!_charge.containsKey(uuid)) + { + continue; + } + + // Max Charge + if (_charge.get(uuid) >= _max) + { + continue; + } + + // Charge Interval + if (_charge.get(uuid) == 0) + { + if (!UtilTime.elapsed(_chargeLast.get(uuid), 1000)) + { + continue; + } + } + else + { + if (!UtilTime.elapsed(_chargeLast.get(uuid), _tick)) + { + continue; + } + } + + // No Longer Holding Bow + if (cur.getItemInHand() == null || cur.getItemInHand().getType() != Material.BOW) + { + if (_useExp) + { + cur.setExp(0f); + } + + _charge.remove(uuid); + _chargeLast.remove(uuid); + continue; + } + + // Increase Charge + _charge.put(uuid, _charge.get(cur) + 1); + + if (_useExp) + { + cur.setExp(Math.min(0.99f, _charge.get(cur) / _max)); + } + + _chargeLast.put(uuid, System.currentTimeMillis()); + + // Effect + cur.playSound(cur.getLocation(), Sound.CLICK, 1f, 1f + (0.1f * _charge.get(cur))); + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void fireBow(EntityShootBowEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!Manager.GetGame().IsLive()) + { + return; + } + + if (!(event.getEntity() instanceof Player)) + { + return; + } + + if (!(event.getProjectile() instanceof Arrow)) + { + return; + } + + Player player = (Player) event.getEntity(); + + if (!_charge.containsKey(player.getUniqueId())) + { + return; + } + + int charge = _charge.remove(player.getUniqueId()); + + if (charge <= 0) + { + return; + } + + // Start Barrage + _arrows.put((Arrow) event.getProjectile(), charge); + + player.setExp(0f); + } + + @EventHandler(priority = EventPriority.HIGH) + public void damageBonus(CustomDamageEvent event) + { + if (event.GetProjectile() == null) + { + return; + } + + if (!_arrows.containsKey(event.GetProjectile())) + { + return; + } + + int charge = _arrows.remove(event.GetProjectile()); + + event.AddMod(GetName(), GetName(), charge * 0.9, true); + } + + @EventHandler + public void clean(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + for (Iterator arrowIterator = _arrows.keySet().iterator(); arrowIterator.hasNext();) + { + Arrow arrow = arrowIterator.next(); + + if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround() || arrow.getTicksLived() > 120) + { + arrowIterator.remove(); + } + else + { + UtilParticle.PlayParticle(ParticleType.RED_DUST, arrow.getLocation(), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); + } + } + } + + @EventHandler + public void quit(PlayerQuitEvent event) + { + Player player = event.getPlayer(); + + _charge.remove(player.getUniqueId()); + _chargeLast.remove(player.getUniqueId()); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkZombieBile.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkZombieBile.java new file mode 100644 index 000000000..982230c41 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkZombieBile.java @@ -0,0 +1,189 @@ +package nautilus.game.arcade.game.games.smash.perks.zombie; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.UUID; + +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.entity.PlayerDeathEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkZombieBile extends SmashPerk implements IThrown +{ + + private static final int COOLDOWN = 10000; + + private Map _active = new HashMap<>(); + + public PerkZombieBile() + { + super("Spew Bile", new String[] { C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Spew Bile" }); + } + + @EventHandler + public void activate(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isAxe(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } + + _active.put(player.getUniqueId(), System.currentTimeMillis()); + + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void deactivateDeath(PlayerDeathEvent event) + { + if (!hasPerk(event.getEntity())) + { + return; + } + + _active.remove(event.getEntity().getUniqueId()); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + Iterator activeIter = _active.keySet().iterator(); + + while (activeIter.hasNext()) + { + UUID uuid = activeIter.next(); + Player player = UtilPlayer.searchExact(uuid); + + // Expire + if (UtilTime.elapsed(_active.get(player.getUniqueId()), 2000)) + { + activeIter.remove(); + continue; + } + + // Sound + if (Math.random() > 0.85) + { + player.getWorld().playSound(player.getLocation(), Sound.BURP, 1f, (float) (Math.random() + 0.5)); + } + + // Projectiles + for (int i = 0; i < 3; i++) + { + Vector rand = new Vector((Math.random() - 0.5) * 0.525, (Math.random() - 0.5) * 0.525, (Math.random() - 0.5) * 0.525); + + Item ent = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()).subtract(0, 0.5, 0), new ItemStack(Material.ROTTEN_FLESH)); + UtilAction.velocity(ent, player.getLocation().getDirection().add(rand), 0.8, false, 0, 0.2, 10, false); + Manager.GetProjectile().AddThrow(ent, player, this, System.currentTimeMillis() + 2000, true, true, true, false, 0.5f); + } + } + } + + @EventHandler + public void death(PlayerDeathEvent event) + { + if (_active.containsKey(event.getEntity())) + { + _active.remove(event.getEntity()); + } + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + data.getThrown().remove(); + + if (target == null) + return; + + if (target instanceof Player) + if (!Manager.GetGame().IsAlive((Player) target)) + return; + + // Damage Event + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, 3, true, false, false, UtilEnt.getName(data.getThrower()), GetName()); + + data.getThrown().remove(); + } + + @Override + public void Idle(ProjectileUser data) + { + data.getThrown().remove(); + } + + @Override + public void Expire(ProjectileUser data) + { + data.getThrown().remove(); + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + return; + + event.AddKnockback(GetName(), 1); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java index f71dc6aca..6e94c5983 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java @@ -12,7 +12,6 @@ import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Slime; import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.player.PlayerInteractEvent; @@ -22,6 +21,9 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; @@ -35,11 +37,15 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.TeamSuperSmash; import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkSlimeRocket extends SmashPerk implements IThrown { + + private static final long COOLDOWN = 6000; + private static final float ENERGY_PER_TICK = 0.004F; + private static final int KNOCKBACK_MAGNITUDE = 3; + private Map _charge = new HashMap<>(); private Map _owner = new HashMap<>(); private Map _lastAttack = new HashMap<>(); @@ -60,11 +66,15 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown for (Player player : Manager.GetGame().GetPlayers(true)) { if (!hasPerk(player)) + { continue; - + } + if (isSuperActive(player)) + { continue; - + } + int size = 1; if (player.getExp() > 0.8) { @@ -84,9 +94,11 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown } if (player.isBlocking()) + { continue; + } - player.setExp((float) Math.min(0.999, player.getExp() + 0.004)); + player.setExp((float) Math.min(0.999, player.getExp() + ENERGY_PER_TICK)); } } @@ -94,46 +106,69 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown public void Activate(PlayerInteractEvent event) { if (event.isCancelled()) + { return; + } - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + if (!UtilEvent.isAction(event, ActionType.R)) + { return; + } if (UtilBlock.usable(event.getClickedBlock())) + { return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_SWORD")) - return; + } Player player = event.getPlayer(); + if (!UtilItem.isSword(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + if (isSuperActive(player)) + { return; + } - if (!Kit.HasKit(player)) + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { return; - - if (!Recharge.Instance.use(player, GetName(), 6000, true, true)) - return; - + } + UtilPlayer.message(player, F.main("Skill", "You are charging " + F.skill(GetName()) + ".")); - _charge.put(player, System.currentTimeMillis()); + _charge.put(player.getUniqueId(), System.currentTimeMillis()); } @EventHandler public void ChargeRelease(UpdateEvent event) { if (event.getType() != UpdateType.TICK) + { return; - - Iterator chargeIterator = _charge.keySet().iterator(); + } + + Iterator chargeIterator = _charge.keySet().iterator(); while (chargeIterator.hasNext()) { - Player player = chargeIterator.next(); + UUID key = chargeIterator.next(); + Player player = UtilPlayer.searchExact(key); - long time = _charge.get(player); + if (player == null) + { + chargeIterator.remove(); + continue; + } + + long time = _charge.get(key); // Charge if (player.isBlocking()) @@ -178,7 +213,7 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown public void FireRocket(Player player) { - double charge = Math.min(3, (double) (System.currentTimeMillis() - _charge.get(player)) / 1000d); + double charge = Math.min(3, (double) (System.currentTimeMillis() - _charge.get(player.getUniqueId())) / 1000d); // Spawn Slime Manager.GetGame().CreatureAllowOverride = true; @@ -192,7 +227,7 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown slime.setMaxHealth(5 + charge * 7); slime.setHealth(slime.getMaxHealth()); - _owner.put(slime, player); + _owner.put(slime, player.getUniqueId()); // Inform UtilPlayer.message(player, F.main("Skill", "You released " + F.skill(GetName()) + ".")); @@ -209,19 +244,21 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown public void SlimeTarget(EntityTargetEvent event) { if (event.isCancelled()) - return; - - if (!_owner.containsKey(event.getEntity())) - return; - - if (Manager.GetGame() instanceof TeamSuperSmash && event.getTarget() instanceof Player) { - TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); - Player targetPlayer = (Player) event.getTarget(); - - if (smash.GetTeam(_owner.get(event.getEntity())).equals(smash.GetTeam(targetPlayer))) + return; + } + + if (!_owner.containsKey(event.getEntity())) + { + return; + } + + if (event.getTarget() instanceof Player) + { + if (isTeamDamage((Player) event.getTarget(), UtilPlayer.searchExact(_owner.get(event.getEntity().getUniqueId())))) { event.setCancelled(true); + return; } } @@ -235,20 +272,23 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown public void Collide(LivingEntity target, Block block, ProjectileUser data) { if (target == null) + { return; + } if (!(data.getThrown() instanceof Slime)) + { return; + } Slime slime = (Slime) data.getThrown(); - if (Manager.GetGame() instanceof TeamSuperSmash && target instanceof Player && data.getThrower() instanceof Player) + if (target instanceof Player && data.getThrower() instanceof Player) { - TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); Player targetPlayer = (Player) target; Player throwerPlayer = (Player) data.getThrower(); - if (smash.GetTeam(targetPlayer).equals(smash.GetTeam(throwerPlayer))) + if (isTeamDamage(targetPlayer, throwerPlayer)) { return; } @@ -262,9 +302,11 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown public void Knockback(CustomDamageEvent event) { if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { return; + } - event.AddKnockback(GetName(), 3.0); + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); } @Override @@ -297,19 +339,18 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown _lastAttack.put(slime, System.currentTimeMillis()); // Get Owner - Player owner = _owner.get(slime); - // if (owner != null) - // event.SetDamager(owner); This gives knockback from wrong direction :( + UUID key = _owner.get(slime); + Player owner = UtilPlayer.searchExact(key); - if (Manager.GetGame() instanceof TeamSuperSmash) + if (owner == null) { - TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); + return; + } - if (smash.GetTeam(owner).equals(smash.GetTeam(event.GetDamageePlayer()))) - { - event.SetCancelled("Team Damage"); - return; - } + if (isTeamDamage(owner, event.GetDamageePlayer())) + { + event.SetCancelled("Team Damage"); + return; } if (owner != null && owner.equals(event.GetDamageeEntity())) @@ -328,7 +369,9 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown public void SlimeClean(UpdateEvent event) { if (event.getType() != UpdateType.SEC) + { return; + } Iterator slimeIterator = _owner.keySet().iterator(); @@ -346,14 +389,20 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown Manager.GetBlood().Effects(null, slime.getLocation(), 6 + 6 * slime.getSize(), 0.2 + 0.1 * slime.getSize(), null, 1f, 1f, Material.SLIME_BALL, (byte) 0, 15, false); if (slime.getSize() <= 1) + { slime.remove(); + } else + { slime.setSize(slime.getSize() - 1); + } } } if (!slime.isValid()) + { slimeIterator.remove(); + } } slimeIterator = _lastAttack.keySet().iterator(); @@ -363,7 +412,9 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown Slime slime = slimeIterator.next(); if (!slime.isValid()) + { slimeIterator.remove(); + } } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpiderLeap.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpiderLeap.java index 37d07564d..4df288188 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpiderLeap.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpiderLeap.java @@ -1,6 +1,8 @@ package nautilus.game.arcade.kit.perks; import java.util.HashSet; +import java.util.Set; +import java.util.UUID; import org.bukkit.GameMode; import org.bukkit.Sound; @@ -15,6 +17,7 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; @@ -23,67 +26,77 @@ import nautilus.game.arcade.kit.Perk; public class PerkSpiderLeap extends Perk { - private HashSet _secondJump = new HashSet(); - public PerkSpiderLeap() + private static final float ENERGY_PER_TICK = 1 / 80; + private static final float ENERGY_PER_LEAP = 1 / 6; + + private Set _secondJump = new HashSet<>(); + + public PerkSpiderLeap() { - super("Spider Leap", new String[] - { - C.cYellow + "Tap Jump Twice" + C.cGray + " to " + C.cGreen + "Spider Leap", - C.cYellow + "Hold Crouch" + C.cGray + " to " + C.cGreen + "Wall Climb", - C.cWhite + "Wall Climb requires Energy (Experience Bar)." - - }); + super("Spider Leap", new String[] { C.cYellow + "Tap Jump Twice" + C.cGray + " to " + C.cGreen + "Spider Leap", C.cYellow + "Hold Crouch" + C.cGray + " to " + C.cGreen + "Wall Climb", C.cWhite + + "Wall Climb requires Energy (Experience Bar)." + }); } - + @EventHandler public void WallClimb(UpdateEvent event) { if (event.getType() != UpdateType.TICK) + { return; - + } + for (Player player : UtilServer.getPlayers()) { - if (Manager.isSpectator(player)) + if (UtilPlayer.isSpectator(player)) + { continue; - - if (!Kit.HasKit(player)) + } + + if (!hasPerk(player)) + { continue; + } if (!player.isSneaking()) { if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) { - player.setExp((float) Math.min(0.999, player.getExp()+(1f/80f))); - _secondJump.remove(player); + player.setExp((float) Math.min(0.999, player.getExp() + ENERGY_PER_TICK)); + _secondJump.remove(player.getUniqueId()); } continue; } - - player.setExp((float) Math.max(0, player.getExp()-(1f/80f))); - + + player.setExp((float) Math.max(0, player.getExp() - ENERGY_PER_TICK)); + if (player.getExp() <= 0) + { continue; + } if (!Recharge.Instance.usable(player, GetName())) + { continue; + } for (Block block : UtilBlock.getSurrounding(player.getLocation().getBlock(), true)) { if (!UtilBlock.airFoliage(block) && !block.isLiquid()) { UtilAction.velocity(player, new Vector(0, 0.2, 0)); - - if (!_secondJump.contains(player)) + + if (!_secondJump.contains(player.getUniqueId())) { player.setAllowFlight(true); - _secondJump.add(player); + _secondJump.add(player.getUniqueId()); } - + continue; } - } + } } } @@ -91,37 +104,45 @@ public class PerkSpiderLeap extends Perk public void FlightHop(PlayerToggleFlightEvent event) { Player player = event.getPlayer(); - - if (!Kit.HasKit(player)) + + if (!hasPerk(player)) + { return; + } - if (Manager.isSpectator(player)) + if (UtilPlayer.isSpectator(player)) + { return; + } if (player.getGameMode() == GameMode.CREATIVE) + { return; + } event.setCancelled(true); player.setFlying(false); - - //Disable Flight + + // Disable Flight player.setAllowFlight(false); - - if (player.getExp() < (1f/6f)) + + if (player.getExp() < ENERGY_PER_LEAP) + { return; + } - //Velocity + // Velocity UtilAction.velocity(player, 1.0, 0.2, 1.0, true); - - //Energy - player.setExp((float) Math.max(0, player.getExp()-(1f/6f))); - - //Sound + + // Energy + player.setExp((float) Math.max(0, player.getExp() - ENERGY_PER_LEAP)); + + // Sound player.getWorld().playSound(player.getLocation(), Sound.SPIDER_IDLE, 1f, 1.5f); - + Recharge.Instance.use(player, GetName(), 500, false, false); } - + @EventHandler public void FlightUpdate(UpdateEvent event) { @@ -130,14 +151,20 @@ public class PerkSpiderLeap extends Perk for (Player player : UtilServer.getPlayers()) { - if (Manager.isSpectator(player)) + if (UtilPlayer.isSpectator(player)) + { continue; + } - if (!Kit.HasKit(player)) + if (!hasPerk(player)) + { continue; + } if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) + { player.setAllowFlight(true); + } } } } From 315a50aa16953f9699290b8510a7234fdb99cd8c Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 24 Sep 2016 21:34:45 +0100 Subject: [PATCH 005/147] Whoops --- .../smash/perks/zombie/PerkDeathsGrasp.java | 128 ++++++++++-------- .../smash/perks/zombie/PerkZombieBile.java | 35 +++-- 2 files changed, 90 insertions(+), 73 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkDeathsGrasp.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkDeathsGrasp.java index a659a2ee2..ebaebf084 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkDeathsGrasp.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkDeathsGrasp.java @@ -1,10 +1,10 @@ package nautilus.game.arcade.game.games.smash.perks.zombie; -import java.time.temporal.WeekFields; import java.util.HashMap; import java.util.Iterator; +import java.util.Map; -import org.bukkit.GameMode; +import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Arrow; import org.bukkit.entity.LivingEntity; @@ -14,7 +14,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.util.Vector; +import org.fusesource.jansi.internal.Kernel32.COORD; import mineplex.core.common.util.C; import mineplex.core.common.util.F; @@ -22,14 +22,16 @@ import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -38,50 +40,61 @@ import nautilus.game.arcade.kit.Perk; public class PerkDeathsGrasp extends Perk { - private HashMap _live = new HashMap(); - private HashMap _weakness = new HashMap(); + + private static final int COOLDOWN = 12000; + + private Map _live = new HashMap<>(); + private Map _weakness = new HashMap<>(); - public PerkDeathsGrasp() + public PerkDeathsGrasp() { - super("Deaths Grasp", new String[] - { - C.cYellow + "Left-Click" + C.cGray + " with Bow to use " + C.cGreen + "Deaths Grasp", - C.cGray + "+100% Arrow Damage to enemies thrown by Deaths Grasp" - }); + super("Deaths Grasp", new String[] { C.cYellow + "Left-Click" + C.cGray + " with Bow to use " + C.cGreen + "Deaths Grasp", C.cGray + "+100% Arrow Damage to enemies thrown by Deaths Grasp" }); } @EventHandler public void leap(PlayerInteractEvent event) { if (event.isCancelled()) + { return; + } - if (event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.LEFT_CLICK_BLOCK) + if (!UtilEvent.isAction(event, ActionType.L)) + { return; + } if (UtilBlock.usable(event.getClickedBlock())) + { return; - - if (!UtilGear.isBow(event.getPlayer().getItemInHand())) - return; + } Player player = event.getPlayer(); - if (!Kit.HasKit(player)) + if (player.getItemInHand() == null || player.getItemInHand().getType() != Material.BOW) + { return; + } - if (!Recharge.Instance.use(player, GetName(), 12000, true, true)) + if (!hasPerk(player)) + { return; + } + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } + UtilAction.velocity(player, player.getLocation().getDirection(), 1.4, false, 0, 0.2, 1.2, true); - //Record + // Record _live.put(player, System.currentTimeMillis()); - //Inform + // Inform UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); - - //Effect + + // Effect player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_HURT, 1f, 1.4f); } @@ -89,9 +102,11 @@ public class PerkDeathsGrasp extends Perk public void end(UpdateEvent event) { if (event.getType() != UpdateType.TICK) + { return; - - //Collide + } + + // Collide for (Player player : Manager.GetGame().GetPlayers(true)) if (_live.containsKey(player)) for (Player other : Manager.GetGame().GetPlayers(true)) @@ -104,62 +119,60 @@ public class PerkDeathsGrasp extends Perk return; } - //Leap End + // Leap End Iterator leapIter = _live.keySet().iterator(); - + while (leapIter.hasNext()) { LivingEntity ent = leapIter.next(); - + if (!UtilEnt.isGrounded(ent)) continue; - - if (!UtilTime.elapsed(_live.get(ent), 1000)) + + if (!UtilTime.elapsed(_live.get(ent), 1000)) continue; - + leapIter.remove(); } - //Weakness End + // Weakness End Iterator weaknessIter = _weakness.keySet().iterator(); - + while (weaknessIter.hasNext()) { LivingEntity ent = weaknessIter.next(); - + if (!UtilEnt.isGrounded(ent)) continue; - - if (!UtilTime.elapsed(_weakness.get(ent), 1000)) + + if (!UtilTime.elapsed(_weakness.get(ent), 1000)) continue; - + weaknessIter.remove(); } } - + public void collide(Player damager, LivingEntity damagee) { - //Damage Event - Manager.GetDamage().NewDamageEvent(damagee, damager, null, - DamageCause.CUSTOM, 6, false, true, false, - damager.getName(), GetName()); - + // Damage Event + Manager.GetDamage().NewDamageEvent(damagee, damager, null, DamageCause.CUSTOM, 6, false, true, false, damager.getName(), GetName()); + UtilAction.velocity(damagee, UtilAlg.getTrajectory2d(damagee, damager), 1.6, false, 0, 1.2, 1.8, true); - + UtilAction.zeroVelocity(damager); - + damager.getWorld().playSound(damager.getLocation(), Sound.ZOMBIE_HURT, 1f, 0.7f); - + _weakness.put(damagee, System.currentTimeMillis()); - //Inform + // Inform UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName()) + ".")); UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill(GetName()) + ".")); - + Recharge.Instance.recharge(damager, GetName()); Recharge.Instance.use(damager, GetName(), 2000, true, true); } - + @EventHandler(priority = EventPriority.HIGH) public void arrowDamage(CustomDamageEvent event) { @@ -168,26 +181,25 @@ public class PerkDeathsGrasp extends Perk if (!(event.GetProjectile() instanceof Arrow)) return; - + if (!_weakness.containsKey(event.GetDamageeEntity())) return; Player damager = event.GetDamagerPlayer(true); - if (damager == null) return; + if (damager == null) + return; if (!Kit.HasKit(damager)) return; - + if (!Manager.IsAlive(damager)) return; event.AddMult(GetName(), GetName() + " Combo", 2, true); - - UtilParticle.PlayParticle(ParticleType.RED_DUST, event.GetDamageeEntity().getLocation(), 0.5f, 0.5f, 0.5f, 0, 20, - ViewDist.MAX, UtilServer.getPlayers()); - UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, event.GetDamageeEntity().getLocation(), 0, 0, 0, 0, 1, - ViewDist.MAX, UtilServer.getPlayers()); - + + UtilParticle.PlayParticle(ParticleType.RED_DUST, event.GetDamageeEntity().getLocation(), 0.5f, 0.5f, 0.5f, 0, 20, ViewDist.MAX, UtilServer.getPlayers()); + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, event.GetDamageeEntity().getLocation(), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); + damager.getWorld().playSound(damager.getLocation(), Sound.ZOMBIE_HURT, 1f, 2f); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkZombieBile.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkZombieBile.java index 982230c41..cea58d3c1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkZombieBile.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkZombieBile.java @@ -40,7 +40,10 @@ public class PerkZombieBile extends SmashPerk implements IThrown { private static final int COOLDOWN = 10000; - + private static final int ITEMS = 3; + private static final int DAMAGE = 3; + private static final int KNOCKBACK_MAGNITUDE = 1; + private Map _active = new HashMap<>(); public PerkZombieBile() @@ -128,13 +131,13 @@ public class PerkZombieBile extends SmashPerk implements IThrown } // Projectiles - for (int i = 0; i < 3; i++) + for (int i = 0; i < ITEMS; i++) { Vector rand = new Vector((Math.random() - 0.5) * 0.525, (Math.random() - 0.5) * 0.525, (Math.random() - 0.5) * 0.525); Item ent = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()).subtract(0, 0.5, 0), new ItemStack(Material.ROTTEN_FLESH)); UtilAction.velocity(ent, player.getLocation().getDirection().add(rand), 0.8, false, 0, 0.2, 10, false); - Manager.GetProjectile().AddThrow(ent, player, this, System.currentTimeMillis() + 2000, true, true, true, false, 0.5f); + Manager.GetProjectile().AddThrow(ent, player, this, 2000, true, true, true, false, 0.5f); } } } @@ -142,10 +145,7 @@ public class PerkZombieBile extends SmashPerk implements IThrown @EventHandler public void death(PlayerDeathEvent event) { - if (_active.containsKey(event.getEntity())) - { - _active.remove(event.getEntity()); - } + _active.remove(event.getEntity().getUniqueId()); } @Override @@ -154,14 +154,17 @@ public class PerkZombieBile extends SmashPerk implements IThrown data.getThrown().remove(); if (target == null) + { return; - - if (target instanceof Player) - if (!Manager.GetGame().IsAlive((Player) target)) - return; - + } + + if (UtilPlayer.isSpectator(target)) + { + return; + } + // Damage Event - Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, 3, true, false, false, UtilEnt.getName(data.getThrower()), GetName()); + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, DAMAGE, true, false, false, UtilEnt.getName(data.getThrower()), GetName()); data.getThrown().remove(); } @@ -182,8 +185,10 @@ public class PerkZombieBile extends SmashPerk implements IThrown public void Knockback(CustomDamageEvent event) { if (event.GetReason() == null || !event.GetReason().contains(GetName())) + { return; - - event.AddKnockback(GetName(), 1); + } + + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); } } From f8a135cf50291c89ea7f288d4e70552c2a5753a7 Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 25 Sep 2016 00:56:06 +0100 Subject: [PATCH 006/147] Full system conversion --- .../game/games/barbarians/kits/KitArcher.java | 11 +- .../games/bouncyballs/kits/KitPlayer.java | 3 - .../game/games/bridge/kits/KitArcher.java | 12 +- .../castlesiege/kits/KitHumanMarksman.java | 19 +- .../game/games/dragons/kits/KitMarksman.java | 19 +- .../games/halloween/kits/KitRobinHood.java | 15 +- .../game/games/sheep/kits/KitArcher.java | 17 +- .../game/games/smash/SoloSuperSmash.java | 2 +- .../arcade/game/games/smash/SuperSmash.java | 330 +++++++++---- .../game/games/smash/TeamSuperSmash.java | 4 +- .../game/games/smash/kits/KitBlaze.java | 10 +- .../game/games/smash/kits/KitChicken.java | 14 +- .../arcade/game/games/smash/kits/KitCow.java | 4 +- .../game/games/smash/kits/KitCreeper.java | 12 +- .../game/games/smash/kits/KitEnderman.java | 12 +- .../game/games/smash/kits/KitGolem.java | 59 +-- .../game/games/smash/kits/KitMagmaCube.java | 8 +- .../arcade/game/games/smash/kits/KitPig.java | 12 +- .../game/games/smash/kits/KitSheep.java | 8 +- .../games/smash/kits/KitSkeletalHorse.java | 14 +- .../game/games/smash/kits/KitSkeleton.java | 16 +- .../game/games/smash/kits/KitSkySquid.java | 12 +- .../game/games/smash/kits/KitSlime.java | 8 +- .../game/games/smash/kits/KitSnowman.java | 12 +- .../game/games/smash/kits/KitSpider.java | 12 +- .../game/games/smash/kits/KitWitch.java | 13 +- .../games/smash/kits/KitWitherSkeleton.java | 16 +- .../arcade/game/games/smash/kits/KitWolf.java | 8 +- .../game/games/smash/kits/KitZombie.java | 19 +- .../game/games/smash/modes/RandomKitSSM.java | 4 +- .../games/smash/modes/kits/KitHipster.java | 19 +- .../game/games/smash/perks/SmashKit.java | 286 ++++-------- .../game/games/smash/perks/SmashKit2.java | 154 ------- .../game/games/smash/perks/SmashPerk.java | 4 +- .../game/games/smash/perks/SmashUltimate.java | 6 +- .../game/games/smash/perks/cow/SmashCow.java | 6 +- .../smash/perks/creeper/SmashCreeper.java | 2 +- .../{SmashEnderman.java => SmashGolem.java} | 4 +- .../games/smash/perks/pig/PerkPigZombie.java | 6 +- .../skeletalhorse/SmashSkeletalHorse.java | 2 +- .../smash/perks/skeleton/PerkBarrage.java | 14 +- .../smash/perks/skeleton/SmashSkeleton.java | 12 +- .../{PerkStormSquid.java => SmashSquid.java} | 26 +- .../games/smash/perks/witch/SmashBat.java | 17 +- .../witherskeleton/SmashWitherSkeleton.java | 51 +- .../smash/perks/zombie/PerkDeathsGrasp.java | 97 ++-- ...kNightLivingDead.java => SmashZombie.java} | 95 ++-- .../games/survivalgames/kit/KitArcher.java | 7 +- .../arcade/game/games/tug/kits/KitArcher.java | 15 +- .../games/turfforts/kits/KitShredder.java | 19 +- .../kits/KitSurvivorArcher.java | 2 +- .../game/arcade/kit/perks/PerkArcticAura.java | 52 --- .../game/arcade/kit/perks/PerkBarrage.java | 302 ------------ .../game/arcade/kit/perks/PerkBatForm.java | 258 ----------- .../game/arcade/kit/perks/PerkBatWave.java | 256 ---------- .../game/arcade/kit/perks/PerkBlink.java | 102 ---- .../game/arcade/kit/perks/PerkBlockToss.java | 269 ----------- .../arcade/kit/perks/PerkBoneExplosion.java | 90 ---- .../game/arcade/kit/perks/PerkBoneRush.java | 198 -------- .../arcade/kit/perks/PerkChickenRocket.java | 201 -------- .../kit/perks/PerkCreeperElectricity.java | 204 -------- .../arcade/kit/perks/PerkCreeperExplode.java | 321 ------------- .../kit/perks/PerkCreeperSulphurBomb.java | 146 ------ .../arcade/kit/perks/PerkDeadlyBones.java | 110 ----- .../game/arcade/kit/perks/PerkEarthquake.java | 107 ----- .../game/arcade/kit/perks/PerkEggGun.java | 136 ------ .../arcade/kit/perks/PerkEndermanDragon.java | 184 -------- .../game/arcade/kit/perks/PerkFirefly.java | 230 --------- .../game/arcade/kit/perks/PerkFlap.java | 105 ----- .../game/arcade/kit/perks/PerkFleshArrow.java | 112 ----- .../game/arcade/kit/perks/PerkHorseKick.java | 197 -------- .../game/arcade/kit/perks/PerkIcePath.java | 97 ---- .../arcade/kit/perks/PerkInfernalHorror.java | 189 -------- .../game/arcade/kit/perks/PerkInkBlast.java | 169 ------- .../arcade/kit/perks/PerkMeteorShower.java | 50 -- .../game/arcade/kit/perks/PerkNeedler.java | 157 ------- .../arcade/kit/perks/PerkNightLivingDead.java | 150 ------ .../game/arcade/kit/perks/PerkOvercharge.java | 204 -------- .../arcade/kit/perks/PerkPigBaconBomb.java | 178 ------- .../arcade/kit/perks/PerkPigBaconBounce.java | 186 -------- .../game/arcade/kit/perks/PerkPigZombie.java | 129 ------ .../arcade/kit/perks/PerkSeismicSlam.java | 2 +- .../arcade/kit/perks/PerkSheepHoming.java | 107 ----- .../kit/perks/PerkSkeletonArrowStorm.java | 67 --- .../arcade/kit/perks/PerkSlimeRocket.java | 420 ----------------- .../game/arcade/kit/perks/PerkSlimeSlam.java | 185 -------- .../game/arcade/kit/perks/PerkSnowTurret.java | 170 ------- .../arcade/kit/perks/PerkSpidersNest.java | 120 ----- .../game/arcade/kit/perks/PerkStormSquid.java | 179 ------- .../game/arcade/kit/perks/PerkSuperSquid.java | 136 ------ .../game/arcade/kit/perks/PerkWebShot.java | 131 ------ .../arcade/kit/perks/PerkWitchPotion.java | 175 ------- .../game/arcade/kit/perks/PerkWitherForm.java | 134 ------ .../arcade/kit/perks/PerkWitherImage.java | 226 --------- .../arcade/kit/perks/PerkWitherSkull.java | 215 --------- .../game/arcade/kit/perks/PerkWolf.java | 436 ------------------ .../game/arcade/kit/perks/PerkZombieBile.java | 173 ------- .../arcade/kit/perks/PerkZombieNightDead.java | 15 - .../game/arcade/kit/perks/PerkZombieRot.java | 66 --- 99 files changed, 738 insertions(+), 8857 deletions(-) delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashKit2.java rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/{SmashEnderman.java => SmashGolem.java} (97%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/{PerkStormSquid.java => SmashSquid.java} (93%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/{PerkNightLivingDead.java => SmashZombie.java} (73%) delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkArcticAura.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBarrage.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatForm.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatWave.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockToss.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneExplosion.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneRush.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChickenRocket.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperElectricity.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperExplode.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperSulphurBomb.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeadlyBones.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEarthquake.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEggGun.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEndermanDragon.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlap.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFleshArrow.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorseKick.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIcePath.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInfernalHorror.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMeteorShower.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNeedler.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkOvercharge.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBomb.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBounce.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigZombie.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSheepHoming.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletonArrowStorm.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeSlam.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSnowTurret.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpidersNest.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkStormSquid.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSuperSquid.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWebShot.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitchPotion.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherForm.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherSkull.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieNightDead.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieRot.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitArcher.java index 7bfea9ddf..afeb88449 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitArcher.java @@ -1,5 +1,11 @@ package nautilus.game.arcade.game.games.barbarians.kits; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.KitAvailability; @@ -7,11 +13,6 @@ import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.ProgressingKit; import nautilus.game.arcade.kit.perks.PerkFletcher; import nautilus.game.arcade.kit.perks.PerkRopedArrow; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; public class KitArcher extends ProgressingKit { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/kits/KitPlayer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/kits/KitPlayer.java index dc752c593..9c1db1e7b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/kits/KitPlayer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/kits/KitPlayer.java @@ -6,13 +6,10 @@ import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -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.PerkFletcher; -import nautilus.game.arcade.kit.perks.PerkRopedArrow; public class KitPlayer extends Kit { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitArcher.java index 661415b70..a02a04427 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitArcher.java @@ -1,19 +1,19 @@ package nautilus.game.arcade.game.games.bridge.kits; +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.game.games.bridge.Bridge; -import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.game.games.smash.perks.skeleton.PerkBarrage; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.ProgressingKit; -import nautilus.game.arcade.kit.perks.PerkBarrage; import nautilus.game.arcade.kit.perks.PerkFletcher; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; public class KitArcher extends ProgressingKit { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanMarksman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanMarksman.java index 66e032aea..1b01d6622 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanMarksman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanMarksman.java @@ -1,14 +1,5 @@ package nautilus.game.arcade.game.games.castlesiege.kits; -import mineplex.core.common.util.C; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkBarrage; -import nautilus.game.arcade.kit.perks.PerkFletcher; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; @@ -16,6 +7,16 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.inventory.ItemStack; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.smash.perks.skeleton.PerkBarrage; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkFletcher; + public class KitHumanMarksman extends KitHuman { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/kits/KitMarksman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/kits/KitMarksman.java index 6e57a6cdf..9fffc8f5f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/kits/KitMarksman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/kits/KitMarksman.java @@ -1,19 +1,20 @@ package nautilus.game.arcade.game.games.dragons.kits; -import mineplex.core.common.util.C; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.ProgressingKit; -import nautilus.game.arcade.kit.perks.PerkBarrage; -import nautilus.game.arcade.kit.perks.PerkFletcher; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; 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.game.games.smash.perks.skeleton.PerkBarrage; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkFletcher; + public class KitMarksman extends ProgressingKit { @@ -46,7 +47,7 @@ public class KitMarksman extends ProgressingKit { super(manager, "Marksman", "dragonsmarksman", KitAvailability.Gem, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } - + @Override public void GiveItems(Player player) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitRobinHood.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitRobinHood.java index cd31b70d3..f2dbf69bc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitRobinHood.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitRobinHood.java @@ -1,5 +1,12 @@ package nautilus.game.arcade.game.games.halloween.kits; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; + import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilMath; @@ -8,18 +15,12 @@ import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.smash.perks.skeleton.PerkBarrage; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.ProgressingKit; -import nautilus.game.arcade.kit.perks.PerkBarrage; import nautilus.game.arcade.kit.perks.PerkFletcher; import nautilus.game.arcade.kit.perks.PerkQuickshotRobinHood; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.inventory.ItemStack; public class KitRobinHood extends ProgressingKit { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/kits/KitArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/kits/KitArcher.java index b78c3cf40..f562f9b72 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/kits/KitArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/kits/KitArcher.java @@ -1,19 +1,20 @@ package nautilus.game.arcade.game.games.sheep.kits; -import mineplex.core.common.util.C; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.ProgressingKit; -import nautilus.game.arcade.kit.perks.PerkBarrage; -import nautilus.game.arcade.kit.perks.PerkFletcher; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; 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.game.games.smash.perks.skeleton.PerkBarrage; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkFletcher; + public class KitArcher extends ProgressingKit { private static final String[] DESCRIPTION = { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java index 478341edb..7f36bc1fb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java @@ -111,7 +111,7 @@ public class SoloSuperSmash extends SuperSmash Scoreboard.writeGroup(GetPlayers(true), player -> { - int lives = GetLives(player); + int lives = getLives(player); String out; if (lives >= 4) out = C.cGreen + player.getName(); 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 c4e8fa040..1bdfed96b 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 @@ -1,25 +1,17 @@ package nautilus.game.arcade.game.games.smash; -import mineplex.core.common.block.BlockData; -import mineplex.core.common.util.*; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.ArcadeFormat; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.GameType; -import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.GameTeam; -import nautilus.game.arcade.game.GameTeam.PlayerState; -import nautilus.game.arcade.game.games.smash.kits.*; -import nautilus.game.arcade.game.games.smash.perks.SmashKit; -import nautilus.game.arcade.kit.Kit; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.TimeUnit; -import org.bukkit.*; +import org.bukkit.ChatColor; +import org.bukkit.Color; import org.bukkit.FireworkEffect.Type; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; import org.bukkit.block.BlockFace; import org.bukkit.entity.EnderCrystal; import org.bukkit.entity.Player; @@ -32,121 +24,159 @@ import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.scheduler.BukkitRunnable; -import java.util.HashMap; -import java.util.HashSet; +import mineplex.core.common.block.BlockData; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.ArcadeFormat; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.GameTeam.PlayerState; +import nautilus.game.arcade.game.games.smash.kits.KitBlaze; +import nautilus.game.arcade.game.games.smash.kits.KitChicken; +import nautilus.game.arcade.game.games.smash.kits.KitCow; +import nautilus.game.arcade.game.games.smash.kits.KitCreeper; +import nautilus.game.arcade.game.games.smash.kits.KitEnderman; +import nautilus.game.arcade.game.games.smash.kits.KitGolem; +import nautilus.game.arcade.game.games.smash.kits.KitMagmaCube; +import nautilus.game.arcade.game.games.smash.kits.KitPig; +import nautilus.game.arcade.game.games.smash.kits.KitSheep; +import nautilus.game.arcade.game.games.smash.kits.KitSkeletalHorse; +import nautilus.game.arcade.game.games.smash.kits.KitSkeleton; +import nautilus.game.arcade.game.games.smash.kits.KitSkySquid; +import nautilus.game.arcade.game.games.smash.kits.KitSlime; +import nautilus.game.arcade.game.games.smash.kits.KitSnowman; +import nautilus.game.arcade.game.games.smash.kits.KitSpider; +import nautilus.game.arcade.game.games.smash.kits.KitWitch; +import nautilus.game.arcade.game.games.smash.kits.KitWitherSkeleton; +import nautilus.game.arcade.game.games.smash.kits.KitWolf; +import nautilus.game.arcade.game.games.smash.kits.KitZombie; +import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.Perk; public abstract class SuperSmash extends Game { - private HashMap _lives = new HashMap(); + private Map _lives = new HashMap<>(); private Location _powerupCurrent = null; private Location _powerupTarget = null; private EnderCrystal _powerup = null; private long _nextPowerup = 0; - - private HashSet _restoreBlock = new HashSet(); - public SuperSmash(ArcadeManager manager, GameType type, String[] description) + private Set _restoreBlock = new HashSet<>(); + + public SuperSmash(ArcadeManager manager, GameType type, String[] description) { this(manager, - new Kit[] - { + new Kit[] { - new KitSkeleton(manager), - new KitGolem(manager), - new KitSpider(manager), - new KitSlime(manager), + new KitSkeleton(manager), new KitGolem(manager), new KitSpider(manager), new KitSlime(manager), - new KitCreeper(manager), - new KitEnderman(manager), - new KitSnowman(manager), - new KitWolf(manager), + new KitCreeper(manager), new KitEnderman(manager), new KitSnowman(manager), new KitWolf(manager), + new KitBlaze(manager), new KitWitch(manager), new KitChicken(manager), new KitSkeletalHorse(manager), new KitPig(manager), new KitSkySquid(manager), new KitWitherSkeleton( + manager), new KitMagmaCube(manager), new KitZombie(manager), new KitCow(manager), - new KitBlaze(manager), - new KitWitch(manager), - new KitChicken(manager), - new KitSkeletalHorse(manager), - new KitPig(manager), - new KitSkySquid(manager), - new KitWitherSkeleton(manager), - new KitMagmaCube(manager), - new KitZombie(manager), - new KitCow(manager), + new KitSheep(manager) - new KitSheep(manager) - - }, type, description); + }, type, description); } - - public SuperSmash(ArcadeManager manager, Kit[] kits, GameType type, String[] description) + + public SuperSmash(ArcadeManager manager, Kit[] kits, GameType type, String[] description) { super(manager, type, kits, description); this.DeathOut = false; - this.CompassEnabled = true; - this.DeathSpectateSecs = 4; - this.WorldWaterDamage = 1000; - this.HideTeamSheep = true; - this.ReplaceTeamsWithKits = true; - - // Add stat table here - // Example - // Manager.GetStatsManager().addTable("SuperSmashMobStats", "Kills", "Deaths", "Wins", "Losses"); + this.WorldLeavesDecay = false; } @EventHandler(priority = EventPriority.HIGH) - public void GameStateChange(GameStateChangeEvent event) + public void onGameStateChange(GameStateChangeEvent event) { if (event.GetState() != GameState.Prepare) + { return; + } for (Player player : GetPlayers(true)) + { _lives.put(player, 4); - - _nextPowerup = (long) (System.currentTimeMillis() + 240000 + 360000 * Math.random()); + } + + _nextPowerup = (long) (System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(10) * Math.random()); } @EventHandler - public void PlayerOut(PlayerDeathEvent event) + public void onPlayerOut(PlayerDeathEvent event) { - if (!LoseLife(event.getEntity())) + if (!loseLife(event.getEntity())) { this.SetPlayerState(event.getEntity(), PlayerState.OUT); } } - public int GetLives(Player player) + public int getLives(Player player) { if (!_lives.containsKey(player)) + { return 0; + } if (!IsAlive(player)) + { return 0; + } return _lives.get(player); } - public boolean LoseLife(Player player) + public boolean loseLife(Player player) { - int lives = GetLives(player) - 1; + int lives = getLives(player) - 1; if (lives > 0) { - UtilPlayer.message(player, C.cRed + C.Bold + "You have died!"); - UtilPlayer.message(player, C.cRed + C.Bold + "You have " + lives + " " + (lives == 1 ? "life" : "lives") + " left!"); + UtilPlayer.message(player, C.cRedB + "You have died!"); + UtilPlayer.message(player, C.cRedB + "You have " + lives + " " + (lives == 1 ? "life" : "lives") + " left!"); player.playSound(player.getLocation(), Sound.NOTE_BASS_GUITAR, 2f, 0.5f); _lives.put(player, lives); + new BukkitRunnable() + { + + @Override + public void run() + { + UtilTextMiddle.display(getLiveColour(lives) + lives, (lives == 1 ? "life" : "lives") + " left!", 10, 30, 10, player); + } + }.runTaskLater(Manager.getPlugin(), (long) DeathSpectateSecs * 20 + 2); + return true; } else @@ -158,6 +188,39 @@ public abstract class SuperSmash extends Game } } + @EventHandler + public void triggerSuper(PlayerInteractEvent event) + { + if (!IsLive()) + { + return; + } + + if (event.getMaterial() != Material.NETHER_STAR) + { + return; + } + + Player player = event.getPlayer(); + + UtilInv.remove(player, Material.NETHER_STAR, (byte) 0, 1); + + for (Perk perk : GetKit(player).GetPerks()) + { + if (perk instanceof SmashUltimate) + { + SmashUltimate ultimate = (SmashUltimate) perk; + String name = ultimate.GetName(); + + player.setHealth(player.getMaxHealth()); + player.playSound(player.getLocation(), ultimate.getSound(), 10, 1); + + Announce(C.Bold + event.getPlayer().getName() + " activated " + C.cGreenB + name + ChatColor.RESET + C.Bold + "!"); + UtilTextMiddle.display("Smash Crystal", event.getPlayer().getName() + " used " + C.cGreen + name, 5, 50, 5, UtilServer.getPlayers()); + } + } + } + @EventHandler public void powerupSpawn(UpdateEvent event) { @@ -178,22 +241,22 @@ public abstract class SuperSmash extends Game if (_powerupTarget == null) { Location newTarget = UtilAlg.Random(WorldData.GetDataLocs("RED")); - + _powerupTarget = newTarget; _powerupCurrent = _powerupTarget.clone().add(0, 120, 0); - - //Blocks - for (int x=-1 ; x<=1 ; x++) - for (int z=-1 ; z<=1 ; z++) + + // Blocks + for (int x = -1; x <= 1; x++) + for (int z = -1; z <= 1; z++) { _restoreBlock.add(new BlockData(_powerupTarget.getBlock().getRelative(x, -2, z))); _restoreBlock.add(new BlockData(_powerupTarget.getBlock().getRelative(x, -1, z))); - + _powerupTarget.getBlock().getRelative(x, -2, z).setType(Material.IRON_BLOCK); _powerupTarget.getBlock().getRelative(x, -1, z).setType(Material.QUARTZ_BLOCK); } - - _powerupTarget.getBlock().getRelative(BlockFace.DOWN).setType(Material.BEACON); + + _powerupTarget.getBlock().getRelative(BlockFace.DOWN).setType(Material.BEACON); } if (_powerupTarget.getY() < _powerupCurrent.getY()) @@ -208,12 +271,11 @@ public abstract class SuperSmash extends Game CreatureAllowOverride = false; _powerupTarget.getBlock().getRelative(BlockFace.DOWN).setType(Material.GLASS); - + _powerupTarget = null; _powerupCurrent = null; - - //Restore Blocks + // Restore Blocks for (BlockData block : _restoreBlock) block.restore(true); _restoreBlock.clear(); @@ -254,16 +316,18 @@ public abstract class SuperSmash extends Game { _powerup.remove(); _powerup = null; - - best.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, ((SmashKit)GetKit(best)).getSuperCharges(), - C.cYellow + C.Bold + "Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + ((SmashKit)GetKit(best)).getSuperName())); - - _nextPowerup = (long) (System.currentTimeMillis() + 240000 + 360000 * Math.random()); - - Manager.GetGame().Announce(C.Bold + best.getName() + " collected " + C.cGreen + C.Bold + "Smash Crystal" + ChatColor.RESET + C.Bold + "!"); + + giveSmashItem(best); + _nextPowerup = (long) (System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(10) * Math.random()); } } + private void giveSmashItem(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 1, C.cYellowB + "Click" + C.cWhiteB + " - " + C.cGreenB + "Smash")); + Manager.GetGame().Announce(C.Bold + player.getName() + " collected " + C.cGreen + C.Bold + "Smash Crystal" + ChatColor.RESET + C.Bold + "!"); + } + @EventHandler(priority = EventPriority.LOWEST) public void powerupDamage(EntityDamageEvent event) { @@ -306,7 +370,7 @@ public abstract class SuperSmash extends Game event.GetDamageeEntity().getWorld().strikeLightningEffect(event.GetDamageeEntity().getLocation()); event.AddMod("Smash", "Super Smash Mobs", 5000, false); - } + } } @EventHandler @@ -323,7 +387,7 @@ public abstract class SuperSmash extends Game } @Override - public void SetKit(Player player, Kit kit, boolean announce) + public void SetKit(Player player, Kit kit, boolean announce) { GameTeam team = GetTeam(player); if (team != null) @@ -371,14 +435,14 @@ public abstract class SuperSmash extends Game if (Manager.GetGame() == null || Manager.GetGame().GetState() != GameState.Recruit) return; - for (int i=player.getItemInHand().getItemMeta().getLore().size() ; i<=7 ; i++) + for (int i = player.getItemInHand().getItemMeta().getLore().size(); i <= 7; i++) UtilPlayer.message(player, " "); UtilPlayer.message(player, ArcadeFormat.Line); UtilPlayer.message(player, "§aAbility - §f§l" + player.getItemInHand().getItemMeta().getDisplayName()); - //Perk Descs + // Perk Descs for (String line : player.getItemInHand().getItemMeta().getLore()) { UtilPlayer.message(player, line); @@ -404,6 +468,7 @@ public abstract class SuperSmash extends Game } private int hungerTick = 0; + @EventHandler public void Hunger(UpdateEvent event) { @@ -413,18 +478,16 @@ public abstract class SuperSmash extends Game if (!IsLive()) return; - hungerTick = (hungerTick + 1)%10; + hungerTick = (hungerTick + 1) % 10; for (Player player : GetPlayers(true)) { - player.setSaturation(3f); + player.setSaturation(3f); player.setExhaustion(0f); if (player.getFoodLevel() <= 0) { - Manager.GetDamage().NewDamageEvent(player, null, null, - DamageCause.STARVATION, 1, false, true, false, - "Starvation", GetName()); + Manager.GetDamage().NewDamageEvent(player, null, null, DamageCause.STARVATION, 1, false, true, false, "Starvation", GetName()); UtilPlayer.message(player, F.main("Game", "Attack other players to restore hunger!")); } @@ -446,19 +509,86 @@ public abstract class SuperSmash extends Game if (damager.equals(event.GetDamageeEntity())) return; - + if (!(event.GetDamageeEntity() instanceof Player)) - return; + return; if (!Recharge.Instance.use(damager, "Hunger Restore", 250, false, false)) return; - int amount = Math.max(1, (int)(event.GetDamage()/2)); + int amount = Math.max(1, (int) (event.GetDamage() / 2)); UtilPlayer.hunger(damager, amount); } - - public HashMap getLiveMap() + + public String getLiveColour(int lives) + { + switch (lives) + { + case 3: + return C.cYellow; + case 2: + return C.cGold; + case 1: + case 0: + return C.cRed; + default: + return C.cGreen; + } + } + + public Map getLiveMap() { return _lives; } + + @EventHandler + public void debugCommands(PlayerCommandPreprocessEvent event) + { + if (!UtilServer.isTestServer()) + { + return; + } + + String message = event.getMessage(); + Player player = event.getPlayer(); + + if (message.startsWith("/cooldown")) + { + event.setCancelled(true); + + for (Player other : UtilServer.getPlayers()) + { + Recharge.Instance.Reset(other); + } + + Announce(C.cWhiteB + player.getName() + C.cAquaB + " reset cooldowns!"); + } + else if (message.startsWith("/nextsmash")) + { + event.setCancelled(true); + + _nextPowerup = System.currentTimeMillis() + 1000; + Announce(C.cWhiteB + player.getName() + C.cAquaB + " spawned a smash crystal!"); + } + else if (message.startsWith("/smash")) + { + event.setCancelled(true); + + giveSmashItem(player); + } + else if (message.startsWith("/kit")) + { + event.setCancelled(true); + + String kit = message.split(" ")[1]; + + for (Kit kits : GetKits()) + { + if (kit.equalsIgnoreCase(kits.GetName())) + { + SetKit(player, kits, true); + } + } + } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java index d129e972d..102ccd267 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java @@ -74,7 +74,7 @@ public class TeamSuperSmash extends SuperSmash { for (Player player : team.GetPlayers(true)) { - int lives = GetLives(player); + int lives = getLives(player); Scoreboard.write(C.cWhite + lives + " " + team.GetColor() + player.getName()); } @@ -88,7 +88,7 @@ public class TeamSuperSmash extends SuperSmash for (Player player : team.GetPlayers(true)) { - lives += GetLives(player); + lives += getLives(player); } Scoreboard.write(C.cWhite + lives + " " + team.GetColor() + team.GetName()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java index f76f1fb2c..37399886a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java @@ -16,16 +16,17 @@ import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.blaze.PerkFirefly; import nautilus.game.arcade.game.games.smash.perks.blaze.PerkInferno; +import nautilus.game.arcade.game.games.smash.perks.blaze.SmashBlaze; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkDoubleJump; -import nautilus.game.arcade.kit.perks.PerkFirefly; import nautilus.game.arcade.kit.perks.PerkKnockbackFire; import nautilus.game.arcade.kit.perks.PerkSpeed; -public class KitBlaze extends SmashKit2 +public class KitBlaze extends SmashKit { private static final Perk[] PERKS = { new PerkSmashStats(6, 1.5, 0.25, 5), @@ -33,7 +34,8 @@ public class KitBlaze extends SmashKit2 new PerkKnockbackFire(1.50), new PerkSpeed(0), new PerkInferno(), - new PerkFirefly() + new PerkFirefly(), + new SmashBlaze() }; private static final ItemStack IN_HAND = new ItemStack(Material.BLAZE_ROD); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java index cbb78ffce..6e4f0b442 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java @@ -13,21 +13,23 @@ import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.chicken.PerkChickenRocket; +import nautilus.game.arcade.game.games.smash.perks.chicken.PerkEggGun; +import nautilus.game.arcade.game.games.smash.perks.chicken.PerkFlap; +import nautilus.game.arcade.game.games.smash.perks.chicken.SmashChicken; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkChickenRocket; -import nautilus.game.arcade.kit.perks.PerkEggGun; -import nautilus.game.arcade.kit.perks.PerkFlap; -public class KitChicken extends SmashKit2 +public class KitChicken extends SmashKit { private static final Perk[] PERKS = { new PerkSmashStats(4.5, 2.0, 0.2, 2), new PerkFlap(0.8, 0.8, false), new PerkEggGun(), - new PerkChickenRocket() + new PerkChickenRocket(), + new SmashChicken() }; private static final ItemStack IN_HAND = new ItemStack(Material.EGG); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java index ca09f3e87..33b49741d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java @@ -13,7 +13,7 @@ import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; import nautilus.game.arcade.game.games.smash.perks.cow.PerkCowAngryHerd; import nautilus.game.arcade.game.games.smash.perks.cow.PerkCowMilkSpiral; import nautilus.game.arcade.game.games.smash.perks.cow.SmashCow; @@ -22,7 +22,7 @@ import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkDoubleJump; -public class KitCow extends SmashKit2 +public class KitCow extends SmashKit { private static final Perk[] PERKS = { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java index 378b612e6..9503a5c9f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java @@ -13,15 +13,16 @@ import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.creeper.PerkCreeperElectricity; +import nautilus.game.arcade.game.games.smash.perks.creeper.PerkCreeperExplode; +import nautilus.game.arcade.game.games.smash.perks.creeper.PerkCreeperSulphurBomb; +import nautilus.game.arcade.game.games.smash.perks.creeper.SmashCreeper; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkCreeperElectricity; -import nautilus.game.arcade.kit.perks.PerkCreeperExplode; -import nautilus.game.arcade.kit.perks.PerkCreeperSulphurBomb; import nautilus.game.arcade.kit.perks.PerkDoubleJump; -public class KitCreeper extends SmashKit2 +public class KitCreeper extends SmashKit { private static final Perk[] PERKS = { new PerkSmashStats(6, 1.65, 0.4, 3.5), @@ -29,6 +30,7 @@ public class KitCreeper extends SmashKit2 new PerkCreeperElectricity(), new PerkCreeperSulphurBomb(), new PerkCreeperExplode(), + new SmashCreeper() }; private static final ItemStack IN_HAND = new ItemStack(Material.TNT); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitEnderman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitEnderman.java index f2745458a..0b2307689 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitEnderman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitEnderman.java @@ -21,18 +21,18 @@ import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.enderman.PerkBlink; +import nautilus.game.arcade.game.games.smash.perks.enderman.PerkBlockToss; import nautilus.game.arcade.game.games.smash.perks.enderman.PerkEndermanTeleport; +import nautilus.game.arcade.game.games.smash.perks.enderman.SmashEnderman; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkBlink; -import nautilus.game.arcade.kit.perks.PerkBlockToss; import nautilus.game.arcade.kit.perks.PerkDoubleJump; -import nautilus.game.arcade.kit.perks.PerkEndermanDragon; import nautilus.game.arcade.kit.perks.event.PerkBlockGrabEvent; import nautilus.game.arcade.kit.perks.event.PerkBlockThrowEvent; -public class KitEnderman extends SmashKit2 +public class KitEnderman extends SmashKit { private static final Perk[] PERKS = { @@ -41,7 +41,7 @@ public class KitEnderman extends SmashKit2 new PerkBlink("Blink", 16, 6000), new PerkBlockToss(), new PerkEndermanTeleport(), - new PerkEndermanDragon() + new SmashEnderman() }; private static final ItemStack IN_HAND = new ItemStack(Material.ENDER_PEARL); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGolem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGolem.java index 3d9e0c5da..00c38f95f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGolem.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGolem.java @@ -1,5 +1,11 @@ package nautilus.game.arcade.game.games.smash.kits; +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.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseIronGolem; @@ -9,20 +15,16 @@ import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; import nautilus.game.arcade.game.games.smash.perks.SmashKit; import nautilus.game.arcade.game.games.smash.perks.golem.PerkFissure; +import nautilus.game.arcade.game.games.smash.perks.golem.SmashGolem; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import nautilus.game.arcade.kit.perks.PerkIronHook; +import nautilus.game.arcade.kit.perks.PerkSeismicSlam; +import nautilus.game.arcade.kit.perks.PerkSlow; public class KitGolem extends SmashKit { - private static final String[] DESCRIPTION = { - }; private static final Perk[] PERKS = { new PerkSmashStats(7, 1.0, 0.2, 8), @@ -31,7 +33,7 @@ public class KitGolem extends SmashKit new PerkFissure(), new PerkIronHook(), new PerkSeismicSlam(), - new PerkEarthquake() + new SmashGolem() }; private static final ItemStack IN_HAND = new ItemStack(Material.IRON_BLOCK); @@ -68,20 +70,22 @@ public class KitGolem extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { - ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BOOTS), - ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS), - ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE), - ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET), + new ItemStack(Material.DIAMOND_BOOTS), + new ItemStack(Material.IRON_LEGGINGS), + new ItemStack(Material.IRON_CHESTPLATE), + new ItemStack(Material.IRON_HELMET), }; public KitGolem(ArcadeManager manager) { - super(manager, "Iron Golem", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.IRON_GOLEM, IN_HAND, "Earthquake", 0, Sound.IRONGOLEM_DEATH); + super(manager, "Iron Golem", KitAvailability.Free, PERKS, EntityType.IRON_GOLEM, IN_HAND, DisguiseIronGolem.class); } @Override - public void giveCoreItems(Player player) + public void GiveItems(Player player) { + disguise(player); + UtilInv.Clear(player); player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1], PLAYER_ITEMS[2]); @@ -91,27 +95,4 @@ public class KitGolem extends SmashKit player.getInventory().setArmorContents(PLAYER_ARMOR); } - - @Override - public void giveSuperItems(Player player) - { - - } - - @Override - public void GiveItems(Player player) - { - giveCoreItems(player); - - //Disguise - DisguiseIronGolem disguise = new DisguiseIronGolem(player); - - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else - disguise.setName(player.getName()); - - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java index bbbc8d711..a08ca5af2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java @@ -13,16 +13,16 @@ import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.magmacube.SmashMagmacube; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkDoubleJump; import nautilus.game.arcade.kit.perks.PerkFlameDash; import nautilus.game.arcade.kit.perks.PerkMagmaBlast; import nautilus.game.arcade.kit.perks.PerkMagmaBoost; -import nautilus.game.arcade.kit.perks.PerkMeteorShower; -public class KitMagmaCube extends SmashKit2 +public class KitMagmaCube extends SmashKit { private static final Perk[] PERKS = { @@ -31,7 +31,7 @@ public class KitMagmaCube extends SmashKit2 new PerkMagmaBoost(), new PerkMagmaBlast(), new PerkFlameDash(), - new PerkMeteorShower() + new SmashMagmacube() }; private static final ItemStack IN_HAND = new ItemStack(Material.MAGMA_CREAM); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java index f2956631d..a9992c275 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java @@ -16,15 +16,16 @@ import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.magmacube.SmashMagmacube; +import nautilus.game.arcade.game.games.smash.perks.pig.PerkPigBaconBomb; +import nautilus.game.arcade.game.games.smash.perks.pig.PerkPigBaconBounce; +import nautilus.game.arcade.game.games.smash.perks.pig.PerkPigZombie; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkDoubleJump; -import nautilus.game.arcade.kit.perks.PerkPigBaconBomb; -import nautilus.game.arcade.kit.perks.PerkPigBaconBounce; -import nautilus.game.arcade.kit.perks.PerkPigZombie; -public class KitPig extends SmashKit2 +public class KitPig extends SmashKit { private static final float MAX_ENERGY = 0.99F; @@ -37,6 +38,7 @@ public class KitPig extends SmashKit2 new PerkPigBaconBounce(), new PerkPigBaconBomb(), new PerkPigZombie(), + new SmashMagmacube() }; private static final ItemStack IN_HAND = new ItemStack(Material.PORK); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java index 9ca8f4caa..4df7192d0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java @@ -14,16 +14,16 @@ import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.sheep.SmashSheep; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkDoubleJump; import nautilus.game.arcade.kit.perks.PerkLazer; -import nautilus.game.arcade.kit.perks.PerkSheepHoming; import nautilus.game.arcade.kit.perks.PerkWoolBomb; import nautilus.game.arcade.kit.perks.PerkWoolCloud; -public class KitSheep extends SmashKit2 +public class KitSheep extends SmashKit { private static final Perk[] PERKS = { @@ -32,7 +32,7 @@ public class KitSheep extends SmashKit2 new PerkLazer(40, 7000), new PerkWoolBomb(), new PerkWoolCloud(), - new PerkSheepHoming() + new SmashSheep() }; private static final ItemStack IN_HAND = new ItemStack(Material.WOOL); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java index a903da8d7..6bcd59057 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java @@ -17,15 +17,16 @@ import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.skeletalhorse.PerkBoneRush; +import nautilus.game.arcade.game.games.smash.perks.skeletalhorse.PerkDeadlyBones; +import nautilus.game.arcade.game.games.smash.perks.skeletalhorse.PerkHorseKick; +import nautilus.game.arcade.game.games.smash.perks.skeletalhorse.SmashSkeletalHorse; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkBoneRush; -import nautilus.game.arcade.kit.perks.PerkDeadlyBones; import nautilus.game.arcade.kit.perks.PerkDoubleJump; -import nautilus.game.arcade.kit.perks.PerkHorseKick; -public class KitSkeletalHorse extends SmashKit2 +public class KitSkeletalHorse extends SmashKit { private static final Perk[] PERKS = { @@ -33,7 +34,8 @@ public class KitSkeletalHorse extends SmashKit2 new PerkDoubleJump("Double Jump", 1, 1, false), new PerkHorseKick(), new PerkBoneRush(), - new PerkDeadlyBones() + new PerkDeadlyBones(), + new SmashSkeletalHorse() }; private static final ItemStack IN_HAND = new ItemStack(Material.BONE); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java index dfb44c354..93bc3f989 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java @@ -8,23 +8,23 @@ import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; -import mineplex.core.disguise.disguises.DisguiseCow; +import mineplex.core.disguise.disguises.DisguiseSkeleton; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.skeleton.PerkBarrage; +import nautilus.game.arcade.game.games.smash.perks.skeleton.PerkBoneExplosion; +import nautilus.game.arcade.game.games.smash.perks.skeleton.SmashSkeleton; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkBarrage; -import nautilus.game.arcade.kit.perks.PerkBoneExplosion; import nautilus.game.arcade.kit.perks.PerkDoubleJump; import nautilus.game.arcade.kit.perks.PerkFletcher; import nautilus.game.arcade.kit.perks.PerkKnockbackArrow; import nautilus.game.arcade.kit.perks.PerkRopedArrow; -import nautilus.game.arcade.kit.perks.PerkSkeletonArrowStorm; -public class KitSkeleton extends SmashKit2 +public class KitSkeleton extends SmashKit { private static final Perk[] PERKS = { @@ -35,7 +35,7 @@ public class KitSkeleton extends SmashKit2 new PerkBoneExplosion(), new PerkRopedArrow("Roped Arrow", 1, 5000), new PerkBarrage(5, 300, true, false, true), - new PerkSkeletonArrowStorm() + new SmashSkeleton() }; private static final ItemStack IN_HAND = new ItemStack(Material.BOW); @@ -83,7 +83,7 @@ public class KitSkeleton extends SmashKit2 public KitSkeleton(ArcadeManager manager) { - super(manager, "Skeleton", KitAvailability.Free, PERKS, EntityType.SKELETON, IN_HAND, DisguiseCow.class); + super(manager, "Skeleton", KitAvailability.Free, PERKS, EntityType.SKELETON, IN_HAND, DisguiseSkeleton.class); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java index f741e8db8..5d2576f66 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java @@ -13,16 +13,16 @@ import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; import nautilus.game.arcade.game.games.smash.perks.squid.PerkFishFlurry; +import nautilus.game.arcade.game.games.smash.perks.squid.PerkInkBlast; +import nautilus.game.arcade.game.games.smash.perks.squid.SmashSquid; +import nautilus.game.arcade.game.games.smash.perks.squid.PerkSuperSquid; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkDoubleJump; -import nautilus.game.arcade.kit.perks.PerkInkBlast; -import nautilus.game.arcade.kit.perks.PerkStormSquid; -import nautilus.game.arcade.kit.perks.PerkSuperSquid; -public class KitSkySquid extends SmashKit2 +public class KitSkySquid extends SmashKit { private static final Perk[] PERKS = { @@ -31,7 +31,7 @@ public class KitSkySquid extends SmashKit2 new PerkSuperSquid(), new PerkInkBlast(7, 2), new PerkFishFlurry(), - new PerkStormSquid() + new SmashSquid() }; private static final ItemStack IN_HAND = new ItemStack(Material.INK_SACK); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java index eb8c7a5f2..67639bb37 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java @@ -13,14 +13,14 @@ import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.slime.PerkSlimeRocket; +import nautilus.game.arcade.game.games.smash.perks.slime.PerkSlimeSlam; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkDoubleJump; -import nautilus.game.arcade.kit.perks.PerkSlimeRocket; -import nautilus.game.arcade.kit.perks.PerkSlimeSlam; -public class KitSlime extends SmashKit2 +public class KitSlime extends SmashKit { private static final Perk[] PERKS = { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java index 49e508d07..c8af47cc9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java @@ -13,17 +13,17 @@ import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.snowman.PerkArcticAura; +import nautilus.game.arcade.game.games.smash.perks.snowman.PerkIcePath; +import nautilus.game.arcade.game.games.smash.perks.snowman.SmashSnowman; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkArcticAura; import nautilus.game.arcade.kit.perks.PerkBlizzard; import nautilus.game.arcade.kit.perks.PerkDamageSnow; import nautilus.game.arcade.kit.perks.PerkDoubleJump; -import nautilus.game.arcade.kit.perks.PerkIcePath; -import nautilus.game.arcade.kit.perks.PerkSnowTurret; -public class KitSnowman extends SmashKit2 +public class KitSnowman extends SmashKit { private static final Perk[] PERKS = { @@ -33,7 +33,7 @@ public class KitSnowman extends SmashKit2 new PerkArcticAura(), new PerkBlizzard(), new PerkIcePath(), - new PerkSnowTurret() + new SmashSnowman() }; private static final ItemStack IN_HAND = new ItemStack(Material.SNOW_BALL); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java index b41eb323b..656144692 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java @@ -13,15 +13,15 @@ import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.spider.PerkNeedler; +import nautilus.game.arcade.game.games.smash.perks.spider.PerkWebShot; +import nautilus.game.arcade.game.games.smash.perks.spider.SmashSpider; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkNeedler; import nautilus.game.arcade.kit.perks.PerkSpiderLeap; -import nautilus.game.arcade.kit.perks.PerkSpidersNest; -import nautilus.game.arcade.kit.perks.PerkWebShot; -public class KitSpider extends SmashKit2 +public class KitSpider extends SmashKit { private static final Perk[] PERKS = { @@ -29,7 +29,7 @@ public class KitSpider extends SmashKit2 new PerkSpiderLeap(), new PerkNeedler(), new PerkWebShot(), - new PerkSpidersNest() + new SmashSpider() }; private static final ItemStack IN_HAND = new ItemStack(Material.WEB); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java index 6c8999905..3a96edb26 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java @@ -2,7 +2,6 @@ package nautilus.game.arcade.game.games.smash.kits; import org.bukkit.ChatColor; import org.bukkit.Material; -import org.bukkit.Sound; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -14,15 +13,15 @@ import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.witch.PerkBatWave; +import nautilus.game.arcade.game.games.smash.perks.witch.PerkWitchPotion; +import nautilus.game.arcade.game.games.smash.perks.witch.SmashBat; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkBatForm; -import nautilus.game.arcade.kit.perks.PerkBatWave; import nautilus.game.arcade.kit.perks.PerkDoubleJump; -import nautilus.game.arcade.kit.perks.PerkWitchPotion; -public class KitWitch extends SmashKit2 +public class KitWitch extends SmashKit { private static final Perk[] PERKS = { @@ -30,7 +29,7 @@ public class KitWitch extends SmashKit2 new PerkDoubleJump("Double Jump", 0.9, 0.9, false), new PerkWitchPotion(), new PerkBatWave(), - new PerkBatForm() + new SmashBat() }; private static final ItemStack IN_HAND = new ItemStack(Material.POTION); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java index 6787c436f..8f7e6c21b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java @@ -2,7 +2,6 @@ package nautilus.game.arcade.game.games.smash.kits; import org.bukkit.ChatColor; import org.bukkit.Material; -import org.bukkit.Sound; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.entity.Skeleton.SkeletonType; @@ -13,19 +12,18 @@ import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseSkeleton; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.witherskeleton.PerkWitherImage; +import nautilus.game.arcade.game.games.smash.perks.witherskeleton.PerkWitherSkull; +import nautilus.game.arcade.game.games.smash.perks.witherskeleton.SmashWitherSkeleton; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkDoubleJump; -import nautilus.game.arcade.kit.perks.PerkWitherForm; -import nautilus.game.arcade.kit.perks.PerkWitherImage; -import nautilus.game.arcade.kit.perks.PerkWitherSkull; -import net.minecraft.server.v1_8_R3.MobSpawnerAbstract.a; -public class KitWitherSkeleton extends SmashKit2 +public class KitWitherSkeleton extends SmashKit { private static final Perk[] PERKS = { @@ -33,7 +31,7 @@ public class KitWitherSkeleton extends SmashKit2 new PerkDoubleJump("Double Jump", 0.9, 0.9, false), new PerkWitherSkull(), new PerkWitherImage(), - new PerkWitherForm() + new SmashWitherSkeleton() }; private static final ItemStack IN_HAND = new ItemStack(Material.IRON_SWORD); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java index bededf3e2..89597d808 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java @@ -13,19 +13,19 @@ import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.wolf.SmashWolf; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkDoubleJump; -import nautilus.game.arcade.kit.perks.PerkWolf; -public class KitWolf extends SmashKit2 +public class KitWolf extends SmashKit { private static final Perk[] PERKS = { new PerkSmashStats(5, 1.6, 0.25, 5), new PerkDoubleJump("Wolf Jump", 1.0, 1.0, true), - new PerkWolf() + new SmashWolf() }; private static final ItemStack IN_HAND = new ItemStack(Material.BONE); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java index 7e73d6410..4e472b37f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java @@ -2,32 +2,30 @@ package nautilus.game.arcade.game.games.smash.kits; import org.bukkit.ChatColor; import org.bukkit.Material; -import org.bukkit.Sound; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; +import mineplex.core.disguise.disguises.DisguiseZombie; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; -import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.zombie.SmashZombie; +import nautilus.game.arcade.game.games.smash.perks.zombie.PerkOvercharge; +import nautilus.game.arcade.game.games.smash.perks.zombie.PerkZombieBile; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkDeathsGrasp; import nautilus.game.arcade.kit.perks.PerkDoubleJump; import nautilus.game.arcade.kit.perks.PerkFletcher; import nautilus.game.arcade.kit.perks.PerkKnockbackArrow; -import nautilus.game.arcade.kit.perks.PerkNightLivingDead; -import nautilus.game.arcade.kit.perks.PerkOvercharge; -import nautilus.game.arcade.kit.perks.PerkZombieBile; -public class KitZombie extends SmashKit2 +public class KitZombie extends SmashKit { - private static final String[] DESCRIPTION = { - }; private static final Perk[] PERKS = { new PerkSmashStats(6, 1.25, 0.25, 5), @@ -37,7 +35,7 @@ public class KitZombie extends SmashKit2 new PerkOvercharge(6, 250, true), new PerkZombieBile(), new PerkDeathsGrasp(), - new PerkNightLivingDead() + new SmashZombie() }; private static final ItemStack IN_HAND = new ItemStack(Material.IRON_AXE); @@ -84,7 +82,7 @@ public class KitZombie extends SmashKit2 public KitZombie(ArcadeManager manager) { - super(manager, "Zombie", KitAvailability.Gem, 6000, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND, "Night of the Living Dead", 0, Sound.AMBIENCE_CAVE); + super(manager, "Zombie", KitAvailability.Gem, 6000, PERKS, EntityType.ZOMBIE, IN_HAND, DisguiseZombie.class); } @Override @@ -99,7 +97,6 @@ public class KitZombie extends SmashKit2 if (Manager.GetGame().GetState() == GameState.Recruit) player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]); - player.getInventory().setArmorContents(PLAYER_ARMOR); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/modes/RandomKitSSM.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/modes/RandomKitSSM.java index 1f90c3a95..1e570cc22 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/modes/RandomKitSSM.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/modes/RandomKitSSM.java @@ -85,9 +85,9 @@ public class RandomKitSSM extends SoloSuperSmash @Override @EventHandler(priority = EventPriority.HIGH) - public void GameStateChange(GameStateChangeEvent event) + public void onGameStateChange(GameStateChangeEvent event) { - super.GameStateChange(event); + super.onGameStateChange(event); if (event.GetState() != GameState.Prepare) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/modes/kits/KitHipster.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/modes/kits/KitHipster.java index 0957cfc3c..73a4bdb57 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/modes/kits/KitHipster.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/modes/kits/KitHipster.java @@ -1,7 +1,6 @@ package nautilus.game.arcade.game.games.smash.modes.kits; import org.bukkit.Material; -import org.bukkit.Sound; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -21,27 +20,13 @@ public class KitHipster extends SmashKit public KitHipster(ArcadeManager manager) { - super(manager, "Hipster", KitAvailability.Free, 0, - new String[]{"Always get another kit!"}, new Perk[]{}, EntityType.ZOMBIE, new ItemStack(Material.RECORD_10), "Super", - 1, Sound.BURP); - } - - @Override - public void giveCoreItems(Player player) - { - - } - - @Override - public void giveSuperItems(Player player) - { - + super(manager, "Hipster", KitAvailability.Free, 0, new Perk[] {}, EntityType.ZOMBIE, new ItemStack(Material.RECORD_10), null); } @Override public void GiveItems(Player player) { - + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashKit.java index b67f498d4..d09d7ffab 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashKit.java @@ -1,31 +1,18 @@ package nautilus.game.arcade.game.games.smash.perks; -import java.util.Collection; -import java.util.Iterator; -import java.util.UUID; +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.List; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; +import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.C; -import mineplex.core.common.util.NautHashMap; -import mineplex.core.common.util.UtilGear; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTextMiddle; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.ArcadeFormat; +import mineplex.core.disguise.disguises.DisguiseInsentient; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.ProgressingKit; @@ -35,226 +22,109 @@ public abstract class SmashKit extends ProgressingKit protected static final String DOUBLE_JUMP = C.cYellow + "Double tap " + C.cWhite + "your jump key to " + C.cGreen + "Double Jump"; - private NautHashMap _superActive = new NautHashMap(); - - private int _superCharges = 1; - private String _superName; - private long _superDuration; - private Sound _superSound; - - public SmashKit(ArcadeManager manager, String name, - KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, - EntityType entityType, ItemStack itemInHand, - String superName, long superDuration, Sound superSound) + private Class _clazz; + private String[] _description; + + public SmashKit(ArcadeManager manager, String name, KitAvailability kitAvailability, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand, Class clazz) { - super(manager, name, "smash" + name.toLowerCase().replace(" ", ""), kitAvailability, 3000, kitDesc, kitPerks, entityType, itemInHand); - - _superName = superName; - _superDuration = superDuration; - _superSound = superSound; + this(manager, name, kitAvailability, 0, kitPerks, entityType, itemInHand, clazz); } - public SmashKit(ArcadeManager manager, String name, - KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[] kitPerks, - EntityType entityType, ItemStack itemInHand, - String superName, long superDuration, Sound superSound) + public SmashKit(ArcadeManager manager, String name, KitAvailability kitAvailability, int cost, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand, + Class clazz) { - super(manager, name, "smash" + name.toLowerCase().replace(" ", ""), kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand); - - _superName = superName; - _superDuration = superDuration; - _superSound = superSound; + super(manager, name, "smash" + name.toLowerCase().replace(" ", ""), kitAvailability, cost, null, kitPerks, entityType, itemInHand); + + _clazz = clazz; } - @Override - public void onSelected(UUID player) + public boolean isSmashActive(Player player) { - super.onSelected(player); - - DisplayDesc(UtilPlayer.searchExact(player)); - } - - @Override - public void DisplayDesc(Player player) - { - for (int i=0 ; i<3 ; i++) - UtilPlayer.message(player, ""); - - UtilPlayer.message(player, ArcadeFormat.Line); - - UtilPlayer.message(player, "§aKit - §f§l" + GetName()); - - //Desc - for (String line : GetDesc()) - { - UtilPlayer.message(player, C.cGray + " " + line); - } - - //Perk Descs for (Perk perk : GetPerks()) { - if (!perk.IsVisible()) + if (!(perk instanceof SmashUltimate)) + { continue; + } - for (String line : perk.GetDesc()) + SmashUltimate ultimate = (SmashUltimate) perk; + + if (ultimate.isUsingUltimate(player)) { - UtilPlayer.message(player, C.cGray + " " + line); + return true; } } - UtilPlayer.message(player, ArcadeFormat.Line); - + return false; } - @EventHandler - public void triggerSuper(PlayerInteractEvent event) + public void disguise(Player player) { - if (!Manager.GetGame().IsLive()) - return; - - if (!HasKit(event.getPlayer())) - return; - - if (!UtilGear.isMat(event.getItem(), Material.NETHER_STAR)) - return; - - if (!Recharge.Instance.use(event.getPlayer(), _superName, 500, true, false)) - return; - - UtilInv.remove(event.getPlayer(), Material.NETHER_STAR, (byte)0, 1); - - activateSuper(event.getPlayer()); - - //Heal - event.getPlayer().setHealth(event.getPlayer().getMaxHealth()); - - //Inform + Effect - event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), _superSound, 20f, 1f); - - if (Recharge.Instance.use(event.getPlayer(), _superName + " Announce", 20000, false, false)) - { - Manager.GetGame().Announce(C.Bold + event.getPlayer().getName() + " activated " + C.cGreen + C.Bold + _superName + ChatColor.RESET + C.Bold + "!"); - UtilTextMiddle.display("Smash Crystal", event.getPlayer().getName() + " used " + C.cGreen + _superName, 5, 50, 5, UtilServer.getPlayers()); - } - } - - @EventHandler - public void onEnd(GameStateChangeEvent event) - { - Iterator superIter = _superActive.keySet().iterator(); - - while (superIter.hasNext()) - { - Player player = superIter.next(); - superIter.remove(); - deactivateSuper(player); - } + disguise(player, _clazz); } - @EventHandler - public void expireSuper(UpdateEvent event) + public void disguise(Player player, Class clazz) { - Iterator superIter = _superActive.keySet().iterator(); - - while (superIter.hasNext()) + if (_clazz == null) { - Player player = superIter.next(); + return; + } + + try + { + DisguiseInsentient disguise = _clazz.getConstructor(Entity.class).newInstance(player); + GameTeam gameTeam = Manager.GetGame().GetTeam(player); - if (System.currentTimeMillis() > _superActive.get(player)) + if (gameTeam != null) { - superIter.remove(); - deactivateSuper(player); + disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); } + else + { + disguise.setName(player.getName()); + } + + disguise.setCustomNameVisible(true); + Manager.GetDisguise().disguise(disguise); } - } - - @EventHandler - public void deathSuper(PlayerDeathEvent event) - { - if (_superActive.remove(event.getEntity()) != null) - deactivateSuper(event.getEntity()); - } - - public void activateSuper(Player player) - { - //Duration Super - if (_superDuration > 0) + catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { - _superActive.put(player, System.currentTimeMillis() + _superDuration); - - Recharge.Instance.recharge(player, _superName); - Recharge.Instance.use(player, _superName, _superDuration, false, false); - Recharge.Instance.setDisplayForce(player, _superName, true); - Recharge.Instance.setCountdown(player, _superName, true); - } - - //Disable Perks for Duration - for (Perk perk : GetPerks()) - if (perk instanceof SmashPerk) - ((SmashPerk)perk).addSuperActive(player); - - //Items - giveSuperItems(player); - - //Custom - activateSuperCustom(player); - - //Deactivate if instant - if (_superDuration <= 0) - { - deactivateSuper(player); + e.printStackTrace(); } } - public void activateSuperCustom(Player player) + @Override + public String[] getDescription() { - //Null Default + return GetDesc(); + } + + @Override + public String[] GetDesc() + { + if (_description == null) + { + List description = new ArrayList<>(); + + description.add(C.cGreen + "Kit - " + C.cWhiteB + GetName()); + + for (Perk perk : GetPerks()) + { + if (!perk.IsVisible()) + { + continue; + } + + for (String line : perk.GetDesc()) + { + description.add(C.cGray + " " + line); + } + } + + _description = description.toArray(new String[description.size()]); + } + + return _description; } - public void deactivateSuper(Player player) - { - //Perks - for (Perk perk : GetPerks()) - if (perk instanceof SmashPerk) - ((SmashPerk)perk).removeSuperActive(player); - - //Items - giveCoreItems(player); - - //Custom - deactivateSuperCustom(player); - } - - public void deactivateSuperCustom(Player player) - { - //Null Default - } - - public Collection getSuperActive() - { - return _superActive.keySet(); - } - - public boolean isSuperActive(Player player) - { - return _superActive.containsKey(player); - } - - public String getSuperName() - { - return _superName; - } - - public int getSuperCharges() - { - return _superCharges; - } - - public void setSuperCharges(int charges) - { - _superCharges = charges; - } - - public abstract void giveCoreItems(Player player); - public abstract void giveSuperItems(Player player); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashKit2.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashKit2.java deleted file mode 100644 index 46dd1ffb5..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashKit2.java +++ /dev/null @@ -1,154 +0,0 @@ -package nautilus.game.arcade.game.games.smash.perks; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.disguise.disguises.DisguiseInsentient; -import nautilus.game.arcade.ArcadeFormat; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.game.GameTeam; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.ProgressingKit; - -public abstract class SmashKit2 extends ProgressingKit -{ - - protected static final String DOUBLE_JUMP = C.cYellow + "Double tap " + C.cWhite + "your jump key to " + C.cGreen + "Double Jump"; - - private static final int DESCRIPTION_SPACING_LINES = 3; - - private Class _clazz; - private String[] _description; - - public SmashKit2(ArcadeManager manager, String name, KitAvailability kitAvailability, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand, Class clazz) - { - this(manager, name, kitAvailability, 0, kitPerks, entityType, itemInHand, clazz); - } - - public SmashKit2(ArcadeManager manager, String name, KitAvailability kitAvailability, int cost, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand, - Class clazz) - { - super(manager, name, "smash" + name.toLowerCase().replace(" ", ""), kitAvailability, cost, null, kitPerks, entityType, itemInHand); - - _clazz = clazz; - } - - public boolean isSmashActive(Player player) - { - for (Perk perk : GetPerks()) - { - if (!(perk instanceof SmashUltimate)) - { - continue; - } - - SmashUltimate ultimate = (SmashUltimate) perk; - - if (ultimate.isUsingUltimate(player)) - { - return true; - } - } - - return false; - } - - public void disguise(Player player) - { - disguise(player, _clazz); - } - - public void disguise(Player player, Class clazz) - { - try - { - DisguiseInsentient disguise = _clazz.getConstructor(Player.class).newInstance(player); - GameTeam gameTeam = Manager.GetGame().GetTeam(player); - - if (gameTeam != null) - { - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - } - else - { - disguise.setName(player.getName()); - } - - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); - } - catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) - { - e.printStackTrace(); - } - } - - /** - * When the player clicks to select the kit or we give them that kit, we - * need to send custom information for Smash stuff. - */ - @Override - public void onSelected(UUID player) - { - super.onSelected(player); - - Player playerObj = UtilPlayer.searchExact(player); - - if (playerObj == null) - { - return; - } - - for (int i = 0; i < DESCRIPTION_SPACING_LINES; i++) - { - playerObj.sendMessage(""); - } - - playerObj.sendMessage(ArcadeFormat.Line); - - for (String line : GetDesc()) - { - playerObj.sendMessage(line); - } - - playerObj.sendMessage(ArcadeFormat.Line); - } - - @Override - public String[] GetDesc() - { - if (_description == null) - { - List description = new ArrayList<>(); - - description.add(C.cGreen + "Kit - " + C.cWhiteB + GetName()); - - for (Perk perk : GetPerks()) - { - if (!perk.IsVisible()) - { - continue; - } - - for (String line : perk.GetDesc()) - { - description.add(C.cGray + " " + line); - } - } - - _description = description.toArray(new String[description.size()]); - } - - return _description; - } - -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashPerk.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashPerk.java index e76c24a98..0c7d669be 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashPerk.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashPerk.java @@ -23,9 +23,9 @@ public class SmashPerk extends Perk */ public boolean isSuperActive(Player player) { - if (Kit instanceof SmashKit2) + if (Kit instanceof SmashKit) { - SmashKit2 kit = (SmashKit2) Kit; + SmashKit kit = (SmashKit) Kit; if (kit.isSmashActive(player)) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashUltimate.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashUltimate.java index 0b4b47dec..fd8a9a475 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashUltimate.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashUltimate.java @@ -132,10 +132,14 @@ public class SmashUltimate extends Perk { return _lastUltimate; } + + public Sound getSound() + { + return _sound; + } public long getLength() { return _length; } - } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/SmashCow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/SmashCow.java index 04519fc8e..41a7b0b74 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/SmashCow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/SmashCow.java @@ -8,7 +8,7 @@ import mineplex.core.disguise.disguises.DisguiseCow; import mineplex.core.disguise.disguises.DisguiseMooshroom; import mineplex.core.recharge.Recharge; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashCow extends SmashUltimate @@ -28,7 +28,7 @@ public class SmashCow extends SmashUltimate { super.activate(player); - SmashKit2 kit = (SmashKit2) Kit; + SmashKit kit = (SmashKit) Kit; kit.disguise(player, DisguiseMooshroom.class); @@ -49,7 +49,7 @@ public class SmashCow extends SmashUltimate { super.cancel(player); - SmashKit2 kit = (SmashKit2) Kit; + SmashKit kit = (SmashKit) Kit; kit.disguise(player, DisguiseCow.class); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/SmashCreeper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/SmashCreeper.java index d97715ed6..8dbf277c7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/SmashCreeper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/SmashCreeper.java @@ -9,7 +9,7 @@ import nautilus.game.arcade.kit.Perk; public class SmashCreeper extends SmashUltimate { - public SmashCreeper(String name, String[] perkDesc, Sound sound, long length) + public SmashCreeper() { super("Atomic Blast", new String[] {}, Sound.CREEPER_HISS, 50); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashEnderman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashGolem.java similarity index 97% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashEnderman.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashGolem.java index e0d290f5b..60690fdf1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashEnderman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashGolem.java @@ -22,7 +22,7 @@ import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; import nautilus.game.arcade.kit.perks.data.EarthquakeData; -public class SmashEnderman extends SmashUltimate +public class SmashGolem extends SmashUltimate { private static final long DURATION = 16000; @@ -31,7 +31,7 @@ public class SmashEnderman extends SmashUltimate private List _data = new ArrayList<>(); - public SmashEnderman() + public SmashGolem() { super("Earthquake", new String[] {}, Sound.IRONGOLEM_HIT, DURATION); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigZombie.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigZombie.java index 961782928..306f0ed3b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigZombie.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigZombie.java @@ -18,7 +18,7 @@ import mineplex.core.disguise.disguises.DisguisePig; import mineplex.core.disguise.disguises.DisguisePigZombie; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkPigZombie extends SmashPerk @@ -72,7 +72,7 @@ public class PerkPigZombie extends SmashPerk player.getInventory().remove(Material.IRON_LEGGINGS); player.getInventory().remove(Material.IRON_BOOTS); - SmashKit2 kit = (SmashKit2) Kit; + SmashKit kit = (SmashKit) Kit; kit.disguise(player, DisguisePig.class); @@ -100,7 +100,7 @@ public class PerkPigZombie extends SmashPerk player.getInventory().setLeggings(new ItemStack(Material.IRON_LEGGINGS)); player.getInventory().setBoots(new ItemStack(Material.IRON_BOOTS)); - SmashKit2 kit = (SmashKit2) Kit; + SmashKit kit = (SmashKit) Kit; kit.disguise(player, DisguisePigZombie.class); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/SmashSkeletalHorse.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/SmashSkeletalHorse.java index 4769f77ac..058c4c3d8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/SmashSkeletalHorse.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/SmashSkeletalHorse.java @@ -12,7 +12,7 @@ public class SmashSkeletalHorse extends SmashUltimate private static final int DURATION = 20000; - public SmashSkeletalHorse(String name, String[] perkDesc) + public SmashSkeletalHorse() { super("Bone Storm", new String[] {}, Sound.HORSE_SKELETON_DEATH, DURATION); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBarrage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBarrage.java index 819afe86b..dd8123b3c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBarrage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBarrage.java @@ -144,14 +144,14 @@ public class PerkBarrage extends SmashPerk // Charge Interval if (_charge.get(key) == 0) { - if (!UtilTime.elapsed(_chargeLast.get(cur), 1000)) + if (!UtilTime.elapsed(_chargeLast.get(key), 1000)) { continue; } } else { - if (!UtilTime.elapsed(_chargeLast.get(cur), _tick)) + if (!UtilTime.elapsed(_chargeLast.get(key), _tick)) { continue; } @@ -164,8 +164,8 @@ public class PerkBarrage extends SmashPerk { cur.setExp(0f); } - _charge.remove(cur); - _chargeLast.remove(cur); + _charge.remove(key); + _chargeLast.remove(key); continue; } @@ -179,7 +179,7 @@ public class PerkBarrage extends SmashPerk _chargeLast.put(key, System.currentTimeMillis()); // Effect - cur.playSound(cur.getLocation(), Sound.CLICK, 1f, 1f + (0.1f * _charge.get(cur))); + cur.playSound(cur.getLocation(), Sound.CLICK, 1f, 1f + (0.1f * _charge.get(key))); } } @@ -222,8 +222,10 @@ public class PerkBarrage extends SmashPerk public void BarrageArrows(UpdateEvent event) { if (event.getType() != UpdateType.TICK) + { return; - + } + Set remove = new HashSet(); for (UUID key : _firing) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/SmashSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/SmashSkeleton.java index 6dad090ab..32e37faea 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/SmashSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/SmashSkeleton.java @@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.smash.perks.skeleton; import java.util.HashSet; import java.util.Iterator; import java.util.Set; +import java.util.UUID; import org.bukkit.Sound; import org.bukkit.entity.Arrow; @@ -12,9 +13,9 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.util.Vector; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashKit; import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashSkeleton extends SmashUltimate @@ -37,8 +38,15 @@ public class SmashSkeleton extends SmashUltimate return; } - for (Player cur : ((SmashKit) Kit).getSuperActive()) + for (UUID uuid : getLastUltimate().keySet()) { + Player cur = UtilPlayer.searchExact(uuid); + + if (cur == null) + { + continue; + } + Vector random = new Vector((Math.random() - 0.5) / 5, (Math.random() - 0.5) / 5, (Math.random() - 0.5) / 5); Projectile arrow = cur.launchProjectile(Arrow.class); arrow.setVelocity(cur.getLocation().getDirection().add(random).multiply(3)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkStormSquid.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/SmashSquid.java similarity index 93% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkStormSquid.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/SmashSquid.java index 03afbb943..a7f6e4513 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkStormSquid.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/SmashSquid.java @@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.smash.perks.squid; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.UUID; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -24,18 +25,17 @@ import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.recharge.Recharge; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.games.smash.kits.KitSkySquid; -import nautilus.game.arcade.game.games.smash.perks.SmashKit; import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; -public class PerkStormSquid extends SmashUltimate +public class SmashSquid extends SmashUltimate { private static final int DURATION = 24000; @@ -45,7 +45,7 @@ public class PerkStormSquid extends SmashUltimate private static final int DAMAGE_RADIUS = 8; private static final int KNOCKBACK_MAGNITUDE = 3; - public PerkStormSquid() + public SmashSquid() { super("Storm Squid", new String[] {}, Sound.SPLASH2, DURATION); } @@ -179,8 +179,15 @@ public class PerkStormSquid extends SmashUltimate return; } - for (Player player : ((SmashKit) Kit).getSuperActive()) + for (UUID uuid : getLastUltimate().keySet()) { + Player player = UtilPlayer.searchExact(uuid); + + if (player == null) + { + continue; + } + if (player.isFlying()) { continue; @@ -199,8 +206,15 @@ public class PerkStormSquid extends SmashUltimate return; } - for (Player player : ((SmashKit) Kit).getSuperActive()) + for (UUID uuid : getLastUltimate().keySet()) { + Player player = UtilPlayer.searchExact(uuid); + + if (player == null) + { + continue; + } + List collisions = new ArrayList<>(); // Bump diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/SmashBat.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/SmashBat.java index 94e898356..3febfa3d0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/SmashBat.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/SmashBat.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.UUID; import org.bukkit.GameMode; import org.bukkit.Material; @@ -24,6 +25,7 @@ import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilServer; @@ -34,7 +36,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.smash.perks.SmashKit; -import nautilus.game.arcade.game.games.smash.perks.SmashKit2; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkDoubleJump; @@ -79,7 +81,7 @@ public class SmashBat extends SmashUltimate Manager.GetDisguise().undisguise(Manager.GetDisguise().getActiveDisguise(player)); - SmashKit2 kit = (SmashKit2) Kit; + SmashKit kit = (SmashKit) Kit; kit.disguise(player, DisguiseBat.class); } @@ -98,7 +100,7 @@ public class SmashBat extends SmashUltimate Manager.GetDisguise().undisguise(Manager.GetDisguise().getActiveDisguise(player)); - SmashKit2 kit = (SmashKit2) Kit; + SmashKit kit = (SmashKit) Kit; kit.disguise(player); } @@ -281,8 +283,15 @@ public class SmashBat extends SmashUltimate return; } - for (Player player : ((SmashKit) Kit).getSuperActive()) + for (UUID uuid : getLastUltimate().keySet()) { + Player player = UtilPlayer.searchExact(uuid); + + if (player == null) + { + continue; + } + if (Manager.isSpectator(player)) { continue; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/SmashWitherSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/SmashWitherSkeleton.java index 5711820e7..3e7f65308 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/SmashWitherSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/SmashWitherSkeleton.java @@ -1,6 +1,7 @@ package nautilus.game.arcade.game.games.smash.perks.witherskeleton; import java.util.ArrayList; +import java.util.UUID; import org.bukkit.Location; import org.bukkit.Sound; @@ -14,19 +15,19 @@ import org.bukkit.util.Vector; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.disguise.disguises.DisguiseWither; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.smash.perks.SmashKit; -import nautilus.game.arcade.game.games.smash.perks.SmashKit2; import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashWitherSkeleton extends SmashUltimate { - + private static final long DURAITON = 18000; - + public SmashWitherSkeleton() { super("Wither Form", new String[] {}, Sound.WITHER_SPAWN, DURAITON); @@ -36,10 +37,10 @@ public class SmashWitherSkeleton extends SmashUltimate public void activate(Player player) { super.activate(player); - + Manager.GetDisguise().undisguise(Manager.GetDisguise().getActiveDisguise(player)); - - SmashKit2 kit = (SmashKit2) Kit; + + SmashKit kit = (SmashKit) Kit; kit.disguise(player, DisguiseWither.class); } @@ -47,10 +48,10 @@ public class SmashWitherSkeleton extends SmashUltimate public void cancel(Player player) { super.cancel(player); - + Manager.GetDisguise().undisguise(Manager.GetDisguise().getActiveDisguise(player)); - SmashKit2 kit = (SmashKit2) Kit; + SmashKit kit = (SmashKit) Kit; kit.disguise(player); player.setFlying(false); @@ -63,9 +64,16 @@ public class SmashWitherSkeleton extends SmashUltimate { return; } - - for (Player player : ((SmashKit) Kit).getSuperActive()) + + for (UUID uuid : getLastUltimate().keySet()) { + Player player = UtilPlayer.searchExact(uuid); + + if (player == null) + { + continue; + } + ArrayList collisions = new ArrayList(); // Bump @@ -93,24 +101,24 @@ public class SmashWitherSkeleton extends SmashUltimate { return; } - + Player player = event.GetDamagerPlayer(true); - + if (player == null) { return; } - + if (!isUsingUltimate(player)) { return; } - + if (event.GetCause() != DamageCause.ENTITY_ATTACK) { return; } - + event.SetCancelled("Wither Form Melee Cancel"); } @@ -121,14 +129,21 @@ public class SmashWitherSkeleton extends SmashUltimate { return; } - - for (Player player : ((SmashKit) Kit).getSuperActive()) + + for (UUID uuid : getLastUltimate().keySet()) { + Player player = UtilPlayer.searchExact(uuid); + + if (player == null) + { + continue; + } + if (player.isFlying()) { continue; } - + player.setAllowFlight(true); player.setFlying(true); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkDeathsGrasp.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkDeathsGrasp.java index ebaebf084..c31472a2f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkDeathsGrasp.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkDeathsGrasp.java @@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.smash.perks.zombie; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; import org.bukkit.Material; @@ -11,10 +12,8 @@ import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; -import org.fusesource.jansi.internal.Kernel32.COORD; import mineplex.core.common.util.C; import mineplex.core.common.util.F; @@ -23,7 +22,7 @@ import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; @@ -31,7 +30,6 @@ import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -40,9 +38,9 @@ import nautilus.game.arcade.kit.Perk; public class PerkDeathsGrasp extends Perk { - + private static final int COOLDOWN = 12000; - + private Map _live = new HashMap<>(); private Map _weakness = new HashMap<>(); @@ -85,7 +83,7 @@ public class PerkDeathsGrasp extends Perk { return; } - + UtilAction.velocity(player, player.getLocation().getDirection(), 1.4, false, 0, 0.2, 1.2, true); // Record @@ -105,19 +103,37 @@ public class PerkDeathsGrasp extends Perk { return; } - + + List alivePlayers = Manager.GetGame().GetPlayers(true); + // Collide - for (Player player : Manager.GetGame().GetPlayers(true)) - if (_live.containsKey(player)) - for (Player other : Manager.GetGame().GetPlayers(true)) - if (!Manager.isSpectator(other)) - if (!other.equals(player)) - if (UtilMath.offset(player, other) < 2) - { - collide(player, other); - _live.remove(player); - return; - } + for (Player player : alivePlayers) + { + if (!_live.containsKey(player)) + { + continue; + } + + for (Player other : alivePlayers) + { + if (Manager.isSpectator(other)) + { + continue; + } + + if (other.equals(player)) + { + continue; + } + + if (UtilMath.offset(player, other) < 2) + { + collide(player, other); + _live.remove(player); + return; + } + } + } // Leap End Iterator leapIter = _live.keySet().iterator(); @@ -127,11 +143,15 @@ public class PerkDeathsGrasp extends Perk LivingEntity ent = leapIter.next(); if (!UtilEnt.isGrounded(ent)) + { continue; + } if (!UtilTime.elapsed(_live.get(ent), 1000)) + { continue; - + } + leapIter.remove(); } @@ -143,11 +163,15 @@ public class PerkDeathsGrasp extends Perk LivingEntity ent = weaknessIter.next(); if (!UtilEnt.isGrounded(ent)) + { continue; - + } + if (!UtilTime.elapsed(_weakness.get(ent), 1000)) + { continue; - + } + weaknessIter.remove(); } } @@ -177,24 +201,37 @@ public class PerkDeathsGrasp extends Perk public void arrowDamage(CustomDamageEvent event) { if (event.GetProjectile() == null) + { return; - + } + if (!(event.GetProjectile() instanceof Arrow)) + { return; - + } + if (!_weakness.containsKey(event.GetDamageeEntity())) + { return; - + } + Player damager = event.GetDamagerPlayer(true); + if (damager == null) + { return; - - if (!Kit.HasKit(damager)) + } + + if (!hasPerk(damager)) + { return; - - if (!Manager.IsAlive(damager)) + } + + if (Manager.isSpectator(damager)) + { return; - + } + event.AddMult(GetName(), GetName() + " Combo", 2, true); UtilParticle.PlayParticle(ParticleType.RED_DUST, event.GetDamageeEntity().getLocation(), 0.5f, 0.5f, 0.5f, 0, 20, ViewDist.MAX, UtilServer.getPlayers()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkNightLivingDead.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/SmashZombie.java similarity index 73% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkNightLivingDead.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/SmashZombie.java index 46c7fa2bd..49a2aa35e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkNightLivingDead.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/SmashZombie.java @@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.smash.perks.zombie; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; +import java.util.List; import org.bukkit.Effect; import org.bukkit.Location; @@ -21,105 +22,119 @@ import mineplex.core.common.util.UtilTime; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.game.games.smash.TeamSuperSmash; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; +import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; import nautilus.game.arcade.kit.perks.data.NightLivingDeadData; -public class PerkNightLivingDead extends SmashPerk +public class SmashZombie extends SmashUltimate { - private ArrayList _night = new ArrayList(); + private static final int DURATION = 30000; - private HashSet _ignoreList = new HashSet();; - - public PerkNightLivingDead() + private List _night = new ArrayList<>(); + + private HashSet _ignoreList = new HashSet<>();; + + public SmashZombie() { - super("Night of the Living Dead", new String[] - { - }, false); + super("Night of the Living Dead", new String[] {}, Sound.AMBIENCE_CAVE, 0); } @Override - public void addSuperCustom(Player player) + public void activate(Player player) { + super.activate(player); + _night.add(new NightLivingDeadData(player)); } - + @EventHandler public void timeUpdate(UpdateEvent event) { if (event.getType() != UpdateType.TICK) + { return; + } if (_night.isEmpty() && Manager.GetGame().WorldTimeSet != 12000) { - Manager.GetGame().WorldTimeSet = (Manager.GetGame().WorldTimeSet + 50)%24000; + Manager.GetGame().WorldTimeSet = (Manager.GetGame().WorldTimeSet + 50) % 24000; } else if (!_night.isEmpty() && Manager.GetGame().WorldTimeSet != 18000) { - Manager.GetGame().WorldTimeSet = (Manager.GetGame().WorldTimeSet + 50)%24000; + Manager.GetGame().WorldTimeSet = (Manager.GetGame().WorldTimeSet + 50) % 24000; } } - + @EventHandler public void update(UpdateEvent event) { if (event.getType() != UpdateType.TICK) + { return; + } Iterator nightIter = _night.iterator(); - + while (nightIter.hasNext()) { NightLivingDeadData data = nightIter.next(); - - //Expire - if (UtilTime.elapsed(data.Time, 30000)) + + // Expire + if (UtilTime.elapsed(data.Time, DURATION)) { nightIter.remove(); - + for (Zombie zombie : data.Zombies) + { zombie.damage(1000); + } + continue; } - - //Spawn + + // Spawn if (UtilTime.elapsed(data.LastSpawn, 1000)) { Location origin = UtilAlg.Random(Manager.GetGame().GetPlayers(true)).getLocation(); Location loc = findSpawn(origin); - + if (Math.abs(loc.getY() - origin.getY()) > 6) + { continue; + } if (!UtilBlock.airFoliage(loc.getBlock()) || !UtilBlock.airFoliage(loc.getBlock().getRelative(BlockFace.UP))) + { continue; + } - //Set Spawned + // Set Spawned data.LastSpawn = System.currentTimeMillis(); - - //Move Down + + // Move Down loc.subtract(0, 1, 0); - - //Spawn + + // Spawn Manager.GetGame().CreatureAllowOverride = true; Zombie zombie = loc.getWorld().spawn(loc, Zombie.class); Manager.GetGame().CreatureAllowOverride = false; - + data.Zombies.add(zombie); - - //Pop up - zombie.setVelocity(new Vector(0,0.4,0)); - //zombie.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 9999, 1, true)); - - //Effect + + // Pop up + zombie.setVelocity(new Vector(0, 0.4, 0)); + // zombie.addPotionEffect(new + // PotionEffect(PotionEffectType.SPEED, 9999, 1, true)); + + // Effect zombie.getWorld().playSound(zombie.getLocation(), Sound.ZOMBIE_IDLE, 1f, 0.75f); - + loc.getWorld().playEffect(loc, Effect.STEP_SOUND, loc.getBlock().getType()); } } } - + @EventHandler - public void update(EntityTargetEvent event) + public void target(EntityTargetEvent event) { for (NightLivingDeadData data : _night) { @@ -129,7 +144,7 @@ public class PerkNightLivingDead extends SmashPerk { TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); Player targetPlayer = (Player) event.getTarget(); - + if (smash.GetTeam(data.Player).equals(smash.GetTeam(targetPlayer))) { event.setCancelled(true); @@ -142,9 +157,9 @@ public class PerkNightLivingDead extends SmashPerk } } } - + public Location findSpawn(Location area) { - return UtilBlock.getHighest(area.getWorld(), (int)(area.getX() + Math.random() * 24 - 12), (int)(area.getZ() + Math.random() * 24 - 12), _ignoreList).getLocation().add(0.5, 0.5, 0.5); + return UtilBlock.getHighest(area.getWorld(), (int) (area.getX() + Math.random() * 24 - 12), (int) (area.getZ() + Math.random() * 24 - 12), _ignoreList).getLocation().add(0.5, 0.5, 0.5); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitArcher.java index 8c9c49bd5..f520f6e26 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitArcher.java @@ -1,13 +1,14 @@ package nautilus.game.arcade.game.games.survivalgames.kit; +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; + import mineplex.core.common.util.C; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.smash.perks.skeleton.PerkBarrage; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkBarrage; import nautilus.game.arcade.kit.perks.PerkFletcher; -import org.bukkit.Material; -import org.bukkit.inventory.ItemStack; public class KitArcher extends SurvivalGamesKit { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/kits/KitArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/kits/KitArcher.java index 61d50a516..de82c4e11 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/kits/KitArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/kits/KitArcher.java @@ -1,17 +1,18 @@ package nautilus.game.arcade.game.games.tug.kits; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.ProgressingKit; -import nautilus.game.arcade.kit.perks.PerkBarrage; -import nautilus.game.arcade.kit.perks.PerkFletcher; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.smash.perks.skeleton.PerkBarrage; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkFletcher; + public class KitArcher extends ProgressingKit { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/kits/KitShredder.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/kits/KitShredder.java index b23f051ee..21b33aed8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/kits/KitShredder.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/kits/KitShredder.java @@ -1,20 +1,21 @@ package nautilus.game.arcade.game.games.turfforts.kits; -import mineplex.core.common.util.C; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.ProgressingKit; -import nautilus.game.arcade.kit.perks.PerkBarrage; -import nautilus.game.arcade.kit.perks.PerkConstructor; -import nautilus.game.arcade.kit.perks.PerkFletcher; import org.bukkit.Bukkit; 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.game.games.smash.perks.skeleton.PerkBarrage; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkConstructor; +import nautilus.game.arcade.kit.perks.PerkFletcher; + public class KitShredder extends ProgressingKit { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/kits/KitSurvivorArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/kits/KitSurvivorArcher.java index 071588287..d807865d9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/kits/KitSurvivorArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/kits/KitSurvivorArcher.java @@ -2,10 +2,10 @@ package nautilus.game.arcade.game.games.zombiesurvival.kits; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.smash.perks.skeleton.PerkBarrage; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.ProgressingKit; -import nautilus.game.arcade.kit.perks.PerkBarrage; import nautilus.game.arcade.kit.perks.PerkFletcher; import org.bukkit.Material; import org.bukkit.entity.EntityType; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkArcticAura.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkArcticAura.java deleted file mode 100644 index 6af4ed018..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkArcticAura.java +++ /dev/null @@ -1,52 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashMap; - -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilMath; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.kit.Perk; - -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; - -public class PerkArcticAura extends Perk -{ - public PerkArcticAura() - { - super("Arctic Aura", new String[] - { - "You freeze things around you, slowing enemies." - }); - } - - @EventHandler - public void SnowAura(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - for (Player player : Manager.GetGame().GetPlayers(true)) - { - if (!Kit.HasKit(player)) - continue; - - if (((CraftPlayer) player).getHandle().spectating) - continue; - - double range = 5*player.getExp(); - - //Blocks - double duration = 2000; - HashMap blocks = UtilBlock.getInRadius(player.getLocation(), range); - for (Block block : blocks.keySet()) - { - //Snow - Manager.GetBlockRestore().snow(block, (byte) 1, (byte) 1, (long) (duration * (1 + blocks.get(block))), 250, 0); - } - } - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBarrage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBarrage.java deleted file mode 100644 index de6563837..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBarrage.java +++ /dev/null @@ -1,302 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashSet; -import java.util.Iterator; -import java.util.WeakHashMap; - -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.Player; -import org.bukkit.entity.Projectile; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.block.Action; -import org.bukkit.event.entity.EntityShootBowEvent; -import org.bukkit.event.entity.ProjectileHitEvent; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.util.Vector; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.updater.UpdateType; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; - -public class PerkBarrage extends SmashPerk -{ - private WeakHashMap _charge = new WeakHashMap(); - private WeakHashMap _chargeLast = new WeakHashMap(); - - private HashSet _firing = new HashSet(); - private HashSet _arrows = new HashSet(); - - private int _max; - private long _tick; - private boolean _remove; - private boolean _noDelay; - private boolean _useExp; - - public PerkBarrage(int max, long tick, boolean remove, boolean noDelay) - { - this(max, tick, remove, noDelay, false); - } - - public PerkBarrage(int max, long tick, boolean remove, boolean noDelay, boolean useExpAndBar) - { - super("Barrage", new String[] - { - C.cYellow + "Charge" + C.cGray + " your Bow to use " + C.cGreen + "Barrage" - }); - _useExp = useExpAndBar; - _max = max; - _tick = tick; - _remove = remove; - _noDelay = noDelay; - } - - @EventHandler - public void BarrageDrawBow(PlayerInteractEvent event) - { - Player player = event.getPlayer(); - - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) - return; - - if (player.getItemInHand() == null || player.getItemInHand().getType() != Material.BOW) - return; - - if (isSuperActive(player)) - return; - - if (!Kit.HasKit(player)) - return; - - if (!player.getInventory().contains(Material.ARROW)) - return; - - if (event.getClickedBlock() != null) - if (UtilBlock.usable(event.getClickedBlock())) - return; - - // Start Charge - _charge.put(player, 0); - _chargeLast.put(player, System.currentTimeMillis()); - _firing.remove(player); - } - - @EventHandler - public void BarrageCharge(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - for (Player cur : UtilServer.getPlayers()) - { - // Not Charging - if (!_charge.containsKey(cur)) - continue; - - if (_firing.contains(cur)) - continue; - - // Max Charge - if (_charge.get(cur) >= _max) - continue; - - // Charge Interval - if (_charge.get(cur) == 0) - { - if (!UtilTime.elapsed(_chargeLast.get(cur), 1000)) - continue; - } - else - { - if (!UtilTime.elapsed(_chargeLast.get(cur), _tick)) - continue; - } - - // No Longer Holding Bow - if (cur.getItemInHand() == null || cur.getItemInHand().getType() != Material.BOW) - { - if (_useExp) - { - cur.setExp(0f); - } - _charge.remove(cur); - _chargeLast.remove(cur); - continue; - } - - // Increase Charge - _charge.put(cur, _charge.get(cur) + 1); - - if (_useExp) - { - cur.setExp(Math.min(0.9999f, (float)_charge.get(cur) / (float)_max)); - } - _chargeLast.put(cur, System.currentTimeMillis()); - - // Effect - cur.playSound(cur.getLocation(), Sound.CLICK, 1f, 1f + (0.1f * _charge.get(cur))); - } - } - - @EventHandler(priority = EventPriority.HIGH) - public void BarrageFireBow(EntityShootBowEvent event) - { - if (event.isCancelled()) - return; - - if (!Manager.GetGame().IsLive()) - return; - - if (!(event.getEntity() instanceof Player)) - return; - - if (!(event.getProjectile() instanceof Arrow)) - return; - - Player player = (Player) event.getEntity(); - - if (!_charge.containsKey(player)) - return; - - // Start Barrage - _firing.add(player); - _chargeLast.put(player, System.currentTimeMillis()); - } - - @EventHandler - public void BarrageArrows(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - HashSet remove = new HashSet(); - - for (Player cur : _firing) - { - if (!_charge.containsKey(cur) || !_chargeLast.containsKey(cur)) - { - remove.add(cur); - continue; - } - - if (cur.getItemInHand() == null || cur.getItemInHand().getType() != Material.BOW) - { - remove.add(cur); - continue; - } - - int arrows = _charge.get(cur); - if (arrows <= 0) - { - remove.add(cur); - continue; - } - - _charge.put(cur, arrows - 1); - if (_useExp) - { - cur.setExp(Math.min(0.9999f, (float)_charge.get(cur) / (float)_max)); - } - - // Fire Arrow - Vector random = new Vector((Math.random() - 0.5) / 10, (Math.random() - 0.5) / 10, (Math.random() - 0.5) / 10); - Projectile arrow = cur.launchProjectile(Arrow.class); - arrow.setVelocity(cur.getLocation().getDirection().add(random).multiply(3)); - _arrows.add(arrow); - cur.getWorld().playSound(cur.getLocation(), Sound.SHOOT_ARROW, 1f, 1f); - } - - for (Player cur : remove) - { - if (_useExp) - { - cur.setExp(0f); - } - _charge.remove(cur); - _chargeLast.remove(cur); - _firing.remove(cur); - } - } - - @EventHandler(priority = EventPriority.HIGH) - public void BarrageDamageTime(CustomDamageEvent event) - { - if (!_noDelay) - return; - - if (event.GetProjectile() == null) - return; - - if (event.GetDamagerPlayer(true) == null) - return; - - if (!(event.GetProjectile() instanceof Arrow)) - return; - - Player damager = event.GetDamagerPlayer(true); - - if (!Kit.HasKit(damager)) - return; - - event.SetCancelled("Barrage Cancel"); - - event.GetProjectile().remove(); - - // Damage Event - Manager.GetDamage().NewDamageEvent(event.GetDamageeEntity(), damager, null, DamageCause.THORNS, event.GetDamage(), true, - true, false, damager.getName(), GetName()); - } - - @EventHandler - public void BarrageProjectileHit(ProjectileHitEvent event) - { - if (_remove) - if (_arrows.remove(event.getEntity())) - event.getEntity().remove(); - } - - @EventHandler - public void BarrageClean(UpdateEvent event) - { - if (event.getType() != UpdateType.SEC) - return; - - for (Iterator arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) - { - Projectile arrow = arrowIterator.next(); - - if (arrow.isDead() || !arrow.isValid()) - arrowIterator.remove(); - } - } - - @EventHandler - public void Quit(PlayerQuitEvent event) - { - Player player = event.getPlayer(); - - clean(player); - } - - @Override - public void addSuperCustom(Player player) - { - clean(player); - } - - public void clean(Player player) - { - _charge.remove(player); - _chargeLast.remove(player); - _firing.remove(player); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatForm.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatForm.java deleted file mode 100644 index 02c26ba8a..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatForm.java +++ /dev/null @@ -1,258 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; - -import org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.Sound; -import org.bukkit.block.BlockFace; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.block.Action; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerToggleFlightEvent; - -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.disguise.disguises.DisguiseBat; -import mineplex.core.disguise.disguises.DisguiseWitch; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashKit; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; -import nautilus.game.arcade.kit.perks.data.SonicBoomData; - -public class PerkBatForm extends SmashPerk -{ - private ArrayList _sonic = new ArrayList(); - - public PerkBatForm() - { - super("Bat Form", new String[] - { - }, false); - } - - @Override - public void addSuperCustom(Player player) - { - Manager.GetDisguise().undisguise(player); - - //Disguise - DisguiseBat disguise = new DisguiseBat(player); - - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else - disguise.setName(player.getName()); - - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); - } - - @Override - public void removeSuperCustom(Player player) - { - Manager.GetDisguise().undisguise(player); - - //Disguise - DisguiseWitch disguise = new DisguiseWitch(player); - - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else - disguise.setName(player.getName()); - - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); - } - - @EventHandler(priority = EventPriority.LOWEST) - public void attackCancel(CustomDamageEvent event) - { - if (event.IsCancelled()) - return; - - Player player = event.GetDamagerPlayer(true); - if (player == null) - return; - - if (!isSuperActive(player)) - return; - - if (event.GetCause() != DamageCause.ENTITY_ATTACK) - return; - - event.SetCancelled("Bat Form Melee Cancel"); - } - - @EventHandler(priority = EventPriority.LOW) //Happen before activation of Super - public void sonicBoom(PlayerInteractEvent event) - { - Player player = event.getPlayer(); - - if (!isSuperActive(player)) - return; - - if (event.getAction() == Action.PHYSICAL) - return; - - if (!Recharge.Instance.use(player, GetName() + " Screech", 1200, false, false)) - return; - - //Effect - player.getWorld().playSound(player.getLocation(), Sound.BAT_HURT, 1f, 0.75f); - - _sonic.add(new SonicBoomData(player)); - } - - @EventHandler - public void sonicBoomUpdate(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - Iterator sonicIter = _sonic.iterator(); - - while (sonicIter.hasNext()) - { - SonicBoomData data = sonicIter.next(); - - //Time Boom - if (UtilTime.elapsed(data.Time, 12000)) - { - sonicIter.remove(); - explode(data); - continue; - } - - //Block Boom - if (!UtilBlock.airFoliage(data.Location.getBlock())) - { - sonicIter.remove(); - explode(data); - continue; - } - - //Proxy Boom - for (Player player : Manager.GetGame().GetPlayers(true)) - { - if (Manager.isSpectator(player)) - continue; - - if (player.equals(data.Shooter)) - continue; - - if (UtilMath.offset(player.getLocation().add(0, 1, 0), data.Location) < 4) - { - sonicIter.remove(); - explode(data); - continue; - } - } - - //Move - data.Location.add(data.Direction.clone().multiply(1)); - - //Effect - UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.Location, 0, 0, 0, 0, 1, - ViewDist.MAX, UtilServer.getPlayers()); - data.Location.getWorld().playSound(data.Location, Sound.FIZZ, 1f, 2f); - } - } - - private void explode(SonicBoomData data) - { - //Effect - UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, data.Location, 0, 0, 0, 0, 1, - ViewDist.MAX, UtilServer.getPlayers()); - data.Location.getWorld().playSound(data.Location, Sound.EXPLODE, 1f, 1.5f); - - //Damage - HashMap targets = UtilEnt.getInRadius(data.Location, 10); - for (LivingEntity cur : targets.keySet()) - { - if (cur.equals(data.Shooter)) - continue; - - Manager.GetDamage().NewDamageEvent(cur, data.Shooter, null, - DamageCause.CUSTOM, 12 * targets.get(cur) + 0.5, true, false, false, - data.Shooter.getName(), GetName()); - } - } - - @EventHandler - public void flap(PlayerToggleFlightEvent event) - { - Player player = event.getPlayer(); - - if (Manager.isSpectator(player)) - return; - - if (!isSuperActive(player)) - return; - - if (player.getGameMode() == GameMode.CREATIVE) - return; - - event.setCancelled(true); - player.setFlying(false); - - //Disable Flight - player.setAllowFlight(false); - - //Velocity - UtilAction.velocity(player, player.getLocation().getDirection(), 0.8, false, 0, 0.8, 1, true); - - //Sound - player.getWorld().playSound(player.getLocation(), Sound.BAT_TAKEOFF, (float)(0.3 + player.getExp()), (float)(Math.random()/2+0.5)); - - //Set Recharge - Recharge.Instance.use(player, GetName() + " Flap", 40, false, false); - } - - @EventHandler - public void flapRecharge(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - for (Player player : ((SmashKit)Kit).getSuperActive()) - { - if (Manager.isSpectator(player)) - continue; - - if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) - { - player.setAllowFlight(true); - } - else if (Recharge.Instance.usable(player, GetName() + " Flap")) - { - player.setAllowFlight(true); - } - } - } - - @EventHandler - public void knockback(CustomDamageEvent event) - { - if (event.GetReason() == null || !event.GetReason().contains(GetName())) - return; - - event.AddKnockback(GetName(), 2); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatWave.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatWave.java deleted file mode 100644 index a31827c08..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatWave.java +++ /dev/null @@ -1,256 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; - -import org.bukkit.Location; -import org.bukkit.Sound; -import org.bukkit.entity.Bat; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.util.Vector; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; - -public class PerkBatWave extends SmashPerk -{ - private HashMap _active = new HashMap(); - private HashMap _direction = new HashMap(); - private HashMap> _bats = new HashMap>(); - private HashSet _pulling = new HashSet(); - private HashSet _allowLeash = new HashSet(); - - public PerkBatWave() - { - super("Bat Wave", new String[] - { - C.cYellow + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + "Bat Wave", - C.cYellow + "Double Right-Click" + C.cGray + " with Spade to use " + C.cGreen + "Bat Leash" - }); - } - - @EventHandler - public void Deactivate(CustomDamageEvent event) - { - Player player = event.GetDamageePlayer(); - if (player == null) return; - - if (_pulling.remove(player)) - { - for (Bat bat : _bats.get(player)) - bat.setLeashHolder(null); - } - } - - @EventHandler - public void Activate(PlayerInteractEvent event) - { - if (event.isCancelled()) - return; - - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) - return; - - if (UtilBlock.usable(event.getClickedBlock())) - return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_SPADE")) - return; - - Player player = event.getPlayer(); - - if (isSuperActive(player)) - return; - - if (!Kit.HasKit(player)) - return; - - if (!Recharge.Instance.use(player, GetName(), 8000, false, true)) - { - if (_active.containsKey(player)) - { - if (!Recharge.Instance.use(player, "Leash Bats", 500, false, false)) - return; - - if (!_pulling.remove(player)) - { - if (_allowLeash.remove(player)) - { - _pulling.add(player); - - for (Bat bat : _bats.get(player)) - bat.setLeashHolder(player); - } - } - else - { - for (Bat bat : _bats.get(player)) - bat.setLeashHolder(null); - } - } - else - { - //Inform - Recharge.Instance.use(player, GetName(), 8000, true, true); - } - } - else - { - //Start - _direction.put(player, player.getEyeLocation()); - _active.put(player, System.currentTimeMillis()); - _allowLeash.add(player); - - _bats.put(player, new ArrayList()); - - for (int i=0 ; i<32 ; i++) - { - Manager.GetGame().CreatureAllowOverride = true; - Bat bat = player.getWorld().spawn(player.getEyeLocation(), Bat.class); - _bats.get(player).add(bat); - Manager.GetGame().CreatureAllowOverride = false; - } - - //Inform - UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); - } - } - - @EventHandler - public void Update(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - for (Player cur : UtilServer.getPlayers()) - { - if (!_active.containsKey(cur)) - continue; - - if (UtilTime.elapsed(_active.get(cur), 2500)) - { - Clear(cur); - continue; - } - - Location loc = _direction.get(cur); - - Vector batVec = new Vector(0,0,0); - double batCount = 0; - - //Bat Movement - for (Bat bat : _bats.get(cur)) - { - if (!bat.isValid()) - continue; - - batVec.add(bat.getLocation().toVector()); - batCount++; - - Vector rand = new Vector((Math.random() - 0.5)/2, (Math.random() - 0.5)/2, (Math.random() - 0.5)/2); - bat.setVelocity(loc.getDirection().clone().multiply(0.5).add(rand)); - - for (Player other : Manager.GetGame().GetPlayers(true)) - { - if (other.equals(cur)) - continue; - - if (!Recharge.Instance.usable(other, "Hit by Bat")) - continue; - - if (UtilEnt.hitBox(bat.getLocation(), other, 2, null)) - { - //Damage Event - Manager.GetDamage().NewDamageEvent(other, cur, null, - DamageCause.CUSTOM, 2.5, true, true, false, - cur.getName(), GetName()); - - //Effect - bat.getWorld().playSound(bat.getLocation(), Sound.BAT_HURT, 1f, 1f); - UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, bat.getLocation(), 0, 0, 0, 0, 3, - ViewDist.LONG, UtilServer.getPlayers()); - - bat.remove(); - - //Recharge on hit - Recharge.Instance.useForce(other, "Hit by Bat", 200); - } - } - } - - //Player Pull - if (_pulling.contains(cur)) - { - batVec.multiply(1/batCount); - - Location batLoc = batVec.toLocation(cur.getWorld()); - - UtilAction.velocity(cur, UtilAlg.getTrajectory(cur.getLocation(), batLoc), 0.35, false, 0, 0, 10, false); - } - } - } - - @EventHandler - public void PlayerQuit(PlayerQuitEvent event) - { - Clear(event.getPlayer()); - } - - @EventHandler - public void PlayerDeath(PlayerDeathEvent event) - { - Clear(event.getEntity()); - } - - public void Clear(Player player) - { - _active.remove(player); - _direction.remove(player); - _pulling.remove(player); - if (_bats.containsKey(player)) - { - for (Bat bat : _bats.get(player)) - { - if (bat.isValid()) - UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, bat.getLocation(), 0, 0, 0, 0, 3, - ViewDist.LONG, UtilServer.getPlayers()); - - bat.remove(); - } - - - _bats.remove(player); - } - } - - @EventHandler - public void Knockback(CustomDamageEvent event) - { - if (event.GetReason() == null || !event.GetReason().contains(GetName())) - return; - - event.AddKnockback(GetName(), 1.75); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java deleted file mode 100644 index 570498779..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java +++ /dev/null @@ -1,102 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import org.bukkit.Color; -import org.bukkit.FireworkEffect.Type; -import org.bukkit.Sound; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerInteractEvent; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilFirework; -import mineplex.core.common.util.UtilItem; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.particles.effects.LineParticle; -import mineplex.core.recharge.Recharge; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; - -public class PerkBlink extends SmashPerk -{ - - private static final float INCREMENTAITON = 0.2F; - - private String _name; - private double _range; - private long _recharge; - - public PerkBlink(String name, double range, long recharge) - { - super(name, new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + name }); - - _name = name; - _range = range; - _recharge = recharge; - } - - @EventHandler - public void Blink(PlayerInteractEvent event) - { - if (event.isCancelled()) - { - return; - } - - if (!UtilEvent.isAction(event, ActionType.R)) - { - return; - } - - if (UtilBlock.usable(event.getClickedBlock())) - { - return; - } - - Player player = event.getPlayer(); - - if (!UtilItem.isAxe(player.getItemInHand())) - { - return; - } - - if (!hasPerk(player)) - { - return; - } - - if (isSuperActive(player)) - { - return; - } - - if (!Recharge.Instance.use(player, _name, _recharge, true, true)) - { - return; - } - - LineParticle lineParticle = new LineParticle(player.getEyeLocation(), player.getLocation().getDirection(), INCREMENTAITON, _range, null, ParticleType.SMOKE, UtilServer.getPlayers()); - - while (lineParticle.update()) - { - } - - // Firework - UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.BLACK, false, false); - - player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 1f); - player.teleport(lineParticle.getDestination()); - player.setFallDistance(0); - player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 1f); - - // Firework - UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.BLACK, false, false); - - // Inform - UtilPlayer.message(player, F.main("Game", "You used " + F.skill(_name) + ".")); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockToss.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockToss.java deleted file mode 100644 index bc0943f7a..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockToss.java +++ /dev/null @@ -1,269 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.UUID; - -import org.bukkit.Effect; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.entity.FallingBlock; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityChangeBlockEvent; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.player.PlayerInteractEvent; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilItem; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.projectile.IThrown; -import mineplex.core.projectile.ProjectileUser; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; -import nautilus.game.arcade.kit.perks.data.BlockTossData; -import nautilus.game.arcade.kit.perks.event.PerkBlockGrabEvent; -import nautilus.game.arcade.kit.perks.event.PerkBlockThrowEvent; - -public class PerkBlockToss extends SmashPerk implements IThrown -{ - - private static final long COOLDOWN = 2000; - private static final long CHARGE_TIME = 1200; - private static final int DAMAGE = 8; - private static final float KNOCKBACK_MAGNITUDE = 2.5F; - - private Map _hold = new HashMap<>(); - private Map _charge = new HashMap<>(); - private Set _charged = new HashSet<>(); - private Map _falling = new HashMap<>(); - - public PerkBlockToss() - { - super("Block Toss", new String[] { C.cYellow + "Hold Block" + C.cGray + " to " + C.cGreen + "Grab Block", C.cYellow + "Release Block" + C.cGray + " to " + C.cGreen + "Throw Block" }); - } - - @EventHandler - public void Grab(PlayerInteractEvent event) - { - if (event.isCancelled()) - { - return; - } - - if (!UtilEvent.isAction(event, ActionType.R_BLOCK)) - { - return; - } - - if (UtilBlock.usable(event.getClickedBlock())) - { - return; - } - - Player player = event.getPlayer(); - - if (!UtilItem.isSword(player.getItemInHand())) - { - return; - } - - if (!hasPerk(player)) - { - return; - } - - if (isSuperActive(player)) - { - return; - } - - if (_hold.containsKey(player.getUniqueId())) - { - return; - } - - Block grab = event.getClickedBlock(); - - if (!Recharge.Instance.usable(player, GetName())) - { - return; - } - - if (!UtilBlock.airFoliage(grab.getRelative(BlockFace.UP)) || Manager.GetBlockRestore().contains(grab.getRelative(BlockFace.UP))) - { - UtilPlayer.message(player, F.main("Game", "You can only pick up blocks with Air above them.")); - return; - } - - // Event - PerkBlockGrabEvent blockEvent = new PerkBlockGrabEvent(player, grab.getTypeId(), grab.getData()); - UtilServer.getServer().getPluginManager().callEvent(blockEvent); - - // Block to Data - int id = grab.getTypeId(); - byte data = grab.getData(); - - // Remove Block - event.getClickedBlock().getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, event.getClickedBlock().getType()); - - _hold.put(player.getUniqueId(), new BlockTossData(id, data)); - - _charge.put(player.getUniqueId(), System.currentTimeMillis()); - - // Effect - player.getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, id); - } - - @EventHandler - public void Throw(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - Set throwSet = new HashSet(); - - for (UUID key : _hold.keySet()) - { - Player player = UtilPlayer.searchExact(key); - - if (player == null) - { - continue; - } - - // Throw - if (!player.isBlocking()) - { - throwSet.add(player); - } - - // Charged Tick - if (!_charged.contains(player.getUniqueId())) - { - if (System.currentTimeMillis() - _charge.get(player) > 1200) - { - _charged.add(key); - player.getWorld().playEffect(player.getLocation(), Effect.CLICK1, 0); - } - } - } - - for (Player cur : throwSet) - { - UUID key = cur.getUniqueId(); - - Recharge.Instance.recharge(cur, GetName()); - Recharge.Instance.use(cur, GetName(), COOLDOWN, false, true); - - BlockTossData data = _hold.remove(key); - - FallingBlock block = cur.getWorld().spawnFallingBlock(cur.getEyeLocation().add(cur.getLocation().getDirection()), data.Type, data.Data); - - _falling.put(block, key); - - _charged.remove(key); - - long charge = System.currentTimeMillis() - _charge.remove(key); - - // Throw - double mult = 1.4; - if (charge < CHARGE_TIME) - { - mult = mult * (charge / 1200); - } - - // Action - UtilAction.velocity(block, cur.getLocation().getDirection(), mult, false, 0.2, 0, 1, true); - Manager.GetProjectile().AddThrow(block, cur, this, -1, true, true, true, true, null, 0, 0, null, 0, UpdateType.FASTEST, 1f); - - // Event - PerkBlockThrowEvent blockEvent = new PerkBlockThrowEvent(cur); - UtilServer.getServer().getPluginManager().callEvent(blockEvent); - } - } - - @Override - public void Collide(LivingEntity target, Block block, ProjectileUser data) - { - if (target == null) - { - return; - } - - // Damage Event - Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, data.getThrown().getVelocity().length() * DAMAGE, true, true, false, UtilEnt.getName(data - .getThrower()), GetName()); - - // Block to Item - if (data.getThrown() instanceof FallingBlock) - { - FallingBlock thrown = (FallingBlock) data.getThrown(); - - FallingBlock newThrown = data.getThrown().getWorld().spawnFallingBlock(data.getThrown().getLocation(), thrown.getMaterial(), (byte) 0); - - // Remove Old - _falling.remove(thrown); - thrown.remove(); - - // Add New - if (data.getThrower() instanceof Player) - { - _falling.put(newThrown, data.getThrower().getUniqueId()); - } - } - - } - - @Override - public void Idle(ProjectileUser data) - { - } - - @Override - public void Expire(ProjectileUser data) - { - } - - @EventHandler - public void BlockForm(EntityChangeBlockEvent event) - { - if (!(event.getEntity() instanceof FallingBlock)) - { - return; - } - - FallingBlock falling = (FallingBlock) event.getEntity(); - - falling.getWorld().playEffect(event.getBlock().getLocation(), Effect.STEP_SOUND, falling.getBlockId()); - - _falling.remove(falling); - falling.remove(); - - event.setCancelled(true); - } - - @EventHandler - public void Knockback(CustomDamageEvent event) - { - if (event.GetReason() == null || !event.GetReason().contains(GetName())) - { - return; - } - - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneExplosion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneExplosion.java deleted file mode 100644 index 18a3a1fea..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneExplosion.java +++ /dev/null @@ -1,90 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashMap; - -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.player.PlayerInteractEvent; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.recharge.Recharge; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; - -public class PerkBoneExplosion extends SmashPerk -{ - public PerkBoneExplosion() - { - super("Bone Explosion", new String[] - { - C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Bone Explosion" - }); - } - - @EventHandler - public void Skill(PlayerInteractEvent event) - { - if (event.isCancelled()) - return; - - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) - return; - - if (UtilBlock.usable(event.getClickedBlock())) - return; - - if (event.getPlayer().getItemInHand() == null) - return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) - return; - - Player player = event.getPlayer(); - - if (isSuperActive(player)) - return; - - if (!Kit.HasKit(player)) - return; - - if (!Recharge.Instance.use(player, GetName(), 10000, true, true)) - return; - - HashMap nearby = UtilPlayer.getInRadius(player.getLocation(), 7); - for (Player other : nearby.keySet()) - { - if (player.equals(other)) - continue; - - //Inform - UtilPlayer.message(other, F.main("Game", F.elem(Manager.GetColor(player) + player.getName()) + " used " + F.skill(GetName()) + ".")); - - //Damage Event - Manager.GetDamage().NewDamageEvent(other, player, null, - DamageCause.CUSTOM, 6 * nearby.get(other), true, true, false, - player.getName(), GetName()); - } - - //Inform - UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); - - //Effect - Manager.GetBlood().Effects(null, player.getLocation().add(0, 0.5, 0), 48, 0.8, Sound.SKELETON_HURT, 2f, 1.2f, Material.BONE, (byte)0, 40, false); - } - - @EventHandler - public void Knockback(CustomDamageEvent event) - { - if (event.GetReason() == null || !event.GetReason().contains(GetName())) - return; - - event.AddKnockback(GetName(), 2.5); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneRush.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneRush.java deleted file mode 100644 index 934228464..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneRush.java +++ /dev/null @@ -1,198 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.Iterator; -import java.util.WeakHashMap; - -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.block.Action; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.util.Vector; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.projectile.IThrown; -import mineplex.core.projectile.ProjectileUser; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.TeamSuperSmash; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; - -public class PerkBoneRush extends SmashPerk implements IThrown -{ - private WeakHashMap _active = new WeakHashMap(); - - private double yLimit = 0.25; - - public PerkBoneRush() - { - super("Bone Rush", new String[] - { - C.cYellow + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + "Bone Rush", - C.cGray + "Crouch to avoid movement with " + C.cGreen + "Bone Rush" - }); - } - - @EventHandler - public void Skill(PlayerInteractEvent event) - { - if (event.isCancelled()) - return; - - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) - return; - - if (UtilBlock.usable(event.getClickedBlock())) - return; - - if (event.getPlayer().getItemInHand() == null) - return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_SPADE")) - return; - - Player player = event.getPlayer(); - - if (isSuperActive(player)) - return; - - if (!Kit.HasKit(player)) - return; - - if (!Recharge.Instance.use(player, GetName(), 10000, true, true)) - return; - - _active.put(player, System.currentTimeMillis()); - - UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); - } - - @Override - public void addSuperCustom(Player player) - { - _active.put(player, System.currentTimeMillis()); - } - - @EventHandler - public void Update(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - Iterator playerIterator = _active.keySet().iterator(); - - while (playerIterator.hasNext()) - { - Player player = playerIterator.next(); - - if (!player.isValid() || (UtilTime.elapsed(_active.get(player), 1500) && !isSuperActive(player))) - { - playerIterator.remove(); - continue; - } - - //Sound - player.getWorld().playSound(player.getLocation(), Sound.SKELETON_HURT, 0.4f, (float)(Math.random() + 1)); - - //Velocity - Vector dir = player.getLocation().getDirection(); - double limit = isSuperActive(player) ? yLimit + 0.1 : yLimit; - if (dir.getY() > limit) - dir.setY(limit); - - //Player - if (!player.isSneaking()) - UtilAction.velocity(player, dir, 0.6, false, 0, 0.1, 0.3, false); - - //Bones - for (int i=0 ; i<6 ; i++) - { - Item bone = player.getWorld().dropItem(player.getLocation().add(Math.random()*5 - 2.5, Math.random()*3, Math.random()*5 - 2.5), new ItemStack(Material.BONE)); - UtilAction.velocity(bone, dir, 0.6 + 0.3 * Math.random(), false, 0, 0.1 + Math.random() * 0.05, 0.3, false); - Manager.GetProjectile().AddThrow(bone, player, this, 2000, true, true, true, true, 0.5f); - } - } - } - - @EventHandler - public void Knockback(CustomDamageEvent event) - { - if (event.GetReason() != null && event.GetReason().contains(GetName())) - event.AddKnockback(GetName(), 10); - - if (event.GetReason() != null && event.GetReason().contains("Bone Storm")) - event.AddKnockback(GetName(), 6); - } - - @Override - public void Collide(LivingEntity target, Block block, ProjectileUser data) - { - data.getThrown().remove(); - - if (target == null) - return; - - Player damager = (Player)data.getThrower(); - - double damage = 0.7; - String reason = GetName(); - - if (Manager.GetGame() instanceof TeamSuperSmash && target instanceof Player && data.getThrower() instanceof Player) - { - TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); - Player targetPlayer = (Player) target; - Player throwerPlayer = (Player) data.getThrower(); - - if(smash.GetTeam(targetPlayer).equals(smash.GetTeam(throwerPlayer))) - { - return; - } - } - - if (isSuperActive(damager)) - { - damage = 3; - reason = "Bone Storm"; - } - - //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, - DamageCause.CUSTOM, damage, false, true, false, - UtilEnt.getName(data.getThrower()), reason); - - UtilAction.velocity(target, data.getThrown().getVelocity()); - } - - @Override - public void Idle(ProjectileUser data) - { - data.getThrown().remove(); - } - - @Override - public void Expire(ProjectileUser data) - { - data.getThrown().remove(); - } - - @EventHandler - public void Clean(PlayerDeathEvent event) - { - _active.remove(event.getEntity()); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChickenRocket.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChickenRocket.java deleted file mode 100644 index 39314b2ce..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChickenRocket.java +++ /dev/null @@ -1,201 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashSet; -import java.util.Iterator; - -import org.bukkit.Color; -import org.bukkit.FireworkEffect.Type; -import org.bukkit.Sound; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.Chicken; -import org.bukkit.entity.Entity; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.player.PlayerInteractEvent; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilFirework; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; -import nautilus.game.arcade.kit.perks.data.ChickenMissileData; - -public class PerkChickenRocket extends SmashPerk -{ - private HashSet _data = new HashSet(); - - public PerkChickenRocket() - { - super("Chicken Missile", new String[] - { - C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Chicken Missile", - C.cGreen + "Chicken Missile" + C.cGray + " instantly recharges if you hit a player." - }); - } - - @EventHandler - public void Missile(PlayerInteractEvent event) - { - if (event.isCancelled()) - return; - - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) - return; - - if (UtilBlock.usable(event.getClickedBlock())) - return; - - if (event.getPlayer().getItemInHand() == null) - return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) - return; - - Player player = event.getPlayer(); - - if (isSuperActive(player)) - return; - - if (!Kit.HasKit(player)) - return; - - if (!Recharge.Instance.use(player, GetName(), 7000, true, true)) - return; - - Manager.GetGame().CreatureAllowOverride = true; - Chicken ent = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Chicken.class); - ent.getLocation().setPitch(0); - ent.getLocation().setYaw(player.getLocation().getYaw()); - ent.setBaby(); - ent.setAgeLock(true); - UtilEnt.Vegetate(ent); - Manager.GetGame().CreatureAllowOverride = false; - - _data.add(new ChickenMissileData(player, ent)); - - //Inform - UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); - } - - @EventHandler - public void Update(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - Iterator dataIterator = _data.iterator(); - - while (dataIterator.hasNext()) - { - ChickenMissileData data = dataIterator.next(); - - data.Chicken.setVelocity(data.Direction); - data.Chicken.getWorld().playSound(data.Chicken.getLocation(), Sound.CHICKEN_HURT, 0.3f, 1.5f); - - if (!UtilTime.elapsed(data.Time, 200)) - { - continue; - } - - boolean detonate = false; - - if (UtilTime.elapsed(data.Time, 4000)) - { - detonate = true; - } - else - { - //Hit Entity - for (Entity ent : data.Player.getWorld().getEntities()) - { - if (ent instanceof Arrow) - if (((Arrow)ent).isOnGround()) - continue; - - if (ent.equals(data.Player)) - continue; - - if (ent.equals(data.Chicken)) - continue; - - if (UtilMath.offset(data.Chicken.getLocation(), ent.getLocation().add(0, 0.5, 0)) > 2) - continue; - - if (ent instanceof Player) - if (!Manager.GetGame().IsAlive((Player)ent)) - continue; - - //Recharge - Recharge.Instance.useForce(data.Player, GetName(), -1); - - detonate = true; - break; - } - - //Hit Block - if (!detonate && data.HasHitBlock()) - { - detonate = true; - } - } - - if (detonate) - { - //Damage - for (Entity ent : data.Player.getWorld().getEntities()) - { - if (!(ent instanceof LivingEntity)) - continue; - - if (ent.equals(data.Player)) - continue; - - if (UtilMath.offset(data.Chicken.getLocation(), ent.getLocation().add(0, 0.5, 0)) > 3) - continue; - - if (ent instanceof Player) - if (!Manager.GetGame().IsAlive((Player)ent)) - continue; - - LivingEntity livingEnt = (LivingEntity)ent; - - //Damage Event - Manager.GetDamage().NewDamageEvent(livingEnt, data.Player, null, - DamageCause.PROJECTILE, 8, false, true, false, - data.Player.getName(), GetName()); - - UtilAction.velocity(livingEnt, UtilAlg.getTrajectory2d(data.Chicken, livingEnt), 1.6, true, 0.8, 0, 10, true); - } - - //Effect - UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, data.Chicken.getLocation(), 0, 0, 0, 0, 1, - ViewDist.MAX, UtilServer.getPlayers()); - data.Chicken.getWorld().playSound(data.Chicken.getLocation(), Sound.EXPLODE, 2f, 1.2f); - - //Firework - UtilFirework.playFirework(data.Chicken.getLocation().add(0, 0.6, 0), Type.BALL, Color.WHITE, false, false); - - - data.Chicken.remove(); - dataIterator.remove(); - continue; - } - } - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperElectricity.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperElectricity.java deleted file mode 100644 index c47ec7d60..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperElectricity.java +++ /dev/null @@ -1,204 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.UUID; - -import org.bukkit.Sound; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.disguise.disguises.DisguiseBase; -import mineplex.core.disguise.disguises.DisguiseCreeper; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.Perk; - -public class PerkCreeperElectricity extends Perk -{ - - private static final long DURATION = 2000; - private static final int SHOCK = 1; - private static final int DAMAGE = 4; - private static final float KNOCKBACK_MAGNITUDE = 2.5F; - - private Map _active = new HashMap<>(); - - public PerkCreeperElectricity() - { - super("Lightning Shield", new String[] { "When hit by a non-melee attack, you gain " + C.cGreen + "Lightning Shield" }); - } - - @EventHandler - public void Shield(CustomDamageEvent event) - { - if (event.IsCancelled()) - { - return; - } - - if (event.GetCause() == DamageCause.ENTITY_ATTACK || event.GetCause() == DamageCause.FIRE_TICK || event.GetCause() == DamageCause.STARVATION) - { - return; - } - - Player damagee = event.GetDamageePlayer(); - - if (damagee == null) - { - return; - } - - if (!hasPerk(damagee)) - { - return; - } - - _active.put(damagee.getUniqueId(), System.currentTimeMillis()); - - SetPowered(damagee, true); - - Manager.GetCondition().Factory().Speed(GetName(), damagee, damagee, 4, 1, false, false, false); - - // Sound - damagee.getWorld().playSound(damagee.getLocation(), Sound.CREEPER_HISS, 3f, 1.25f); - - // Inform - UtilPlayer.message(damagee, F.main("Skill", "You gained " + F.skill(GetName()) + ".")); - } - - @EventHandler - public void Update(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - { - return; - } - - Iterator shieldIterator = _active.keySet().iterator(); - - while (shieldIterator.hasNext()) - { - Player player = UtilPlayer.searchExact(shieldIterator.next()); - - if (player == null) - { - shieldIterator.remove(); - } - - if (!IsPowered(player)) - { - shieldIterator.remove(); - SetPowered(player, false); - continue; - } - - if (UtilTime.elapsed(_active.get(player), DURATION)) - { - shieldIterator.remove(); - - SetPowered(player, false); - - // Sound - player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, 3f, 0.75f); - } - } - } - - @EventHandler - public void Damage(CustomDamageEvent event) - { - if (event.IsCancelled()) - return; - - if (event.GetCause() != DamageCause.ENTITY_ATTACK) - return; - - Player damagee = event.GetDamageePlayer(); - if (damagee == null) - return; - - if (!hasPerk(damagee)) - { - return; - } - - if (!IsPowered(damagee)) - { - return; - } - - event.SetCancelled("Lightning Shield"); - - // Inform - UtilPlayer.message(damagee, F.main("Skill", "You hit " + F.elem(UtilEnt.getName(event.GetDamagerPlayer(false))) + " with " + F.skill(GetName()) + ".")); - - // Elec - damagee.getWorld().strikeLightningEffect(damagee.getLocation()); - Manager.GetCondition().Factory().Shock(GetName(), event.GetDamagerEntity(false), event.GetDamageeEntity(), SHOCK, false, false); - - SetPowered(damagee, false); - - // Damage Event - Manager.GetDamage().NewDamageEvent(event.GetDamagerEntity(false), damagee, null, DamageCause.LIGHTNING, DAMAGE, true, true, false, damagee.getName(), GetName()); - } - - public DisguiseCreeper GetDisguise(Player player) - { - DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); - - if (disguise == null) - { - return null; - } - - if (!(disguise instanceof DisguiseCreeper)) - { - return null; - } - - return (DisguiseCreeper) disguise; - } - - public void SetPowered(Player player, boolean powered) - { - DisguiseCreeper creeper = GetDisguise(player); - if (creeper == null) - return; - - creeper.SetPowered(powered); - - Manager.GetDisguise().updateDisguise(creeper); - } - - public boolean IsPowered(Player player) - { - DisguiseCreeper creeper = GetDisguise(player); - - if (creeper == null) - { - return false; - } - - return creeper.IsPowered(); - } - - @EventHandler - public void Knockback(CustomDamageEvent event) - { - if (event.GetReason() == null || !event.GetReason().contains(GetName())) - { - return; - } - - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperExplode.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperExplode.java deleted file mode 100644 index 500c9aee3..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperExplode.java +++ /dev/null @@ -1,321 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilItem; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.disguise.disguises.DisguiseBase; -import mineplex.core.disguise.disguises.DisguiseCreeper; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.GameTeam; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.block.Block; -import org.bukkit.entity.Entity; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.util.Vector; - -public class PerkCreeperExplode extends SmashPerk -{ - - private static final long COOLDOWN = 8000; - private static final int RADIUS_NORMAL = 8; - private static final int RADIUS_SMASH = 24; - private static final int DAMAGE_NORMAL = 20; - private static final int DAMAGE_SMASH = 30; - - private HashMap _active = new HashMap(); - private HashSet _super = new HashSet(); - - public PerkCreeperExplode() - { - super("Explode", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Shovel use " + C.cGreen + "Explosive Leap" }); - } - - @EventHandler - public void Activate(PlayerInteractEvent event) - { - if (event.isCancelled()) - { - return; - } - - if (!UtilEvent.isAction(event, ActionType.R)) - { - return; - } - - if (UtilBlock.usable(event.getClickedBlock())) - { - return; - } - - Player player = event.getPlayer(); - - if (!UtilItem.isSpade(player.getItemInHand())) - { - return; - } - - if (!hasPerk(player)) - { - return; - } - - if (isSuperActive(player)) - { - return; - } - - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) - { - return; - } - - _active.put(player, System.currentTimeMillis()); - - IncreaseSize(player); - - UtilPlayer.message(player, F.main("Skill", "You are charging " + F.skill(GetName()) + ".")); - } - - @Override - public void addSuperCustom(Player player) - { - _active.put(player, System.currentTimeMillis()); - _super.add(player); - - IncreaseSize(player); - } - - @EventHandler - public void Update(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - { - return; - } - - Iterator chargeIterator = _active.keySet().iterator(); - - while (chargeIterator.hasNext()) - { - Player player = chargeIterator.next(); - - double elapsed = (System.currentTimeMillis() - _active.get(player)) / 1000d; - - // Idle in Air - UtilAction.zeroVelocity(player); - - // Sound - player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, (float) (0.5 + elapsed), (float) (0.5 + elapsed)); - - IncreaseSize(player); - - player.setExp(Math.min(0.99f, (float) (elapsed / 1.5))); - - // Not Detonated - if (elapsed < 1.5) - { - continue; - } - - chargeIterator.remove(); - - // Unpower - DecreaseSize(player); - - boolean isSuper = _super.remove(player); - - // Explode - if (!isSuper) - { - // Effect - UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, player.getLocation(), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); - player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 2f, 1f); - } - else - { - // Particles - UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, player.getLocation(), 5f, 5f, 5f, 0, 20, ViewDist.MAX, UtilServer.getPlayers()); - - // Sound - for (int i = 0; i < 4; i++) - player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, (float) (2 + Math.random() * 4), (float) (Math.random() + 0.2)); - - // Blocks - Collection blocks = UtilBlock.getInRadius(player.getLocation(), 12).keySet(); - Iterator iter = blocks.iterator(); - - while (iter.hasNext()) - { - Block b = iter.next(); - - if (b.getType() == Material.STATIONARY_LAVA || b.getType() == Material.LAVA || b.getType() == Material.BEDROCK) - iter.remove(); - } - Manager.GetExplosion().BlockExplosion(blocks, player.getLocation(), false); - - // Remove Spawns - Iterator spawnIterator = Manager.GetGame().GetTeam(player).GetSpawns().iterator(); - while (spawnIterator.hasNext()) - { - Location spawn = spawnIterator.next(); - - if (UtilMath.offset(player.getLocation(), spawn) < 14) - spawnIterator.remove(); - } - - // If all spawns have been destroyed revert to using the - // spectator spawn - for (GameTeam team : Manager.GetGame().GetTeamList()) - { - if (team.GetSpawns().isEmpty()) - { - team.GetSpawns().add(Manager.GetGame().GetSpectatorLocation()); - } - } - } - - double maxRange = isSuper ? RADIUS_SMASH : RADIUS_NORMAL; - double damage = isSuper ? DAMAGE_SMASH : DAMAGE_NORMAL; - - // Damage - for (LivingEntity ent : UtilEnt.getInRadius(player.getLocation(), maxRange).keySet()) - { - - if (ent.equals(player)) - { - continue; - } - - double dist = UtilMath.offset(player.getLocation(), ent.getLocation()); - - if (UtilPlayer.isSpectator(player)) - { - continue; - } - - LivingEntity livingEnt = (LivingEntity) ent; - - double scale = 0.1 + 0.9 * ((maxRange - dist) / maxRange); - - // Damage Event - Manager.GetDamage().NewDamageEvent(livingEnt, player, null, DamageCause.CUSTOM, damage * scale, true, true, false, player.getName(), isSuper ? "Atomic Blast" : GetName()); - } - - // Velocity - UtilAction.velocity(player, 1.8, 0.2, 1.4, true); - - // Inform - if (!isSuper) - UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); - } - } - - public DisguiseCreeper GetDisguise(Player player) - { - DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); - - if (disguise == null) - { - return null; - } - - if (!(disguise instanceof DisguiseCreeper)) - { - return null; - } - - return (DisguiseCreeper) disguise; - } - - public int GetSize(Player player) - { - DisguiseCreeper creeper = GetDisguise(player); - - if (creeper == null) - { - return 0; - } - - return creeper.bV(); - } - - public void DecreaseSize(Player player) - { - DisguiseCreeper creeper = GetDisguise(player); - - if (creeper == null) - { - return; - } - - creeper.a(-1); - - Manager.GetDisguise().updateDisguise(creeper); - } - - public void IncreaseSize(Player player) - { - DisguiseCreeper creeper = GetDisguise(player); - - if (creeper == null) - { - return; - } - - creeper.a(1); - - Manager.GetDisguise().updateDisguise(creeper); - } - - @EventHandler - public void Knockback(CustomDamageEvent event) - { - if (event.GetReason() == null || !event.GetReason().contains(GetName())) - return; - - event.AddKnockback(GetName(), 2.5); - } - - @EventHandler - public void Death(PlayerDeathEvent event) - { - if (!Kit.HasKit(event.getEntity())) - return; - - _active.remove(event.getEntity()); - _super.remove(event.getEntity()); - - DecreaseSize(event.getEntity()); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperSulphurBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperSulphurBomb.java deleted file mode 100644 index cf5f53cd5..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperSulphurBomb.java +++ /dev/null @@ -1,146 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.block.Block; -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 mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilItem; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.projectile.IThrown; -import mineplex.core.projectile.ProjectileUser; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; - -public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown -{ - - private static final long COOLDOWN = 3000; - private static final float DAMAGE = 6.5F; - private static final float KNOCKBACK_MAGNITUDE = 2.5F; - - public PerkCreeperSulphurBomb() - { - super("Sulphur Bomb", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Sulphur Bomb" }); - } - - @EventHandler - public void ShootWeb(PlayerInteractEvent event) - { - if (event.isCancelled()) - { - return; - } - - if (!UtilEvent.isAction(event, ActionType.R)) - { - return; - } - - if (UtilBlock.usable(event.getClickedBlock())) - { - return; - } - - Player player = event.getPlayer(); - - if (!UtilItem.isSword(player.getItemInHand())) - { - return; - } - - if (!hasPerk(player)) - { - return; - } - - if (isSuperActive(player)) - { - return; - } - - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) - { - return; - } - - event.setCancelled(true); - - UtilInv.Update(player); - - org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.COAL, (byte) 0)); - - UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false); - - Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true, null, 1f, 1f, null, 1, UpdateType.SLOW, 0.6f); - - // Inform - UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); - - // Effect - player.getWorld().playSound(player.getLocation(), Sound.CREEPER_DEATH, 2f, 1.5f); - } - - @Override - public void Collide(LivingEntity target, Block block, ProjectileUser data) - { - Explode(data); - - if (target == null) - { - return; - } - - // Damage Event - Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, DAMAGE, true, true, false, UtilEnt.getName(data.getThrower()), GetName()); - } - - @Override - public void Idle(ProjectileUser data) - { - Explode(data); - } - - @Override - public void Expire(ProjectileUser data) - { - Explode(data); - } - - public void Explode(ProjectileUser data) - { - UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.getThrown().getLocation(), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); - data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.EXPLODE, 1f, 1.5f); - data.getThrown().remove(); - } - - @EventHandler - public void Knockback(CustomDamageEvent event) - { - if (event.GetReason() == null || !event.GetReason().contains(GetName())) - { - return; - } - - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeadlyBones.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeadlyBones.java deleted file mode 100644 index eab8530ec..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeadlyBones.java +++ /dev/null @@ -1,110 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import org.bukkit.Material; -import org.bukkit.Sound; -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 mineplex.core.common.util.C; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilServer; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; - -public class PerkDeadlyBones extends SmashPerk -{ - private HashMap _active = new HashMap(); - - public PerkDeadlyBones() - { - super("Deadly Bones", new String[] - { - C.cGray + "Drop explosive bones when you take damage." - }); - } - - @EventHandler - public void damageActivate(CustomDamageEvent event) - { - if (event.IsCancelled()) - return; - - Player player = event.GetDamageePlayer(); - if (player == null) - return; - - if (!Kit.HasKit(player)) - return; - - if (!Recharge.Instance.use(player, GetName(), 400, false, false)) - return; - - _active.put(player.getWorld().dropItemNaturally(player.getLocation().add(0, 0.5, 0), - ItemStackFactory.Instance.CreateStack(Material.BONE, (byte)0, 1, "Explosive Bone " + System.currentTimeMillis())), player); - } - - @EventHandler - public void update(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - -// Using copy to prevent concurrency issues for when an explosion damages -// another player with this perk active adding a new item to the list while -// we are still in the loop - List itemListCopy = new ArrayList<>(_active.keySet()); - - for(Item item : itemListCopy) - { - //Not Ready - if (item.isValid() && item.getTicksLived() < 50) - continue; - - //Effect - UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, item.getLocation(), 0, 0, 0, 0, 1, - ViewDist.MAX, UtilServer.getPlayers()); - item.getWorld().playSound(item.getLocation(), Sound.EXPLODE, 0.8f, 1.4f); - - Player player = _active.get(item); - - //Damage - HashMap targets = UtilEnt.getInRadius(item.getLocation(), 4); - for (LivingEntity cur : targets.keySet()) - { - if (cur.equals(player)) - continue; - - Manager.GetDamage().NewDamageEvent(cur, player, null, - DamageCause.CUSTOM, 4 * targets.get(cur) + 1, true, true, false, - player.getName(), GetName()); - } - - //Remove - item.remove(); - _active.remove(item); - } - } - - @EventHandler - public void knockback(CustomDamageEvent event) - { - if (event.GetReason() == null || !event.GetReason().contains(GetName())) - return; - - event.AddKnockback(GetName(), 2.5); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEarthquake.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEarthquake.java deleted file mode 100644 index 9041a63ed..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEarthquake.java +++ /dev/null @@ -1,107 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; - -import org.bukkit.Effect; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.entity.Player; -import org.bukkit.entity.Zombie; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityTargetEvent; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.util.Vector; - -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilTime; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; -import nautilus.game.arcade.kit.perks.data.EarthquakeData; -import nautilus.game.arcade.kit.perks.data.NightLivingDeadData; - -public class PerkEarthquake extends SmashPerk -{ - private ArrayList _night = new ArrayList(); - - public PerkEarthquake() - { - super("Earthquake", new String[] - { - }, false); - } - - @Override - public void addSuperCustom(Player player) - { - _night.add(new EarthquakeData(player)); - } - - @EventHandler - public void update(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - Iterator quakeIter = _night.iterator(); - - while (quakeIter.hasNext()) - { - EarthquakeData data = quakeIter.next(); - - //Expire - if (UtilTime.elapsed(data.Time, 16000)) - { - quakeIter.remove(); - continue; - } - - for (Player player : Manager.GetGame().GetPlayers(true)) - { - player.playSound(player.getLocation(), Sound.MINECART_BASE, 0.2f, 0.2f); - - if (player.equals(data.Player)) - continue; - - if (UtilEnt.isGrounded(player)) - { - //Damage Event - Manager.GetDamage().NewDamageEvent(player, data.Player, null, - DamageCause.CUSTOM, 1 + 2 * Math.random(), false, false, false, - player.getName(), GetName()); - - //Velocity - if (Recharge.Instance.use(player, GetName() + " Hit", 400, false, false)) - UtilAction.velocity(player, new Vector(Math.random() - 0.5, Math.random() * 0.2, Math.random() - 0.5), - Math.random() * 1 + 1, false, 0, 0.1 + Math.random() * 0.2, 2, true); - } - - //Effect - for (Block block : UtilBlock.getInRadius(player.getLocation(), 5).keySet()) - { - if (Math.random() < 0.98) - continue; - - if (!UtilBlock.solid(block)) - continue; - - if (!UtilBlock.airFoliage(block.getRelative(BlockFace.UP))) - continue; - - player.playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType()); - } - } - } - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEggGun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEggGun.java deleted file mode 100644 index 110e4c671..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEggGun.java +++ /dev/null @@ -1,136 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashMap; - -import org.bukkit.Sound; -import org.bukkit.entity.Egg; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.util.Vector; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; -import nautilus.game.arcade.kit.Perk; - -public class PerkEggGun extends SmashPerk -{ - private HashMap _active = new HashMap(); - - public PerkEggGun() - { - super("Egg Blaster", new String[] - { - C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Egg Blaster" - }); - } - - - @EventHandler - public void Activate(PlayerInteractEvent event) - { - if (event.isCancelled()) - return; - - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) - return; - - if (UtilBlock.usable(event.getClickedBlock())) - return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_SWORD")) - return; - - Player player = event.getPlayer(); - - if (isSuperActive(event.getPlayer())) - return; - - if (!Kit.HasKit(player)) - return; - - if (!Recharge.Instance.use(player, GetName(), 2500, true, true)) - return; - - _active.put(player, System.currentTimeMillis()); - - UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); - } - - @EventHandler - public void Update(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - for (Player cur : UtilServer.getPlayers()) - { - if (!isSuperActive(cur)) - { - if (!_active.containsKey(cur)) - continue; - - if (!cur.isBlocking()) - { - _active.remove(cur); - continue; - } - - if (UtilTime.elapsed(_active.get(cur), 750)) - { - _active.remove(cur); - continue; - } - } - - Vector offset = cur.getLocation().getDirection(); - if (offset.getY() < 0) - offset.setY(0); - - Egg egg = cur.getWorld().spawn(cur.getLocation().add(0, 0.5, 0).add(offset), Egg.class); - egg.setVelocity(cur.getLocation().getDirection().add(new Vector(0,0.2,0))); - egg.setShooter(cur); - - //Effect - cur.getWorld().playSound(cur.getLocation(), Sound.CHICKEN_EGG_POP, 0.5f, 1f); - } - } - - @EventHandler - public void EggHit(CustomDamageEvent event) - { - if (event.GetProjectile() == null) - return; - - if (!(event.GetProjectile() instanceof Egg)) - return; - - if (event.GetDamage() >= 1) - return; - - event.SetCancelled("Egg Blaster"); - - Egg egg = (Egg)event.GetProjectile(); - - //Damage Event - Manager.GetDamage().NewDamageEvent(event.GetDamageeEntity(), (LivingEntity)egg.getShooter(), egg, - DamageCause.PROJECTILE, 1, true, true, false, - UtilEnt.getName((LivingEntity)egg.getShooter()), GetName()); - - UtilAction.zeroVelocity(event.GetDamageeEntity()); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEndermanDragon.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEndermanDragon.java deleted file mode 100644 index 1db72be55..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEndermanDragon.java +++ /dev/null @@ -1,184 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashMap; - -import org.bukkit.Color; -import org.bukkit.Location; -import org.bukkit.FireworkEffect.Type; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEnderDragon; -import org.bukkit.entity.EnderDragon; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.EntityExplodeEvent; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilFirework; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; - -public class PerkEndermanDragon extends SmashPerk -{ - private HashMap _dragons = new HashMap(); - - public PerkEndermanDragon() - { - super("Ender Dragon", new String[] - { - }, false); - } - - @Override - public void addSuperCustom(Player player) - { - Manager.GetGame().CreatureAllowOverride = true; - EnderDragon dragon = player.getWorld().spawn(player.getLocation().add(0, 5, 0), EnderDragon.class); - UtilEnt.Vegetate(dragon); - Manager.GetGame().CreatureAllowOverride = false; - - dragon.setCustomName(C.cYellow + player.getName() + "'s Dragon"); - - UtilFirework.playFirework(dragon.getLocation(), Type.BALL_LARGE, Color.BLACK, true, true); - - _dragons.put(player, dragon); - } - - @Override - public void removeSuperCustom(Player player) - { - EnderDragon dragon = _dragons.remove(player); - if (dragon == null) - return; - - player.leaveVehicle(); - dragon.remove(); - } - - @EventHandler - public void update(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - for (Player player : _dragons.keySet()) - { - EnderDragon dragon = _dragons.get(player); - - //Mount - if (dragon.getPassenger() == null || !dragon.getPassenger().equals(player)) - { - player.leaveVehicle(); - dragon.setPassenger(player); - } - - //Move - Location target = player.getLocation().add(player.getLocation().getDirection().multiply(40)); - ((CraftEnderDragon)dragon).getHandle().setTargetBlock(target.getBlockX(), target.getBlockY(), target.getBlockZ()); - } - } - - @EventHandler(priority = EventPriority.LOWEST) - public void explosionBlocks(EntityExplodeEvent event) - { - event.blockList().clear(); - } - - @EventHandler(priority = EventPriority.LOW) - public void suffocationCancel(CustomDamageEvent event) - { - if (event.GetCause() != DamageCause.SUFFOCATION) - return; - - if (event.GetDamageePlayer() == null) - return; - - if (isSuperActive(event.GetDamageePlayer())) - event.SetCancelled("Enderman Dragon Suffocate"); - } - - @EventHandler(priority = EventPriority.LOW) - public void dragonDamageeCancel(CustomDamageEvent event) - { - if (event.GetDamagerEntity(false) == null) - return; - - if (_dragons.values().contains(event.GetDamagerEntity(false))) - event.SetCancelled("Enderman Dragon Damagee"); - } - - @EventHandler(priority = EventPriority.LOW) - public void dragonDamagerCancel(CustomDamageEvent event) - { - if (event.GetDamagerEntity(false) == null) - return; - - if (!_dragons.values().contains(event.GetDamagerEntity(false))) - return; - - event.SetCancelled("Dragon Damage Cancel"); - } - - @EventHandler - public void updateDamageAoe(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - for (Player player : _dragons.keySet()) - { - EnderDragon dragon = _dragons.get(player); - - UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, dragon.getLocation(), 0, 0, 0, 0, 1, - ViewDist.LONGER, UtilServer.getPlayers()); - - for (Player other : Manager.GetGame().GetPlayers(true)) - { - if (other.equals(player)) - continue; - - if (UtilMath.offset(dragon.getLocation().add(0, 4, 0), other.getLocation()) < 6 && Recharge.Instance.use(other, "Hit By Dragon", 1000, false, false)) - { - //Damage Event - Manager.GetDamage().NewDamageEvent(other, player, null, - DamageCause.CUSTOM, 20, true, true, false, - player.getName(), GetName()); - } - } - } - } - - @EventHandler - public void knockback(CustomDamageEvent event) - { - if (event.GetReason() == null || !event.GetReason().contains(GetName())) - return; - - event.AddKnockback(GetName(), 4); - } - - @EventHandler(priority = EventPriority.LOW) - public void voidCancel(CustomDamageEvent event) - { - if (event.GetCause() != DamageCause.VOID) - return; - - Player player = event.GetDamageePlayer(); - if (player == null) - return; - - if (!isSuperActive(player)) - return; - - event.SetCancelled("Dragon Void Immunity"); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java deleted file mode 100644 index 3803730cd..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java +++ /dev/null @@ -1,230 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -import org.bukkit.EntityEffect; -import org.bukkit.Sound; -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.util.Vector; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilItem; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; -import nautilus.game.arcade.kit.perks.data.FireflyData; - -public class PerkFirefly extends SmashPerk -{ - private Set _data = new HashSet(); - private int _tick = 0; - - public PerkFirefly() - { - super("Firefly", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Firefly" }); - } - - @EventHandler - public void Skill(PlayerInteractEvent event) - { - if (event.isCancelled()) - { - return; - } - - if (!UtilEvent.isAction(event, ActionType.R)) - { - return; - } - - if (UtilBlock.usable(event.getClickedBlock())) - { - return; - } - - Player player = event.getPlayer(); - - if (!UtilItem.isAxe(player.getItemInHand().getType())) - { - return; - } - - if (!hasPerk(player)) - { - return; - } - - if (isSuperActive(player)) - { - return; - } - - if (!Recharge.Instance.use(player, GetName(), 12000, true, true)) - { - return; - } - - activate(player); - } - - /* - * It is split like this so Blaze's Smash can be called without the need to - * copy code. - */ - public void activate(Player player) - { - _data.add(new FireflyData(player)); - - UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); - } - - @EventHandler - public void Update(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - { - return; - } - - _tick++; - - Iterator dataIterator = _data.iterator(); - - while (dataIterator.hasNext()) - { - FireflyData data = dataIterator.next(); - - Player player = data.Player; - boolean superActive = isSuperActive(data.Player); - - // Teleport - if (!UtilTime.elapsed(data.Time, 1500) && !superActive) - { - UtilAction.zeroVelocity(player); - player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 0.2f, 0.6f); - data.Location = player.getLocation(); - - // Sound and Effect - UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, player.getLocation().add(0, 1, 0), 0.6f, 0.6f, 0.6f, 0, 10, ViewDist.LONG, UtilServer.getPlayers()); - - float progress = (float) (System.currentTimeMillis() - data.Time) / 1500f; - - player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 0.5f, 1f + progress); - } - // Velocity - else if (!UtilTime.elapsed(data.Time, 2750) || superActive) - { - UtilAction.velocity(player, player.getLocation().getDirection().multiply(superActive ? 0.9 : 0.7).add(new Vector(0, 0.15, 0))); - player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 0.6f, 1.2f); - - // Sound and Effect - if (!isSuperActive(player)) - { - UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation().add(0, 1, 0), 0.6f, 0.6f, 0.6f, 0, 40, ViewDist.LONG, UtilServer.getPlayers()); - - player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 0.5f, 1.25f); - } - else - { - UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 60, ViewDist.LONG, UtilServer.getPlayers()); - UtilParticle.PlayParticle(ParticleType.LAVA, player.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 40, ViewDist.LONG, UtilServer.getPlayers()); - - player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 0.75f, 0.75f); - } - - for (Player other : UtilPlayer.getNearby(player.getLocation(), superActive ? 7 : 4)) - { - if (other.equals(player)) - { - continue; - } - - if (!Manager.GetGame().IsAlive(other)) - { - continue; - } - - other.playEffect(EntityEffect.HURT); - - if (_tick % 12 == 0) - { - if (Recharge.Instance.use(other, GetName() + " hit by " + player.getName(), 2000, false, false)) - { - // Damage Event - Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, 7, true, true, false, player.getName(), isSuperActive(player) ? "Phoenix" : GetName()); - - UtilPlayer.message(other, F.main("Game", F.elem(Manager.GetColor(player) + player.getName()) + " hit you with " + F.elem(GetName()) + ".")); - } - } - } - } - else - { - dataIterator.remove(); - } - } - } - - @EventHandler - public void FireflyDamage(CustomDamageEvent event) - { - if (event.GetDamage() <= 4) - return; - - if (!(event.GetDamagerEntity(true) instanceof Player)) - { - return; - } - - Iterator dataIterator = _data.iterator(); - - while (dataIterator.hasNext()) - { - FireflyData data = dataIterator.next(); - - if (!data.Player.equals(event.GetDamageeEntity())) - continue; - - if (!UtilTime.elapsed(data.Time, 1250) && !isSuperActive(data.Player)) - { - if (isTeamDamage(data.Player, event.GetDamagerPlayer(true))) - { - continue; - } - - dataIterator.remove(); - } - else - { - event.SetCancelled("Firefly Immunity"); - } - } - } - - @EventHandler - public void Knockback(CustomDamageEvent event) - { - if (event.GetReason() == null || !event.GetReason().contains(GetName())) - return; - - event.AddKnockback(GetName(), 2); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlap.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlap.java deleted file mode 100644 index f5faa41b1..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlap.java +++ /dev/null @@ -1,105 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import org.bukkit.GameMode; -import org.bukkit.Sound; -import org.bukkit.block.BlockFace; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerToggleFlightEvent; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilServer; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; -import nautilus.game.arcade.kit.Perk; - -public class PerkFlap extends SmashPerk -{ - private double _power; - private boolean _control; - - public PerkFlap(double power, double heightLimit, boolean control) - { - super("Flap", new String[] - { - C.cYellow + "Tap Jump Twice" + C.cGray + " to " + C.cGreen + "Flap" - }); - - _power = power; - _control = control; - } - - @EventHandler - public void FlightHop(PlayerToggleFlightEvent event) - { - Player player = event.getPlayer(); - - if (Manager.isSpectator(player)) - return; - - if (!Kit.HasKit(player)) - return; - - if (player.getGameMode() == GameMode.CREATIVE) - return; - - event.setCancelled(true); - player.setFlying(false); - - //Disable Flight - player.setAllowFlight(false); - - double power = 0.4 + 0.6 * (_power * player.getExp()); - - //Velocity - if (_control) - { - UtilAction.velocity(player, power, 0.2, 10, true); - } - else - { - UtilAction.velocity(player, player.getLocation().getDirection(), power, true, power, 0, 10, true); - } - - //Sound - player.getWorld().playSound(player.getLocation(), Sound.BAT_TAKEOFF, (float)(0.3 + player.getExp()), (float)(Math.random()/2+1)); - - //Set Recharge - Recharge.Instance.use(player, GetName(), 80, false, false); - - //Energy - if (!isSuperActive(player)) - player.setExp(Math.max(0f, player.getExp() - (1f/6f))); - } - - @EventHandler - public void FlightUpdate(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - for (Player player : UtilServer.getPlayers()) - { - if (player.getGameMode() == GameMode.CREATIVE) - continue; - - if (!Kit.HasKit(player)) - continue; - - if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)) || UtilBlock.solid(player.getLocation().subtract(0, 1, 0).getBlock())) - { - player.setExp(Math.min(0.9999f, player.getExp() + 0.03f)); - player.setAllowFlight(true); - } - else if (Recharge.Instance.usable(player, GetName()) && player.getExp() > 0) - { - player.setAllowFlight(true); - } - } - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFleshArrow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFleshArrow.java deleted file mode 100644 index e98337f2e..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFleshArrow.java +++ /dev/null @@ -1,112 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashSet; -import java.util.Iterator; - -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.Entity; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Projectile; -import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; -import org.bukkit.event.entity.ProjectileHitEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.util.Vector; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; - -public class PerkFleshArrow extends SmashPerk -{ - private HashSet _arrows = new HashSet(); - - public PerkFleshArrow() - { - super("Flesh Arrow", new String[] - { - C.cYellow + "Left-Click" + C.cGray + " with Bow to " + C.cGreen + "Flesh Arrow" - }); - } - - @EventHandler - public void fire(PlayerInteractEvent event) - { - if (event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.LEFT_CLICK_BLOCK) - return; - - if (event.getPlayer().getItemInHand() == null) - return; - - if (event.getPlayer().getItemInHand().getType() != Material.BOW) - return; - - Player player = event.getPlayer(); - - if (!Kit.HasKit(player)) - return; - - if (!Recharge.Instance.use(player, GetName(), 8000, true, true)) - return; - - //Arrow - Arrow arrow = player.launchProjectile(Arrow.class); - arrow.setVelocity(player.getLocation().getDirection().multiply(3)); - _arrows.add(arrow); - - //Inform - UtilPlayer.message(player, F.main("Game", "You fired " + F.skill(GetName()) + ".")); - } - - @EventHandler - public void hit(ProjectileHitEvent event) - { - if (!_arrows.remove(event.getEntity())) - return; - - System.out.println("Flesh Arrow A"); - - event.getEntity().remove(); - } - - @EventHandler - public void damage(CustomDamageEvent event) - { - if (event.GetProjectile() == null) - return; - - if (!_arrows.contains(event.GetProjectile())) - return; - - LivingEntity ent = event.GetDamageeEntity(); - - Manager.GetCondition().Factory().Slow(GetName(), ent, event.GetDamagerEntity(true), 4, 3, false, false, false, false); - - UtilAction.velocity(ent, new Vector(0,-0.5,0)); - } - - @EventHandler - public void clean(UpdateEvent event) - { - if (event.getType() != UpdateType.SEC) - return; - - for (Iterator arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) - { - Entity arrow = arrowIterator.next(); - - if (!arrow.isValid()) - arrowIterator.remove(); - } - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorseKick.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorseKick.java deleted file mode 100644 index 75f51451b..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorseKick.java +++ /dev/null @@ -1,197 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.UUID; - -import org.bukkit.Location; -import org.bukkit.Sound; -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 mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilItem; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.disguise.disguises.DisguiseBase; -import mineplex.core.disguise.disguises.DisguiseHorse; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; - -public class PerkHorseKick extends SmashPerk -{ - - private static final long COOLDOWN = 6000; - private static final float DAMAGE = 6.5F; - private static final long KICK_TIME = 1000; - private static final int KNOCKBACK_MAGNITUDE = 4; - - private Map _active = new HashMap<>(); - - public PerkHorseKick() - { - super("Bone Kick", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Bone Kick" }); - } - - @EventHandler - public void Activate(PlayerInteractEvent event) - { - if (event.isCancelled()) - { - return; - } - - if (!UtilEvent.isAction(event, ActionType.R)) - { - return; - } - - if (UtilBlock.usable(event.getClickedBlock())) - { - return; - } - - Player player = event.getPlayer(); - - if (!UtilItem.isAxe(player.getItemInHand())) - { - return; - } - - if (!hasPerk(player)) - { - return; - } - - if (isSuperActive(player)) - { - return; - } - - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) - { - return; - } - - // Horse Animation - DisguiseBase horse = Manager.GetDisguise().getActiveDisguise(player); - - if (horse != null && horse instanceof DisguiseHorse) - { - ((DisguiseHorse) horse).kick(); - Manager.GetDisguise().updateDisguise(horse); - } - - // Animation - _active.put(player.getUniqueId(), System.currentTimeMillis()); - - // AoE Area - Location loc = player.getLocation(); - loc.add(player.getLocation().getDirection().setY(0).normalize().multiply(1.5)); - loc.add(0, 0.8, 0); - - for (LivingEntity other : UtilEnt.getInRadius(loc, 2.5).keySet()) - { - if (UtilPlayer.isSpectator(other)) - { - continue; - } - - if (other.equals(player)) - { - continue; - } - - // Damage Event - Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE, true, true, false, player.getName(), GetName()); - - // Sound - player.getWorld().playSound(player.getLocation(), Sound.SKELETON_HURT, 4f, 0.6f); - player.getWorld().playSound(player.getLocation(), Sound.SKELETON_HURT, 4f, 0.6f); - - // Inform - UtilPlayer.message(other, F.main("Skill", F.name(player.getName()) + " hit you with " + F.skill(GetName()) + ".")); - } - - // Inform - UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); - - // Slow - Manager.GetCondition().Factory().Slow(GetName(), player, player, 0.8, 3, false, false, true, false); - } - - @EventHandler - public void Update(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - { - return; - } - - // Player - Iterator playerIterator = _active.keySet().iterator(); - - while (playerIterator.hasNext()) - { - UUID key = playerIterator.next(); - Player player = UtilPlayer.searchExact(key); - - if (player == null) - { - playerIterator.remove(); - continue; - } - - if (!player.isValid() || player.getHealth() <= 0 || UtilTime.elapsed(_active.get(player), KICK_TIME)) - { - playerIterator.remove(); - - // Horse Animation - DisguiseBase horse = Manager.GetDisguise().getActiveDisguise(player); - - if (horse != null && horse instanceof DisguiseHorse) - { - ((DisguiseHorse) horse).stopKick(); - Manager.GetDisguise().updateDisguise(horse); - } - - Manager.GetCondition().EndCondition(player, null, GetName()); - } - else - { - Location loc = player.getLocation(); - loc.add(player.getLocation().getDirection().setY(0).normalize().multiply(1.5)); - loc.add(0, 0.8, 0); - - UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, loc, 0.3f, 0.3f, 0.3f, 0, 2, ViewDist.LONG, UtilServer.getPlayers()); - } - } - } - - @EventHandler - public void Knockback(CustomDamageEvent event) - { - if (event.GetReason() == null || !event.GetReason().contains(GetName())) - { - return; - } - - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIcePath.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIcePath.java deleted file mode 100644 index 0e87f9d3e..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIcePath.java +++ /dev/null @@ -1,97 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashSet; -import java.util.Iterator; - -import org.bukkit.Effect; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.util.Vector; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.data.IcePathData; - -public class PerkIcePath extends Perk -{ - private HashSet _data = new HashSet(); - - public PerkIcePath() - { - super("Ice Path", new String[] - { - C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Ice Path" - }); - } - - @EventHandler - public void Skill(PlayerInteractEvent event) - { - if (event.isCancelled()) - return; - - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) - return; - - if (UtilBlock.usable(event.getClickedBlock())) - return; - - if (event.getPlayer().getItemInHand() == null) - return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) - return; - - Player player = event.getPlayer(); - - if (!Kit.HasKit(player)) - return; - - if (!Recharge.Instance.use(player, GetName(), 12000, true, true)) - return; - - player.teleport(player.getLocation().add(0, 1, 0)); - UtilAction.velocity(player, new Vector(0,0.5,0)); - - _data.add(new IcePathData(player)); - - //Inform - UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); - } - - @EventHandler - public void Freeze(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - Iterator dataIterator = _data.iterator(); - - while (dataIterator.hasNext()) - { - IcePathData data = dataIterator.next(); - - Block block = data.GetNextBlock(); - - if (block == null) - { - dataIterator.remove(); - } - else - { - block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 79); - Manager.GetBlockRestore().add(block, 79, (byte) 0, 6000); - } - } - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInfernalHorror.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInfernalHorror.java deleted file mode 100644 index 8b472984d..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInfernalHorror.java +++ /dev/null @@ -1,189 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashSet; - -import org.bukkit.Sound; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.events.PlayerGameRespawnEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; - -public class PerkInfernalHorror extends SmashPerk -{ - public HashSet _active = new HashSet(); - - public PerkInfernalHorror() - { - super("Infernal Horror", new String[] - { - C.cGray + "Tranform into " + F.skill("Infernal Horror") + " at 100% Rage.", - C.cGray + "Charge your Rage by dealing/taking damage." - }); - } - - @Override - public void addSuperCustom(Player player) - { - _active.add(player); - player.setExp(0.9999f); - } - - @EventHandler - public void energyUpdate(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - for (Player player : Manager.GetGame().GetPlayers(true)) - { - if (!Kit.HasKit(player)) - continue; - - player.setExp((float) Math.max(0, player.getExp()-0.001)); - } - } - - @EventHandler(priority = EventPriority.HIGHEST) - public void damagerEnergy(CustomDamageEvent event) - { - if (event.IsCancelled()) - return; - - if (event.GetCause() == DamageCause.FIRE_TICK) - return; - - Player damager = event.GetDamagerPlayer(true); - if (damager == null) return; - - if (!Kit.HasKit(damager)) - return; - - damager.setExp(Math.min(0.999f, damager.getExp() + (float)(event.GetDamage()/60d))); - - activeCheck(damager); - } - - @EventHandler(priority = EventPriority.MONITOR) - public void damageeEnergy(CustomDamageEvent event) - { - if (event.IsCancelled()) - return; - - if (event.GetCause() == DamageCause.FIRE_TICK) - return; - - if (event.GetCause() == DamageCause.VOID) - return; - - - Player damagee = event.GetDamageePlayer(); - if (damagee == null) return; - - if (!Kit.HasKit(damagee)) - return; - - damagee.setExp(Math.min(0.999f, damagee.getExp() + (float)(event.GetDamage()/60d))); - - activeCheck(damagee); - } - - @EventHandler(priority = EventPriority.HIGH) - public void damageBoost(CustomDamageEvent event) - { - if (event.IsCancelled()) - return; - - if (event.GetCause() != DamageCause.ENTITY_ATTACK) - return; - - Player damager = event.GetDamagerPlayer(false); - if (damager == null) return; - - if (!Kit.HasKit(damager)) - return; - - if (!_active.contains(damager)) - return; - - event.AddMod(damager.getName(), GetName(), 1, false); - } - - @EventHandler - public void check(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - for (Player player : Manager.GetGame().GetPlayers(true)) - if (Kit.HasKit(player)) - activeCheck(player); - } - - public void activeCheck(Player player) - { - //Active - if (_active.contains(player)) - { - if (!isSuperActive(player)) - player.setExp((float) Math.max(0, player.getExp()-0.005)); - - if (player.getExp() > 0) - { - //Condition - Manager.GetCondition().Factory().Speed(GetName(), player, player, 0.9, 1, false, false, false); - - //Particles - UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation().add(0, 1, 0), 0.25f, 0.25f, 0.25f, 0, 1, - ViewDist.LONG, UtilServer.getPlayers()); - - if (Math.random() > 0.9) - UtilParticle.PlayParticle(ParticleType.LAVA, player.getLocation().add(0, 1, 0), 0.25f, 0.25f, 0.25f, 0, 1, - ViewDist.LONG, UtilServer.getPlayers()); - } - else - { - _active.remove(player); - - //Inform - UtilPlayer.message(player, F.main("Skill", "You are no longer " + F.skill("Infernal Horror") + ".")); - } - } - //Not Active - else if (player.getExp() > 0.99) - { - _active.add(player); - - //Sound - player.getWorld().playSound(player.getLocation(), Sound.FIRE, 2f, 1f); - player.getWorld().playSound(player.getLocation(), Sound.FIRE, 2f, 1f); - - //Inform - UtilPlayer.message(player, F.main("Skill", "You transformed into " + F.skill("Infernal Horror") + ".")); - } - } - - @EventHandler - public void clean(PlayerGameRespawnEvent event) - { - event.GetPlayer().setExp(0f); - _active.remove(event.GetPlayer()); - } - - public boolean isActive(Player player) - { - return _active.contains(player); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java deleted file mode 100644 index f2bcd0c40..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java +++ /dev/null @@ -1,169 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -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.util.Vector; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilItem; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.projectile.IThrown; -import mineplex.core.projectile.ProjectileUser; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; - -public class PerkInkBlast extends SmashPerk implements IThrown -{ - - private static final long COOLDOWN = 6000; - private static final float PROJECTILE_VELOCITY = 0.15F; - private static final int KNOCKBACK_MAGNITUDE = 3; - - private int _bullets; - private double _damagePerBullet; - - public PerkInkBlast(int bullets, double damagePerBullet) - { - super("Ink Shotgun", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Ink Shotgun" }); - - _bullets = bullets; - _damagePerBullet = damagePerBullet; - } - - @EventHandler - public void shoot(PlayerInteractEvent event) - { - if (event.isCancelled()) - { - return; - } - - if (!UtilEvent.isAction(event, ActionType.R)) - { - return; - } - - if (UtilBlock.usable(event.getClickedBlock())) - { - return; - } - - Player player = event.getPlayer(); - - if (!UtilItem.isAxe(player.getItemInHand())) - { - return; - } - - if (!hasPerk(player)) - { - return; - } - - if (isSuperActive(player)) - { - return; - } - - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) - { - return; - } - - event.setCancelled(true); - - UtilInv.Update(player); - - for (int i = 0; i < _bullets; i++) - { - Item ent = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(Material.INK_SACK, (byte) 0, 1, "Ink" + Math - .random())); - - Vector random = new Vector(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5); - random.normalize(); - random.multiply(PROJECTILE_VELOCITY); - - if (i == 0) - { - random.multiply(0); - } - - UtilAction.velocity(ent, player.getLocation().getDirection().add(random), 1 + 0.4 * Math.random(), false, 0, 0.2, 10, false); - - Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true, null, 1f, 1f, ParticleType.EXPLODE, UpdateType.FASTEST, 0.5f); - } - - // Inform - UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); - - // Effect - player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 1.5f, 0.75f); - player.getWorld().playSound(player.getLocation(), Sound.SPLASH, 0.75f, 1f); - } - - @Override - public void Collide(LivingEntity target, Block block, ProjectileUser data) - { - Explode(data); - - if (target == null) - { - return; - } - - // Damage Event - Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, _damagePerBullet, true, true, false, UtilEnt.getName(data.getThrower()), GetName()); - - UtilParticle.PlayParticle(ParticleType.EXPLODE, target.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 12, ViewDist.LONG, UtilServer.getPlayers()); - } - - @Override - public void Idle(ProjectileUser data) - { - Explode(data); - } - - @Override - public void Expire(ProjectileUser data) - { - Explode(data); - } - - public void Explode(ProjectileUser data) - { - data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.EXPLODE, 0.75f, 1.25f); - data.getThrown().remove(); - } - - @EventHandler - public void Knockback(CustomDamageEvent event) - { - if (event.GetReason() == null || !event.GetReason().contains(GetName())) - { - return; - } - - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMeteorShower.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMeteorShower.java deleted file mode 100644 index 949d5c76c..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMeteorShower.java +++ /dev/null @@ -1,50 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; - -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; -import nautilus.game.arcade.kit.perks.data.MeteorShowerData; - -public class PerkMeteorShower extends SmashPerk -{ - private ArrayList _meteors = new ArrayList(); - - public PerkMeteorShower() - { - super("Meteor Shower", new String[] - { - }, false); - } - - @Override - public void addSuperCustom(Player player) - { - _meteors.add(new MeteorShowerData(player, player.getTargetBlock((HashSet) null, 128).getLocation())); - } - - @EventHandler - public void update(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - Iterator meteorIter = _meteors.iterator(); - - while (meteorIter.hasNext()) - { - MeteorShowerData data = meteorIter.next(); - - if (data.update()) - { - meteorIter.remove(); - } - } - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNeedler.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNeedler.java deleted file mode 100644 index 442dde4bb..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNeedler.java +++ /dev/null @@ -1,157 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; - -import org.bukkit.Sound; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.player.PlayerInteractEvent; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; -import nautilus.game.arcade.kit.Perk; - -public class PerkNeedler extends SmashPerk -{ - private HashMap _active = new HashMap(); - private HashSet _arrows = new HashSet(); - - public PerkNeedler() - { - super("Needler", new String[] - { - C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Needler" - }); - } - - @EventHandler - public void Activate(PlayerInteractEvent event) - { - if (event.isCancelled()) - return; - - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) - return; - - if (UtilBlock.usable(event.getClickedBlock())) - return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_SWORD")) - return; - - Player player = event.getPlayer(); - - if (!Kit.HasKit(player)) - return; - - if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? 600 : 2000, !isSuperActive(player), !isSuperActive(player))) - return; - - _active.put(player, 8); - - UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); - } - - @EventHandler - public void Update(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - for (Player cur : UtilServer.getPlayers()) - { - if (!_active.containsKey(cur)) - continue; - - if (!cur.isBlocking()) - { - _active.remove(cur); - continue; - } - - int count = _active.get(cur) - 1; - - - if (count <= 0) - { - _active.remove(cur); - continue; - } - else - { - _active.put(cur, count); - } - - Arrow arrow = cur.getWorld().spawnArrow(cur.getEyeLocation().add(cur.getLocation().getDirection()), - cur.getLocation().getDirection(), 1.2f, 6); - arrow.setShooter(cur); - _arrows.add(arrow); - - //Sound - cur.getWorld().playSound(cur.getLocation(), Sound.SPIDER_IDLE, 0.8f, 2f); - } - } - - @EventHandler - public void ArrowDamamge(CustomDamageEvent event) - { - if (event.GetProjectile() == null) - return; - - if (event.GetDamagerPlayer(true) == null) - return; - - if (!(event.GetProjectile() instanceof Arrow)) - return; - - Player damager = event.GetDamagerPlayer(true); - - if (!Kit.HasKit(damager)) - return; - - event.SetCancelled("Needler Cancel"); - - event.GetProjectile().remove(); - - //Damage Event - Manager.GetDamage().NewDamageEvent(event.GetDamageeEntity(), damager, null, - DamageCause.THORNS, 1.1, true, true, false, - damager.getName(), GetName()); - - if(!Manager.GetGame().GetTeam(event.GetDamageePlayer()).equals(Manager.GetGame().GetTeam(damager))) - { - Manager.GetCondition().Factory().Poison(GetName(), event.GetDamageeEntity(), damager, 2, 0, false, false, false); - } - } - - @EventHandler - public void Clean(UpdateEvent event) - { - if (event.getType() != UpdateType.SEC) - return; - - for (Iterator arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) - { - Arrow arrow = arrowIterator.next(); - - if (arrow.isOnGround() || !arrow.isValid() || arrow.getTicksLived() > 300) - { - arrowIterator.remove(); - arrow.remove(); - } - } - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java deleted file mode 100644 index 719fa9588..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java +++ /dev/null @@ -1,150 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; - -import org.bukkit.Effect; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.block.BlockFace; -import org.bukkit.entity.Player; -import org.bukkit.entity.Zombie; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityTargetEvent; -import org.bukkit.util.Vector; - -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilTime; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.game.games.smash.TeamSuperSmash; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; -import nautilus.game.arcade.kit.perks.data.NightLivingDeadData; - -public class PerkNightLivingDead extends SmashPerk -{ - private ArrayList _night = new ArrayList(); - - private HashSet _ignoreList = new HashSet();; - - public PerkNightLivingDead() - { - super("Night of the Living Dead", new String[] - { - }, false); - } - - @Override - public void addSuperCustom(Player player) - { - _night.add(new NightLivingDeadData(player)); - } - - @EventHandler - public void timeUpdate(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - if (_night.isEmpty() && Manager.GetGame().WorldTimeSet != 12000) - { - Manager.GetGame().WorldTimeSet = (Manager.GetGame().WorldTimeSet + 50)%24000; - } - else if (!_night.isEmpty() && Manager.GetGame().WorldTimeSet != 18000) - { - Manager.GetGame().WorldTimeSet = (Manager.GetGame().WorldTimeSet + 50)%24000; - } - } - - @EventHandler - public void update(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - Iterator nightIter = _night.iterator(); - - while (nightIter.hasNext()) - { - NightLivingDeadData data = nightIter.next(); - - //Expire - if (UtilTime.elapsed(data.Time, 30000)) - { - nightIter.remove(); - - for (Zombie zombie : data.Zombies) - zombie.damage(1000); - continue; - } - - //Spawn - if (UtilTime.elapsed(data.LastSpawn, 1000)) - { - Location origin = UtilAlg.Random(Manager.GetGame().GetPlayers(true)).getLocation(); - Location loc = findSpawn(origin); - - if (Math.abs(loc.getY() - origin.getY()) > 6) - continue; - - if (!UtilBlock.airFoliage(loc.getBlock()) || !UtilBlock.airFoliage(loc.getBlock().getRelative(BlockFace.UP))) - continue; - - //Set Spawned - data.LastSpawn = System.currentTimeMillis(); - - //Move Down - loc.subtract(0, 1, 0); - - //Spawn - Manager.GetGame().CreatureAllowOverride = true; - Zombie zombie = loc.getWorld().spawn(loc, Zombie.class); - Manager.GetGame().CreatureAllowOverride = false; - - data.Zombies.add(zombie); - - //Pop up - zombie.setVelocity(new Vector(0,0.4,0)); - //zombie.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 9999, 1, true)); - - //Effect - zombie.getWorld().playSound(zombie.getLocation(), Sound.ZOMBIE_IDLE, 1f, 0.75f); - - loc.getWorld().playEffect(loc, Effect.STEP_SOUND, loc.getBlock().getType()); - } - } - } - - @EventHandler - public void update(EntityTargetEvent event) - { - for (NightLivingDeadData data : _night) - { - if (data.Zombies.contains(event.getEntity())) - { - if (Manager.GetGame() instanceof TeamSuperSmash && event.getTarget() instanceof Player) - { - TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); - Player targetPlayer = (Player) event.getTarget(); - - if (smash.GetTeam(data.Player).equals(smash.GetTeam(targetPlayer))) - { - event.setCancelled(true); - } - } - if (data.Player.equals(event.getTarget())) - { - event.setCancelled(true); - } - } - } - } - - public Location findSpawn(Location area) - { - return UtilBlock.getHighest(area.getWorld(), (int)(area.getX() + Math.random() * 24 - 12), (int)(area.getZ() + Math.random() * 24 - 12), _ignoreList).getLocation().add(0.5, 0.5, 0.5); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkOvercharge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkOvercharge.java deleted file mode 100644 index e3ce2434e..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkOvercharge.java +++ /dev/null @@ -1,204 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.Iterator; -import java.util.WeakHashMap; - -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.block.Action; -import org.bukkit.event.entity.EntityShootBowEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.updater.UpdateType; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; - -public class PerkOvercharge extends SmashPerk -{ - private WeakHashMap _charge = new WeakHashMap(); - private WeakHashMap _chargeLast = new WeakHashMap(); - - private WeakHashMap _arrows = new WeakHashMap(); - - private int _max; - private long _tick; - private boolean _useExp; - - public PerkOvercharge(int max, long tick, boolean useExpBar) - { - super("Corrupted Arrow", new String[] - { - C.cYellow + "Charge" + C.cGray + " your Bow to use " + C.cGreen + "Corrupted Arrow" - }); - - _useExp = useExpBar; - _max = max; - _tick = tick; - } - - @EventHandler - public void drawBow(PlayerInteractEvent event) - { - Player player = event.getPlayer(); - - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) - return; - - if (player.getItemInHand() == null || player.getItemInHand().getType() != Material.BOW) - return; - - if (isSuperActive(player)) - return; - - if (!Kit.HasKit(player)) - return; - - if (!player.getInventory().contains(Material.ARROW)) - return; - - if (event.getClickedBlock() != null) - if (UtilBlock.usable(event.getClickedBlock())) - return; - - // Start Charge - _charge.put(player, 0); - _chargeLast.put(player, System.currentTimeMillis()); - } - - @EventHandler - public void charge(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - for (Player cur : UtilServer.getPlayers()) - { - // Not Charging - if (!_charge.containsKey(cur)) - continue; - - // Max Charge - if (_charge.get(cur) >= _max) - continue; - - // Charge Interval - if (_charge.get(cur) == 0) - { - if (!UtilTime.elapsed(_chargeLast.get(cur), 1000)) - continue; - } - else - { - if (!UtilTime.elapsed(_chargeLast.get(cur), _tick)) - continue; - } - - // No Longer Holding Bow - if (cur.getItemInHand() == null || cur.getItemInHand().getType() != Material.BOW) - { - if (_useExp) - cur.setExp(0f); - - _charge.remove(cur); - _chargeLast.remove(cur); - continue; - } - - // Increase Charge - _charge.put(cur, _charge.get(cur) + 1); - - if (_useExp) - cur.setExp(Math.min(0.9999f, (float)_charge.get(cur) / (float)_max)); - - _chargeLast.put(cur, System.currentTimeMillis()); - - // Effect - cur.playSound(cur.getLocation(), Sound.CLICK, 1f, 1f + (0.1f * _charge.get(cur))); - } - } - - @EventHandler(priority = EventPriority.HIGH) - public void fireBow(EntityShootBowEvent event) - { - if (event.isCancelled()) - return; - - if (!Manager.GetGame().IsLive()) - return; - - if (!(event.getEntity() instanceof Player)) - return; - - if (!(event.getProjectile() instanceof Arrow)) - return; - - Player player = (Player) event.getEntity(); - - if (!_charge.containsKey(player)) - return; - - int charge = _charge.remove(player); - if (charge <= 0) - return; - - // Start Barrage - _arrows.put((Arrow)event.getProjectile(), charge); - - player.setExp(0f); - } - - @EventHandler(priority = EventPriority.HIGH) - public void damageBonus(CustomDamageEvent event) - { - if (event.GetProjectile() == null) - return; - - if (!_arrows.containsKey(event.GetProjectile())) - return; - - int charge = _arrows.remove(event.GetProjectile()); - - event.AddMod(GetName(), GetName(), charge * 0.9, true); - } - - @EventHandler - public void clean(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - for (Iterator arrowIterator = _arrows.keySet().iterator(); arrowIterator.hasNext();) - { - Arrow arrow = arrowIterator.next(); - - if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround() || arrow.getTicksLived() > 120) - arrowIterator.remove(); - else - UtilParticle.PlayParticle(ParticleType.RED_DUST, arrow.getLocation(), 0, 0, 0, 0, 1, - ViewDist.MAX, UtilServer.getPlayers()); - } - } - - @EventHandler - public void quit(PlayerQuitEvent event) - { - Player player = event.getPlayer(); - - _charge.remove(player); - _chargeLast.remove(player); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBomb.java deleted file mode 100644 index d89a735de..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBomb.java +++ /dev/null @@ -1,178 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.WeakHashMap; - -import org.bukkit.Sound; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Pig; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.util.Vector; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.disguise.disguises.DisguiseBase; -import mineplex.core.disguise.disguises.DisguisePigZombie; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; - -public class PerkPigBaconBomb extends SmashPerk -{ - private WeakHashMap> _pigs = new WeakHashMap>(); - - public PerkPigBaconBomb() - { - super("Baby Bacon Bomb", new String[] - { - C.cYellow + "Right-Click" + C.cGray + " with Spade to " + C.cGreen + "Baby Bacon Bomb" - }); - } - - - @EventHandler - public void Skill(PlayerInteractEvent event) - { - if (event.isCancelled()) - return; - - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) - return; - - if (UtilBlock.usable(event.getClickedBlock())) - return; - - if (event.getPlayer().getItemInHand() == null) - return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_SPADE")) - return; - - Player player = event.getPlayer(); - - if (!Kit.HasKit(player)) - return; - - float energy = 0.35f; - - DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); - if (disguise != null && disguise instanceof DisguisePigZombie) - energy = energy * 0.7f; - - //Energy - if (player.getExp() < energy) - { - UtilPlayer.message(player, F.main("Energy", "Not enough Energy to use " + F.skill(GetName()) + ".")); - return; - } - - //Recharge - if (!Recharge.Instance.use(player, GetName(), 100, false, false)) - return; - - //Use Energy - player.setExp(Math.max(0f, player.getExp() - energy)); - - //Velocity - UtilAction.velocity(player, player.getLocation().getDirection(), 0.8, true, 0.9, 0, 1, true); - - //Sound - player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 2f, 0.75f); - - //Pig - Manager.GetGame().CreatureAllowOverride = true; - Pig pig = player.getWorld().spawn(player.getLocation(), Pig.class); - pig.setHealth(5); - pig.setVelocity(new Vector(0, -0.4, 0)); - Manager.GetGame().CreatureAllowOverride = false; - - pig.setBaby(); - UtilEnt.Vegetate(pig); - UtilEnt.ghost(pig, true, false); - - //Store - if (!_pigs.containsKey(player)) - _pigs.put(player, new HashSet()); - - _pigs.get(player).add(pig); - - //Inform - UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); - } - - @EventHandler - public void Check(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - for (Player player : _pigs.keySet()) - { - Iterator pigIterator = _pigs.get(player).iterator(); - - while (pigIterator.hasNext()) - { - Pig pig = pigIterator.next(); - - if (!pig.isValid() || pig.getTicksLived() > 80) - { - PigExplode(pigIterator, pig, player); - continue; - } - - Player target = UtilPlayer.getClosest(pig.getLocation(), player); - if (target == null) - continue; - - UtilEnt.CreatureMoveFast(pig, target.getLocation(), 1.2f); - - if (UtilMath.offset(target, pig) < 2) - PigExplode(pigIterator, pig, player); - } - } - } - - public void PigExplode(Iterator pigIterator, Pig pig, Player owner) - { - //Effect - UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, pig.getLocation().add(0, 0.5, 0), 0, 0, 0, 0, 1, - ViewDist.MAX, UtilServer.getPlayers()); - - //Sound - pig.getWorld().playSound(pig.getLocation(), Sound.EXPLODE, 0.6f, 2f); - pig.getWorld().playSound(pig.getLocation(), Sound.PIG_DEATH, 1f, 2f); - - //Damage - HashMap targets = UtilEnt.getInRadius(pig.getLocation(), 4); - for (LivingEntity cur : targets.keySet()) - { - if (cur.equals(owner)) - continue; - - //Damage Event - Manager.GetDamage().NewDamageEvent(cur, owner, null, - DamageCause.CUSTOM, 4, false, true, false, - owner.getName(), GetName()); - } - - //Remove - pigIterator.remove(); - pig.remove(); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBounce.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBounce.java deleted file mode 100644 index f2660d71d..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBounce.java +++ /dev/null @@ -1,186 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.block.Block; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Item; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.block.Action; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerPickupItemEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.util.Vector; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilServer; -import mineplex.core.disguise.disguises.DisguiseBase; -import mineplex.core.disguise.disguises.DisguisePigZombie; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.projectile.IThrown; -import mineplex.core.projectile.ProjectileUser; -import mineplex.core.recharge.Recharge; -import nautilus.game.arcade.game.games.smash.TeamSuperSmash; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; - -public class PerkPigBaconBounce extends SmashPerk implements IThrown -{ - public PerkPigBaconBounce() - { - super("Bouncy Bacon", new String[] - { - C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Bouncy Bacon", - }); - } - - @EventHandler - public void Skill(PlayerInteractEvent event) - { - if (event.isCancelled()) - return; - - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) - return; - - if (UtilBlock.usable(event.getClickedBlock())) - return; - - if (event.getPlayer().getItemInHand() == null) - return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) - return; - - Player player = event.getPlayer(); - - if (!Kit.HasKit(player)) - return; - - float energy = 0.2f; - - DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); - if (disguise != null && disguise instanceof DisguisePigZombie) - energy = energy * 0.7f; - - //Energy - if (player.getExp() < energy) - { - UtilPlayer.message(player, F.main("Energy", "Not enough Energy to use " + F.skill(GetName()) + ".")); - return; - } - - //Recharge - if (!Recharge.Instance.use(player, GetName(), 100, false, false)) - return; - - //Use Energy - player.setExp(Math.max(0f, player.getExp() - energy)); - - //Launch - Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.PORK, (byte) 0, 1, "Bacon"+System.currentTimeMillis())); - UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false); - Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 0.4f); - ent.setPickupDelay(9999); - - //Sound - player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 2f, 1.5f); - - //Inform - UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); - } - - @Override - public void Collide(LivingEntity target, Block block, ProjectileUser data) - { - Rebound(data.getThrower(), data.getThrown()); - - if (target == null) - return; - - if (Manager.GetGame() instanceof TeamSuperSmash && target instanceof Player && data.getThrower() instanceof Player) - { - TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); - Player targetPlayer = (Player) target; - Player throwerPlayer = (Player) data.getThrower(); - - if(smash.GetTeam(targetPlayer).equals(smash.GetTeam(throwerPlayer))) - { - return; - } - } - - //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, - DamageCause.CUSTOM, 4, true, true, false, - UtilEnt.getName(data.getThrower()), GetName()); - - Item item = (Item)data.getThrown(); - item.setItemStack(new ItemStack(Material.GRILLED_PORK)); - } - - @Override - public void Idle(ProjectileUser data) - { - Rebound(data.getThrower(), data.getThrown()); - } - - @Override - public void Expire(ProjectileUser data) - { - Rebound(data.getThrower(), data.getThrown()); - } - - public void Rebound(LivingEntity player, Entity ent) - { - ent.getWorld().playSound(ent.getLocation(), Sound.ITEM_PICKUP, 1f, 0.5f); - - double mult = 0.5 + (0.035 * UtilMath.offset(player.getLocation(), ent.getLocation())); - - //Velocity - ent.setVelocity(player.getLocation().toVector().subtract(ent.getLocation().toVector()).normalize().add(new Vector(0, 0.4, 0)).multiply(mult)); - - //Ticks - if (ent instanceof Item) - ((Item)ent).setPickupDelay(5); - } - - @EventHandler(priority = EventPriority.LOWEST) - public void Pickup(PlayerPickupItemEvent event) - { - if (!Kit.HasKit(event.getPlayer())) - return; - - if (event.getItem().getItemStack().getType() != Material.PORK && event.getItem().getItemStack().getType() != Material.GRILLED_PORK) - return; - - //Remove - event.getItem().remove(); - - //Restore Energy - event.getPlayer().setExp(Math.min(0.999f, event.getPlayer().getExp() + 0.05f)); - - //Sound - event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.EAT, 2f, 1f); - - //Heal - if (event.getItem().getItemStack().getType() == Material.GRILLED_PORK) - { - UtilPlayer.health(event.getPlayer(), 1); - UtilParticle.PlayParticle(ParticleType.HEART, event.getPlayer().getLocation().add(0, 0.5, 0), 0.2f, 0.2f, 0.2f, 0, 4, - ViewDist.LONG, UtilServer.getPlayers()); - } - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigZombie.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigZombie.java deleted file mode 100644 index 1c2461fd7..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigZombie.java +++ /dev/null @@ -1,129 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashSet; - -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.inventory.ItemStack; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.disguise.disguises.DisguisePig; -import mineplex.core.disguise.disguises.DisguisePigZombie; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; - -public class PerkPigZombie extends SmashPerk -{ - public HashSet _active = new HashSet(); - - public PerkPigZombie() - { - super("Nether Pig", new String[] - { - C.cGray + "Become Nether Pig when HP is below 6.", - C.cGray + "Return to Pig when HP is 10 or higher." - }); - } - - @EventHandler - public void Check(UpdateEvent event) - { - if (event.getType() != UpdateType.FASTER) - return; - - for (Player player : Manager.GetGame().GetPlayers(true)) - { - if (!Kit.HasKit(player)) - continue; - - //Active - if (_active.contains(player)) - { - Manager.GetCondition().Factory().Speed("Pig Zombie", player, player, 0.9, 0, false, false, false); - - if (player.getHealth() < 10 || isSuperActive(player)) - continue; - - //Deactivate - _active.remove(player); - - //Armor - player.getInventory().setHelmet(null); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); - - player.getInventory().remove(Material.IRON_HELMET); - player.getInventory().remove(Material.IRON_CHESTPLATE); - player.getInventory().remove(Material.IRON_LEGGINGS); - player.getInventory().remove(Material.IRON_BOOTS); - - //Disguise - DisguisePig disguise = new DisguisePig(player); - - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else - disguise.setName(player.getName()); - - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); - - //Sound - player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 2f, 1f); - player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 2f, 1f); - - //Inform - UtilPlayer.message(player, F.main("Skill", "You returned to " + F.skill("Pig Form") + ".")); - } - //Not Active - else - { - if (player.getHealth() <= 0 || (!isSuperActive(player) && player.getHealth() > 6)) - continue; - - //Activate - _active.add(player); - - //Armor - player.getInventory().setHelmet(new ItemStack(Material.IRON_HELMET)); - player.getInventory().setChestplate(new ItemStack(Material.IRON_CHESTPLATE)); - player.getInventory().setLeggings(new ItemStack(Material.IRON_LEGGINGS)); - player.getInventory().setBoots(new ItemStack(Material.IRON_BOOTS)); - - //Disguise - DisguisePigZombie disguise = new DisguisePigZombie(player); - - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else - disguise.setName(player.getName()); - - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); - - //Sound - player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_PIG_ANGRY, 2f, 1f); - player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_PIG_ANGRY, 2f, 1f); - - //Inform - UtilPlayer.message(player, F.main("Skill", "You transformed into " + F.skill("Nether Pig Form") + ".")); - - player.setExp(0.99f); - } - } - } - - @EventHandler - public void Clean(PlayerDeathEvent event) - { - _active.remove(event.getEntity()); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlam.java index 0109e984e..f55739404 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlam.java @@ -150,7 +150,7 @@ public class PerkSeismicSlam extends Perk continue; } - if (cur instanceof Player && !UtilPlayer.isSpectator(cur)) + if (UtilPlayer.isSpectator(cur)) { continue; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSheepHoming.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSheepHoming.java deleted file mode 100644 index 2ff903baf..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSheepHoming.java +++ /dev/null @@ -1,107 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; - -import org.bukkit.Sound; -import org.bukkit.entity.Player; -import org.bukkit.entity.Sheep; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; - -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; -import nautilus.game.arcade.kit.perks.data.HomingSheepData; - -public class PerkSheepHoming extends SmashPerk -{ - private ArrayList _sheep = new ArrayList(); - - public PerkSheepHoming() - { - super("Homing Sheeples", new String[] - { - }, false); - } - - @Override - public void addSuperCustom(Player player) - { - //Fire Sheep - for (Player target : Manager.GetGame().GetPlayers(true)) - { - if (target.equals(player)) - continue; - - Manager.GetGame().CreatureAllowOverride = true; - Sheep sheep = player.getWorld().spawn(player.getEyeLocation(), Sheep.class); - Manager.GetGame().CreatureAllowOverride = false; - - sheep.setBaby(); - - _sheep.add(new HomingSheepData(player, target, sheep)); - } - } - - @EventHandler - public void sheepUpdate(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - Iterator sheepIter = _sheep.iterator(); - - while (sheepIter.hasNext()) - { - HomingSheepData data = sheepIter.next(); - - if (data.update()) - { - sheepIter.remove(); - explode(data); - } - } - } - - private void explode(HomingSheepData data) - { - double scale = 0.4 + 0.6 * Math.min(1, data.Sheep.getTicksLived()/60d); - - //Players - HashMap players = UtilPlayer.getInRadius(data.Sheep.getLocation(), 10); - for (Player player : players.keySet()) - { - if (!Manager.GetGame().IsAlive(player)) - continue; - - //Damage Event - Manager.GetDamage().NewDamageEvent(player, data.Shooter, null, - DamageCause.CUSTOM, 20 * scale, true, true, false, - data.Shooter.getName(), GetName()); - } - - UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, data.Sheep.getLocation(), 0, 0, 0, 0, 1, - ViewDist.MAX, UtilServer.getPlayers()); - data.Sheep.getWorld().playSound(data.Sheep.getLocation(), Sound.EXPLODE, 2f, 1f); - - data.Sheep.remove(); - } - - @EventHandler - public void knockback(CustomDamageEvent event) - { - if (event.GetReason() == null || !event.GetReason().contains(GetName())) - return; - - event.AddKnockback(GetName(), 3); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletonArrowStorm.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletonArrowStorm.java deleted file mode 100644 index 5b8a8f72a..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletonArrowStorm.java +++ /dev/null @@ -1,67 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashSet; -import java.util.Iterator; - -import org.bukkit.Sound; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.Player; -import org.bukkit.entity.Projectile; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.ProjectileHitEvent; -import org.bukkit.util.Vector; - -import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.updater.UpdateType; -import nautilus.game.arcade.game.games.smash.perks.SmashKit; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; - -public class PerkSkeletonArrowStorm extends SmashPerk -{ - private HashSet _arrows = new HashSet(); - - public PerkSkeletonArrowStorm() - { - super("Arrow Storm", new String[] { - - }, false); - } - - @EventHandler - public void fireArrows(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - for (Player cur : ((SmashKit) Kit).getSuperActive()) - { - Vector random = new Vector((Math.random() - 0.5) / 5, (Math.random() - 0.5) / 5, (Math.random() - 0.5) / 5); - Projectile arrow = cur.launchProjectile(Arrow.class); - arrow.setVelocity(cur.getLocation().getDirection().add(random).multiply(3)); - _arrows.add(arrow); - cur.getWorld().playSound(cur.getLocation(), Sound.SHOOT_ARROW, 1f, 1f); - } - } - - @EventHandler - public void projectileHit(ProjectileHitEvent event) - { - if (_arrows.remove(event.getEntity())) - event.getEntity().remove(); - } - - @EventHandler - public void clean(UpdateEvent event) - { - if (event.getType() != UpdateType.SEC) - return; - - for (Iterator arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) - { - Projectile arrow = arrowIterator.next(); - - if (arrow.isDead() || !arrow.isValid()) - arrowIterator.remove(); - } - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java deleted file mode 100644 index 6e94c5983..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java +++ /dev/null @@ -1,420 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.UUID; - -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.block.Block; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Slime; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.entity.EntityTargetEvent; -import org.bukkit.event.player.PlayerInteractEvent; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilItem; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.disguise.disguises.DisguiseSlime; -import mineplex.core.projectile.IThrown; -import mineplex.core.projectile.ProjectileUser; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; - -public class PerkSlimeRocket extends SmashPerk implements IThrown -{ - - private static final long COOLDOWN = 6000; - private static final float ENERGY_PER_TICK = 0.004F; - private static final int KNOCKBACK_MAGNITUDE = 3; - - private Map _charge = new HashMap<>(); - private Map _owner = new HashMap<>(); - private Map _lastAttack = new HashMap<>(); - - public PerkSlimeRocket() - { - super("Slime Rocket", new String[] { C.cYellow + "Hold/Release Block" + C.cGray + " to use " + C.cGreen + "Slime Rocket" }); - } - - @EventHandler - public void EnergyUpdate(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - { - return; - } - - for (Player player : Manager.GetGame().GetPlayers(true)) - { - if (!hasPerk(player)) - { - continue; - } - - if (isSuperActive(player)) - { - continue; - } - - int size = 1; - if (player.getExp() > 0.8) - { - size = 3; - } - else if (player.getExp() > 0.55) - { - size = 2; - } - - DisguiseSlime slime = (DisguiseSlime) Manager.GetDisguise().getActiveDisguise(player); - - if (slime != null && slime.GetSize() != size) - { - slime.SetSize(size); - Manager.GetDisguise().updateDisguise(slime); - } - - if (player.isBlocking()) - { - continue; - } - - player.setExp((float) Math.min(0.999, player.getExp() + ENERGY_PER_TICK)); - } - } - - @EventHandler - public void Activate(PlayerInteractEvent event) - { - if (event.isCancelled()) - { - return; - } - - if (!UtilEvent.isAction(event, ActionType.R)) - { - return; - } - - if (UtilBlock.usable(event.getClickedBlock())) - { - return; - } - - Player player = event.getPlayer(); - - if (!UtilItem.isSword(player.getItemInHand())) - { - return; - } - - if (!hasPerk(player)) - { - return; - } - - if (isSuperActive(player)) - { - return; - } - - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) - { - return; - } - - UtilPlayer.message(player, F.main("Skill", "You are charging " + F.skill(GetName()) + ".")); - - _charge.put(player.getUniqueId(), System.currentTimeMillis()); - } - - @EventHandler - public void ChargeRelease(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - { - return; - } - - Iterator chargeIterator = _charge.keySet().iterator(); - - while (chargeIterator.hasNext()) - { - UUID key = chargeIterator.next(); - Player player = UtilPlayer.searchExact(key); - - if (player == null) - { - chargeIterator.remove(); - continue; - } - - long time = _charge.get(key); - - // Charge - if (player.isBlocking()) - { - // Energy Depleted - if (player.getExp() < 0.1) - { - FireRocket(player); - chargeIterator.remove(); - } - else - { - double elapsed = Math.min(3, (double) (System.currentTimeMillis() - time) / 1000d); - - // Use Energy - if (!UtilTime.elapsed(time, 3000)) - { - player.setExp((float) Math.max(0, player.getExp() - 0.01f)); - } - - // AutoFire - if (UtilTime.elapsed(time, 5000)) - { - FireRocket(player); - chargeIterator.remove(); - } - - // Effect - player.getWorld().playSound(player.getLocation(), Sound.SLIME_WALK, 0.5f, (float) (0.5 + 1.5 * (elapsed / 3d))); - UtilParticle.PlayParticle(ParticleType.SLIME, player.getLocation().add(0, 1, 0), (float) (elapsed / 6d), (float) (elapsed / 6d), (float) (elapsed / 6d), 0, (int) (elapsed * 5), - ViewDist.LONGER, UtilServer.getPlayers()); - } - } - // Release - else - { - FireRocket(player); - chargeIterator.remove(); - } - } - } - - public void FireRocket(Player player) - { - double charge = Math.min(3, (double) (System.currentTimeMillis() - _charge.get(player.getUniqueId())) / 1000d); - - // Spawn Slime - Manager.GetGame().CreatureAllowOverride = true; - Slime slime = player.getWorld().spawn(player.getEyeLocation(), Slime.class); - slime.setSize(1); - Manager.GetGame().CreatureAllowOverride = false; - - // Size - slime.setSize(Math.max(1, (int) charge)); - - slime.setMaxHealth(5 + charge * 7); - slime.setHealth(slime.getMaxHealth()); - - _owner.put(slime, player.getUniqueId()); - - // Inform - UtilPlayer.message(player, F.main("Skill", "You released " + F.skill(GetName()) + ".")); - - slime.leaveVehicle(); - player.eject(); - - UtilAction.velocity(slime, player.getLocation().getDirection(), 1 + charge / 2d, false, 0, 0.2, 10, true); - - Manager.GetProjectile().AddThrow(slime, player, this, -1, true, true, true, true, null, 0, 0, null, 0, UpdateType.FASTEST, 1f); - } - - @EventHandler - public void SlimeTarget(EntityTargetEvent event) - { - if (event.isCancelled()) - { - return; - } - - if (!_owner.containsKey(event.getEntity())) - { - return; - } - - if (event.getTarget() instanceof Player) - { - if (isTeamDamage((Player) event.getTarget(), UtilPlayer.searchExact(_owner.get(event.getEntity().getUniqueId())))) - { - event.setCancelled(true); - return; - } - } - - if (_owner.get(event.getEntity()).equals(event.getTarget())) - { - event.setCancelled(true); - } - } - - @Override - public void Collide(LivingEntity target, Block block, ProjectileUser data) - { - if (target == null) - { - return; - } - - if (!(data.getThrown() instanceof Slime)) - { - return; - } - - Slime slime = (Slime) data.getThrown(); - - if (target instanceof Player && data.getThrower() instanceof Player) - { - Player targetPlayer = (Player) target; - Player throwerPlayer = (Player) data.getThrower(); - - if (isTeamDamage(targetPlayer, throwerPlayer)) - { - return; - } - } - - // Damage Event - Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 3 + slime.getSize() * 3, true, true, false, UtilEnt.getName(data.getThrower()), GetName()); - } - - @EventHandler - public void Knockback(CustomDamageEvent event) - { - if (event.GetReason() == null || !event.GetReason().contains(GetName())) - { - return; - } - - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); - } - - @Override - public void Idle(ProjectileUser data) - { - - } - - @Override - public void Expire(ProjectileUser data) - { - - } - - @EventHandler - public void SlimeDamage(CustomDamageEvent event) - { - if (!(event.GetDamagerEntity(false) instanceof Slime)) - return; - - Slime slime = (Slime) event.GetDamagerEntity(false); - - // Attack Rate - if (_lastAttack.containsKey(slime) && !UtilTime.elapsed(_lastAttack.get(slime), 500)) - { - event.SetCancelled("Slime Attack Rate"); - return; - } - - _lastAttack.put(slime, System.currentTimeMillis()); - - // Get Owner - UUID key = _owner.get(slime); - Player owner = UtilPlayer.searchExact(key); - - if (owner == null) - { - return; - } - - if (isTeamDamage(owner, event.GetDamageePlayer())) - { - event.SetCancelled("Team Damage"); - return; - } - - if (owner != null && owner.equals(event.GetDamageeEntity())) - { - event.SetCancelled("Owner Damage"); - } - else - { - event.AddMod("Slime Damage", "Negate", -event.GetDamageInitial(), false); - event.AddMod("Slime Damage", "Attack", 2 * slime.getSize(), true); - event.AddKnockback("Slime Knockback", 2); - } - } - - @EventHandler - public void SlimeClean(UpdateEvent event) - { - if (event.getType() != UpdateType.SEC) - { - return; - } - - Iterator slimeIterator = _owner.keySet().iterator(); - - while (slimeIterator.hasNext()) - { - Slime slime = slimeIterator.next(); - - // Shrink - if (slime.getVehicle() == null) - { - if (slime.getTicksLived() > 120) - { - slime.setTicksLived(1); - - Manager.GetBlood().Effects(null, slime.getLocation(), 6 + 6 * slime.getSize(), 0.2 + 0.1 * slime.getSize(), null, 1f, 1f, Material.SLIME_BALL, (byte) 0, 15, false); - - if (slime.getSize() <= 1) - { - slime.remove(); - } - else - { - slime.setSize(slime.getSize() - 1); - } - } - } - - if (!slime.isValid()) - { - slimeIterator.remove(); - } - } - - slimeIterator = _lastAttack.keySet().iterator(); - - while (slimeIterator.hasNext()) - { - Slime slime = slimeIterator.next(); - - if (!slime.isValid()) - { - slimeIterator.remove(); - } - } - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeSlam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeSlam.java deleted file mode 100644 index 6b6aba795..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeSlam.java +++ /dev/null @@ -1,185 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -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 mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilItem; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; - -public class PerkSlimeSlam extends SmashPerk -{ - - private static final int COOLDOWN = 6000; - private static final int HIT_BOX = 2; - private static final int START_TIME = 1000; - private static final int DAMAGE = 7; - private static final int KNOCKBACK_MAGNITUDE = 2; - - private Map _live = new HashMap<>(); - - public PerkSlimeSlam() - { - super("Slime Slam", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Slime Slam" }); - } - - @EventHandler - public void Leap(PlayerInteractEvent event) - { - if (event.isCancelled()) - { - return; - } - - if (!UtilEvent.isAction(event, ActionType.R)) - { - return; - } - - if (UtilBlock.usable(event.getClickedBlock())) - { - return; - } - - Player player = event.getPlayer(); - - if (!UtilItem.isAxe(player.getItemInHand())) - { - return; - } - - if (!hasPerk(player)) - { - return; - } - - if (isSuperActive(player)) - { - return; - } - - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) - { - return; - } - - UtilAction.velocity(player, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 1.2, true); - - // Record - _live.put(player.getUniqueId(), System.currentTimeMillis()); - - // Inform - UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); - } - - @EventHandler - public void End(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - { - return; - } - - List alivePlayers = Manager.GetGame().GetPlayers(true); - - // Collide - for (Player player : alivePlayers) - { - if (!_live.containsKey(player)) - { - continue; - } - - for (Player other : alivePlayers) - { - if (UtilPlayer.isSpectator(other)) - { - continue; - } - - if (other.equals(player)) - { - continue; - } - - if (UtilMath.offset(player, other) < HIT_BOX) - { - doSlam(player, other); - _live.remove(player); - return; - } - } - } - - // End - for (Player player : alivePlayers) - { - UUID key = player.getUniqueId(); - - if (!UtilEnt.isGrounded(player)) - { - continue; - } - - if (!_live.containsKey(key)) - { - continue; - } - - if (!UtilTime.elapsed(_live.get(key), START_TIME)) - { - continue; - } - - _live.remove(key); - } - } - - public void doSlam(Player damager, LivingEntity damagee) - { - // Recoil Event - if (!isSuperActive(damager)) - { - Manager.GetDamage().NewDamageEvent(damager, damagee, null, DamageCause.CUSTOM, DAMAGE / 4, true, true, false, damager.getName(), GetName() + " Recoil"); - } - - // Damage Event - Manager.GetDamage().NewDamageEvent(damagee, damager, null, DamageCause.CUSTOM, DAMAGE, true, true, false, damager.getName(), GetName()); - - // Inform - UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName()) + ".")); - UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill(GetName()) + ".")); - } - - @EventHandler - public void Knockback(CustomDamageEvent event) - { - if (event.GetReason() == null || !event.GetReason().contains(GetName())) - { - return; - } - - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSnowTurret.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSnowTurret.java deleted file mode 100644 index 75e9e5d0d..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSnowTurret.java +++ /dev/null @@ -1,170 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.WeakHashMap; - -import org.bukkit.Location; -import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSnowman; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Projectile; -import org.bukkit.entity.Snowball; -import org.bukkit.entity.Snowman; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.ProjectileHitEvent; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.util.Vector; - -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; -import net.minecraft.server.v1_8_R3.EntityInsentient; - -public class PerkSnowTurret extends SmashPerk -{ - private WeakHashMap _snowball = new WeakHashMap(); - - private HashMap _turret = new HashMap(); - - public PerkSnowTurret() - { - super("Snow Turret", new String[] - { - }, false); - } - - @Override - public void addSuperCustom(Player player) - { - Manager.GetGame().CreatureAllowOverride = true; - Snowman ent = player.getWorld().spawn(player.getEyeLocation(), Snowman.class); - Manager.GetGame().CreatureAllowOverride = false; - - UtilEnt.Vegetate(ent); - UtilEnt.ghost(ent, true, false); - - ent.setMaxHealth(40); - ent.setHealth(40); - - UtilAction.velocity(ent, player.getLocation().getDirection(), 1, false, 0, 0.2, 1, false); - - _turret.put(ent, player); - } - - @EventHandler - public void updateSnowman(UpdateEvent event) - { - if (event.getType() != UpdateType.FASTER) - return; - - Iterator turretIter = _turret.keySet().iterator(); - - while (turretIter.hasNext()) - { - Snowman snowman = turretIter.next(); - Player player = _turret.get(snowman); - - if (snowman.getTicksLived() > 400) - { - UtilParticle.PlayParticle(ParticleType.SNOWBALL_POOF, snowman.getLocation().add(0, 1, 0), 0.4f, 0.4f, 0.4f, 0, 12, - ViewDist.LONG, UtilServer.getPlayers()); - turretIter.remove(); - snowman.remove(); - continue; - } - - Player target = UtilPlayer.getClosest(snowman.getLocation(), player); - if (target == null) - continue; - - snowman.setTarget(target); - - //Snowball - double mult = 1 + Math.min(3, UtilMath.offset(snowman, target)/16); - double heightBonus = UtilMath.offset(snowman, target)/140; - Vector rand = new Vector((Math.random()-0.5)*0.2,(Math.random()-0.5)*0.2,(Math.random()-0.5)*0.2); - - _snowball.put(snowman.launchProjectile(Snowball.class, UtilAlg.getTrajectory(snowman.getLocation(), - target.getLocation()).multiply(mult).add(rand).add(new Vector(0,heightBonus,0))), player); - - //Look dir - UtilEnt.CreatureMoveFast(snowman, target.getLocation(), 0.1f); - - //Sound - snowman.getWorld().playSound(snowman.getLocation(), Sound.STEP_SNOW, 0.6f, 1f); - } - } - - @EventHandler(priority = EventPriority.LOW) - public void snowballHit(CustomDamageEvent event) - { - if (event.GetCause() != DamageCause.PROJECTILE) - return; - - Projectile proj = event.GetProjectile(); - if (proj == null) return; - - if (!(proj instanceof Snowball)) - return; - - if (!_snowball.containsKey(proj)) - return; - - LivingEntity damagee = event.GetDamageeEntity(); - if (damagee == null) return; - - event.SetCancelled("Turret"); - - if (damagee.equals(_snowball.get(proj))) - return; - - UtilAction.velocity(damagee, proj.getVelocity().multiply(0.3).add(new Vector(0, 0.3, 0))); - - //Damage Event - if (!(damagee instanceof LivingEntity)) - return; - - if (!Recharge.Instance.use((Player)damagee, GetName() + " Hit", 250, false, false)) - return; - - Manager.GetDamage().NewDamageEvent(damagee, _snowball.get(proj), null, - DamageCause.PROJECTILE, 2, false, true, false, - UtilEnt.getName(_snowball.get(proj)), GetName()); - } - - @EventHandler - public void damageCancel(CustomDamageEvent event) - { - if (_turret.containsKey(event.GetDamageeEntity())) - event.SetCancelled("Turret Immunity"); - } - - @EventHandler - public void clean(ProjectileHitEvent event) - { - _snowball.remove(event.getEntity()); - } - - @EventHandler - public void knockback(CustomDamageEvent event) - { - if (event.GetReason() == null || !event.GetReason().contains(GetName())) - return; - - event.AddKnockback(GetName(), 2.5); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpidersNest.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpidersNest.java deleted file mode 100644 index c31eac12b..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpidersNest.java +++ /dev/null @@ -1,120 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashMap; -import java.util.WeakHashMap; - -import org.bukkit.Sound; -import org.bukkit.block.Block; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; - -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; - -public class PerkSpidersNest extends SmashPerk -{ - private WeakHashMap _preHealth = new WeakHashMap(); - - public PerkSpidersNest() - { - super("Spider Nest", new String[] {}); - } - - @Override - public void addSuperCustom(Player player) - { - //Nest - HashMap blocks = UtilBlock.getInRadius(player.getLocation().getBlock(), 16); - - for (Block block : blocks.keySet()) - { - if (blocks.get(block) > 0.07) - continue; - - if (!UtilBlock.airFoliage(block)) - continue; - - if (block.getY() > player.getLocation().getY() + 10) - continue; - - if (block.getY() < player.getLocation().getY() - 10) - continue; - - Manager.GetBlockRestore().add(block, 30, (byte) 0, (long) (30000 + 5000 * Math.random())); - } - - //Regen - Manager.GetCondition().Factory().Regen(GetName(), player, player, 30, 0, false, false, false); - } - - @EventHandler(priority = EventPriority.HIGH) - public void damagePre(CustomDamageEvent event) - { - if (event.IsCancelled()) - return; - - if (event.GetCause() != DamageCause.ENTITY_ATTACK && - event.GetCause() != DamageCause.PROJECTILE && - event.GetCause() != DamageCause.CUSTOM) - return; - - Player damager = event.GetDamagerPlayer(true); - if (damager == null) - return; - - LivingEntity damagee = event.GetDamageeEntity(); - if (damagee == null) - return; - - if (!isSuperActive(damager)) - return; - - _preHealth.put(damagee, damagee.getHealth()); - } - - @EventHandler(priority = EventPriority.MONITOR) - public void damagePost(CustomDamageEvent event) - { - if (event.IsCancelled()) - return; - - Player damager = event.GetDamagerPlayer(true); - if (damager == null) - return; - - LivingEntity damagee = event.GetDamageeEntity(); - if (damagee == null) - return; - - if (!isSuperActive(damager)) - return; - - if (!_preHealth.containsKey(damagee)) - return; - - double diff = (_preHealth.remove(damagee) - damagee.getHealth())/2d; - - if (diff <= 0) - return; - - damager.setMaxHealth(Math.min(60, damager.getMaxHealth() + diff)); - damager.setHealth(damager.getHealth() + diff); - - UtilParticle.PlayParticle(ParticleType.HEART, damager.getLocation().add(0, 1, 0), 0, 0, 0, 0, 1, - ViewDist.LONG, UtilServer.getPlayers()); - - UtilParticle.PlayParticle(ParticleType.RED_DUST, damagee.getLocation().add(0, 1, 0), 0.4f, 0.4f, 0.4f, 0, 12, - ViewDist.LONG, UtilServer.getPlayers()); - - if (event.GetCause() == DamageCause.ENTITY_ATTACK) - damager.getWorld().playSound(damager.getLocation(), Sound.SPIDER_IDLE, 1.5f, 1f); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkStormSquid.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkStormSquid.java deleted file mode 100644 index 392e11c4f..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkStormSquid.java +++ /dev/null @@ -1,179 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.block.Block; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.block.Action; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.util.Vector; - -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashKit; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; - -public class PerkStormSquid extends SmashPerk -{ - public PerkStormSquid() - { - super("Storm Squid", new String[] - { - }, false); - } - - @Override - public void addSuperCustom(Player player) - { - - } - - @Override - public void removeSuperCustom(Player player) - { - player.setFlying(false); - } - - @EventHandler(priority = EventPriority.LOW) //Happen before activation of Super - public void lightningStrike(PlayerInteractEvent event) - { - final Player player = event.getPlayer(); - - if (!isSuperActive(player)) - return; - - if (event.getAction() == Action.PHYSICAL) - return; - - Block block = player.getTargetBlock((HashSet) null, 100); - if (block == null) - return; - - final Location loc = block.getLocation().add(0.5, 0.5, 0.5); - - if (!Recharge.Instance.use(player, GetName() + " Strike", 1600, false, false)) - return; - - //Warning - UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, loc.clone().add(0, 0.5, 0), 1f, 1f, 1f, 0.1f, 40, - ViewDist.MAX, UtilServer.getPlayers()); - UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, loc.clone().add(0, 0.5, 0), 0, 0, 0, 0, 1, - ViewDist.MAX, UtilServer.getPlayers()); - - Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable() - { - @Override - public void run() - { - //Warning - player.getWorld().spigot().strikeLightningEffect(loc, false); - - HashMap targets = UtilEnt.getInRadius(loc, 8); - for (LivingEntity cur : targets.keySet()) - { - if (cur.equals(player)) - continue; - - //Damage Event - Manager.GetDamage().NewDamageEvent(cur, player, null, - DamageCause.CUSTOM, 16 * targets.get(cur), false, true, false, - player.getName(), GetName()); - - //Velocity - UtilAction.velocity(cur, UtilAlg.getTrajectory(loc, cur.getLocation()), - 3 * targets.get(cur), false, 0, 1 * targets.get(cur), 2, true); - } - } - }, 10); - } - - @EventHandler(priority = EventPriority.LOWEST) - public void attackCancel(CustomDamageEvent event) - { - if (event.IsCancelled()) - return; - - Player player = event.GetDamagerPlayer(true); - if (player == null) - return; - - if (!isSuperActive(player)) - return; - - if (event.GetCause() != DamageCause.ENTITY_ATTACK) - return; - - event.SetCancelled("Wither Form Melee Cancel"); - } - - @EventHandler - public void flight(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - for (Player player : ((SmashKit)Kit).getSuperActive()) - { - if (player.isFlying()) - continue; - - player.setAllowFlight(true); - player.setFlying(true); - } - } - - @EventHandler - public void flightBump(UpdateEvent event) - { - if (event.getType() != UpdateType.FASTER) - return; - - for (Player player : ((SmashKit)Kit).getSuperActive()) - { - ArrayList collisions = new ArrayList(); - - //Bump - for (Block block : UtilBlock.getInRadius(player.getLocation().add(0, 0.5, 0), 1.5d).keySet()) - { - if (!UtilBlock.airFoliage(block)) - { - collisions.add(block.getLocation().add(0.5, 0.5, 0.5)); - } - } - - Vector vec = UtilAlg.getAverageBump(player.getLocation(), collisions); - - if (vec == null) - continue; - - UtilAction.velocity(player, vec, 0.6, false, 0, 0.4, 10, true); - } - } - - @EventHandler - public void knockback(CustomDamageEvent event) - { - if (event.GetReason() == null || !event.GetReason().contains(GetName())) - return; - - event.AddKnockback(GetName(), 3); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSuperSquid.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSuperSquid.java deleted file mode 100644 index 3d8fc7fa5..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSuperSquid.java +++ /dev/null @@ -1,136 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.bukkit.Sound; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerInteractEvent; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilItem; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; - -public class PerkSuperSquid extends SmashPerk -{ - - private static final long COOLDOWN = 8000; - private static final long VELOCITY_TIME = 1100; - - private Map _active = new HashMap<>(); - - public PerkSuperSquid() - { - super("Super Squid", new String[] { C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Super Squid", }); - } - - @EventHandler - public void Activate(PlayerInteractEvent event) - { - if (event.isCancelled()) - { - return; - } - - if (!UtilEvent.isAction(event, ActionType.R)) - { - return; - } - - if (UtilBlock.usable(event.getClickedBlock())) - { - return; - } - - Player player = event.getPlayer(); - - if (!UtilItem.isSword(player.getItemInHand())) - { - return; - } - - if (!hasPerk(player)) - { - return; - } - - if (isSuperActive(player)) - { - return; - } - - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) - { - return; - } - - _active.put(player.getUniqueId(), System.currentTimeMillis()); - - UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); - } - - @EventHandler - public void Update(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - { - return; - } - - for (Player cur : UtilServer.getPlayers()) - { - if (!_active.containsKey(cur.getUniqueId())) - { - continue; - } - - if (isSuperActive(cur)) - { - continue; - } - - if (!cur.isBlocking()) - { - _active.remove(cur.getUniqueId()); - continue; - } - - if (UtilTime.elapsed(_active.get(cur.getUniqueId()), VELOCITY_TIME)) - { - _active.remove(cur.getUniqueId()); - continue; - } - - UtilAction.velocity(cur, 0.6, 0.1, 1, true); - - cur.getWorld().playSound(cur.getLocation(), Sound.SPLASH2, 0.5f, 1f); - UtilParticle.PlayParticle(ParticleType.SPLASH, cur.getLocation().add(0, 0.5, 0), 0.3f, 0.3f, 0.3f, 0, 60, ViewDist.LONG, UtilServer.getPlayers()); - } - } - - @EventHandler - public void DamageCancel(CustomDamageEvent event) - { - if (_active.containsKey(event.GetDamageeEntity().getUniqueId())) - { - event.SetCancelled("Super Squid"); - } - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWebShot.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWebShot.java deleted file mode 100644 index c5955f148..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWebShot.java +++ /dev/null @@ -1,131 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.block.Block; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.util.Vector; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.projectile.IThrown; -import mineplex.core.projectile.ProjectileUser; -import mineplex.core.recharge.Recharge; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; - -public class PerkWebShot extends SmashPerk implements IThrown -{ - public PerkWebShot() - { - super("Spin Web", new String[] - { - C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Spin Web" - }); - } - - - @EventHandler - public void ShootWeb(PlayerInteractEvent event) - { - if (event.isCancelled()) - return; - - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) - return; - - if (UtilBlock.usable(event.getClickedBlock())) - return; - - if (event.getPlayer().getItemInHand() == null) - return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) - return; - - Player player = event.getPlayer(); - - if (!Kit.HasKit(player)) - return; - - if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? 1000 : 10000, !isSuperActive(player), !isSuperActive(player))) - return; - - event.setCancelled(true); - - //Boost - UtilAction.velocity(player, 1.2, 0.2, 1.2, true); - - for (int i=0 ; i<20 ; i++) - { - org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getLocation().add(0, 0.5, 0), - ItemStackFactory.Instance.CreateStack(Material.WEB, (byte)0, 1, "Web " + player.getName() + " " + i)); - - Vector random = new Vector(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5); - random.normalize(); - random.multiply(0.2); - - UtilAction.velocity(ent, player.getLocation().getDirection().multiply(-1).add(random), 1 + Math.random() * 0.4, false, 0, 0.2, 10, false); - Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true, 0.5f); - } - - //Inform - UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); - - //Effect - player.getWorld().playSound(player.getLocation(), Sound.SPIDER_IDLE, 2f, 0.6f); - } - - @Override - public void Collide(LivingEntity target, Block block, ProjectileUser data) - { - if (target != null) - { - data.getThrown().remove(); - - Manager.GetBlockRestore().add(target.getLocation().getBlock(), 30, (byte) 0, 3000); - - //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, - DamageCause.PROJECTILE, 6, false, false, false, - UtilEnt.getName(data.getThrower()), GetName()); - - UtilAction.zeroVelocity(target); - - return; - } - - Web(data); - } - - @Override - public void Idle(ProjectileUser data) - { - Web(data); - } - - @Override - public void Expire(ProjectileUser data) - { - Web(data); - } - - public void Web(ProjectileUser data) - { - Location loc = data.getThrown().getLocation(); - data.getThrown().remove(); - - if (data.getThrown().getTicksLived() > 3) - Manager.GetBlockRestore().add(loc.getBlock(), 30, (byte) 0, 2000); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitchPotion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitchPotion.java deleted file mode 100644 index 4b7ac44aa..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitchPotion.java +++ /dev/null @@ -1,175 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.ArrayList; -import java.util.Iterator; - -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Projectile; -import org.bukkit.entity.ThrownPotion; -import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; -import org.bukkit.event.entity.ProjectileHitEvent; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.player.PlayerInteractEvent; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; - -public class PerkWitchPotion extends SmashPerk -{ - private ArrayList _proj = new ArrayList(); - - public PerkWitchPotion() - { - super("Daze Potion", new String[] - { - C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Daze Potion" - }); - } - - - @EventHandler - public void Activate(PlayerInteractEvent event) - { - if (event.isCancelled()) - return; - - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) - return; - - if (UtilBlock.usable(event.getClickedBlock())) - return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) - return; - - Player player = event.getPlayer(); - - if (isSuperActive(player)) - return; - - if (!Kit.HasKit(player)) - return; - - if (!Recharge.Instance.use(player, GetName(), 2000, true, true)) - return; - - //Start - ThrownPotion potion = player.launchProjectile(ThrownPotion.class); - UtilAction.velocity(potion, player.getLocation().getDirection(), 1, false, 0, 0.2, 10, false); - - _proj.add(potion); - - //Inform - UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); - } - - @EventHandler - public void Hit(ProjectileHitEvent event) - { - if (!_proj.remove(event.getEntity())) - return; - - for (Player player : Manager.GetGame().GetPlayers(true)) - { - if (player.equals(event.getEntity().getShooter())) - continue; - - if (!(event.getEntity().getShooter() instanceof Player)) - continue; - - Player thrower = (Player)event.getEntity().getShooter(); - - double range = 3; - if (isSuperActive(thrower)) - range = 4; - - if (UtilMath.offset(player.getLocation().add(0,1,0), event.getEntity().getLocation()) > range) - continue; - - //Standard - if (!isSuperActive(thrower)) - { - //Damage Event - Manager.GetDamage().NewDamageEvent(player, thrower, null, - DamageCause.CUSTOM, 7, true, true, false, - UtilEnt.getName((LivingEntity)event.getEntity().getShooter()), GetName()); - - Manager.GetCondition().Factory().Slow("Witch Potion", player, null, 3, 1, true, false, false, false); - } - //Super Effect - else - { - //Bonus Damage - double bonus = 5; - - //Damage Event - Manager.GetDamage().NewDamageEvent(player, thrower, null, - DamageCause.CUSTOM, 5 + bonus, true, true, false, - UtilEnt.getName((LivingEntity)event.getEntity().getShooter()), GetName()); - - Manager.GetCondition().Factory().Slow("Witch Potion", player, null, 7, 2, true, false, false, false); - //Manager.GetCondition().Factory().Confuse(reason, ent, source, duration, mult, extend, showIndicator, ambient) - } - } - } - - @EventHandler - public void Update(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - Iterator potionIterator = _proj.iterator(); - - while (potionIterator.hasNext()) - { - Projectile proj = potionIterator.next(); - - if (!proj.isValid()) - { - potionIterator.remove(); - continue; - } - - UtilParticle.PlayParticle(ParticleType.MOB_SPELL, proj.getLocation(), 0, 0, 0, 0, 1, - ViewDist.LONGER, UtilServer.getPlayers()); - - //Super - if (!(proj.getShooter() instanceof Player)) - continue; - - Player thrower = (Player)proj.getShooter(); - - //Super Effect - if (!isSuperActive(thrower)) - { - //XXX - } - } - } - - @EventHandler - public void Knockback(CustomDamageEvent event) - { - if (event.GetReason() == null || !event.GetReason().contains(GetName())) - return; - - event.AddKnockback(GetName(), 2); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherForm.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherForm.java deleted file mode 100644 index cdebce00e..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherForm.java +++ /dev/null @@ -1,134 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.ArrayList; - -import org.bukkit.Location; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.entity.Skeleton.SkeletonType; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.util.Vector; - -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.disguise.disguises.DisguiseSkeleton; -import mineplex.core.disguise.disguises.DisguiseWither; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashKit; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; - -public class PerkWitherForm extends SmashPerk -{ - public PerkWitherForm() - { - super("Wither Form", new String[] - { - }, false); - } - - @Override - public void addSuperCustom(Player player) - { - Manager.GetDisguise().undisguise(player); - - //Disguise - DisguiseWither disguise = new DisguiseWither(player); - - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else - disguise.setName(player.getName()); - - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); - } - - @Override - public void removeSuperCustom(Player player) - { - Manager.GetDisguise().undisguise(player); - - //Disguise - DisguiseSkeleton disguise = new DisguiseSkeleton(player); - - if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else - disguise.setName(player.getName()); - - disguise.setCustomNameVisible(true); - disguise.SetSkeletonType(SkeletonType.WITHER); - disguise.hideArmor(); - Manager.GetDisguise().disguise(disguise); - - player.setFlying(false); - } - - @EventHandler - public void witherBump(UpdateEvent event) - { - if (event.getType() != UpdateType.FASTER) - return; - - for (Player player : ((SmashKit)Kit).getSuperActive()) - { - ArrayList collisions = new ArrayList(); - - //Bump - for (Block block : UtilBlock.getInRadius(player.getLocation().add(0, 0.5, 0), 1.5d).keySet()) - { - if (!UtilBlock.airFoliage(block)) - { - collisions.add(block.getLocation().add(0.5, 0.5, 0.5)); - } - } - - Vector vec = UtilAlg.getAverageBump(player.getLocation(), collisions); - - if (vec == null) - continue; - - UtilAction.velocity(player, vec, 0.6, false, 0, 0.4, 10, true); - } - } - - @EventHandler(priority = EventPriority.LOWEST) - public void witherMeleeCancel(CustomDamageEvent event) - { - if (event.IsCancelled()) - return; - - Player player = event.GetDamagerPlayer(true); - if (player == null) - return; - - if (!isSuperActive(player)) - return; - - if (event.GetCause() != DamageCause.ENTITY_ATTACK) - return; - - event.SetCancelled("Wither Form Melee Cancel"); - } - - @EventHandler - public void witherFlight(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - for (Player player : ((SmashKit)Kit).getSuperActive()) - { - if (player.isFlying()) - continue; - - player.setAllowFlight(true); - player.setFlying(true); - } - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java deleted file mode 100644 index d43939c46..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java +++ /dev/null @@ -1,226 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashMap; -import java.util.Iterator; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.TeamSuperSmash; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; - -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Skeleton; -import org.bukkit.entity.Skeleton.SkeletonType; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.block.Action; -import org.bukkit.event.entity.EntityTargetEvent; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.player.PlayerInteractEvent; - -public class PerkWitherImage extends SmashPerk -{ - private HashMap _ownerToSkeleton = new HashMap(); - private HashMap _skeletonToOwner = new HashMap(); - - public PerkWitherImage() - { - super("Wither Image", new String[] - { - C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Wither Image", - C.cYellow + "Double Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Wither Swap" - }); - } - - @EventHandler - public void activate(PlayerInteractEvent event) - { - if (event.isCancelled()) - return; - - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) - return; - - if (UtilBlock.usable(event.getClickedBlock())) - return; - - if (event.getPlayer().getItemInHand() == null) - return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) - return; - - Player player = event.getPlayer(); - - if (isSuperActive(player)) - return; - - if (!Kit.HasKit(player)) - return; - - if (!_ownerToSkeleton.containsKey(player)) - { - if (!Recharge.Instance.use(player, GetName(), 12000, true, true)) - return; - - //Spawn - Manager.GetGame().CreatureAllowOverride = true; - Skeleton skel = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Skeleton.class); - Manager.GetGame().CreatureAllowOverride = false; - - skel.setSkeletonType(SkeletonType.WITHER); - - skel.getEquipment().setItemInHand(player.getItemInHand()); - skel.setMaxHealth(20); - skel.setHealth(skel.getMaxHealth()); - - if (Manager.GetGame().GetTeamList().size() > 1) - skel.setCustomName(Manager.GetColor(player) + player.getName()); - else - skel.setCustomName(C.cYellow + player.getName()); - - skel.setCustomNameVisible(true); - - //skel.setLeashHolder(player); - - UtilAction.velocity(skel, player.getLocation().getDirection(), 1.6, false, 0, 0.2, 10, true); - - _ownerToSkeleton.put(player, skel); - _skeletonToOwner.put(skel, player); - - Recharge.Instance.use(player, "Wither Swap", 500, false, false); - - //Sound - player.getWorld().playSound(player.getLocation(), Sound.WITHER_SPAWN, 1f, 1f); - - //Inform - UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); - } - else - { - if (!Recharge.Instance.use(player, "Wither Swap", 2000, true, false)) - return; - - Skeleton skel = _ownerToSkeleton.get(player); - - Location loc = skel.getLocation(); - skel.teleport(player.getLocation()); - player.teleport(loc); - - //Sound - player.getWorld().playSound(player.getLocation(), Sound.WITHER_SPAWN, 1f, 2f); - - //Inform - UtilPlayer.message(player, F.main("Game", "You used " + F.skill("Wither Swap") + ".")); - } - } - - @EventHandler - public void entityTarget(EntityTargetEvent event) - { - if (_skeletonToOwner.containsKey(event.getEntity())) - { - if (Manager.GetGame() instanceof TeamSuperSmash && event.getTarget() instanceof Player) - { - TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); - Player targetPlayer = (Player) event.getTarget(); - - if(smash.GetTeam(_skeletonToOwner.get(event.getEntity())).equals(smash.GetTeam(targetPlayer))) - { - event.setCancelled(true); - } - } - if (_ownerToSkeleton.get(event.getTarget()).equals(event.getEntity())) - { - event.setCancelled(true); - } - } - } - - @EventHandler - public void damage(CustomDamageEvent event) - { - Player damagee = event.GetDamageePlayer(); - if (damagee == null) return; - - if (!_ownerToSkeleton.containsKey(damagee.getUniqueId())) - return; - - LivingEntity damager = event.GetDamagerEntity(false); - if (damager == null) return; - - if (_ownerToSkeleton.get(damagee.getUniqueId()).equals(damager)) - event.SetCancelled("Wither Image"); - } - - @EventHandler(priority = EventPriority.HIGHEST) - public void minionDamageTransfer(CustomDamageEvent event) - { - LivingEntity damager = event.GetDamagerEntity(true); - if (damager == null) return; - - if (!_ownerToSkeleton.containsValue(damager)) - return; - - for (Player player : _ownerToSkeleton.keySet()) - { - if (_ownerToSkeleton.get(player).equals(damager)) - { - event.SetDamager(player); - event.setKnockbackOrigin(damager.getLocation()); - event.AddMod(GetName(), "Wither Image", -5.5, true); - } - } - } - - @EventHandler - public void update(UpdateEvent event) - { - if (event.getType() != UpdateType.FAST) - return; - - Iterator playerIterator = _ownerToSkeleton.keySet().iterator(); - - while (playerIterator.hasNext()) - { - Player player = playerIterator.next(); - Skeleton skel = _ownerToSkeleton.get(player); - - if (!player.isValid() || !skel.isValid() || skel.getTicksLived() > 160 || UtilBlock.liquid(skel.getLocation().getBlock())) - { - //Effect - Manager.GetBlood().Effects(null, skel.getLocation().add(0, 0.5, 0), 12, 0.3, Sound.WITHER_HURT, 1f, 0.75f, Material.BONE, (byte)0, 40, false); - - playerIterator.remove(); - skel.remove(); - continue; - } - } - } - - @EventHandler(priority = EventPriority.LOWEST) - public void clean(PlayerDeathEvent event) - { - Skeleton skel = _ownerToSkeleton.remove(event.getEntity()); - _skeletonToOwner.remove(skel); - - if (skel != null) - { - //Effect - Manager.GetBlood().Effects(null, skel.getLocation().add(0, 0.5, 0), 12, 0.3, Sound.WITHER_HURT, 1f, 0.75f, Material.BONE, (byte)0, 40, false); - - skel.remove(); - } - } - -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherSkull.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherSkull.java deleted file mode 100644 index 086732aeb..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherSkull.java +++ /dev/null @@ -1,215 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; - -import org.bukkit.Location; -import org.bukkit.Sound; -import org.bukkit.entity.Entity; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.WitherSkull; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.block.Action; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.entity.EntityExplodeEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.util.Vector; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; - -public class PerkWitherSkull extends SmashPerk -{ - private HashMap _active = new HashMap(); - private HashSet _ignoreControl = new HashSet(); - - public PerkWitherSkull() - { - super("Wither Skull", new String[] - { - C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Wither Skull" - }); - } - - - @EventHandler(priority = EventPriority.LOW) // Happen BEFORE super is triggered - public void activate(PlayerInteractEvent event) - { - if (event.isCancelled()) - return; - - Player player = event.getPlayer(); - - if (!isSuperActive(player)) - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) - return; - - if (UtilBlock.usable(event.getClickedBlock())) - return; - - if (!isSuperActive(player)) - if (!event.getPlayer().getItemInHand().getType().toString().contains("_SWORD")) - return; - - if (!Kit.HasKit(player)) - return; - - if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? 1000 : 6000, !isSuperActive(player), !isSuperActive(player))) - return; - - //Fire - WitherSkull skull = player.launchProjectile(WitherSkull.class); - - if (!isSuperActive(player)) - skull.setDirection(player.getLocation().getDirection()); - - _active.put(skull, player.getLocation().getDirection().multiply(0.6)); - - //Sound - player.getWorld().playSound(player.getLocation(), Sound.WITHER_SHOOT, 1f, 1f); - - //Inform - if (!isSuperActive(player)) - UtilPlayer.message(player, F.main("Skill", "You launched " + F.skill(GetName()) + ".")); - - //Control - if (!isSuperActive(player)) - _ignoreControl.remove(player); - else - _ignoreControl.add(player); - } - - @EventHandler - public void cleanAndControl(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - Iterator skullIterator = _active.keySet().iterator(); - - while (skullIterator.hasNext()) - { - WitherSkull skull = skullIterator.next(); - Player player = (Player)skull.getShooter(); - - if (!skull.isValid()) - { - skullIterator.remove(); - skull.remove(); - continue; - } - - if (_ignoreControl.contains(player)) - continue; - - if (player.isBlocking() && !_ignoreControl.contains(player)) - { - skull.setDirection(player.getLocation().getDirection()); - skull.setVelocity(player.getLocation().getDirection().multiply(0.6)); - _active.put(skull, player.getLocation().getDirection().multiply(0.6)); - } - else - { - _ignoreControl.add(player); - skull.setDirection(_active.get(skull)); - skull.setVelocity(_active.get(skull)); - } - } - } - - @EventHandler - public void explode(EntityExplodeEvent event) - { - if (!_active.containsKey(event.getEntity())) - return; - - event.setCancelled(true); - - WitherSkull skull = (WitherSkull)event.getEntity(); - - UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, skull.getLocation(), 0, 0, 0, 0, 1, - ViewDist.MAX, UtilServer.getPlayers()); - - explode(skull, event.getLocation(), (LivingEntity)skull.getShooter()); - } - - @EventHandler(priority = EventPriority.LOWEST) - public void explodeDamage(CustomDamageEvent event) - { - if (event.IsCancelled()) - return; - - if (event.GetProjectile() != null && event.GetProjectile() instanceof WitherSkull) - event.SetCancelled("Wither Skull Cancel"); - } - - //Sometimes wither skulls do entity attack damage (non-explosion)... cancel it! - @EventHandler(priority = EventPriority.LOWEST) - public void directHitDamageCancel(CustomDamageEvent event) - { - if (event.IsCancelled()) - return; - - if (event.GetCause() != DamageCause.ENTITY_ATTACK) - return; - - if (event.GetDamageInitial() != 7) - return; - - Player damager = event.GetDamagerPlayer(false); - if (damager == null) return; - - if (!Kit.HasKit(damager)) - return; - - if (!Manager.IsAlive(damager)) - return; - - event.SetCancelled("Wither Skull Direct Hit"); - } - - private void explode(WitherSkull skull, Location loc, LivingEntity shooter) - { - double scale = 0.4 + 0.6 * Math.min(1, skull.getTicksLived()/20d); - - //Players - HashMap players = UtilPlayer.getInRadius(skull.getLocation(), 6); - for (Player player : players.keySet()) - { - if (!Manager.GetGame().IsAlive(player)) - continue; - - //Damage Event - Manager.GetDamage().NewDamageEvent(player, (LivingEntity)skull.getShooter(), null, - DamageCause.CUSTOM, 12 * players.get(player) * scale, true, true, false, - UtilEnt.getName((LivingEntity)skull.getShooter()), GetName()); - } - } - - @EventHandler - public void knockback(CustomDamageEvent event) - { - if (event.GetReason() == null || !event.GetReason().contains(GetName())) - return; - - event.AddKnockback(GetName(), 1.5); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java deleted file mode 100644 index c11724c09..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java +++ /dev/null @@ -1,436 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; - -import org.bukkit.Effect; -import org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Wolf; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.block.Action; -import org.bukkit.event.entity.EntityTargetEvent; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.util.Vector; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.updater.UpdateType; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; -import net.minecraft.server.v1_8_R3.EntityCreature; -import net.minecraft.server.v1_8_R3.Navigation; -import net.minecraft.server.v1_8_R3.NavigationAbstract; - -public class PerkWolf extends SmashPerk -{ - private HashMap _owner = new HashMap(); - private HashMap _tackle = new HashMap(); - - private HashMap _strike = new HashMap(); - - private HashMap> _repeat = new HashMap>(); - - private HashMap _tackleStrike = new HashMap(); - - public PerkWolf() - { - super("Wolf Skills", new String[] - { - C.cGray + "Attacks give +1 Damage for 3 seconds. Stacks.", - C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Cub Tackle", - C.cYellow + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + "Wolf Strike", - C.cGray + "Wolf Strike deals 300% Knockback to tackled opponents.", - }); - } - - @EventHandler - public void TackleTrigger(PlayerInteractEvent event) - { - if (event.isCancelled()) - return; - - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) - return; - - if (UtilBlock.usable(event.getClickedBlock())) - return; - - if (event.getPlayer().getItemInHand() == null) - return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) - return; - - Player player = event.getPlayer(); - - if (!Kit.HasKit(player)) - return; - - if (!Recharge.Instance.use(player, "Cub Tackle", isSuperActive(player) ? 1600 : 8000, !isSuperActive(player), !isSuperActive(player))) - return; - - //Get Nearest Wolf - Manager.GetGame().CreatureAllowOverride = true; - Wolf wolf = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Wolf.class); - Manager.GetGame().CreatureAllowOverride = false; - - wolf.setBaby(); - - wolf.setAngry(true); - - UtilEnt.Vegetate(wolf); - - wolf.setMaxHealth(30); - wolf.setHealth(wolf.getMaxHealth()); - - UtilAction.velocity(wolf, player.getLocation().getDirection(), 1.8, false, 0, 0.2, 1.2, true); - - player.getWorld().playSound(wolf.getLocation(), Sound.WOLF_BARK, 1f, 1.8f); - - //Record - _owner.put(wolf, player); - - //Inform - UtilPlayer.message(player, F.main("Game", "You used " + F.skill("Cub Tackle") + ".")); - } - - @EventHandler - public void TackleCollide(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - //Collide - Iterator wolfIterator = _owner.keySet().iterator(); - - while (wolfIterator.hasNext()) - { - Wolf wolf = wolfIterator.next(); - - //Hit Player - for (Player other : Manager.GetGame().GetPlayers(true)) - if (!Manager.isSpectator(other)) - if (UtilEnt.hitBox(wolf.getLocation(), other, 2.5, null)) - { - if (other.equals(TackleGetOwner(wolf))) - continue; - - TackleCollideAction(TackleGetOwner(wolf), other, wolf); - wolfIterator.remove(); - return; - } - - if (!wolf.isValid() ||( UtilEnt.isGrounded(wolf) && wolf.getTicksLived() > 20)) - { - wolf.remove(); - wolfIterator.remove(); - } - } - } - - public void TackleCollideAction(Player damager, LivingEntity damagee, Wolf wolf) - { - if (damager == null) - return; - - _tackle.put(wolf, damagee); - - wolf.setVelocity(new Vector(0,-0.6,0)); - UtilAction.zeroVelocity(damagee); - - //Damage - Manager.GetDamage().NewDamageEvent(damagee, damager, null, - DamageCause.CUSTOM, 5, false, true, false, - damager.getName(), "Cub Tackle"); - - //Sound - damagee.getWorld().playSound(damagee.getLocation(), Sound.WOLF_GROWL, 1.5f, 1.5f); - - //Inform - UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill("Cub Tackle") + ".")); - UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill("Cub Tackle") + ".")); - } - - @EventHandler - public void TackleUpdate(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - Iterator wolfIterator = _tackle.keySet().iterator(); - - while (wolfIterator.hasNext()) - { - Wolf wolf = wolfIterator.next(); - LivingEntity ent = _tackle.get(wolf); - - if (!wolf.isValid() || !ent.isValid() || wolf.getTicksLived() > 70) - { - wolf.remove(); - wolfIterator.remove(); - continue; - } - - if (UtilMath.offset(wolf, ent) < 2.5) - { - Manager.GetCondition().Factory().Slow("Cub Table", ent, wolf, 0.9, 1, false, false, false, false); - UtilAction.velocity(ent, new Vector(0,-0.3,0)); - } - - //Move - Location loc = ent.getLocation(); - loc.add(UtilAlg.getTrajectory2d(ent, wolf).multiply(1)); - - EntityCreature ec = ((CraftCreature)wolf).getHandle(); - NavigationAbstract nav = ec.getNavigation(); - nav.a(loc.getX(), loc.getY(), loc.getZ(), 1); - } - } - - public Player TackleGetOwner(Wolf wolf) - { - if (_owner.containsKey(wolf)) - return _owner.get(wolf); - - return null; - } - - @EventHandler - public void TackleTargetCancel(EntityTargetEvent event) - { - if (_owner.containsKey(event.getEntity())) - if (_owner.get(event.getEntity()).equals(event.getTarget())) - event.setCancelled(true); - } - - @EventHandler - public void TackleDamage(CustomDamageEvent event) - { - if (event.GetCause() != DamageCause.ENTITY_ATTACK) - return; - - LivingEntity damager = event.GetDamagerEntity(false); - if (damager == null) return; - - if (damager instanceof Wolf) - event.SetCancelled("Wolf Cub"); - } - - @EventHandler - public void StrikeTrigger(PlayerInteractEvent event) - { - if (event.isCancelled()) - return; - - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) - return; - - if (UtilBlock.usable(event.getClickedBlock())) - return; - - if (event.getPlayer().getItemInHand() == null) - return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_SPADE")) - return; - - Player player = event.getPlayer(); - - if (!Kit.HasKit(player)) - return; - - if (!Recharge.Instance.use(player, "Wolf Strike", isSuperActive(player) ? 1600 : 8000, !isSuperActive(player), !isSuperActive(player))) - return; - - //Velocity - UtilAction.velocity(player, player.getLocation().getDirection(), 1.6, false, 1, 0.2, 1.2, true); - - //Record - _strike.put(player, System.currentTimeMillis()); - - player.getWorld().playSound(player.getLocation(), Sound.WOLF_BARK, 1f, 1.2f); - - //Inform - UtilPlayer.message(player, F.main("Game", "You used " + F.skill("Wolf Strike") + ".")); - } - - @EventHandler - public void StrikeEnd(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - //Collide - Iterator playerIterator = _strike.keySet().iterator(); - - while (playerIterator.hasNext()) - { - Player player = playerIterator.next(); - - for (Player other : Manager.GetGame().GetPlayers(true)) - if (!player.equals(other)) - if (!Manager.isSpectator(other)) - if (UtilEnt.hitBox(player.getLocation().add(0, 1, 0), other, 2, null)) - { - StrikeHit(player, other); - playerIterator.remove(); - return; - } - - if (!UtilEnt.isGrounded(player)) - continue; - - if (!UtilTime.elapsed(_strike.get(player), 1500)) - continue; - - playerIterator.remove(); - } - } - - public void StrikeHit(Player damager, LivingEntity damagee) - { - UtilAction.zeroVelocity(damager); - - //Remove Tackle - Iterator wolfIterator = _tackle.keySet().iterator(); - while (wolfIterator.hasNext()) - { - Wolf wolf = wolfIterator.next(); - - if (_tackle.get(wolf).equals(damagee)) - { - wolf.remove(); - wolfIterator.remove(); - - _tackleStrike.put(damagee, System.currentTimeMillis()); - } - } - - Manager.GetDamage().NewDamageEvent(damagee, damager, null, - DamageCause.CUSTOM, 7, true, true, false, - damager.getName(), "Wolf Strike"); - - - //Sound - damagee.getWorld().playSound(damagee.getLocation(), Sound.WOLF_BARK, 1.5f, 1f); - - //Inform - UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill("Wolf Strike") + ".")); - UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill("Wolf Strike") + ".")); - } - - @EventHandler - public void StrikeKnockback(CustomDamageEvent event) - { - if (event.GetReason() != null && event.GetReason().contains("Wolf Strike")) - { - if (_tackleStrike.containsKey(event.GetDamageeEntity()) && !UtilTime.elapsed(_tackleStrike.get(event.GetDamageeEntity()), 100)) - { - event.AddKnockback(GetName(), 3.0); - - //Blood - event.GetDamageeEntity().getWorld().playEffect(event.GetDamageeEntity().getLocation(), Effect.STEP_SOUND, 55); - - //Double Sound - event.GetDamageeEntity().getWorld().playSound(event.GetDamageeEntity().getLocation(), Sound.WOLF_BARK, 2f, 1.5f); - } - else - { - event.AddKnockback(GetName(), 1.5); - } - } - } - - @EventHandler(priority = EventPriority.HIGHEST) - public void RepeatDamage(CustomDamageEvent event) - { - if (event.IsCancelled()) - return; - - if (event.GetCause() != DamageCause.ENTITY_ATTACK) - return; - - Player damager = event.GetDamagerPlayer(false); - if (damager == null) return; - - if (!Kit.HasKit(damager)) - return; - - if (!_repeat.containsKey(damager)) - { - _repeat.put(damager, new ArrayList()); - _repeat.get(damager).add(System.currentTimeMillis()); - - //Exp - damager.setExp(Math.min(0.9999f, _repeat.get(damager).size()/9f)); - - return; - } - - int count = _repeat.get(damager).size(); - - if (count > 0) - { - event.AddMod(damager.getName(), "Ravage", Math.min(2, count), false); - - //Sound - damager.getWorld().playSound(damager.getLocation(), Sound.WOLF_BARK, (float)(0.5 + count*0.25), (float)(1 + count*0.25)); - } - - _repeat.get(damager).add(System.currentTimeMillis()); - - //Exp - damager.setExp(Math.min(0.9999f, _repeat.get(damager).size()/9f)); - } - - @EventHandler - public void RepeatExpire(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - Iterator playerIterator = _repeat.keySet().iterator(); - - while (playerIterator.hasNext()) - { - Player player = playerIterator.next(); - - Iterator timeIterator = _repeat.get(player).iterator(); - - while (timeIterator.hasNext()) - { - long time = timeIterator.next(); - - if (UtilTime.elapsed(time, 3000)) - timeIterator.remove(); - } - - //Exp - player.setExp(Math.min(0.9999f, _repeat.get(player).size()/9f)); - } - } - - @Override - public void addSuperCustom(Player player) - { - Recharge.Instance.recharge(player, "Wolf Strike"); - Recharge.Instance.recharge(player, "Cub Tackle"); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java deleted file mode 100644 index 23dbc93d5..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java +++ /dev/null @@ -1,173 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashMap; -import java.util.Iterator; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.projectile.IThrown; -import mineplex.core.projectile.ProjectileUser; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; - -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.block.Block; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.util.Vector; - -public class PerkZombieBile extends SmashPerk implements IThrown -{ - private HashMap _active = new HashMap(); - - public PerkZombieBile() - { - super("Spew Bile", new String[] - { - C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Spew Bile" - }); - } - - @EventHandler - public void activate(PlayerInteractEvent event) - { - if (event.isCancelled()) - return; - - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) - return; - - if (UtilBlock.usable(event.getClickedBlock())) - return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) - return; - - Player player = event.getPlayer(); - - if (!Kit.HasKit(player)) - return; - - if (!Recharge.Instance.use(player, GetName(), 10000, true, true)) - return; - - _active.put(player, System.currentTimeMillis()); - - UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); - } - - @EventHandler - public void deactivateDeath(PlayerDeathEvent event) - { - if (!Manager.GetGame().IsLive()) - return; - - if (!Kit.HasKit(event.getEntity())) - return; - - if (_active.containsKey(event.getEntity())) - { - _active.remove(event.getEntity()); - } - } - - @EventHandler - public void update(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - Iterator activeIter = _active.keySet().iterator(); - - while (activeIter.hasNext()) - { - Player player = activeIter.next(); - - //Expire - if (UtilTime.elapsed(_active.get(player), 2000)) - { - activeIter.remove(); - continue; - } - - //Sound - if (Math.random() > 0.85) - player.getWorld().playSound(player.getLocation(), Sound.BURP, 1f, (float)(Math.random() + 0.5)); - - //Projectiles - for (int i=0 ; i<3 ; i++) - { - Vector rand = new Vector((Math.random()-0.5)*0.525,(Math.random()-0.5)*0.525,(Math.random()-0.5)*0.525); - - org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()).subtract(0, 0.5, 0), ItemStackFactory.Instance.CreateStack(Material.ROTTEN_FLESH)); - UtilAction.velocity(ent, player.getLocation().getDirection().add(rand), 0.8, false, 0, 0.2, 10, false); - Manager.GetProjectile().AddThrow(ent, player, this, System.currentTimeMillis() + 2000, true, true, true, false, 0.5f); - } - } - } - - @EventHandler - public void death(PlayerDeathEvent event) - { - if (_active.containsKey(event.getEntity())) - { - _active.remove(event.getEntity()); - } - } - - @Override - public void Collide(LivingEntity target, Block block, ProjectileUser data) - { - data.getThrown().remove(); - - if (target == null) - return; - - if (target instanceof Player) - if (!Manager.GetGame().IsAlive((Player)target)) - return; - - //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, - DamageCause.CUSTOM, 3, true, false, false, - UtilEnt.getName(data.getThrower()), GetName()); - - data.getThrown().remove(); - } - - @Override - public void Idle(ProjectileUser data) - { - data.getThrown().remove(); - } - - @Override - public void Expire(ProjectileUser data) - { - data.getThrown().remove(); - } - - @EventHandler - public void Knockback(CustomDamageEvent event) - { - if (event.GetReason() == null || !event.GetReason().contains(GetName())) - return; - - event.AddKnockback(GetName(), 1); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieNightDead.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieNightDead.java deleted file mode 100644 index 8c41a4576..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieNightDead.java +++ /dev/null @@ -1,15 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; - -public class PerkZombieNightDead extends SmashPerk -{ - - public PerkZombieNightDead() - { - super("Night of the Dead", new String[] - { - }, false); - } - -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieRot.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieRot.java deleted file mode 100644 index 87e8b8d0d..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieRot.java +++ /dev/null @@ -1,66 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashMap; - -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; - -public class PerkZombieRot extends SmashPerk -{ - public PerkZombieRot() - { - super("Rot", new String[] - { - C.cGray + "Leave a path that slows and prevents jumping.", - }); - } - - @EventHandler - public void SnowAura(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - for (Player player : Manager.GetGame().GetPlayers(true)) - { - if (!Kit.HasKit(player)) - continue; - - //Blocks - HashMap blocks = UtilBlock.getInRadius(player.getLocation(), 3); - for (Block block : blocks.keySet()) - { - if (UtilBlock.solid(block.getRelative(BlockFace.UP))) - continue; - - if (!UtilBlock.solid(block)) - continue; - - //Snow - Manager.GetBlockRestore().add(block, 159, (byte) 12, 3000); - } - } - - for (Player player : Manager.GetGame().GetPlayers(true)) - { - if (Kit.HasKit(player)) - continue; - - if (player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() != Material.STAINED_CLAY || - player.getLocation().getBlock().getRelative(BlockFace.DOWN).getData() != 12) - continue; - - Manager.GetCondition().Factory().Slow(GetName(), player, null, 1.9, 1, false, false, false, false); - Manager.GetCondition().Factory().Jump(GetName(), player, null, 1.9, 244, false, false, false); - } - } -} From 96e1e944e1da259bf04eb19907aeb80e597409d6 Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 25 Sep 2016 22:32:23 +0100 Subject: [PATCH 007/147] Addition of the GWEN kit and a billion other things --- .../arcade/game/games/smash/SuperSmash.java | 41 ++- .../game/games/smash/kits/KitGuardian.java | 81 ++++++ .../game/games/smash/kits/KitMagmaCube.java | 6 +- .../arcade/game/games/smash/kits/KitPig.java | 4 +- .../game/games/smash/kits/KitSkeleton.java | 20 ++ .../game/games/smash/kits/KitSkySquid.java | 1 + .../game/games/smash/kits/KitSlime.java | 4 +- .../game/games/smash/kits/KitWitch.java | 14 +- .../games/smash/kits/KitWitherSkeleton.java | 19 +- .../game/games/smash/perks/SmashKit.java | 7 +- .../game/games/smash/perks/SmashUltimate.java | 42 ++-- .../games/smash/perks/blaze/PerkFirefly.java | 8 +- .../games/smash/perks/blaze/SmashBlaze.java | 2 +- .../perks/chicken/PerkChickenRocket.java | 6 +- .../games/smash/perks/chicken/PerkEggGun.java | 6 +- .../games/smash/perks/chicken/PerkFlap.java | 2 +- .../smash/perks/chicken/SmashChicken.java | 2 +- .../smash/perks/cow/PerkCowAngryHerd.java | 12 +- .../smash/perks/cow/PerkCowMilkSpiral.java | 4 +- .../smash/perks/cow/PerkCowStampede.java | 20 +- .../game/games/smash/perks/cow/SmashCow.java | 5 +- .../perks/creeper/PerkCreeperElectricity.java | 26 +- .../perks/creeper/PerkCreeperExplode.java | 13 +- .../perks/creeper/PerkCreeperSulphurBomb.java | 7 +- .../smash/perks/creeper/SmashCreeper.java | 3 +- .../games/smash/perks/enderman/PerkBlink.java | 6 +- .../smash/perks/enderman/PerkBlockToss.java | 12 +- .../perks/enderman/PerkEndermanTeleport.java | 2 +- .../smash/perks/enderman/SmashEnderman.java | 4 +- .../games/smash/perks/golem/PerkFissure.java | 2 +- .../games/smash/perks/golem/PerkIronHook.java | 2 +- .../smash/perks/golem/PerkSeismicSlam.java | 4 +- .../games/smash/perks/golem/SmashGolem.java | 63 ++--- .../smash/perks/guardian/PerkTargetLazer.java | 233 ++++++++++++++++++ .../smash/perks/guardian/PerkThorns.java | 43 ++++ .../smash/perks/guardian/PerkWaterSplash.java | 167 +++++++++++++ .../perks/guardian/PerkWhirlpoolBlade.java | 147 +++++++++++ .../perks/guardian/SmashAnimationData.java | 182 ++++++++++++++ .../smash/perks/guardian/SmashGuardian.java | 105 ++++++++ .../smash/perks/guardian/TargetLazerData.java | 60 +++++ .../smash/perks/magmacube/PerkFlameDash.java | 4 +- .../smash/perks/magmacube/PerkMagmaBlast.java | 1 - .../smash/perks/magmacube/SmashMagmacube.java | 5 +- .../smash/perks/pig/PerkPigBaconBomb.java | 2 +- .../smash/perks/pig/PerkPigBaconBounce.java | 2 +- .../game/games/smash/perks/pig/SmashPig.java | 6 +- .../games/smash/perks/sheep/PerkLazer.java | 4 +- .../games/smash/perks/sheep/PerkWoolBomb.java | 4 +- .../smash/perks/sheep/PerkWoolCloud.java | 6 +- .../perks/skeletalhorse/PerkBoneRush.java | 4 +- .../perks/skeletalhorse/PerkHorseKick.java | 4 +- .../smash/perks/skeleton/PerkBarrage.java | 17 +- .../perks/skeleton/PerkBoneExplosion.java | 2 +- .../smash/perks/skeleton/SmashSkeleton.java | 2 +- .../smash/perks/slime/PerkSlimeRocket.java | 2 +- .../smash/perks/slime/PerkSlimeSlam.java | 13 +- .../games/smash/perks/slime/SmashSlime.java | 10 +- .../smash/perks/snowman/PerkArcticAura.java | 2 +- .../smash/perks/snowman/PerkIcePath.java | 4 +- .../smash/perks/snowman/SmashSnowman.java | 34 ++- .../games/smash/perks/spider/PerkNeedler.java | 4 +- .../games/smash/perks/spider/PerkWebShot.java | 4 +- .../games/smash/perks/spider/SmashSpider.java | 6 +- .../smash/perks/squid/PerkFishFlurry.java | 13 +- .../games/smash/perks/squid/PerkInkBlast.java | 2 +- .../smash/perks/squid/PerkSuperSquid.java | 6 +- .../games/smash/perks/squid/SmashSquid.java | 2 +- .../games/smash/perks/witch/PerkBatWave.java | 35 ++- .../smash/perks/witch/PerkWitchPotion.java | 2 +- .../witch/{SmashBat.java => SmashWitch.java} | 26 +- .../perks/witherskeleton/PerkWitherImage.java | 10 +- .../witherskeleton/SmashWitherSkeleton.java | 22 +- .../games/smash/perks/wolf/SmashWolf.java | 6 +- .../smash/perks/zombie/PerkOvercharge.java | 10 +- .../games/smash/perks/zombie/SmashZombie.java | 29 ++- .../game/arcade/kit/perks/PerkFlameDash.java | 195 --------------- .../game/arcade/kit/perks/PerkLazer.java | 2 +- .../game/arcade/kit/perks/PerkMagmaBlast.java | 160 ------------ .../game/arcade/kit/perks/PerkMagmaBoost.java | 144 ----------- .../arcade/kit/perks/PerkSeismicSlam.java | 2 +- .../game/arcade/kit/perks/PerkSpiderLeap.java | 53 ++-- .../game/arcade/kit/perks/PerkWoolBomb.java | 8 +- .../game/arcade/kit/perks/PerkWoolCloud.java | 2 +- .../arcade/kit/perks/data/EarthquakeData.java | 15 -- 84 files changed, 1475 insertions(+), 798 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkThorns.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashAnimationData.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashGuardian.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/TargetLazerData.java rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/{SmashBat.java => SmashWitch.java} (93%) delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameDash.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMagmaBlast.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMagmaBoost.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/EarthquakeData.java 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 1bdfed96b..76f43254c 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 @@ -56,6 +56,7 @@ import nautilus.game.arcade.game.games.smash.kits.KitCow; import nautilus.game.arcade.game.games.smash.kits.KitCreeper; import nautilus.game.arcade.game.games.smash.kits.KitEnderman; import nautilus.game.arcade.game.games.smash.kits.KitGolem; +import nautilus.game.arcade.game.games.smash.kits.KitGuardian; import nautilus.game.arcade.game.games.smash.kits.KitMagmaCube; import nautilus.game.arcade.game.games.smash.kits.KitPig; import nautilus.game.arcade.game.games.smash.kits.KitSheep; @@ -97,7 +98,7 @@ public abstract class SuperSmash extends Game new KitBlaze(manager), new KitWitch(manager), new KitChicken(manager), new KitSkeletalHorse(manager), new KitPig(manager), new KitSkySquid(manager), new KitWitherSkeleton( manager), new KitMagmaCube(manager), new KitZombie(manager), new KitCow(manager), - new KitSheep(manager) + new KitSheep(manager), new KitGuardian(manager) }, type, description); } @@ -112,7 +113,6 @@ public abstract class SuperSmash extends Game this.WorldWaterDamage = 1000; this.HideTeamSheep = true; this.ReplaceTeamsWithKits = true; - this.WorldLeavesDecay = false; } @EventHandler(priority = EventPriority.HIGH) @@ -128,16 +128,18 @@ public abstract class SuperSmash extends Game _lives.put(player, 4); } - _nextPowerup = (long) (System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(10) * Math.random()); + _nextPowerup = getNewSmashTime(); } - @EventHandler + @EventHandler(priority = EventPriority.LOWEST) public void onPlayerOut(PlayerDeathEvent event) { if (!loseLife(event.getEntity())) { this.SetPlayerState(event.getEntity(), PlayerState.OUT); } + + Manager.GetDisguise().undisguise(Manager.GetDisguise().getActiveDisguise(event.getEntity())); } public int getLives(Player player) @@ -212,11 +214,18 @@ public abstract class SuperSmash extends Game SmashUltimate ultimate = (SmashUltimate) perk; String name = ultimate.GetName(); + if (ultimate.isUsingUltimate(player)) + { + continue; + } + player.setHealth(player.getMaxHealth()); player.playSound(player.getLocation(), ultimate.getSound(), 10, 1); Announce(C.Bold + event.getPlayer().getName() + " activated " + C.cGreenB + name + ChatColor.RESET + C.Bold + "!"); UtilTextMiddle.display("Smash Crystal", event.getPlayer().getName() + " used " + C.cGreen + name, 5, 50, 5, UtilServer.getPlayers()); + + ultimate.activate(player); } } } @@ -300,6 +309,11 @@ public abstract class SuperSmash extends Game for (Player player : GetPlayers(true)) { + if (UtilPlayer.isSpectator(player)) + { + continue; + } + double dist = UtilMath.offset(player, _powerup); if (dist > 2) @@ -318,7 +332,7 @@ public abstract class SuperSmash extends Game _powerup = null; giveSmashItem(best); - _nextPowerup = (long) (System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(10) * Math.random()); + _nextPowerup = getNewSmashTime(); } } @@ -519,6 +533,11 @@ public abstract class SuperSmash extends Game int amount = Math.max(1, (int) (event.GetDamage() / 2)); UtilPlayer.hunger(damager, amount); } + + public long getNewSmashTime() + { + return (long) (System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(2) + TimeUnit.MINUTES.toMillis(5) * Math.random()); + } public String getLiveColour(int lives) { @@ -535,7 +554,7 @@ public abstract class SuperSmash extends Game return C.cGreen; } } - + public Map getLiveMap() { return _lives; @@ -580,7 +599,15 @@ public abstract class SuperSmash extends Game { event.setCancelled(true); - String kit = message.split(" ")[1]; + String[] args = message.split(" "); + String kit = ""; + + for (int i = 1; i < args.length; i++) + { + kit += args[i] + " "; + } + + kit = kit.trim(); for (Kit kits : GetKits()) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java new file mode 100644 index 000000000..08e4f0069 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java @@ -0,0 +1,81 @@ +package nautilus.game.arcade.game.games.smash.kits; + +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.common.util.UtilInv; +import mineplex.core.disguise.disguises.DisguiseGuardian; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; +import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.guardian.PerkTargetLazer; +import nautilus.game.arcade.game.games.smash.perks.guardian.PerkWaterSplash; +import nautilus.game.arcade.game.games.smash.perks.guardian.PerkWhirlpoolBlade; +import nautilus.game.arcade.game.games.smash.perks.guardian.SmashGuardian; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; + +public class KitGuardian extends SmashKit +{ + + private static final Perk[] PERKS = { + new PerkSmashStats(4, 1.25, 0.25, 4), + new PerkDoubleJump("Double Jump", 0.9, 0.9, false), + new PerkWhirlpoolBlade(), + new PerkWaterSplash(), + new PerkTargetLazer(), + new SmashGuardian() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.PRISMARINE_SHARD); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte) 0, 1, + C.cYellowB + "Left-Click" + C.cWhiteB + " - " + C.cGreenB + "Whirlpool Blade", + new String[] { + C.Reset + "Something" + }), + ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte) 0, 1, + C.cYellowB + "Right-Click" + C.cWhiteB + " - " + C.cGreenB + "Water Splash", + new String[] { + C.Reset + "Something" + }), + ItemStackFactory.Instance.CreateStack(Material.IRON_PICKAXE, (byte) 0, 1, + C.cYellowB + "Right-Click" + C.cWhiteB + " - " + C.cGreenB + "Target Lazer", + new String[] { + C.Reset + "Something" + }), + + }; + + private static final ItemStack[] PLAYER_ARMOR = { + null, + null, + new ItemStack(Material.DIAMOND_CHESTPLATE), + null, + }; + + public KitGuardian(ArcadeManager manager) + { + super(manager, "Guardian", KitAvailability.Free, PERKS, EntityType.GUARDIAN, IN_HAND, DisguiseGuardian.class); + } + + @Override + public void GiveItems(Player player) + { + disguise(player); + + UtilInv.Clear(player); + + player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1], PLAYER_ITEMS[2]); + + player.getInventory().setArmorContents(PLAYER_ARMOR); + } + + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java index a08ca5af2..438cd0f9c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java @@ -14,13 +14,13 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.magmacube.PerkFlameDash; +import nautilus.game.arcade.game.games.smash.perks.magmacube.PerkMagmaBlast; +import nautilus.game.arcade.game.games.smash.perks.magmacube.PerkMagmaBoost; import nautilus.game.arcade.game.games.smash.perks.magmacube.SmashMagmacube; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkDoubleJump; -import nautilus.game.arcade.kit.perks.PerkFlameDash; -import nautilus.game.arcade.kit.perks.PerkMagmaBlast; -import nautilus.game.arcade.kit.perks.PerkMagmaBoost; public class KitMagmaCube extends SmashKit { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java index a9992c275..ac7d67712 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java @@ -17,10 +17,10 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; import nautilus.game.arcade.game.games.smash.perks.SmashKit; -import nautilus.game.arcade.game.games.smash.perks.magmacube.SmashMagmacube; import nautilus.game.arcade.game.games.smash.perks.pig.PerkPigBaconBomb; import nautilus.game.arcade.game.games.smash.perks.pig.PerkPigBaconBounce; import nautilus.game.arcade.game.games.smash.perks.pig.PerkPigZombie; +import nautilus.game.arcade.game.games.smash.perks.pig.SmashPig; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkDoubleJump; @@ -38,7 +38,7 @@ public class KitPig extends SmashKit new PerkPigBaconBounce(), new PerkPigBaconBomb(), new PerkPigZombie(), - new SmashMagmacube() + new SmashPig() }; private static final ItemStack IN_HAND = new ItemStack(Material.PORK); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java index 93bc3f989..586d94657 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java @@ -4,12 +4,14 @@ import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseSkeleton; import mineplex.core.itemstack.ItemStackFactory; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; @@ -102,4 +104,22 @@ public class KitSkeleton extends SmashKit player.getInventory().setArmorContents(PLAYER_ARMOR); } + + @EventHandler + public void arrowDamage(CustomDamageEvent event) + { + Player player = event.GetDamagerPlayer(true); + + if (player == null) + { + return; + } + + if (!HasKit(player)) + { + return; + } + + event.AddMod("Arrow Nerf", -2); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java index 5d2576f66..7e0c0bf36 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java @@ -91,6 +91,7 @@ public class KitSkySquid extends SmashKit { player.getInventory().remove(Material.IRON_SWORD); player.getInventory().remove(Material.IRON_AXE); + player.getInventory().remove(Material.IRON_SPADE); player.getInventory().addItem(PLAYER_ITEMS[4]); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java index 67639bb37..f439afb7c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java @@ -16,6 +16,7 @@ import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; import nautilus.game.arcade.game.games.smash.perks.SmashKit; import nautilus.game.arcade.game.games.smash.perks.slime.PerkSlimeRocket; import nautilus.game.arcade.game.games.smash.perks.slime.PerkSlimeSlam; +import nautilus.game.arcade.game.games.smash.perks.slime.SmashSlime; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkDoubleJump; @@ -27,7 +28,8 @@ public class KitSlime extends SmashKit new PerkSmashStats(6, 1.75, 0.35, 3), new PerkDoubleJump("Double Jump", 1.2, 1, false), new PerkSlimeSlam(), - new PerkSlimeRocket() + new PerkSlimeRocket(), + new SmashSlime() }; private static final ItemStack IN_HAND = new ItemStack(Material.SLIME_BALL); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java index 3a96edb26..34657771c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java @@ -16,7 +16,7 @@ import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; import nautilus.game.arcade.game.games.smash.perks.SmashKit; import nautilus.game.arcade.game.games.smash.perks.witch.PerkBatWave; import nautilus.game.arcade.game.games.smash.perks.witch.PerkWitchPotion; -import nautilus.game.arcade.game.games.smash.perks.witch.SmashBat; +import nautilus.game.arcade.game.games.smash.perks.witch.SmashWitch; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkDoubleJump; @@ -29,7 +29,7 @@ public class KitWitch extends SmashKit new PerkDoubleJump("Double Jump", 0.9, 0.9, false), new PerkWitchPotion(), new PerkBatWave(), - new SmashBat() + new SmashWitch() }; private static final ItemStack IN_HAND = new ItemStack(Material.POTION); @@ -85,6 +85,16 @@ public class KitWitch extends SmashKit { super(manager, "Witch", KitAvailability.Gem, 6000, PERKS, EntityType.WITCH, IN_HAND, DisguiseWitch.class); } + + public void giveSmashItems(Player player) + { + player.getInventory().remove(Material.IRON_AXE); + player.getInventory().remove(Material.IRON_SPADE); + + player.getInventory().addItem(PLAYER_ITEMS[4]); + + UtilInv.Update(player); + } @Override public void GiveItems(Player player) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java index 8f7e6c21b..8efef7fe6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java @@ -81,16 +81,15 @@ public class KitWitherSkeleton extends SmashKit super(manager, "Wither Skeleton", KitAvailability.Gem, 6000, PERKS, EntityType.SKELETON, IN_HAND, DisguiseSkeleton.class); } -// @Override -// public void giveSuperItems(Player player) -// { -// player.getInventory().remove(Material.IRON_SWORD); -// player.getInventory().remove(Material.IRON_AXE); -// -// player.getInventory().addItem(PLAYER_ITEMS[3]); -// -// UtilInv.Update(player); -// } + public void giveSmashItems(Player player) + { + player.getInventory().remove(Material.IRON_SWORD); + player.getInventory().remove(Material.IRON_AXE); + + player.getInventory().addItem(PLAYER_ITEMS[3]); + + UtilInv.Update(player); + } @Override public void GiveItems(Player player) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashKit.java index d09d7ffab..17ac0ada2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashKit.java @@ -10,6 +10,7 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.C; +import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.disguises.DisguiseInsentient; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.GameTeam; @@ -70,9 +71,11 @@ public abstract class SmashKit extends ProgressingKit return; } + DisguiseManager disguiseManager = Manager.GetDisguise(); + try { - DisguiseInsentient disguise = _clazz.getConstructor(Entity.class).newInstance(player); + DisguiseInsentient disguise = clazz.getConstructor(Entity.class).newInstance(player); GameTeam gameTeam = Manager.GetGame().GetTeam(player); if (gameTeam != null) @@ -85,7 +88,7 @@ public abstract class SmashKit extends ProgressingKit } disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); + disguiseManager.disguise(disguise); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashUltimate.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashUltimate.java index fd8a9a475..eb76419eb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashUltimate.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashUltimate.java @@ -8,27 +8,28 @@ import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import mineplex.core.common.util.C; +import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; +import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game.GameState; -import nautilus.game.arcade.game.games.quiver.Quiver; import nautilus.game.arcade.kit.Perk; public class SmashUltimate extends Perk { + private static final int MIN_ULTIAMTE_DISPLAY_TIME = 1000; + private Map _lastUltimate = new HashMap<>(); private Sound _sound; - private long _length; + private int _length; - public SmashUltimate(String name, String[] perkDesc, Sound sound, long length) + public SmashUltimate(String name, String[] perkDesc, Sound sound, int length) { super(name, perkDesc); @@ -39,14 +40,15 @@ public class SmashUltimate extends Perk public void activate(Player player) { _lastUltimate.put(player.getUniqueId(), System.currentTimeMillis()); - - player.getInventory().addItem(Quiver.SUPER_ARROW); - - UtilServer.broadcast(C.cGreenB + player.getName() + C.cWhiteB + " activated their " + C.cGreenB + C.Bold + GetName() + C.cWhiteB + "."); - - for (Player other : UtilServer.getPlayers()) + + if (_length > MIN_ULTIAMTE_DISPLAY_TIME) { - other.playSound(other.getLocation(), _sound, 1, 0); + Recharge recharge = Recharge.Instance; + + recharge.recharge(player, GetName()); + recharge.use(player, GetName(), _length, false, false); + recharge.setDisplayForce(player, GetName(), true); + recharge.setCountdown(player, GetName(), true); } } @@ -54,16 +56,16 @@ public class SmashUltimate extends Perk { _lastUltimate.remove(player.getUniqueId()); + if (_length > MIN_ULTIAMTE_DISPLAY_TIME) + { + player.sendMessage(F.main("Game", "Deactivated " + F.skill(GetName()) + ".")); + player.playSound(player.getLocation(), Sound.BLAZE_DEATH, 1, 0); + } + player.getInventory().clear(); Kit.GiveItems(player); - player.playSound(player.getLocation(), Sound.BLAZE_DEATH, 1, 0); } - - public boolean isUsable(Player player) - { - return true; - } - + @EventHandler public void onUpdate(UpdateEvent event) { @@ -138,7 +140,7 @@ public class SmashUltimate extends Perk return _sound; } - public long getLength() + public int getLength() { return _length; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkFirefly.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkFirefly.java index 4017edff7..76a22df83 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkFirefly.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkFirefly.java @@ -35,8 +35,8 @@ import nautilus.game.arcade.kit.perks.data.FireflyData; public class PerkFirefly extends SmashPerk { - private static final long COOLDOWN = 12000; - private static final long DURATION = 2750; + private static final int COOLDOWN = 12000; + private static final int DURATION = 2750; private static final int DAMAGE = 7; private static final int RADIUS_NORMAL = 4; @@ -45,8 +45,8 @@ public class PerkFirefly extends SmashPerk private static final int RADIUS_SMASH = 7; private static final float VELOCITY_SMASH = 0.79F; - private static final long HIT_FREQUENCY = 2000; - private static final long WARMUP_TIME = 1500; + private static final int HIT_FREQUENCY = 2000; + private static final int WARMUP_TIME = 1500; private static final int MIN_CANCEL_DAMAGE = 4; private static final int KNOCKBACK_MAGNITUDE = 2; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/SmashBlaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/SmashBlaze.java index 341dd1df6..9bbf07151 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/SmashBlaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/SmashBlaze.java @@ -10,7 +10,7 @@ import nautilus.game.arcade.kit.Perk; public class SmashBlaze extends SmashUltimate { - private static final long DURATION = 18000; + private static final int DURATION = 18000; public SmashBlaze() { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java index f8f5e06a9..3f88daa93 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java @@ -41,9 +41,9 @@ import nautilus.game.arcade.kit.perks.data.ChickenMissileData; public class PerkChickenRocket extends SmashPerk { - private static final long COOLDOWN = 7000; - private static final long MIN_TIME = 200; - private static final long MAX_TIME = 4000; + private static final int COOLDOWN = 7000; + private static final int MIN_TIME = 200; + private static final int MAX_TIME = 4000; private static final int HIT_BOX_RADIUS = 2; private static final int DAMAGE_RADIUS = 3; private static final int DAMAGE = 8; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkEggGun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkEggGun.java index ae1c86bca..81831fabf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkEggGun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkEggGun.java @@ -32,9 +32,9 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkEggGun extends SmashPerk { - private static final long COOLDOWN = 2500; - private static final long DURATION = 750; - private static final long DAMAGE = 1; + private static final int COOLDOWN = 2500; + private static final int DURATION = 750; + private static final int DAMAGE = 1; private Map _active = new HashMap<>(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkFlap.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkFlap.java index e5a7ef692..6464c22d1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkFlap.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkFlap.java @@ -23,7 +23,7 @@ public class PerkFlap extends SmashPerk private static final float MAX_ENERGY = 0.999F; private static final float ENERGY_PER_TICK = 0.03F; private static final float ENERGY_PER_FLAP = 0.17F; - private static final long COOLDOWN = 80; + private static final int COOLDOWN = 80; private double _power; private boolean _control; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/SmashChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/SmashChicken.java index beea2b8b9..605499efc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/SmashChicken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/SmashChicken.java @@ -9,7 +9,7 @@ import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashChicken extends SmashUltimate { - private static final long DURATION = 20000; + private static final int DURATION = 20000; public SmashChicken() { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowAngryHerd.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowAngryHerd.java index 7b802998f..445f6a006 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowAngryHerd.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowAngryHerd.java @@ -37,13 +37,13 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkCowAngryHerd extends SmashPerk { - private static final long COOLDOWN_NORMAL = 13000; - private static final long COOLDOWN_SMASH = 6000; - private static final long MAX_TIME = 1000; - private static final long STUCK_TIME = 300; - private static final long FORCE_MOVE = 350; + private static final int COOLDOWN_NORMAL = 13000; + private static final int COOLDOWN_SMASH = 6000; + private static final int MAX_TIME = 1000; + private static final int STUCK_TIME = 300; + private static final int FORCE_MOVE = 350; private static final float HIT_BOX_RADIUS = 2.2F; - private static final long HIT_FREQUENCY = 600; + private static final int HIT_FREQUENCY = 600; private static final int DAMAGE = 5; private List _active = new ArrayList<>(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowMilkSpiral.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowMilkSpiral.java index a538fa73d..e909decf2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowMilkSpiral.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowMilkSpiral.java @@ -30,8 +30,8 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkCowMilkSpiral extends SmashPerk { - private static final long COOLDOWN_NORMAL = 11000; - private static final long COOLDOWN_SMASH = 6000; + private static final int COOLDOWN_NORMAL = 11000; + private static final int COOLDOWN_SMASH = 6000; private static final int HIT_BOX_RADIUS = 2; private static final int DAMAGE = 6; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowStampede.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowStampede.java index 2995dd0eb..5b7a16647 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowStampede.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowStampede.java @@ -67,8 +67,8 @@ public class PerkCowStampede extends SmashPerk continue; } - long time = _sprintTime.get(cur); - int str = _sprintStr.get(cur); + long time = _sprintTime.get(key); + int str = _sprintStr.get(key); // Apply Speed if (str > 0) @@ -98,7 +98,7 @@ public class PerkCowStampede extends SmashPerk else if (cur.isSprinting() || !cur.getLocation().getBlock().isLiquid()) { // Start Timer - if (!_sprintTime.containsKey(cur)) + if (!_sprintTime.containsKey(key)) { _sprintTime.put(key, System.currentTimeMillis()); _sprintStr.put(key, 0); @@ -130,7 +130,7 @@ public class PerkCowStampede extends SmashPerk } UtilParticle.PlayParticle(isSuperActive(player) ? ParticleType.RED_DUST : ParticleType.CRIT, player.getLocation(), (float) (Math.random() - 0.5), 0.2f + (float) Math.random(), - (float) (Math.random() - 0.5), 0, _sprintStr.get(player) * 2, ViewDist.NORMAL, UtilServer.getPlayers()); + (float) (Math.random() - 0.5), 0, _sprintStr.get(key) * 2, ViewDist.NORMAL, UtilServer.getPlayers()); } } @@ -148,18 +148,20 @@ public class PerkCowStampede extends SmashPerk } Player damager = event.GetDamagerPlayer(false); - + if (damager == null) { return; } + + UUID key = damager.getUniqueId(); - if (!_sprintStr.containsKey(damager)) + if (!_sprintStr.containsKey(key)) { return; } - if (_sprintStr.get(damager) == 0) + if (_sprintStr.get(key) == 0) { return; } @@ -172,8 +174,8 @@ public class PerkCowStampede extends SmashPerk } // Remove - _sprintTime.remove(damager); - int str = _sprintStr.remove(damager); + _sprintTime.remove(key); + int str = _sprintStr.remove(key); damager.removePotionEffect(PotionEffectType.SPEED); // Damage diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/SmashCow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/SmashCow.java index 41a7b0b74..d3aaa527d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/SmashCow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/SmashCow.java @@ -14,7 +14,7 @@ import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashCow extends SmashUltimate { - private static final long DURATION = 30000; + private static final int DURATION = 30000; private static final int DAMAGE_BUFF = 1; private static final int HEALTH = 30; @@ -50,8 +50,9 @@ public class SmashCow extends SmashUltimate super.cancel(player); SmashKit kit = (SmashKit) Kit; - kit.disguise(player, DisguiseCow.class); + + player.setMaxHealth(20); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperElectricity.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperElectricity.java index c4d286214..6581b6a97 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperElectricity.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperElectricity.java @@ -25,7 +25,7 @@ import nautilus.game.arcade.kit.Perk; public class PerkCreeperElectricity extends Perk { - private static final long DURATION = 2000; + private static final int DURATION = 2000; private static final int SHOCK = 1; private static final int DAMAGE = 4; private static final float KNOCKBACK_MAGNITUDE = 2.5F; @@ -87,11 +87,13 @@ public class PerkCreeperElectricity extends Perk while (shieldIterator.hasNext()) { - Player player = UtilPlayer.searchExact(shieldIterator.next()); + UUID key = shieldIterator.next(); + Player player = UtilPlayer.searchExact(key); if (player == null) { shieldIterator.remove(); + continue; } if (!IsPowered(player)) @@ -101,7 +103,7 @@ public class PerkCreeperElectricity extends Perk continue; } - if (UtilTime.elapsed(_active.get(player), DURATION)) + if (UtilTime.elapsed(_active.get(key), DURATION)) { shieldIterator.remove(); @@ -117,15 +119,22 @@ public class PerkCreeperElectricity extends Perk public void Damage(CustomDamageEvent event) { if (event.IsCancelled()) + { return; - + } + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + { return; - + } + Player damagee = event.GetDamageePlayer(); + if (damagee == null) + { return; - + } + if (!hasPerk(damagee)) { return; @@ -171,9 +180,12 @@ public class PerkCreeperElectricity extends Perk public void SetPowered(Player player, boolean powered) { DisguiseCreeper creeper = GetDisguise(player); + if (creeper == null) + { return; - + } + creeper.SetPowered(powered); Manager.GetDisguise().updateDisguise(creeper); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperExplode.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperExplode.java index 6deee5676..048b614b0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperExplode.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperExplode.java @@ -44,8 +44,8 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkCreeperExplode extends SmashPerk { - private static final long COOLDOWN = 8000; - private static final long WARMUP = 1500; + private static final int COOLDOWN = 8000; + private static final int WARMUP = 1500; private static final int RADIUS_NORMAL = 8; private static final int RADIUS_SMASH = 24; private static final int DAMAGE_NORMAL = 20; @@ -128,7 +128,7 @@ public class PerkCreeperExplode extends SmashPerk continue; } - long elapsed = (System.currentTimeMillis() - _active.get(player)); + long elapsed = (System.currentTimeMillis() - _active.get(key)); // Idle in Air UtilAction.zeroVelocity(player); @@ -141,7 +141,7 @@ public class PerkCreeperExplode extends SmashPerk player.setExp(Math.min(0.99f, (float) (elapsed / (WARMUP / 1000)))); // Not Detonated - if (UtilTime.elapsed(_active.get(key), WARMUP)) + if (!UtilTime.elapsed(_active.get(key), WARMUP)) { continue; } @@ -243,6 +243,11 @@ public class PerkCreeperExplode extends SmashPerk } } } + + public void activate(Player player) + { + _active.put(player.getUniqueId(), System.currentTimeMillis()); + } public DisguiseCreeper GetDisguise(Player player) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperSulphurBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperSulphurBomb.java index 6e1ce3e6a..111271be2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperSulphurBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperSulphurBomb.java @@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.smash.perks.creeper; 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; @@ -34,7 +35,7 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown { - private static final long COOLDOWN = 3000; + private static final int COOLDOWN = 3000; private static final float DAMAGE = 6.5F; private static final float KNOCKBACK_MAGNITUDE = 2.5F; @@ -63,7 +64,7 @@ public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown Player player = event.getPlayer(); - if (!UtilItem.isSword(player.getItemInHand())) + if (!UtilItem.isAxe(player.getItemInHand())) { return; } @@ -87,7 +88,7 @@ public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown UtilInv.Update(player); - org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.COAL, (byte) 0)); + Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.COAL, (byte) 0)); UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/SmashCreeper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/SmashCreeper.java index 8dbf277c7..b20752818 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/SmashCreeper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/SmashCreeper.java @@ -11,7 +11,7 @@ public class SmashCreeper extends SmashUltimate public SmashCreeper() { - super("Atomic Blast", new String[] {}, Sound.CREEPER_HISS, 50); + super("Atomic Blast", new String[] {}, Sound.CREEPER_HISS, 1600); } @Override @@ -29,6 +29,7 @@ public class SmashCreeper extends SmashUltimate PerkCreeperExplode explode = (PerkCreeperExplode) perk; explode.IncreaseSize(player); + explode.activate(player); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlink.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlink.java index e96c0535a..c7f8c30ff 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlink.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlink.java @@ -28,9 +28,9 @@ public class PerkBlink extends SmashPerk private String _name; private double _range; - private long _recharge; + private int _recharge; - public PerkBlink(String name, double range, long recharge) + public PerkBlink(String name, double range, int recharge) { super(name, new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + name }); @@ -81,7 +81,7 @@ public class PerkBlink extends SmashPerk LineParticle lineParticle = new LineParticle(player.getEyeLocation(), player.getLocation().getDirection(), INCREMENTAITON, _range, null, ParticleType.SMOKE, UtilServer.getPlayers()); - while (lineParticle.update()) + while (!lineParticle.update()) { } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java index b57a4c2cf..7372a19af 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java @@ -41,8 +41,8 @@ import nautilus.game.arcade.kit.perks.event.PerkBlockThrowEvent; public class PerkBlockToss extends SmashPerk implements IThrown { - private static final long COOLDOWN = 2000; - private static final long CHARGE_TIME = 1200; + private static final int COOLDOWN = 2000; + private static final int CHARGE_TIME = 1200; private static final int DAMAGE = 8; private static final float KNOCKBACK_MAGNITUDE = 2.5F; @@ -132,8 +132,10 @@ public class PerkBlockToss extends SmashPerk implements IThrown public void Throw(UpdateEvent event) { if (event.getType() != UpdateType.TICK) + { return; - + } + Set throwSet = new HashSet(); for (UUID key : _hold.keySet()) @@ -152,9 +154,9 @@ public class PerkBlockToss extends SmashPerk implements IThrown } // Charged Tick - if (!_charged.contains(player.getUniqueId())) + if (!_charged.contains(key)) { - if (System.currentTimeMillis() - _charge.get(player) > 1200) + if (System.currentTimeMillis() - _charge.get(key) > 1200) { _charged.add(key); player.getWorld().playEffect(player.getLocation(), Effect.CLICK1, 0); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkEndermanTeleport.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkEndermanTeleport.java index c6c27df8a..48e6b5fc8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkEndermanTeleport.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkEndermanTeleport.java @@ -27,7 +27,7 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkEndermanTeleport extends SmashPerk { - private static final long COOLDOWN = 5000; + private static final int COOLDOWN = 5000; private static final float CHARGE_PER_TICK = 0.015F; private Map _target = new HashMap<>(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/SmashEnderman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/SmashEnderman.java index d06f16ef9..bd45991da 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/SmashEnderman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/SmashEnderman.java @@ -33,9 +33,9 @@ import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashEnderman extends SmashUltimate { - private static final long DURATION = 30000; + private static final int DURATION = 30000; private static final int DRAGON_VELOCITY_MAGNITUDE = 40; - private static final long HIT_COOLDOWN = 1000; + private static final int HIT_COOLDOWN = 1000; private static final int DAMAGE_RADIUS = 6; private static final int DAMAGE = 20; private static final int KNOCKBACK_MAGNITUDE = 4; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkFissure.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkFissure.java index 30facb8b0..ad8cd2688 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkFissure.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkFissure.java @@ -24,7 +24,7 @@ import nautilus.game.arcade.kit.perks.data.FissureData; public class PerkFissure extends Perk { - private static final long COOLDOWN = 8000; + private static final int COOLDOWN = 8000; private Set _active = new HashSet<>(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkIronHook.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkIronHook.java index a1d72f294..93ca69da5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkIronHook.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkIronHook.java @@ -29,7 +29,7 @@ import nautilus.game.arcade.kit.Perk; public class PerkIronHook extends Perk implements IThrown { - private static final long COOLDOWN = 8000; + private static final int COOLDOWN = 8000; private static final int DAMAGE = 4; public PerkIronHook() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkSeismicSlam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkSeismicSlam.java index 1c38d2849..0363bf106 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkSeismicSlam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkSeismicSlam.java @@ -34,8 +34,8 @@ import nautilus.game.arcade.kit.Perk; public class PerkSeismicSlam extends Perk { - private static final long COOLDOWN = 7000; - private static final long TIME = 1000; + private static final int COOLDOWN = 7000; + private static final int TIME = 1000; private static final int DAMAGE = 10; private static final int RADIUS = 8; private static final float KNOCKBACK_MAGNITUDE = 2.4F; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashGolem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashGolem.java index 60690fdf1..07560abd9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashGolem.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashGolem.java @@ -1,7 +1,5 @@ package nautilus.game.arcade.game.games.smash.perks.golem; -import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import org.bukkit.Effect; @@ -20,16 +18,13 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; -import nautilus.game.arcade.kit.perks.data.EarthquakeData; public class SmashGolem extends SmashUltimate { - private static final long DURATION = 16000; - private static final long HIT_FREQUENCY = 400; - private static final int EFFECT_RADIUS = 5; - - private List _data = new ArrayList<>(); + private static final int DURATION = 16000; + private static final int HIT_FREQUENCY = 400; + private static final int EFFECT_RADIUS = 5; public SmashGolem() { @@ -40,26 +35,6 @@ public class SmashGolem extends SmashUltimate public void activate(Player player) { super.activate(player); - - _data.add(new EarthquakeData(player)); - } - - @Override - public void cancel(Player player) - { - super.cancel(player); - - Iterator quakeIter = _data.iterator(); - - while (quakeIter.hasNext()) - { - EarthquakeData data = quakeIter.next(); - - if (isUsingUltimate(data.Player)) - { - quakeIter.remove(); - } - } } @EventHandler @@ -70,35 +45,39 @@ public class SmashGolem extends SmashUltimate return; } - Iterator quakeIter = _data.iterator(); + List alivePlayers = Manager.GetGame().GetPlayers(true); - while (quakeIter.hasNext()) + for (Player player : alivePlayers) { - EarthquakeData data = quakeIter.next(); - - for (Player player : Manager.GetGame().GetPlayers(true)) + + if (!isUsingUltimate(player)) { - player.playSound(player.getLocation(), Sound.MINECART_BASE, 0.2f, 0.2f); - - if (player.equals(data.Player)) + continue; + } + + for (Player other : alivePlayers) + { + if (player.equals(other)) { continue; } - if (UtilEnt.isGrounded(player)) + other.playSound(other.getLocation(), Sound.MINECART_BASE, 0.2f, 0.2f); + + if (UtilEnt.isGrounded(other)) { // Damage Event - Manager.GetDamage().NewDamageEvent(player, data.Player, null, DamageCause.CUSTOM, 1 + 2 * Math.random(), false, false, false, player.getName(), GetName()); + Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, 1 + 2 * Math.random(), false, false, false, other.getName(), GetName()); // Velocity - if (Recharge.Instance.use(player, GetName() + " Hit", HIT_FREQUENCY, false, false)) + if (Recharge.Instance.use(other, GetName() + " Hit", HIT_FREQUENCY, false, false)) { - UtilAction.velocity(player, new Vector(Math.random() - 0.5, Math.random() * 0.2, Math.random() - 0.5), Math.random() * 1 + 1, false, 0, 0.1 + Math.random() * 0.2, 2, true); + UtilAction.velocity(other, new Vector(Math.random() - 0.5, Math.random() * 0.2, Math.random() - 0.5), Math.random() * 1 + 1, false, 0, 0.1 + Math.random() * 0.2, 2, true); } } // Effect - for (Block block : UtilBlock.getInRadius(player.getLocation(), EFFECT_RADIUS).keySet()) + for (Block block : UtilBlock.getInRadius(other.getLocation(), EFFECT_RADIUS).keySet()) { if (Math.random() < 0.98) { @@ -115,7 +94,7 @@ public class SmashGolem extends SmashUltimate continue; } - player.playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType()); + other.playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType()); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java new file mode 100644 index 000000000..6dce9b9ca --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java @@ -0,0 +1,233 @@ +package nautilus.game.arcade.game.games.smash.perks.guardian; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.disguise.DisguiseManager; +import mineplex.core.disguise.disguises.DisguiseGuardian; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; + +public class PerkTargetLazer extends Perk +{ + + private static final int COOLDOWN = 15000; + private static final int MAX_RANGE = 7; + private static final int MAX_TIME = 8000; + private static final int DAMAGE_INCREASE = 3; + private static final int KNOCKBACK_INCREASE = 1; + + private Set _data = new HashSet<>(); + + public PerkTargetLazer() + { + super("Target Lazer", new String[] {}); + } + + @EventHandler + public void activate(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isPickaxe(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (!UtilEnt.isGrounded(player)) + { + player.sendMessage(F.main("Game", "You must be on the ground to use " + F.skill(GetName())) + "."); + return; + } + + if (!Recharge.Instance.usable(player, GetName())) + { + return; + } + + Player best = null; + double bestD = Double.MAX_VALUE; + + for (Player other : UtilServer.getPlayers()) + { + if (player.equals(other) || UtilPlayer.isSpectator(other)) + { + continue; + } + + double d = UtilMath.offset(player, other); + + if (d > MAX_RANGE) + { + continue; + } + + if (best == null || d < bestD) + { + best = other; + bestD = d; + } + } + + if (best == null) + { + player.sendMessage(F.main("Game", "There are no targets within the range.")); + return; + } + + player.sendMessage(F.main("Game", "You targeted " + F.name(best.getName())) + "."); + + boolean contained = false; + + for (TargetLazerData data : _data) + { + if (data.getAttacker().equals(player)) + { + contained = true; + data.setTarget(best); + } + } + + if (!contained) + { + TargetLazerData data = new TargetLazerData(player); + + _data.add(data); + data.setTarget(best); + } + + setLazerTarget(player, best); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() == UpdateType.TICK) + { + for (TargetLazerData data : _data) + { + data.update(Manager); + } + } + + if (event.getType() != UpdateType.FASTER) + { + return; + } + + Iterator iterator = _data.iterator(); + + while (iterator.hasNext()) + { + TargetLazerData data = iterator.next(); + + if (data.getTarget() == null) + { + continue; + } + + UtilParticle.PlayParticle(ParticleType.MAGIC_CRIT, data.getTarget().getLocation().add(0, 0.5, 0.5), 1F, 0.5F, 1F, 0.1F, 10, ViewDist.LONG, data.getAttacker()); + + if (UtilMath.offset(data.getTarget(), data.getAttacker()) > MAX_RANGE || data.getTimeElapsed() > MAX_TIME) + { + Manager.GetDamage().NewDamageEvent(data.getTarget(), data.getAttacker(), null, DamageCause.CUSTOM, 0.5 * (data.getTimeElapsed() / 1000), false, true, false, data.getAttacker().getName(), GetName()); + setLazerTarget(data.getAttacker(), null); + Recharge.Instance.use(data.getAttacker(), GetName(), COOLDOWN, true, true); + iterator.remove(); + } + } + } + + @EventHandler + public void damage(CustomDamageEvent event) + { + if (event.GetDamagerPlayer(true) == null || event.GetDamageePlayer() == null) + { + return; + } + + Player damager = event.GetDamagerPlayer(true); + Player damagee = event.GetDamageePlayer(); + + for (TargetLazerData data : _data) + { + if (data.getTarget() == null) + { + continue; + } + + if (data.getAttacker().equals(damager) && data.getTarget().equals(damagee)) + { + event.AddMod(GetName(), DAMAGE_INCREASE); + event.AddKnockback(GetName(), KNOCKBACK_INCREASE); + data.getAttacker().playEffect(damagee.getLocation().add(0, 0.5, 0), Effect.STEP_SOUND, Material.REDSTONE_BLOCK); + } + } + } + + private void setLazerTarget(Player disguised, Player target) + { + DisguiseManager disguiseManager = Manager.GetDisguise(); + DisguiseGuardian disguise = (DisguiseGuardian) disguiseManager.getActiveDisguise(disguised); + + for (TargetLazerData data : _data) + { + if (data.getAttacker().equals(disguised)) + { + if (target == null) + { + disguise.setTarget(0); + } + else + { + disguise.setTarget(data.update(Manager).getEntityId()); + } + + disguiseManager.updateDisguise(disguise); + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkThorns.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkThorns.java new file mode 100644 index 000000000..3001bea50 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkThorns.java @@ -0,0 +1,43 @@ +package nautilus.game.arcade.game.games.smash.perks.guardian; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; + +public class PerkThorns extends Perk +{ + + private static final int MAX_HEALTH = 6; + private static final float DAMAGE_DECREASE = 0.5F; + private static final float KNOCKBACK_DECREASE = 0.75F; + + public PerkThorns() + { + super("Thorns", new String[] {}); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void damage(CustomDamageEvent event) + { + if (event.GetDamagerPlayer(true) == null) + { + return; + } + + Player player = event.GetDamagerPlayer(true); + + if (!hasPerk(player)) + { + return; + } + + if (player.getHealth() < MAX_HEALTH) + { + event.AddMod(GetName(), DAMAGE_DECREASE * event.GetDamage()); + event.AddKnockback(GetName(), -KNOCKBACK_DECREASE); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java new file mode 100644 index 000000000..1486c4a5a --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java @@ -0,0 +1,167 @@ +package nautilus.game.arcade.game.games.smash.perks.guardian; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Effect; +import org.bukkit.Sound; +import org.bukkit.block.Block; +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.util.Vector; + +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; + +public class PerkWaterSplash extends Perk +{ + + private static final int COOLDOWN = 18000; + private static final int VELOCITY_Y = 1; + private static final int RADIUS = 5; + private static final int MIN_AIR_TIME = 750; + private static final int DAMAGE = 10; + + private Map _active = new HashMap<>(); + + public PerkWaterSplash() + { + super("Water Splash", new String[] {}); + } + + @EventHandler + public void activate(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isSpade(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } + + UtilAction.velocity(player, new Vector(0, VELOCITY_Y, 0)); + _active.put(player.getUniqueId(), System.currentTimeMillis()); + + for (Player other : UtilPlayer.getNearby(player.getLocation(), RADIUS)) + { + if (player.equals(other)) + { + continue; + } + + UtilAction.velocity(other, UtilAlg.getTrajectory(other, player).setY(0.5)); + } + } + + @EventHandler + public void damage(CustomDamageEvent event) + { + if (_active.containsKey(event.GetDamageeEntity().getUniqueId())) + { + event.SetKnockback(false); + } + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + Iterator iterator = _active.keySet().iterator(); + + while (iterator.hasNext()) + { + UUID uuid = iterator.next(); + Player player = UtilPlayer.searchExact(uuid); + + if (player == null) + { + continue; + } + + if (UtilPlayer.isSpectator(player)) + { + iterator.remove(); + continue; + } + + UtilParticle.PlayParticleToAll(ParticleType.DRIP_WATER, player.getLocation(), 0.5F, 0.5F, 0.5F, 0.01F, 10, ViewDist.LONG); + + if (UtilEnt.isGrounded(player) && UtilTime.elapsed(_active.get(uuid), MIN_AIR_TIME)) + { + iterator.remove(); + + UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, player.getEyeLocation(), 0, 0, 0, 0.5F, 50, ViewDist.LONG); + + for (Block block : UtilBlock.getInRadius(player.getLocation(), RADIUS).keySet()) + { + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType()); + } + + player.getWorld().playSound(player.getLocation(), Sound.SPLASH2, 2, 0); + + Map nearby = UtilPlayer.getInRadius(player.getLocation(), RADIUS); + + for (Player other : nearby.keySet()) + { + if (player.equals(other)) + { + continue; + } + + double power = nearby.get(other); + + Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE * power, true, true, true, player.getName(), GetName()); + } + } + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java new file mode 100644 index 000000000..77fdaa33b --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java @@ -0,0 +1,147 @@ +package nautilus.game.arcade.game.games.smash.perks.guardian; + +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 mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.kit.Perk; + +public class PerkWhirlpoolBlade extends Perk implements IThrown +{ + + private static final int COOLDOWN = 5000; + private static final int EXPIRE_TIME = 3000; + private static final float VELOCITY = 1.2F; + private static final int HIT_BOX = 1; + private static final int DAMAGE = 2; + + private Set _items = new HashSet<>(); + + public PerkWhirlpoolBlade() + { + super("Whirlpool Blade", new String[] {}); + } + + @EventHandler + public void activate(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.L)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isSword(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } + + player.playSound(player.getLocation(), Sound.DIG_SNOW, 1, 1); + + Item item = player.getWorld().dropItem(player.getEyeLocation(), new ItemStack(Material.PRISMARINE_SHARD)); + + item.setVelocity(player.getLocation().getDirection().multiply(VELOCITY)); + Manager.GetProjectile().AddThrow(item, player, this, EXPIRE_TIME, true, true, true, false, false, HIT_BOX); + _items.add(item); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + Iterator iterator = _items.iterator(); + + while (iterator.hasNext()) + { + Item item = iterator.next(); + + if (!item.isValid()) + { + iterator.remove(); + continue; + } + + UtilParticle.PlayParticleToAll(ParticleType.DRIP_WATER, item.getLocation(), 0, 0, 0, 0.01F, 1, ViewDist.LONG); + } + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + if (!UtilBlock.airFoliage(block)) + { + data.getThrown().remove(); + } + + if (target == null) + { + return; + } + + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, DAMAGE, false, true, true, data.getThrower().getName(), GetName()); + + UtilAction.velocity(target, UtilAlg.getTrajectory(target, data.getThrower()).setY(0.5)); + } + + @Override + public void Idle(ProjectileUser data) + { + data.getThrown().remove(); + } + + @Override + public void Expire(ProjectileUser data) + { + data.getThrown().remove(); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashAnimationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashAnimationData.java new file mode 100644 index 000000000..714e0a69a --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashAnimationData.java @@ -0,0 +1,182 @@ +package nautilus.game.arcade.game.games.smash.perks.guardian; + +import java.util.Map; +import java.util.Random; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Player; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.util.Vector; + +import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.particles.effects.LineParticle; +import mineplex.core.disguise.DisguiseManager; +import mineplex.core.disguise.disguises.DisguiseGuardian; +import nautilus.game.arcade.ArcadeManager; + +public class SmashAnimationData +{ + + private static final double THETA_INCREMENTATION = Math.PI / 20; + private static final int RADIUS = 3; + private static final int DAMAGE_RADIUS = 11; + private static final int VELOCITY_DAMAGE = 3; + + private ArcadeManager _manager; + private Player _player; + private ArmorStand _elder; + private ArmorStand[] _guardians; + private ArmorStand _target; + + private double _lastTheta; + private double _thetaSpacing; + + private int _blockRadius; + private int _duration; + private int _ticks; + + public SmashAnimationData(ArcadeManager manager, Player player, int guardians, int duration) + { + _manager = manager; + _player = player; + _thetaSpacing = 2 * Math.PI / guardians; + _duration = duration; + + DisguiseManager disguiseManager = manager.GetDisguise(); + Location location = player.getLocation().add(0, 7, 0); + ArmorStand target = player.getWorld().spawn(player.getLocation(), ArmorStand.class); + + target.setArms(false); + target.setSmall(true); + target.setBasePlate(false); + target.setGravity(false); + target.setVisible(false); + + _target = target; + + _elder = player.getWorld().spawn(location, ArmorStand.class); + _elder.setGravity(false); + + DisguiseGuardian disguiseElder = new DisguiseGuardian(_elder); + disguiseElder.setElder(true); + disguiseElder.setTarget(target.getEntityId()); + disguiseManager.disguise(disguiseElder); + + _guardians = new ArmorStand[guardians]; + + for (int i = 0; i < guardians; i++) + { + ArmorStand guardian = player.getWorld().spawn(location, ArmorStand.class); + + guardian.setGravity(false); + + DisguiseGuardian disguise = new DisguiseGuardian(guardian); + disguise.setTarget(target.getEntityId()); + disguiseManager.disguise(disguise); + + _guardians[i] = guardian; + + } + } + + @SuppressWarnings("deprecation") + public void update() + { + _ticks++; + + if (_ticks % 10 == 0) + { + _blockRadius++; + + BlockRestore blockRestore = _manager.GetBlockRestore(); + Map inRadius = UtilBlock.getInRadius(_target.getLocation().getBlock(), _blockRadius, true); + Random random = new Random(); + + for (Block block : inRadius.keySet()) + { + if (blockRestore.contains(block) || UtilBlock.airFoliage(block) || UtilBlock.liquid(block)) + { + continue; + } + + blockRestore.add(block, Material.PRISMARINE.getId(), (byte) random.nextInt(3), (long) (_duration + 5000 * Math.random())); + } + } + + if (_ticks % 12 == 0) + { + for (Player player : UtilPlayer.getNearby(_target.getLocation(), DAMAGE_RADIUS)) + { + if (player.equals(_player)) + { + continue; + } + + double offset = UtilMath.offset(_target, player); + Vector vector = UtilAlg.getTrajectory(player, _target); + + if (offset < DAMAGE_RADIUS / 2) + { + continue; + } + + LineParticle lineParticle = new LineParticle(player.getEyeLocation(), _target.getEyeLocation(), vector, 0.2, offset, null, ParticleType.WITCH_MAGIC, UtilServer.getPlayers()); + + while (!lineParticle.update()) + { + } + + player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_REMEDY, 1, 0.75F); + UtilAction.velocity(player, vector.setY(player.getLocation().getY() - 3 > _target.getLocation().getY() ? 0 : 0.5).multiply(0.5)); + _manager.GetDamage().NewDamageEvent(player, _player, null, DamageCause.CUSTOM, VELOCITY_DAMAGE, false, true, false, _player.getName(), "Mini Guardian"); + } + } + + Location center = _elder.getLocation(); + int i = 0; + + for (ArmorStand guardian : _guardians) + { + double theta = _lastTheta + _thetaSpacing * i++; + double x = RADIUS * Math.cos(theta); + double z = RADIUS * Math.sin(theta); + + center.add(x, 0, z); + guardian.teleport(center); + center.subtract(x, 0, z); + } + + _lastTheta += THETA_INCREMENTATION; + } + + public Player getPlayer() + { + return _player; + } + + public ArmorStand getElder() + { + return _elder; + } + + public ArmorStand[] getGuardians() + { + return _guardians; + } + + public ArmorStand getTarget() + { + return _target; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashGuardian.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashGuardian.java new file mode 100644 index 000000000..1e312ddf7 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashGuardian.java @@ -0,0 +1,105 @@ +package nautilus.game.arcade.game.games.smash.perks.guardian; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +import org.bukkit.Sound; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; + +public class SmashGuardian extends SmashUltimate +{ + + private static final int DURATION = 10000; + private static final int GUARDIANS = 4; + private static final int RADIUS = 15; + private static final int DAMAGE = 40; + + private Set _data = new HashSet<>(); + + public SmashGuardian() + { + super("Rise of the Guardian", new String[] {}, Sound.AMBIENCE_THUNDER, DURATION); + } + + @Override + public void activate(Player player) + { + super.activate(player); + + Manager.GetGame().CreatureAllowOverride = true; + + _data.add(new SmashAnimationData(Manager, player, GUARDIANS, DURATION)); + + Manager.GetGame().CreatureAllowOverride = false; + } + + @Override + public void cancel(Player player) + { + super.cancel(player); + + Iterator iterator = _data.iterator(); + + while (iterator.hasNext()) + { + SmashAnimationData data = iterator.next(); + + if (data.getPlayer().equals(player)) + { + Map inRadius = UtilPlayer.getInRadius(data.getTarget().getLocation(), RADIUS); + + for (Player other : inRadius.keySet()) + { + if (player.equals(other)) + { + continue; + } + + Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE * inRadius.get(other), true, true, false, player.getName(), GetName()); + } + + data.getTarget().getWorld().strikeLightningEffect(data.getTarget().getLocation()); + UtilParticle.PlayParticleToAll(ParticleType.HUGE_EXPLOSION, data.getTarget().getLocation().add(0, 2, 0), RADIUS, 1, RADIUS, 1F, 30, ViewDist.MAX); + player.getWorld().playSound(data.getTarget().getLocation(), Sound.EXPLODE, 5, 0.5F); + + data.getElder().remove(); + data.getTarget().remove(); + + for (ArmorStand guardian : data.getGuardians()) + { + guardian.remove(); + } + + iterator.remove(); + } + } + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + for (SmashAnimationData data : _data) + { + data.update(); + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/TargetLazerData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/TargetLazerData.java new file mode 100644 index 000000000..b089f4f72 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/TargetLazerData.java @@ -0,0 +1,60 @@ +package nautilus.game.arcade.game.games.smash.perks.guardian; + +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Player; + +import nautilus.game.arcade.ArcadeManager; + +public class TargetLazerData +{ + + private Player _attacker; + private Player _target; + private long _startTime; + private ArmorStand _targetPlaceholder; + + public TargetLazerData(Player attacker) + { + _attacker = attacker; + } + + public void setTarget(Player target) + { + _target = target; + _startTime = System.currentTimeMillis(); + } + + public ArmorStand update(ArcadeManager manager) + { + if (_targetPlaceholder == null) + { + manager.GetGame().CreatureAllowOverride = true; + _targetPlaceholder = _target.getWorld().spawn(_target.getLocation(), ArmorStand.class); + _targetPlaceholder.setArms(false); + _targetPlaceholder.setSmall(true); + _targetPlaceholder.setBasePlate(false); + _targetPlaceholder.setGravity(false); + _targetPlaceholder.setVisible(false); + manager.GetGame().CreatureAllowOverride = false; + } + + _targetPlaceholder.teleport(_target.getLocation().add(0, 0.25, 0)); + return _targetPlaceholder; + } + + public Player getAttacker() + { + return _attacker; + } + + public Player getTarget() + { + return _target; + } + + public long getTimeElapsed() + { + return System.currentTimeMillis() - _startTime; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkFlameDash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkFlameDash.java index 0f50c2a2d..4477c5692 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkFlameDash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkFlameDash.java @@ -35,8 +35,8 @@ import nautilus.game.arcade.kit.perks.data.FireflyData; public class PerkFlameDash extends Perk { - private static final long COOLDOWN = 8000; - private static final long TIME = 800; + private static final int COOLDOWN = 8000; + private static final int TIME = 800; private static final int DAMAGE_RADIUS = 3; private static final int KNOCKBACK_MAGNITUDE = 2; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBlast.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBlast.java index c3a2587a7..dc7e59dbf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBlast.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBlast.java @@ -27,7 +27,6 @@ import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/SmashMagmacube.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/SmashMagmacube.java index ceaddbe11..5f2a61ba2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/SmashMagmacube.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/SmashMagmacube.java @@ -8,6 +8,7 @@ import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilPlayer; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -17,7 +18,7 @@ import nautilus.game.arcade.kit.perks.data.MeteorShowerData; public class SmashMagmacube extends SmashUltimate { - private static final long DURATION = 12000; + private static final int DURATION = 12000; private List _meteors = new ArrayList<>(); @@ -29,7 +30,7 @@ public class SmashMagmacube extends SmashUltimate @Override public void activate(Player player) { - _meteors.add(new MeteorShowerData(player, UtilPlayer.getTargetLocation(player, 128), DURATION)); + _meteors.add(new MeteorShowerData(player, UtilPlayer.getTarget(player, UtilBlock.blockPassSet, 128).getLocation(), DURATION)); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBomb.java index f85cd3732..9e863f0a0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBomb.java @@ -42,7 +42,7 @@ public class PerkPigBaconBomb extends SmashPerk private static final float ENERGY_PER_PIG = 0.35F; private static final float ENERGY_PER_PIG_DISGUISED_FACTOR = 0.7F; - private static final long COOLDOWN = 100; + private static final int COOLDOWN = 100; private static final int PIG_MAX_TICKS = 80; private static final float PIG_SPEED = 1.2F; private static final int PIG_EXPLODE_RADIUS = 2; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBounce.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBounce.java index 092deedb8..14eb68ebe 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBounce.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBounce.java @@ -42,7 +42,7 @@ public class PerkPigBaconBounce extends SmashPerk implements IThrown private static final float ENERGY_PER_BACON = 0.2F; private static final float ENERGY_PER_BACON_DISGUISED_FACTOR = 0.7F; - private static final long COOLDOWN = 100; + private static final int COOLDOWN = 100; private static final int HEALTH_PER_BACON = 1; private static final int BACON_DAMAGE = 4; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/SmashPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/SmashPig.java index a799b1e41..e8300adde 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/SmashPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/SmashPig.java @@ -8,9 +8,11 @@ import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashPig extends SmashUltimate { + private static final int DURATION = 40000; + public SmashPig() { - super("Pig Stink", new String[] {}, Sound.PIG_IDLE, 0); + super("Pig Stink", new String[] {}, Sound.PIG_IDLE, DURATION); } @Override @@ -22,7 +24,7 @@ public class SmashPig extends SmashUltimate { if (!player.equals(other)) { - Manager.GetCondition().Factory().Confuse(GetName() + " " + player.getName(), other, player, 40, 0, false, false, false); + Manager.GetCondition().Factory().Confuse(GetName() + " " + player.getName(), other, player, DURATION / 1000, 0, false, false, false); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkLazer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkLazer.java index 54862f097..1ff82cc2d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkLazer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkLazer.java @@ -50,11 +50,11 @@ public class PerkLazer extends Perk private static final int KNOCKBACK_MAGNITUDE = 3; private double _range; - private long _recharge; + private int _recharge; private Set _active = new HashSet<>(); - public PerkLazer(double range, long recharge) + public PerkLazer(double range, int recharge) { super("Static Lazer", new String[] { C.cYellow + "Hold Block" + C.cGray + " with Sword to use " + C.cGreen + "Static Lazer" }); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolBomb.java index b5af795c2..beb6cc23f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolBomb.java @@ -49,8 +49,8 @@ import nautilus.game.arcade.kit.perks.data.WoolBombData; public class PerkWoolBomb extends Perk implements IThrown { - private static final long RATE = 800; - private static final long COOLDOWN = 8000; + private static final int RATE = 800; + private static final int COOLDOWN = 8000; private static final int DAMAGE_RADIUS = 9; private static final int DAMAGE_EXPLODE = 14; private static final int DAMAGE_COLLIDE = 4; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolCloud.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolCloud.java index 43b85ace2..186ba1acf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolCloud.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolCloud.java @@ -39,9 +39,9 @@ import nautilus.game.arcade.kit.Perk; public class PerkWoolCloud extends Perk { - private static final long COOLDOWN = 10000; - private static final long MIN_VELOCITY_TIME = 200; - private static final long MAX_VELOCITY_TIME = 1200; + private static final int COOLDOWN = 10000; + private static final int MIN_VELOCITY_TIME = 200; + private static final int MAX_VELOCITY_TIME = 1200; private static final int DAMAGE_RADIUS = 2; private static final int DAMAGE = 8; private static final float KNOCKBACK_MAGNITUDE = 2.5F; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkBoneRush.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkBoneRush.java index 4106bb52b..4fc78ea1b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkBoneRush.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkBoneRush.java @@ -39,12 +39,12 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkBoneRush extends SmashPerk implements IThrown { - private static final long COOLDOWN = 10000; + private static final int COOLDOWN = 10000; private static final float DAMAGE_NORMAL = 0.7F; private static final int DAMAGE_SMASH = 3; private static final int KNOCKBACK_NORMAL = 10; private static final int KNOCKBACK_SMASH = 6; - private static final long EXPIRE_TIME = 2000; + private static final int EXPIRE_TIME = 2000; private static final float Y_LIMIT = 0.25F; private Map _active = new HashMap<>(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkHorseKick.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkHorseKick.java index 52c60f119..392632d5b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkHorseKick.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkHorseKick.java @@ -37,9 +37,9 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkHorseKick extends SmashPerk { - private static final long COOLDOWN = 6000; + private static final int COOLDOWN = 6000; private static final float DAMAGE = 6.5F; - private static final long KICK_TIME = 1000; + private static final int KICK_TIME = 1000; private static final int KNOCKBACK_MAGNITUDE = 4; private Map _active = new HashMap<>(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBarrage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBarrage.java index dd8123b3c..4c980e69b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBarrage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBarrage.java @@ -24,6 +24,7 @@ import org.bukkit.util.Vector; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; @@ -42,17 +43,17 @@ public class PerkBarrage extends SmashPerk private Set _arrows = new HashSet(); private int _max; - private long _tick; + private int _tick; private boolean _remove; private boolean _noDelay; private boolean _useExp; - public PerkBarrage(int max, long tick, boolean remove, boolean noDelay) + public PerkBarrage(int max, int tick, boolean remove, boolean noDelay) { this(max, tick, remove, noDelay, false); } - public PerkBarrage(int max, long tick, boolean remove, boolean noDelay, boolean useExpAndBar) + public PerkBarrage(int max, int tick, boolean remove, boolean noDelay, boolean useExpAndBar) { super("Barrage", new String[] { C.cYellow + "Charge" + C.cGray + " your Bow to use " + C.cGreen + "Barrage" }); _useExp = useExpAndBar; @@ -82,7 +83,7 @@ public class PerkBarrage extends SmashPerk Player player = event.getPlayer(); - if (player.getItemInHand() == null || player.getItemInHand().getType() == Material.BOW) + if (!UtilGear.isBow(player.getItemInHand())) { return; } @@ -98,8 +99,10 @@ public class PerkBarrage extends SmashPerk } if (!player.getInventory().contains(Material.ARROW)) + { return; - + } + if (event.getClickedBlock() != null) { if (UtilBlock.usable(event.getClickedBlock())) @@ -118,8 +121,10 @@ public class PerkBarrage extends SmashPerk public void BarrageCharge(UpdateEvent event) { if (event.getType() != UpdateType.TICK) + { return; - + } + for (Player cur : UtilServer.getPlayers()) { UUID key = cur.getUniqueId(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBoneExplosion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBoneExplosion.java index 1f195daaf..5fe9a20db 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBoneExplosion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/PerkBoneExplosion.java @@ -23,7 +23,7 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkBoneExplosion extends SmashPerk { - private static final long COOLDOWN = 10000; + private static final int COOLDOWN = 10000; private static final int DAMAGE_RADIUS = 7; private static final int DAMAGE = 6; private static final float KNOCKBACK_MAGNITUDE = 2.5F; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/SmashSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/SmashSkeleton.java index 32e37faea..bb86fdbcf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/SmashSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeleton/SmashSkeleton.java @@ -21,7 +21,7 @@ import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashSkeleton extends SmashUltimate { - private static final long DURATION = 8000; + private static final int DURATION = 10000; private Set _arrows = new HashSet(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeRocket.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeRocket.java index 6b2d92b4d..9a2db18a1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeRocket.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeRocket.java @@ -42,7 +42,7 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkSlimeRocket extends SmashPerk implements IThrown { - private static final long COOLDOWN = 6000; + private static final int COOLDOWN = 6000; private static final float ENERGY_PER_TICK = 0.004F; private static final int KNOCKBACK_MAGNITUDE = 3; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeSlam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeSlam.java index 2bc39bb17..b51206e02 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeSlam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeSlam.java @@ -34,6 +34,7 @@ public class PerkSlimeSlam extends SmashPerk private static final int COOLDOWN = 6000; private static final int HIT_BOX = 2; private static final int START_TIME = 1000; + private static final int DAMAGE_RATE_LIMIT = 500; private static final int DAMAGE = 7; private static final int KNOCKBACK_MAGNITUDE = 2; @@ -106,7 +107,7 @@ public class PerkSlimeSlam extends SmashPerk // Collide for (Player player : alivePlayers) { - if (!_live.containsKey(player)) + if (!_live.containsKey(player.getUniqueId())) { continue; } @@ -126,7 +127,7 @@ public class PerkSlimeSlam extends SmashPerk if (UtilMath.offset(player, other) < HIT_BOX) { doSlam(player, other); - _live.remove(player); + _live.remove(player.getUniqueId()); return; } } @@ -158,6 +159,14 @@ public class PerkSlimeSlam extends SmashPerk public void doSlam(Player damager, LivingEntity damagee) { + if (damagee instanceof Player) + { + if (!Recharge.Instance.use((Player) damagee, GetName() + " Hit", DAMAGE_RATE_LIMIT, false, false)) + { + return; + } + } + // Recoil Event if (!isSuperActive(damager)) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/SmashSlime.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/SmashSlime.java index 7c41af96f..31d5b98e0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/SmashSlime.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/SmashSlime.java @@ -26,7 +26,7 @@ import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashSlime extends SmashUltimate { - private static final long DURATION = 24000; + private static final int DURATION = 24000; private static final int HIT_BOX = 5; private static final int DAMAGE = 8; @@ -54,7 +54,7 @@ public class SmashSlime extends SmashUltimate player.setExp(0.99f); - Manager.GetCondition().Factory().Speed(GetName(), player, player, 20, 2, false, false, false); + Manager.GetCondition().Factory().Speed(GetName(), player, player, DURATION / 1000, 2, false, false, false); } @@ -111,6 +111,12 @@ public class SmashSlime extends SmashUltimate for (Player player : alivePlayers) { + + if (!isUsingUltimate(player)) + { + continue; + } + for (Player other : alivePlayers) { if (player.equals(other)) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkArcticAura.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkArcticAura.java index d02695389..aa0ed0242 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkArcticAura.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkArcticAura.java @@ -49,7 +49,7 @@ public class PerkArcticAura extends Perk for (Block block : blocks.keySet()) { - Manager.GetBlockRestore().snow(block, (byte) 1, (byte) 1, (long) (DURATION * (1 + blocks.get(block))), 250, 0); + Manager.GetBlockRestore().snow(block, (byte) 1, (byte) 1, (int) (DURATION * (1 + blocks.get(block))), 250, 0); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkIcePath.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkIcePath.java index b11a3472c..3916424a9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkIcePath.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/PerkIcePath.java @@ -28,8 +28,8 @@ import nautilus.game.arcade.kit.perks.data.IcePathData; public class PerkIcePath extends Perk { - private static final long COOLDOWN = 12000; - private static final long MELT_TIME = 6000; + private static final int COOLDOWN = 12000; + private static final int MELT_TIME = 6000; private Set _data = new HashSet<>(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java index 381d3968d..613aa5bf4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java @@ -35,8 +35,8 @@ import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashSnowman extends SmashUltimate { + private static final int DURATION = 20000; private static final int TURRET_HEALTH = 40; - private static final int MAX_TICKS = 400; private static final int RATE = 250; private static final float KNOCKBACK_MAGNITUDE = 2.5F; @@ -46,7 +46,7 @@ public class SmashSnowman extends SmashUltimate public SmashSnowman() { - super("Snow Turret", new String[] {}, Sound.STEP_SNOW, 0); + super("Snow Turret", new String[] {}, Sound.STEP_SNOW, DURATION); } @Override @@ -71,6 +71,27 @@ public class SmashSnowman extends SmashUltimate _turret.put(ent, player); } + @Override + public void cancel(Player player) + { + super.cancel(player); + + Iterator iterator = _turret.keySet().iterator(); + + while (iterator.hasNext()) + { + Snowman snowman = iterator.next(); + + if (_turret.get(snowman).equals(player)) + { + UtilParticle.PlayParticle(ParticleType.SNOWBALL_POOF, snowman.getLocation().add(0, 1, 0), 0.4f, 0.4f, 0.4f, 0, 12, ViewDist.LONG, UtilServer.getPlayers()); + snowman.remove(); + iterator.remove(); + return; + } + } + } + @EventHandler public void updateSnowman(UpdateEvent event) { @@ -85,15 +106,6 @@ public class SmashSnowman extends SmashUltimate { Snowman snowman = turretIter.next(); Player player = _turret.get(snowman); - - if (snowman.getTicksLived() > MAX_TICKS) - { - UtilParticle.PlayParticle(ParticleType.SNOWBALL_POOF, snowman.getLocation().add(0, 1, 0), 0.4f, 0.4f, 0.4f, 0, 12, ViewDist.LONG, UtilServer.getPlayers()); - turretIter.remove(); - snowman.remove(); - continue; - } - Player target = UtilPlayer.getClosest(snowman.getLocation(), player); if (target == null) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkNeedler.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkNeedler.java index 4153fca46..d65af9d03 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkNeedler.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkNeedler.java @@ -31,8 +31,8 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkNeedler extends SmashPerk { - private static final long COOLDOWN_NORMAL = 2000; - private static final long COOLDOWN_SMASH = 600; + private static final int COOLDOWN_NORMAL = 2000; + private static final int COOLDOWN_SMASH = 600; private static final float DAMAGE = 1.1F; private static final int MAX_TICKS = 300; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkWebShot.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkWebShot.java index faf02aebd..1fdd08267 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkWebShot.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkWebShot.java @@ -30,8 +30,8 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkWebShot extends SmashPerk implements IThrown { - private static final long COOLDOWN_NORMAL = 10000; - private static final long COOLDOWN_SMASH = 1000; + private static final int COOLDOWN_NORMAL = 10000; + private static final int COOLDOWN_SMASH = 1000; private static final int WEBS = 20; public PerkWebShot() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java index 2549dd73c..c38a1fd2c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java @@ -21,7 +21,7 @@ import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashSpider extends SmashUltimate { - private static final long DURATION = 30000; + private static final int DURATION = 30000; private Map _preHealth = new HashMap<>(); @@ -60,11 +60,11 @@ public class SmashSpider extends SmashUltimate continue; } - Manager.GetBlockRestore().add(block, 30, (byte) 0, (long) (DURATION + 5000 * Math.random())); + Manager.GetBlockRestore().add(block, 30, (byte) 0, (int) (DURATION + 5000 * Math.random())); } // Regen - Manager.GetCondition().Factory().Regen(GetName(), player, player, 30, 0, false, false, false); + Manager.GetCondition().Factory().Regen(GetName(), player, player, DURATION / 1000, 0, false, false, false); } @EventHandler(priority = EventPriority.HIGH) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkFishFlurry.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkFishFlurry.java index c28aa56dc..335f7c7ae 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkFishFlurry.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkFishFlurry.java @@ -46,7 +46,7 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkFishFlurry extends SmashPerk implements IThrown { - private static final long COOLDOWN = 24000; + private static final int COOLDOWN = 24000; private static final int DAMAGE = 3; private static final int START_TIME = 2000; private static final int END_TIME = 6000; @@ -94,7 +94,7 @@ public class PerkFishFlurry extends SmashPerk implements IThrown return; } - Block block = UtilPlayer.getTargetLocation(player, 64).getBlock(); + Block block = UtilPlayer.getTarget(player, UtilBlock.blockAirFoliageSet, 64); if (block == null || block.getType() == Material.AIR) { @@ -164,7 +164,12 @@ public class PerkFishFlurry extends SmashPerk implements IThrown block.getWorld().playSound(block.getLocation(), Math.random() > 0.5 ? Sound.SPLASH : Sound.SPLASH2, 0.5f, 1f); } - if (UtilTime.elapsed(data.StartTime, START_TIME) && !UtilTime.elapsed(data.StartTime, END_TIME)) + if (!UtilTime.elapsed(data.StartTime, START_TIME)) + { + continue; + } + + if (!UtilTime.elapsed(data.StartTime, END_TIME)) { Item fish = block.getWorld().dropItem(block.getLocation().add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.RAW_FISH, (byte) UtilMath.r(4), 1, "Fish" + Math.random())); @@ -187,7 +192,7 @@ public class PerkFishFlurry extends SmashPerk implements IThrown if (target != null) { // Damage Event - Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, DAMAGE, true, false, false, UtilEnt.getName(data.getThrower()), GetName()); + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, DAMAGE, false, true, false, UtilEnt.getName(data.getThrower()), GetName()); UtilParticle.PlayParticle(ParticleType.EXPLODE, target.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 12, ViewDist.LONG, UtilServer.getPlayers()); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkInkBlast.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkInkBlast.java index eb9def768..80f6d91a5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkInkBlast.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkInkBlast.java @@ -36,7 +36,7 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkInkBlast extends SmashPerk implements IThrown { - private static final long COOLDOWN = 6000; + private static final int COOLDOWN = 6000; private static final float PROJECTILE_VELOCITY = 0.15F; private static final int KNOCKBACK_MAGNITUDE = 3; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkSuperSquid.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkSuperSquid.java index 5f1d54bae..dc203d554 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkSuperSquid.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkSuperSquid.java @@ -31,8 +31,8 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkSuperSquid extends SmashPerk { - private static final long COOLDOWN = 8000; - private static final long VELOCITY_TIME = 1100; + private static final int COOLDOWN = 8000; + private static final int VELOCITY_TIME = 1100; private Map _active = new HashMap<>(); @@ -130,7 +130,7 @@ public class PerkSuperSquid extends SmashPerk { if (_active.containsKey(event.GetDamageeEntity().getUniqueId())) { - event.SetCancelled("Super Squid"); + event.SetCancelled(GetName()); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/SmashSquid.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/SmashSquid.java index a7f6e4513..118449e13 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/SmashSquid.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/SmashSquid.java @@ -98,7 +98,7 @@ public class SmashSquid extends SmashUltimate return; } - Block block = UtilPlayer.getTargetLocation(player, MAX_RANGE).getBlock(); + Block block = UtilPlayer.getTarget(player, UtilBlock.blockAirFoliageSet, MAX_RANGE); if (block == null) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java index 2c6f48e0f..02b5204bf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java @@ -13,6 +13,7 @@ import org.bukkit.Sound; import org.bukkit.entity.Bat; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEvent; @@ -43,11 +44,12 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkBatWave extends SmashPerk { - private static final long COOLDOWN = 8000; - private static final long LEASH_COOLDOWN = 500; - private static final long HIT_COOLDOWN = 200; + private static final int COOLDOWN = 8000; + private static final int LEASH_COOLDOWN = 500; + private static final int HIT_COOLDOWN = 200; private static final int HIT_BOX = 2; private static final int DAMAGE = 3; + private static final int DISABLE_DAMAGE = 8; private static final float KNOCKBACK_MAGNITUDE = 1.75F; private static final String LEASH = "Leash Bats"; @@ -56,6 +58,7 @@ public class PerkBatWave extends SmashPerk private Map _active = new HashMap<>(); private Map _direction = new HashMap<>(); private Map> _bats = new HashMap<>(); + private Map _damageTaken = new HashMap<>(); private Set _pulling = new HashSet<>(); private Set _allowLeash = new HashSet<>(); @@ -299,9 +302,31 @@ public class PerkBatWave extends SmashPerk } } - @EventHandler - public void Knockback(CustomDamageEvent event) + @EventHandler(priority = EventPriority.HIGHEST) + public void damage(CustomDamageEvent event) { + if (event.GetDamageePlayer() != null) + { + Player player = event.GetDamageePlayer(); + + if (hasPerk(player)) + { + UUID key = player.getUniqueId(); + + if (!_damageTaken.containsKey(key)) + { + _damageTaken.put(key, 0); + } + + _damageTaken.put(key, (int) (_damageTaken.get(key) + event.GetDamage())); + + if (_damageTaken.get(key) >= DISABLE_DAMAGE) + { + Clear(player); + } + } + } + if (event.GetReason() == null || !event.GetReason().contains(GetName())) { return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java index 8c37318fc..073c8b282 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java @@ -36,7 +36,7 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkWitchPotion extends SmashPerk { - private static final long COOLDOWN = 2000; + private static final int COOLDOWN = 2000; private static final int RANGE_NOMRAL = 3; private static final int RANGE_SMASH = 4; private static final int DAMAGE_NORMAL = 7; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/SmashBat.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/SmashWitch.java similarity index 93% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/SmashBat.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/SmashWitch.java index 3febfa3d0..c8c048c3b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/SmashBat.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/SmashWitch.java @@ -7,7 +7,6 @@ import java.util.Map; import java.util.UUID; import org.bukkit.GameMode; -import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.BlockFace; import org.bukkit.entity.LivingEntity; @@ -18,16 +17,15 @@ import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerToggleFlightEvent; -import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; import mineplex.core.disguise.disguises.DisguiseBat; @@ -35,19 +33,19 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.kits.KitWitch; import nautilus.game.arcade.game.games.smash.perks.SmashKit; import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkDoubleJump; import nautilus.game.arcade.kit.perks.data.SonicBoomData; -public class SmashBat extends SmashUltimate +public class SmashWitch extends SmashUltimate { - private static final long DURATION = 20000; - private static final long COOLDOWN = 1200; - private static final long MAX_TIME = 12000; + private static final int DURATION = 20000; + private static final int COOLDOWN = 1200; + private static final int MAX_TIME = 12000; private static final int HIT_BOX = 4; private static final int DAMAGE_RADIUS = 10; private static final int DAMAGE = 12; @@ -56,7 +54,7 @@ public class SmashBat extends SmashUltimate private List _sonic = new ArrayList<>(); - public SmashBat() + public SmashWitch() { super("Bat Form", new String[] {}, Sound.BAT_HURT, DURATION); } @@ -66,10 +64,12 @@ public class SmashBat extends SmashUltimate { super.activate(player); - player.getInventory().remove(Material.IRON_SPADE); - player.getInventory().remove(Material.IRON_AXE); - - player.getInventory().addItem(new ItemStack(Material.DIAMOND_AXE)); + if (Kit instanceof KitWitch) + { + KitWitch kit = (KitWitch) Kit; + + kit.giveSmashItems(player); + } for (Perk perk : Kit.GetPerks()) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java index 49d800c70..5484d6ae6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java @@ -14,7 +14,6 @@ import org.bukkit.entity.Skeleton; import org.bukkit.entity.Skeleton.SkeletonType; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEvent; @@ -24,21 +23,20 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.TeamSuperSmash; import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkWitherImage extends SmashPerk { - private static final long COOLDOWN = 12000; - private static final long SWAP_COOLDOWN = 2000; + private static final int COOLDOWN = 12000; + private static final int SWAP_COOLDOWN = 2000; private Map _skeletons = new HashMap<>(); @@ -116,7 +114,7 @@ public class PerkWitherImage extends SmashPerk _skeletons.put(player.getUniqueId(), skel); - Recharge.Instance.use(player, "Wither Swap", SWAP_COOLDOWN, false, false); + Recharge.Instance.use(player, "Wither Swap", SWAP_COOLDOWN / 4, false, false); // Sound player.getWorld().playSound(player.getLocation(), Sound.WITHER_SPAWN, 1f, 1f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/SmashWitherSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/SmashWitherSkeleton.java index 3e7f65308..717328a64 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/SmashWitherSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/SmashWitherSkeleton.java @@ -1,6 +1,7 @@ package nautilus.game.arcade.game.games.smash.perks.witherskeleton; import java.util.ArrayList; +import java.util.List; import java.util.UUID; import org.bukkit.Location; @@ -20,13 +21,14 @@ import mineplex.core.disguise.disguises.DisguiseWither; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.kits.KitWitherSkeleton; import nautilus.game.arcade.game.games.smash.perks.SmashKit; import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashWitherSkeleton extends SmashUltimate { - private static final long DURAITON = 18000; + private static final int DURAITON = 18000; public SmashWitherSkeleton() { @@ -38,10 +40,12 @@ public class SmashWitherSkeleton extends SmashUltimate { super.activate(player); - Manager.GetDisguise().undisguise(Manager.GetDisguise().getActiveDisguise(player)); - - SmashKit kit = (SmashKit) Kit; - kit.disguise(player, DisguiseWither.class); + if (Kit instanceof KitWitherSkeleton) + { + KitWitherSkeleton kit = (KitWitherSkeleton) Kit; + kit.disguise(player, DisguiseWither.class); + kit.giveSmashItems(player); + } } @Override @@ -49,8 +53,6 @@ public class SmashWitherSkeleton extends SmashUltimate { super.cancel(player); - Manager.GetDisguise().undisguise(Manager.GetDisguise().getActiveDisguise(player)); - SmashKit kit = (SmashKit) Kit; kit.disguise(player); @@ -74,7 +76,7 @@ public class SmashWitherSkeleton extends SmashUltimate continue; } - ArrayList collisions = new ArrayList(); + List collisions = new ArrayList<>(); // Bump for (Block block : UtilBlock.getInRadius(player.getLocation().add(0, 0.5, 0), 1.5d).keySet()) @@ -88,8 +90,10 @@ public class SmashWitherSkeleton extends SmashUltimate Vector vec = UtilAlg.getAverageBump(player.getLocation(), collisions); if (vec == null) + { continue; - + } + UtilAction.velocity(player, vec, 0.6, false, 0, 0.4, 10, true); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/SmashWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/SmashWolf.java index af0145b89..20fda8f14 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/SmashWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/SmashWolf.java @@ -14,7 +14,6 @@ import org.bukkit.entity.Player; import org.bukkit.entity.Wolf; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.player.PlayerInteractEvent; @@ -28,18 +27,17 @@ import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.disguise.disguises.DisguiseBase; -import mineplex.core.disguise.disguises.DisguiseWolf; import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTime; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseWolf; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.condition.ConditionFactory; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.smash.perks.SmashPerk; import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashWolf extends SmashUltimate diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkOvercharge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkOvercharge.java index fa61a59ff..92edcd250 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkOvercharge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/PerkOvercharge.java @@ -37,10 +37,10 @@ public class PerkOvercharge extends SmashPerk private Map _arrows = new HashMap<>(); private int _max; - private long _tick; + private int _tick; private boolean _useExp; - public PerkOvercharge(int max, long tick, boolean useExpBar) + public PerkOvercharge(int max, int tick, boolean useExpBar) { super("Corrupted Arrow", new String[] { C.cYellow + "Charge" + C.cGray + " your Bow to use " + C.cGreen + "Corrupted Arrow" }); @@ -143,17 +143,17 @@ public class PerkOvercharge extends SmashPerk } // Increase Charge - _charge.put(uuid, _charge.get(cur) + 1); + _charge.put(uuid, _charge.get(uuid) + 1); if (_useExp) { - cur.setExp(Math.min(0.99f, _charge.get(cur) / _max)); + cur.setExp(Math.min(0.99f, _charge.get(uuid) / _max)); } _chargeLast.put(uuid, System.currentTimeMillis()); // Effect - cur.playSound(cur.getLocation(), Sound.CLICK, 1f, 1f + (0.1f * _charge.get(cur))); + cur.playSound(cur.getLocation(), Sound.CLICK, 1f, 1f + (0.1f * _charge.get(uuid))); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/SmashZombie.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/SmashZombie.java index 49a2aa35e..3973da393 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/SmashZombie.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/zombie/SmashZombie.java @@ -35,7 +35,7 @@ public class SmashZombie extends SmashUltimate public SmashZombie() { - super("Night of the Living Dead", new String[] {}, Sound.AMBIENCE_CAVE, 0); + super("Night of the Living Dead", new String[] {}, Sound.AMBIENCE_CAVE, DURATION); } @Override @@ -45,6 +45,33 @@ public class SmashZombie extends SmashUltimate _night.add(new NightLivingDeadData(player)); } + + @Override + public void cancel(Player player) + { + super.cancel(player); + + Iterator nightIter = _night.iterator(); + + while (nightIter.hasNext()) + { + NightLivingDeadData data = nightIter.next(); + + // Expire + if (data.Player.equals(player)) + { + nightIter.remove(); + + for (Zombie zombie : data.Zombies) + { + zombie.damage(1000); + } + + return; + } + } + + } @EventHandler public void timeUpdate(UpdateEvent event) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameDash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameDash.java deleted file mode 100644 index e099b91dd..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameDash.java +++ /dev/null @@ -1,195 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -import org.bukkit.Sound; -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.util.Vector; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilItem; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.data.FireflyData; - -public class PerkFlameDash extends Perk -{ - - private static final long COOLDOWN = 8000; - private static final long TIME = 800; - private static final int DAMAGE_RADIUS = 3; - private static final int KNOCKBACK_MAGNITUDE = 2; - - private Set _data = new HashSet(); - - public PerkFlameDash() - { - super("Flame Dash", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + "Flame Dash" }); - } - - @EventHandler - public void Skill(PlayerInteractEvent event) - { - if (event.isCancelled()) - { - return; - } - - if (!UtilEvent.isAction(event, ActionType.R)) - { - return; - } - - if (UtilBlock.usable(event.getClickedBlock())) - { - return; - } - - Player player = event.getPlayer(); - - if (!UtilItem.isSpade(player.getItemInHand())) - { - return; - } - - if (!hasPerk(player)) - { - return; - } - - if (!Recharge.Instance.usable(player, GetName())) - { - boolean done = false; - for (FireflyData data : _data) - { - if (data.Player.equals(player)) - { - data.Time = 0; - done = true; - } - } - - if (done) - { - UtilPlayer.message(player, F.main("Skill", "You ended " + F.skill(GetName()) + ".")); - UpdateMovement(); - } - else - { - Recharge.Instance.use(player, GetName(), COOLDOWN, true, true); - } - - return; - } - - Recharge.Instance.useForce(player, GetName(), COOLDOWN); - - _data.add(new FireflyData(player)); - - Manager.GetCondition().Factory().Cloak(GetName(), player, player, 2.5, false, false); - - UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); - } - - @EventHandler - public void Update(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - UpdateMovement(); - } - - public void UpdateMovement() - { - Iterator dataIterator = _data.iterator(); - - while (dataIterator.hasNext()) - { - FireflyData data = dataIterator.next(); - - // Move - if (!UtilTime.elapsed(data.Time, TIME)) - { - Vector vel = data.Location.getDirection(); - vel.setY(0); - vel.normalize(); - vel.setY(0.05); - - UtilAction.velocity(data.Player, vel); - - // Sound - data.Player.getWorld().playSound(data.Player.getLocation(), Sound.FIZZ, 0.6f, 1.2f); - - // Particles - UtilParticle.PlayParticle(ParticleType.FLAME, data.Player.getLocation().add(0, 0.4, 0), 0.2f, 0.2f, 0.2f, 0f, 3, ViewDist.LONGER, UtilServer.getPlayers()); - } - // End - else - { - for (Player other : UtilPlayer.getNearby(data.Player.getLocation(), DAMAGE_RADIUS)) - { - if (other.equals(data.Player)) - { - continue; - } - - if (UtilPlayer.isSpectator(other)) - { - continue; - } - - double dist = UtilMath.offset(data.Player.getLocation(), data.Location) / 2; - - // Damage Event - Manager.GetDamage().NewDamageEvent(other, data.Player, null, DamageCause.CUSTOM, 2 + dist, true, true, false, data.Player.getName(), GetName()); - - UtilPlayer.message(other, F.main("Game", F.elem(Manager.GetColor(data.Player) + data.Player.getName()) + " hit you with " + F.elem(GetName()) + ".")); - } - - // End Invisible - Manager.GetCondition().EndCondition(data.Player, null, GetName()); - - // Sound - data.Player.getWorld().playSound(data.Player.getLocation(), Sound.EXPLODE, 1f, 1.2f); - - // Particles - UtilParticle.PlayParticle(ParticleType.FLAME, data.Player.getLocation(), 0.1f, 0.1f, 0.1f, 0.3f, 100, ViewDist.MAX, UtilServer.getPlayers()); - UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.Player.getLocation().add(0, 0.4, 0), 0.2f, 0.2f, 0.2f, 0f, 1, ViewDist.MAX, UtilServer.getPlayers()); - - dataIterator.remove(); - } - } - } - - @EventHandler - public void Knockback(CustomDamageEvent event) - { - if (event.GetReason() == null || !event.GetReason().contains(GetName())) - { - return; - } - - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLazer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLazer.java index 6fcdbbe1c..e962d477b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLazer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLazer.java @@ -173,7 +173,7 @@ public class PerkLazer extends Perk LineParticle lineParticle = new LineParticle(player.getEyeLocation(), player.getLocation().getDirection(), INCREMENTATION, _range * player.getExp(), null, ParticleType.FIREWORKS_SPARK, UtilServer.getPlayers()); - particleLoop: while (lineParticle.update()) + particleLoop: while (!lineParticle.update()) { for (Player other : UtilPlayer.getNearby(lineParticle.getLastLocation(), HIT_BOX_RADIUS)) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMagmaBlast.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMagmaBlast.java deleted file mode 100644 index b25cb4ea7..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMagmaBlast.java +++ /dev/null @@ -1,160 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashMap; -import java.util.Iterator; - -import org.bukkit.Location; -import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLargeFireball; -import org.bukkit.entity.LargeFireball; -import org.bukkit.entity.Player; -import org.bukkit.entity.Projectile; -import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; -import org.bukkit.event.entity.ProjectileHitEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.util.Vector; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.kit.Perk; -import net.minecraft.server.v1_8_R3.EntityLargeFireball; - -public class PerkMagmaBlast extends Perk -{ - public HashMap _proj = new HashMap(); - - public PerkMagmaBlast() - { - super("Magma Blast", new String[] - { - C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Magma Blast" - }); - } - - - @EventHandler - public void Shoot(PlayerInteractEvent event) - { - if (event.isCancelled()) - return; - - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) - return; - - if (UtilBlock.usable(event.getClickedBlock())) - return; - - if (event.getPlayer().getItemInHand() == null) - return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) - return; - - Player player = event.getPlayer(); - - if (!Kit.HasKit(player)) - return; - - if (!Recharge.Instance.use(player, GetName(), 6000, true, true)) - return; - - event.setCancelled(true); - - //Action - LargeFireball ball = player.launchProjectile(LargeFireball.class); - ball.setShooter(player); - ball.setIsIncendiary(false); - ball.setYield(0); - ball.setBounce(false); - ball.teleport(player.getEyeLocation().add(player.getLocation().getDirection().multiply(1))); - - //ball.setVelocity(new Vector(0,0,0)); - - Vector dir = player.getLocation().getDirection().multiply(0.2); - - EntityLargeFireball eFireball = ((CraftLargeFireball) ball).getHandle(); - eFireball.dirX = dir.getX(); - eFireball.dirY = dir.getY(); - eFireball.dirZ = dir.getZ(); - - //Knockback - UtilAction.velocity(player, player.getLocation().getDirection().multiply(-1), 1.2, false, 0, 0.2, 1.2, true); - - //Add - _proj.put(ball, player.getLocation()); - - //Inform - UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); - - //Effect - player.getWorld().playSound(player.getLocation(), Sound.CREEPER_DEATH, 2f, 1.5f); - } - - @EventHandler - public void Update(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - Iterator projIterator = _proj.keySet().iterator(); - - while (projIterator.hasNext()) - { - LargeFireball proj = projIterator.next(); - - if (!proj.isValid()) - { - projIterator.remove(); - proj.remove(); - continue; - } - -// proj.setDirection(_proj.get(proj).clone().getDirection()); -// proj.setVelocity(_proj.get(proj).clone().getDirection().multiply(0.6)); - } - } - - @EventHandler - public void Collide(ProjectileHitEvent event) - { - Projectile proj = event.getEntity(); - - if (!_proj.containsKey(proj)) - return; - - if (proj.getShooter() == null) - return; - - if (!(proj.getShooter() instanceof Player)) - return; - - //Velocity Players - HashMap hitMap = UtilPlayer.getInRadius(proj.getLocation(), 8); - for (Player cur : hitMap.keySet()) - { - double range = hitMap.get(cur); - - //Velocity - UtilAction.velocity(cur, UtilAlg.getTrajectory(proj.getLocation().add(0, -0.5, 0), cur.getEyeLocation()), - 1 + 2 * range, false, 0, 0.2 + 0.4 * range, 1.2, true); - - cur.setFireTicks(40); - } - - //Particles - UtilParticle.PlayParticle(ParticleType.LAVA, proj.getLocation(), 0.1f, 0.1f, 0.1f, 0.1f, 50, - ViewDist.LONG, UtilServer.getPlayers()); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMagmaBoost.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMagmaBoost.java deleted file mode 100644 index 0b8edda31..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMagmaBoost.java +++ /dev/null @@ -1,144 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashMap; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.disguise.disguises.DisguiseMagmaCube; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.Perk; - -public class PerkMagmaBoost extends Perk -{ - private HashMap _kills = new HashMap(); - - public PerkMagmaBoost() - { - super("Fuel the Fire", new String[] - { - C.cGray + "Kills give +1 Damage, -15% Knockback Taken and +1 Size.", - C.cGray + "Kill bonuses can stack 3 times, and reset on death.", - }); - } - - @EventHandler - public void Kill(CombatDeathEvent event) - { - Player killed = (Player)event.GetEvent().getEntity(); - - _kills.remove(killed); - - if (event.GetLog().GetKiller() == null) - return; - - Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); - - if (killer == null || killer.equals(killed) || !Kit.HasKit(killer)) - return; - - DisguiseMagmaCube slime = (DisguiseMagmaCube)Manager.GetDisguise().getDisguise(killer); - if (slime == null) - return; - - int size = 1; - if (_kills.containsKey(killer)) - size += _kills.get(killer); - - size = Math.min(3, size); - - _kills.put(killer, size); - - slime.SetSize(size + 1); - Manager.GetDisguise().updateDisguise(slime); - - killer.setExp(0.99f * (size/3f)); - } - - @EventHandler(priority = EventPriority.HIGHEST) - public void SizeDamage(CustomDamageEvent event) - { - if (event.IsCancelled()) - return; - - if (event.GetCause() != DamageCause.ENTITY_ATTACK) - return; - - Player damager = event.GetDamagerPlayer(false); - if (damager == null) return; - - if (!Kit.HasKit(damager)) - return; - - if (!_kills.containsKey(damager)) - return; - - int bonus = _kills.get(damager); - - event.AddMod(damager.getName(), GetName(), bonus, false); - } - - @EventHandler(priority = EventPriority.HIGHEST) - public void SizeKnockback(CustomDamageEvent event) - { - if (event.IsCancelled()) - return; - - if (event.GetCause() != DamageCause.ENTITY_ATTACK) - return; - - Player damagee = event.GetDamageePlayer(); - if (damagee == null) return; - - if (!Kit.HasKit(damagee)) - return; - - if (!_kills.containsKey(damagee)) - return; - - int bonus = _kills.get(damagee); - - event.AddKnockback(GetName(), bonus*0.15d); - } - - @EventHandler - public void EnergyUpdate(UpdateEvent event) - { - if (event.getType() != UpdateType.SEC && event.getType() != UpdateType.FAST && event.getType() != UpdateType.FASTER && event.getType() != UpdateType.FASTEST) - return; - - for (Player player : UtilServer.getPlayers()) - { - if (!Kit.HasKit(player)) - continue; - - float size = 0; - if (_kills.containsKey(player)) - size += _kills.get(player); - - if (size == 0 && event.getType() == UpdateType.SEC) - UtilParticle.PlayParticle(ParticleType.LAVA, player.getLocation().add(0,0.4,0), 0.15f + 0.15f * size, 0.15f + 0.15f * size, 0.15f + 0.15f * size, 0, 1, - ViewDist.LONG, UtilServer.getPlayers()); - else if (size == 1 && event.getType() == UpdateType.FAST) - UtilParticle.PlayParticle(ParticleType.LAVA, player.getLocation().add(0,0.4,0), 0.15f + 0.15f * size, 0.15f + 0.15f * size, 0.15f + 0.15f * size, 0, 1, - ViewDist.LONG, UtilServer.getPlayers()); - else if (size == 2 && event.getType() == UpdateType.FASTER) - UtilParticle.PlayParticle(ParticleType.LAVA, player.getLocation().add(0,0.4,0), 0.15f + 0.15f * size, 0.15f + 0.15f * size, 0.15f + 0.15f * size, 0, 1, - ViewDist.LONG, UtilServer.getPlayers()); - else if (size == 3 && event.getType() == UpdateType.FASTEST) - UtilParticle.PlayParticle(ParticleType.LAVA, player.getLocation().add(0,0.4,0), 0.15f + 0.15f * size, 0.15f + 0.15f * size, 0.15f + 0.15f * size, 0, 1, - ViewDist.LONG, UtilServer.getPlayers()); - } - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlam.java index f55739404..9b93d6fe8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlam.java @@ -173,7 +173,7 @@ public class PerkSeismicSlam extends Perk { if (UtilBlock.airFoliage(cur.getRelative(BlockFace.UP)) && !UtilBlock.airFoliage(cur)) { - cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getTypeId()); + cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getType()); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpiderLeap.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpiderLeap.java index 4df288188..11b6804c0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpiderLeap.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpiderLeap.java @@ -26,17 +26,17 @@ import nautilus.game.arcade.kit.Perk; public class PerkSpiderLeap extends Perk { - - private static final float ENERGY_PER_TICK = 1 / 80; + + private static final float ENERGY_PER_TICK = 1 / 200; private static final float ENERGY_PER_LEAP = 1 / 6; private Set _secondJump = new HashSet<>(); + private Set _finalJump = new HashSet<>(); public PerkSpiderLeap() { super("Spider Leap", new String[] { C.cYellow + "Tap Jump Twice" + C.cGray + " to " + C.cGreen + "Spider Leap", C.cYellow + "Hold Crouch" + C.cGray + " to " + C.cGreen + "Wall Climb", C.cWhite - + "Wall Climb requires Energy (Experience Bar)." - }); + + "Wall Climb requires Energy (Experience Bar)." }); } @EventHandler @@ -46,27 +46,28 @@ public class PerkSpiderLeap extends Perk { return; } - + for (Player player : UtilServer.getPlayers()) { if (UtilPlayer.isSpectator(player)) { continue; } - + if (!hasPerk(player)) { continue; } - + if (!player.isSneaking()) { - if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) + if (UtilEnt.isGrounded(player)) { - player.setExp((float) Math.min(0.999, player.getExp() + ENERGY_PER_TICK)); _secondJump.remove(player.getUniqueId()); } - + + player.setExp((float) Math.min(0.999, player.getExp() + (UtilEnt.isGrounded(player) ? ENERGY_PER_TICK * 2 : ENERGY_PER_TICK))); + continue; } @@ -77,11 +78,16 @@ public class PerkSpiderLeap extends Perk continue; } + if (player.getExp() >= ENERGY_PER_LEAP) + { + _finalJump.remove(player.getUniqueId()); + } + if (!Recharge.Instance.usable(player, GetName())) { continue; } - + for (Block block : UtilBlock.getSurrounding(player.getLocation().getBlock(), true)) { if (!UtilBlock.airFoliage(block) && !block.isLiquid()) @@ -93,8 +99,6 @@ public class PerkSpiderLeap extends Perk player.setAllowFlight(true); _secondJump.add(player.getUniqueId()); } - - continue; } } } @@ -109,17 +113,17 @@ public class PerkSpiderLeap extends Perk { return; } - + if (UtilPlayer.isSpectator(player)) { return; } - + if (player.getGameMode() == GameMode.CREATIVE) { return; } - + event.setCancelled(true); player.setFlying(false); @@ -128,9 +132,16 @@ public class PerkSpiderLeap extends Perk if (player.getExp() < ENERGY_PER_LEAP) { - return; + if (!_finalJump.contains(player.getUniqueId())) + { + _finalJump.add(player.getUniqueId()); + } + else + { + return; + } } - + // Velocity UtilAction.velocity(player, 1.0, 0.2, 1.0, true); @@ -147,7 +158,9 @@ public class PerkSpiderLeap extends Perk public void FlightUpdate(UpdateEvent event) { if (event.getType() != UpdateType.TICK) + { return; + } for (Player player : UtilServer.getPlayers()) { @@ -155,12 +168,12 @@ public class PerkSpiderLeap extends Perk { continue; } - + if (!hasPerk(player)) { continue; } - + if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) { player.setAllowFlight(true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java index 155fdf212..110a2acda 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java @@ -99,7 +99,9 @@ public class PerkWoolBomb extends Perk implements IThrown return; } - if (_active.containsKey(player)) + UUID key = player.getUniqueId(); + + if (_active.containsKey(key)) { if (detonate(player, true)) { @@ -107,7 +109,7 @@ public class PerkWoolBomb extends Perk implements IThrown } } - if (_thrown.containsKey(player)) + if (_thrown.containsKey(key)) { if (solidify(player, true)) { @@ -220,7 +222,7 @@ public class PerkWoolBomb extends Perk implements IThrown private boolean detonate(Player player, boolean inform) { - WoolBombData data = _active.remove(player); + WoolBombData data = _active.remove(player.getUniqueId()); if (data == null) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolCloud.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolCloud.java index 9c5694a6b..93ca2537d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolCloud.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolCloud.java @@ -131,7 +131,7 @@ public class PerkWoolCloud extends Perk UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation(), 0.2f, 0.2f, 0.2f, 0, 4, ViewDist.LONGER, UtilServer.getPlayers()); - if (!UtilTime.elapsed(_active.get(player), MIN_VELOCITY_TIME)) + if (!UtilTime.elapsed(_active.get(key), MIN_VELOCITY_TIME)) { continue; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/EarthquakeData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/EarthquakeData.java deleted file mode 100644 index c3e994b14..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/EarthquakeData.java +++ /dev/null @@ -1,15 +0,0 @@ -package nautilus.game.arcade.kit.perks.data; - -import org.bukkit.entity.Player; - -public class EarthquakeData -{ - public Player Player; - public long Time; - - public EarthquakeData(Player player) - { - Player = player; - Time = System.currentTimeMillis(); - } -} From 68c62acb004da4259cb892526d1adda72103a94b Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 27 Sep 2016 19:02:54 +0100 Subject: [PATCH 008/147] Guardian changes --- .../smash/perks/golem/PerkSeismicSlam.java | 2 +- .../smash/perks/guardian/PerkTargetLazer.java | 28 +++++++++++++++++-- .../smash/perks/guardian/PerkWaterSplash.java | 3 +- .../perks/guardian/SmashAnimationData.java | 18 ++++++++++-- 4 files changed, 44 insertions(+), 7 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkSeismicSlam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkSeismicSlam.java index 0363bf106..88b960cd1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkSeismicSlam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/PerkSeismicSlam.java @@ -173,7 +173,7 @@ public class PerkSeismicSlam extends Perk { if (UtilBlock.airFoliage(cur.getRelative(BlockFace.UP)) && !UtilBlock.airFoliage(cur)) { - cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getTypeId()); + cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getType()); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java index 6dce9b9ca..f58a3069b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java @@ -9,6 +9,7 @@ import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEvent; import mineplex.core.common.util.F; @@ -118,7 +119,8 @@ public class PerkTargetLazer extends Perk return; } - player.sendMessage(F.main("Game", "You targeted " + F.name(best.getName())) + "."); + player.sendMessage(F.main("Game", "You targeted " + F.name(best.getName())) + " with " + F.skill(GetName()) + "."); + best.sendMessage(F.main("Game", F.name(player.getName()) + " targeted you with their " + F.skill(GetName()) + ".")); boolean contained = false; @@ -173,7 +175,11 @@ public class PerkTargetLazer extends Perk if (UtilMath.offset(data.getTarget(), data.getAttacker()) > MAX_RANGE || data.getTimeElapsed() > MAX_TIME) { - Manager.GetDamage().NewDamageEvent(data.getTarget(), data.getAttacker(), null, DamageCause.CUSTOM, 0.5 * (data.getTimeElapsed() / 1000), false, true, false, data.getAttacker().getName(), GetName()); + long time = data.getTimeElapsed() / 1000; + double damage = 0.5 * time; + + data.getAttacker().sendMessage(F.main("Game", "Your laser ended dealing damage to " + F.name(data.getTarget().getName())) + "."); + Manager.GetDamage().NewDamageEvent(data.getTarget(), data.getAttacker(), null, DamageCause.CUSTOM, damage, false, true, false, data.getAttacker().getName(), GetName()); setLazerTarget(data.getAttacker(), null); Recharge.Instance.use(data.getAttacker(), GetName(), COOLDOWN, true, true); iterator.remove(); @@ -207,6 +213,24 @@ public class PerkTargetLazer extends Perk } } } + + @EventHandler + public void death(PlayerDeathEvent event) + { + Player player = event.getEntity(); + + Iterator iterator = _data.iterator(); + + while (iterator.hasNext()) + { + TargetLazerData data = iterator.next(); + + if (data.getTarget().equals(player) || data.getAttacker().equals(player)) + { + iterator.remove(); + } + } + } private void setLazerTarget(Player disguised, Player target) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java index 1486c4a5a..34354559e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java @@ -158,7 +158,8 @@ public class PerkWaterSplash extends Perk double power = nearby.get(other); - Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE * power, true, true, true, player.getName(), GetName()); + Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE * power, true, true, false, player.getName(), GetName()); + Manager.GetCondition().Factory().Falling(GetName(), other, player, DAMAGE, false, true); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashAnimationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashAnimationData.java index 714e0a69a..c6172c8ce 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashAnimationData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashAnimationData.java @@ -31,7 +31,8 @@ public class SmashAnimationData private static final double THETA_INCREMENTATION = Math.PI / 20; private static final int RADIUS = 3; private static final int DAMAGE_RADIUS = 11; - private static final int VELOCITY_DAMAGE = 3; + private static final int VELOCITY_DAMAGE = 2; + private static final int Y_INCREASE = 7; private ArcadeManager _manager; private Player _player; @@ -54,7 +55,7 @@ public class SmashAnimationData _duration = duration; DisguiseManager disguiseManager = manager.GetDisguise(); - Location location = player.getLocation().add(0, 7, 0); + Location location = player.getLocation().add(0, Y_INCREASE, 0); ArmorStand target = player.getWorld().spawn(player.getLocation(), ArmorStand.class); target.setArms(false); @@ -143,9 +144,20 @@ public class SmashAnimationData } } - Location center = _elder.getLocation(); + Location center = _target.getLocation().add(0, Y_INCREASE, 0); int i = 0; + //Teleport the elder guardian around in a circle + { + double x = Math.cos(_lastTheta); + double z = Math.sin(_lastTheta); + + center.add(x, 0, z); + _elder.teleport(center); + center.subtract(x, 0, z); + } + + //Teleport all guardians around in a circle for (ArmorStand guardian : _guardians) { double theta = _lastTheta + _thetaSpacing * i++; From 22f8a1496a7407d36c49ed78f51e6b2af844d21e Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 29 Sep 2016 22:44:03 +0100 Subject: [PATCH 009/147] Guardian fixes --- .../arcade/game/games/smash/SuperSmash.java | 2 +- .../game/games/smash/kits/KitGuardian.java | 45 +++++++++++++++---- .../smash/perks/enderman/PerkBlockToss.java | 10 ++--- .../smash/perks/guardian/PerkTargetLazer.java | 38 +++++++++------- .../smash/perks/guardian/PerkThorns.java | 6 ++- .../smash/perks/guardian/PerkWaterSplash.java | 17 ++++++- .../perks/guardian/PerkWhirlpoolBlade.java | 7 +-- .../perks/guardian/SmashAnimationData.java | 2 +- .../games/smash/perks/spider/SmashSpider.java | 4 +- 9 files changed, 88 insertions(+), 43 deletions(-) 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 76f43254c..8ee31b928 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 @@ -536,7 +536,7 @@ public abstract class SuperSmash extends Game public long getNewSmashTime() { - return (long) (System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(2) + TimeUnit.MINUTES.toMillis(5) * Math.random()); + return (long) (System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(3) + TimeUnit.MINUTES.toMillis(5) * Math.random()); } public String getLiveColour(int lives) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java index 08e4f0069..2bf87668a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java @@ -10,9 +10,11 @@ import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseGuardian; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; import nautilus.game.arcade.game.games.smash.perks.SmashKit; import nautilus.game.arcade.game.games.smash.perks.guardian.PerkTargetLazer; +import nautilus.game.arcade.game.games.smash.perks.guardian.PerkThorns; import nautilus.game.arcade.game.games.smash.perks.guardian.PerkWaterSplash; import nautilus.game.arcade.game.games.smash.perks.guardian.PerkWhirlpoolBlade; import nautilus.game.arcade.game.games.smash.perks.guardian.SmashGuardian; @@ -29,28 +31,51 @@ public class KitGuardian extends SmashKit new PerkWhirlpoolBlade(), new PerkWaterSplash(), new PerkTargetLazer(), + new PerkThorns(), new SmashGuardian() }; private static final ItemStack IN_HAND = new ItemStack(Material.PRISMARINE_SHARD); private static final ItemStack[] PLAYER_ITEMS = { - ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte) 0, 1, - C.cYellowB + "Left-Click" + C.cWhiteB + " - " + C.cGreenB + "Whirlpool Blade", + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte) 0, 1, + C.cYellowB + "Right-Click" + C.cWhiteB + " - " + C.cGreenB + "Whirlpool Axe", new String[] { - C.Reset + "Something" + C.Reset + "Fires a Prismarine Shard that deals damage to", + C.Reset + "the first player it collides with.", + C.Reset + "The player is then drawn towards you." }), - ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte) 0, 1, + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte) 0, 1, C.cYellowB + "Right-Click" + C.cWhiteB + " - " + C.cGreenB + "Water Splash", new String[] { - C.Reset + "Something" + C.Reset + "You bounce into the air and pull all nearby players", + C.Reset + "towards you.", + C.Reset + "Blocking with the sword while bouncing increases the height.", + C.Reset + "Landing causes a water splash dealing damage and knockback to", + C.Reset + "nearby players." }), ItemStackFactory.Instance.CreateStack(Material.IRON_PICKAXE, (byte) 0, 1, C.cYellowB + "Right-Click" + C.cWhiteB + " - " + C.cGreenB + "Target Lazer", new String[] { - C.Reset + "Something" + C.Reset + "You target the nearest player with your lazer.", + C.Reset + "That player takes increased damage and knockback from you.", + C.Reset + "Your lazer breaks if you get too far away or after some time." + }), + ItemStackFactory.Instance.CreateStack(Material.PRISMARINE_SHARD, (byte) 0, 1, + C.cYellowB + "Passive" + C.cWhiteB + " - " + C.cGreenB + "Thorns", + new String[] { + C.Reset + "When your health drops below 6 all ranged attacks", + C.Reset + "deal reduced damage and knockback.", + }), + ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 1, + C.cYellowB + "Smash Crystal" + C.cWhiteB + " - " + C.cGreenB + "Rise of the Guardian", + new String[] { + C.Reset + "You call upon Gwen who begins to charge their lazer.", + C.Reset + "Any player near the laser is drawn to it and cannot", + C.Reset + "escape from it.", + C.Reset + "Once the lazer has charged all players nearby get hit", + C.Reset + "with HUGE damage and knockback!" }), - }; private static final ItemStack[] PLAYER_ARMOR = { @@ -74,8 +99,10 @@ public class KitGuardian extends SmashKit player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1], PLAYER_ITEMS[2]); + if (Manager.GetGame().GetState() == GameState.Recruit) + player.getInventory().addItem(PLAYER_ITEMS[3], PLAYER_ITEMS[4]); + player.getInventory().setArmorContents(PLAYER_ARMOR); } - - + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java index 7372a19af..d2706e47c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java @@ -43,7 +43,7 @@ public class PerkBlockToss extends SmashPerk implements IThrown private static final int COOLDOWN = 2000; private static final int CHARGE_TIME = 1200; - private static final int DAMAGE = 8; + private static final int DAMAGE = 12; private static final float KNOCKBACK_MAGNITUDE = 2.5F; private Map _hold = new HashMap<>(); @@ -156,7 +156,7 @@ public class PerkBlockToss extends SmashPerk implements IThrown // Charged Tick if (!_charged.contains(key)) { - if (System.currentTimeMillis() - _charge.get(key) > 1200) + if (System.currentTimeMillis() - _charge.get(key) > CHARGE_TIME) { _charged.add(key); player.getWorld().playEffect(player.getLocation(), Effect.CLICK1, 0); @@ -182,11 +182,7 @@ public class PerkBlockToss extends SmashPerk implements IThrown long charge = System.currentTimeMillis() - _charge.remove(key); // Throw - double mult = 1.4; - if (charge < CHARGE_TIME) - { - mult = mult * (charge / 1200); - } + double mult = 1.4 * (charge / CHARGE_TIME); // Action UtilAction.velocity(block, cur.getLocation().getDirection(), mult, false, 0.2, 0, 1, true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java index f58a3069b..f8c820570 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java @@ -12,6 +12,7 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEvent; +import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; @@ -30,9 +31,9 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; -public class PerkTargetLazer extends Perk +public class PerkTargetLazer extends SmashPerk { private static final int COOLDOWN = 15000; @@ -45,7 +46,7 @@ public class PerkTargetLazer extends Perk public PerkTargetLazer() { - super("Target Lazer", new String[] {}); + super("Target Lazer", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Pickaxe to use " + C.cGreen + "Target Lazer" }); } @EventHandler @@ -91,10 +92,10 @@ public class PerkTargetLazer extends Perk Player best = null; double bestD = Double.MAX_VALUE; - + for (Player other : UtilServer.getPlayers()) { - if (player.equals(other) || UtilPlayer.isSpectator(other)) + if (player.equals(other) || UtilPlayer.isSpectator(other) || isTeamDamage(player, other)) { continue; } @@ -113,6 +114,22 @@ public class PerkTargetLazer extends Perk } } + boolean contained = false; + + for (TargetLazerData data : _data) + { + if (data.getAttacker().equals(player)) + { + if (data.getTimeElapsed() < MAX_TIME) + { + break; + } + + contained = true; + data.setTarget(best); + } + } + if (best == null) { player.sendMessage(F.main("Game", "There are no targets within the range.")); @@ -122,17 +139,6 @@ public class PerkTargetLazer extends Perk player.sendMessage(F.main("Game", "You targeted " + F.name(best.getName())) + " with " + F.skill(GetName()) + "."); best.sendMessage(F.main("Game", F.name(player.getName()) + " targeted you with their " + F.skill(GetName()) + ".")); - boolean contained = false; - - for (TargetLazerData data : _data) - { - if (data.getAttacker().equals(player)) - { - contained = true; - data.setTarget(best); - } - } - if (!contained) { TargetLazerData data = new TargetLazerData(player); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkThorns.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkThorns.java index 3001bea50..5420f86dc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkThorns.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkThorns.java @@ -3,7 +3,9 @@ package nautilus.game.arcade.game.games.smash.perks.guardian; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import mineplex.core.common.util.C; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.kit.Perk; @@ -16,13 +18,13 @@ public class PerkThorns extends Perk public PerkThorns() { - super("Thorns", new String[] {}); + super("Thorns", new String[] { C.cGray + "When below 6 health you take reduced damage and knockback."}); } @EventHandler(priority = EventPriority.HIGHEST) public void damage(CustomDamageEvent event) { - if (event.GetDamagerPlayer(true) == null) + if (event.GetDamagerPlayer(true) == null || event.GetCause() == DamageCause.ENTITY_ATTACK) { return; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java index 34354559e..77212581b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java @@ -1,8 +1,10 @@ package nautilus.game.arcade.game.games.smash.perks.guardian; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.Map; +import java.util.Set; import java.util.UUID; import org.bukkit.Effect; @@ -14,6 +16,7 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.util.Vector; +import mineplex.core.common.util.C; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; @@ -39,13 +42,15 @@ public class PerkWaterSplash extends Perk private static final int VELOCITY_Y = 1; private static final int RADIUS = 5; private static final int MIN_AIR_TIME = 750; + private static final int SECOND_BOOST_TIME = 800; private static final int DAMAGE = 10; private Map _active = new HashMap<>(); + private Set _usedSecondBoost = new HashSet<>(); public PerkWaterSplash() { - super("Water Splash", new String[] {}); + super("Water Splash", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Sword to use " + C.cGreen + "Water Splash", C.cYellow + "Hold Block" + C.cGray + " to " + C.cGreen + "Bounce higher with Water Splash" }); } @EventHandler @@ -68,7 +73,7 @@ public class PerkWaterSplash extends Perk Player player = event.getPlayer(); - if (!UtilItem.isSpade(player.getItemInHand())) + if (!UtilItem.isSword(player.getItemInHand())) { return; } @@ -129,6 +134,7 @@ public class PerkWaterSplash extends Perk if (UtilPlayer.isSpectator(player)) { iterator.remove(); + _usedSecondBoost.remove(uuid); continue; } @@ -137,6 +143,7 @@ public class PerkWaterSplash extends Perk if (UtilEnt.isGrounded(player) && UtilTime.elapsed(_active.get(uuid), MIN_AIR_TIME)) { iterator.remove(); + _usedSecondBoost.remove(uuid); UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, player.getEyeLocation(), 0, 0, 0, 0.5F, 50, ViewDist.LONG); @@ -162,6 +169,12 @@ public class PerkWaterSplash extends Perk Manager.GetCondition().Factory().Falling(GetName(), other, player, DAMAGE, false, true); } } + else if (UtilTime.elapsed(_active.get(uuid), SECOND_BOOST_TIME) && !_usedSecondBoost.contains(uuid) && player.isBlocking()) + { + _usedSecondBoost.add(uuid); + + UtilAction.velocity(player, new Vector(0, VELOCITY_Y, 0)); + } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java index 77fdaa33b..f8bbcfb7f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java @@ -15,6 +15,7 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; +import mineplex.core.common.util.C; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; @@ -44,7 +45,7 @@ public class PerkWhirlpoolBlade extends Perk implements IThrown public PerkWhirlpoolBlade() { - super("Whirlpool Blade", new String[] {}); + super("Whirlpool Axe", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Whirlpool Blade" }); } @EventHandler @@ -55,7 +56,7 @@ public class PerkWhirlpoolBlade extends Perk implements IThrown return; } - if (!UtilEvent.isAction(event, ActionType.L)) + if (!UtilEvent.isAction(event, ActionType.R)) { return; } @@ -67,7 +68,7 @@ public class PerkWhirlpoolBlade extends Perk implements IThrown Player player = event.getPlayer(); - if (!UtilItem.isSword(player.getItemInHand())) + if (!UtilItem.isAxe(player.getItemInHand())) { return; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashAnimationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashAnimationData.java index c6172c8ce..6a4de9246 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashAnimationData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashAnimationData.java @@ -127,7 +127,7 @@ public class SmashAnimationData double offset = UtilMath.offset(_target, player); Vector vector = UtilAlg.getTrajectory(player, _target); - if (offset < DAMAGE_RADIUS / 2) + if (offset < DAMAGE_RADIUS / 3) { continue; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java index c38a1fd2c..cae011251 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java @@ -132,14 +132,14 @@ public class SmashSpider extends SmashUltimate return; } - double diff = (_preHealth.remove(damagee) - damagee.getHealth()) / 2d; + double diff = (_preHealth.remove(damagee) - damagee.getHealth()) / 2; if (diff <= 0) { return; } - damager.setMaxHealth(Math.min(60, damager.getMaxHealth() + diff)); + damager.setMaxHealth(Math.min(25, damager.getMaxHealth() + diff)); damager.setHealth(damager.getHealth() + diff); UtilParticle.PlayParticle(ParticleType.HEART, damager.getLocation().add(0, 1, 0), 0, 0, 0, 0, 1, ViewDist.LONG, UtilServer.getPlayers()); From 4e9cf4dbb412ff9ae599d25b053aef0b4759f743 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 3 Oct 2016 19:45:15 +0100 Subject: [PATCH 010/147] More fixes --- .../game/games/smash/kits/KitSkeleton.java | 10 ++++- .../game/games/smash/kits/KitZombie.java | 28 +++++++++++++ .../smash/perks/enderman/PerkBlockToss.java | 3 ++ .../perks/enderman/PerkEndermanTeleport.java | 7 ++-- .../smash/perks/magmacube/PerkMagmaBlast.java | 41 +++++++++++++++++-- .../perks/skeletalhorse/PerkDeadlyBones.java | 2 +- .../perks/skeletalhorse/PerkHorseKick.java | 2 +- .../smash/perks/spider/PerkSpiderLeap.java | 2 +- .../games/smash/perks/spider/SmashSpider.java | 2 +- .../games/smash/perks/witch/PerkBatWave.java | 2 +- .../perks/witherskeleton/PerkWitherImage.java | 14 ++++++- 11 files changed, 100 insertions(+), 13 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java index 586d94657..978224567 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java @@ -2,8 +2,10 @@ package nautilus.game.arcade.game.games.smash.kits; import org.bukkit.ChatColor; import org.bukkit.Material; +import org.bukkit.entity.Arrow; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; import org.bukkit.event.EventHandler; import org.bukkit.inventory.ItemStack; @@ -109,8 +111,14 @@ public class KitSkeleton extends SmashKit public void arrowDamage(CustomDamageEvent event) { Player player = event.GetDamagerPlayer(true); + Projectile proj = event.GetProjectile(); - if (player == null) + if (player == null || proj == null) + { + return; + } + + if (!(proj instanceof Arrow)) { return; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java index 4e472b37f..62ea7dc0a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java @@ -2,14 +2,18 @@ package nautilus.game.arcade.game.games.smash.kits; import org.bukkit.ChatColor; import org.bukkit.Material; +import org.bukkit.entity.Arrow; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseZombie; import mineplex.core.itemstack.ItemStackFactory; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; @@ -99,4 +103,28 @@ public class KitZombie extends SmashKit player.getInventory().setArmorContents(PLAYER_ARMOR); } + + @EventHandler + public void arrowDamage(CustomDamageEvent event) + { + Player player = event.GetDamagerPlayer(true); + Projectile proj = event.GetProjectile(); + + if (player == null || proj == null) + { + return; + } + + if (!(proj instanceof Arrow)) + { + return; + } + + if (!HasKit(player)) + { + return; + } + + event.AddMod("Arrow Nerf", -1); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java index d2706e47c..17aa4d7fc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java @@ -6,6 +6,7 @@ import java.util.Map; import java.util.Set; import java.util.UUID; +import org.bukkit.Bukkit; import org.bukkit.Effect; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; @@ -184,6 +185,8 @@ public class PerkBlockToss extends SmashPerk implements IThrown // Throw double mult = 1.4 * (charge / CHARGE_TIME); + Bukkit.broadcastMessage("mult = " + mult); + // Action UtilAction.velocity(block, cur.getLocation().getDirection(), mult, false, 0.2, 0, 1, true); Manager.GetProjectile().AddThrow(block, cur, this, -1, true, true, true, true, null, 0, 0, null, 0, UpdateType.FASTEST, 1f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkEndermanTeleport.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkEndermanTeleport.java index 48e6b5fc8..a135b38d5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkEndermanTeleport.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkEndermanTeleport.java @@ -13,6 +13,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerQuitEvent; import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; @@ -55,14 +56,14 @@ public class PerkEndermanTeleport extends SmashPerk UUID key = player.getUniqueId(); - if (!player.isSneaking() || !Recharge.Instance.usable(player, GetName())) + if (!(player.isSneaking() || Recharge.Instance.usable(player, GetName()))) { _target.remove(key); _charge.remove(key); continue; } - Block block = UtilPlayer.getTarget(player, null, 100); + Block block = UtilPlayer.getTarget(player, UtilBlock.blockPassSet, 100); if (!_target.containsKey(key) || !_charge.containsKey(key)) { @@ -89,7 +90,7 @@ public class PerkEndermanTeleport extends SmashPerk UtilTextMiddle.display(null, UtilTextMiddle.progress(_charge.get(player)), 0, 10, 10, player); - if (_charge.get(key) >= 1f) + if (_charge.get(key) >= 1) { UtilTextMiddle.display(null, C.cGreen + "Teleported", 0, 10, 10, player); Recharge.Instance.useForce(player, GetName(), COOLDOWN); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBlast.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBlast.java index dc7e59dbf..060e72fc3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBlast.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBlast.java @@ -11,6 +11,7 @@ import org.bukkit.entity.LargeFireball; import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.util.Vector; @@ -23,6 +24,7 @@ import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; @@ -30,6 +32,7 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.kit.Perk; import net.minecraft.server.v1_8_R3.EntityLargeFireball; @@ -38,8 +41,11 @@ public class PerkMagmaBlast extends Perk private static final int COOLDOWN = 6000; private static final float FIREBALL_VELOCITY = 0.2F; - private static final int VELOCITY_RADIUS = 8; private static final int FIRE_TICKS = 40; + private static final int VELOCITY_RADIUS = 8; + private static final int FIRE_RADIUS = 2; + private static final int DAMAGE = 8; + private Map _proj = new HashMap<>(); @@ -156,6 +162,7 @@ public class PerkMagmaBlast extends Perk return; } + Player shooter = (Player) proj.getShooter(); // Velocity Players Map hitMap = UtilPlayer.getInRadius(proj.getLocation(), VELOCITY_RADIUS); @@ -163,13 +170,41 @@ public class PerkMagmaBlast extends Perk { double range = hitMap.get(cur); + Manager.GetDamage().NewDamageEvent(cur, shooter, proj, DamageCause.PROJECTILE, range * DAMAGE, false, true, false, shooter.getName(), GetName()); + // Velocity UtilAction.velocity(cur, UtilAlg.getTrajectory(proj.getLocation().add(0, -0.5, 0), cur.getEyeLocation()), 1 + 2 * range, false, 0, 0.2 + 0.4 * range, 1.2, true); - - cur.setFireTicks(FIRE_TICKS); } // Particles UtilParticle.PlayParticleToAll(ParticleType.LAVA, proj.getLocation(), 0.1f, 0.1f, 0.1f, 0.1f, 50, ViewDist.LONG); } + + @EventHandler + public void damage(CustomDamageEvent event) + { + if (event.GetProjectile() == null || event.GetDamageeEntity() == null) + { + return; + } + + Projectile proj = event.GetProjectile(); + + if (!(proj instanceof LargeFireball)) + { + return; + } + + if (!_proj.containsKey(proj)) + { + return; + } + + Player player = event.GetDamageePlayer(); + + if (UtilMath.offset(player, proj) < FIRE_RADIUS) + { + player.setFireTicks(FIRE_TICKS); + } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkDeadlyBones.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkDeadlyBones.java index a8bdca3b3..ca13e82ac 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkDeadlyBones.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkDeadlyBones.java @@ -118,7 +118,7 @@ public class PerkDeadlyBones extends SmashPerk continue; } - Manager.GetDamage().NewDamageEvent(cur, player, null, DamageCause.CUSTOM, DAMAGE * targets.get(key) + 1, true, true, false, player.getName(), GetName()); + Manager.GetDamage().NewDamageEvent(cur, player, null, DamageCause.CUSTOM, DAMAGE * targets.get(cur) + 1, true, true, false, player.getName(), GetName()); } // Remove diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkHorseKick.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkHorseKick.java index 392632d5b..a343c4a12 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkHorseKick.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkHorseKick.java @@ -158,7 +158,7 @@ public class PerkHorseKick extends SmashPerk continue; } - if (!player.isValid() || player.getHealth() <= 0 || UtilTime.elapsed(_active.get(player), KICK_TIME)) + if (!player.isValid() || player.getHealth() <= 0 || UtilTime.elapsed(_active.get(key), KICK_TIME)) { playerIterator.remove(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java index 0eb494eae..41bdc1f68 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java @@ -135,7 +135,7 @@ public class PerkSpiderLeap extends Perk UtilAction.velocity(player, 1.0, 0.2, 1.0, true); // Energy - player.setExp((float) Math.max(0, player.getExp() - ENERGY_PER_LEAP)); + player.setExp(Math.max(0, player.getExp() - ENERGY_PER_LEAP)); // Sound player.getWorld().playSound(player.getLocation(), Sound.SPIDER_IDLE, 1f, 1.5f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java index cae011251..5b5297bc6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java @@ -139,7 +139,7 @@ public class SmashSpider extends SmashUltimate return; } - damager.setMaxHealth(Math.min(25, damager.getMaxHealth() + diff)); + damager.setMaxHealth(Math.min(30, damager.getMaxHealth() + diff)); damager.setHealth(damager.getHealth() + diff); UtilParticle.PlayParticle(ParticleType.HEART, damager.getLocation().add(0, 1, 0), 0, 0, 0, 0, 1, ViewDist.LONG, UtilServer.getPlayers()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java index 02b5204bf..2b628c182 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java @@ -49,7 +49,7 @@ public class PerkBatWave extends SmashPerk private static final int HIT_COOLDOWN = 200; private static final int HIT_BOX = 2; private static final int DAMAGE = 3; - private static final int DISABLE_DAMAGE = 8; + private static final int DISABLE_DAMAGE = 20; private static final float KNOCKBACK_MAGNITUDE = 1.75F; private static final String LEASH = "Leash Bats"; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java index 5484d6ae6..dd5413a20 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java @@ -37,7 +37,8 @@ public class PerkWitherImage extends SmashPerk private static final int COOLDOWN = 12000; private static final int SWAP_COOLDOWN = 2000; - + private static final int TARGET_RADIUS = 15; + private Map _skeletons = new HashMap<>(); public PerkWitherImage() @@ -98,6 +99,17 @@ public class PerkWitherImage extends SmashPerk skel.getEquipment().setItemInHand(player.getItemInHand()); skel.setMaxHealth(20); skel.setHealth(skel.getMaxHealth()); + + for (Player other : UtilPlayer.getNearby(skel.getLocation(), TARGET_RADIUS)) + { + if (player.equals(other) || UtilPlayer.isSpectator(other) || isTeamDamage(player, other)) + { + continue; + } + + skel.setTarget(other); + break; + } if (Manager.GetGame().GetTeamList().size() > 1) { From e48dfbefe463d8ea8791f31e8e0370343223ba9d Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 3 Oct 2016 21:20:15 +0100 Subject: [PATCH 011/147] Even more fixes! --- .../evolution/mobs/perks/PerkBlockTossEVO.java | 9 +++------ .../game/games/smash/SoloSuperSmash.java | 13 ++----------- .../arcade/game/games/smash/SuperSmash.java | 10 +++++++++- .../smash/perks/enderman/PerkBlockToss.java | 16 ++++++---------- .../perks/enderman/PerkEndermanTeleport.java | 6 +++--- .../smash/perks/enderman/SmashEnderman.java | 18 +++--------------- .../smash/perks/guardian/PerkTargetLazer.java | 6 +++--- .../perks/guardian/PerkWhirlpoolBlade.java | 2 +- .../arcade/kit/perks/data/BlockTossData.java | 4 +++- 9 files changed, 33 insertions(+), 51 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java index 1ed85835a..2d91ec76d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java @@ -43,7 +43,6 @@ public class PerkBlockTossEVO extends Perk implements IThrown */ private HashMap _hold = new HashMap(); - private HashMap _charge = new HashMap(); private HashSet _charged = new HashSet(); private HashMap _falling = new HashMap(); @@ -107,10 +106,8 @@ public class PerkBlockTossEVO extends Perk implements IThrown //Manager.GetBlockRestore().Add(event.getClickedBlock(), 0, (byte)0, 10000); event.getClickedBlock().getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, event.getClickedBlock().getType()); - _hold.put(player, new BlockTossData(id, data)); + _hold.put(player, new BlockTossData(id, data, System.currentTimeMillis())); - _charge.put(player, System.currentTimeMillis()); - //Effect player.getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, id); } @@ -132,7 +129,7 @@ public class PerkBlockTossEVO extends Perk implements IThrown //Charged Tick if (!_charged.contains(cur)) - if (System.currentTimeMillis() - _charge.get(cur) > 1200) + if (System.currentTimeMillis() - _hold.get(cur).Time > 1200) { _charged.add(cur); cur.playEffect(cur.getLocation(), Effect.CLICK1, 0); @@ -149,7 +146,7 @@ public class PerkBlockTossEVO extends Perk implements IThrown _charged.remove(cur); - long charge = System.currentTimeMillis() - _charge.remove(cur); + long charge = System.currentTimeMillis() - data.Time; //Throw double mult = 1.4; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java index 7f36bc1fb..fd1262539 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java @@ -109,20 +109,11 @@ public class SoloSuperSmash extends SuperSmash { Scoreboard.writeNewLine(); - Scoreboard.writeGroup(GetPlayers(true), player -> + Scoreboard.writeGroup(GetPlayers(false), player -> { int lives = getLives(player); - String out; - if (lives >= 4) out = C.cGreen + player.getName(); - else if (lives == 3) out = C.cYellow + player.getName(); - else if (lives == 2) out = C.cGold + player.getName(); - else if (lives == 1) out = C.cRed + player.getName(); - else if (lives == 0) out = C.cRed + player.getName(); - else - return null; - - return Pair.create(out, lives); + return Pair.create(getLiveColour(lives) + player.getName(), lives); }, true); } 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 8ee31b928..cbd4e822e 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 @@ -548,8 +548,9 @@ public abstract class SuperSmash extends Game case 2: return C.cGold; case 1: - case 0: return C.cRed; + case 0: + return C.cGray + C.Strike; default: return C.cGreen; } @@ -617,5 +618,12 @@ public abstract class SuperSmash extends Game } } } + else if (message.startsWith("/lives")) + { + event.setCancelled(true); + + _lives.put(player, 4); + Announce(C.cWhiteB + player.getName() + C.cAquaB + " reset their lives!"); + } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java index 17aa4d7fc..adb43f296 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java @@ -34,6 +34,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.game.games.smash.perks.SmashPerk; import nautilus.game.arcade.kit.perks.data.BlockTossData; import nautilus.game.arcade.kit.perks.event.PerkBlockGrabEvent; @@ -48,7 +49,6 @@ public class PerkBlockToss extends SmashPerk implements IThrown private static final float KNOCKBACK_MAGNITUDE = 2.5F; private Map _hold = new HashMap<>(); - private Map _charge = new HashMap<>(); private Set _charged = new HashSet<>(); private Map _falling = new HashMap<>(); @@ -121,9 +121,7 @@ public class PerkBlockToss extends SmashPerk implements IThrown // Remove Block event.getClickedBlock().getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, event.getClickedBlock().getType()); - _hold.put(player.getUniqueId(), new BlockTossData(id, data)); - - _charge.put(player.getUniqueId(), System.currentTimeMillis()); + _hold.put(player.getUniqueId(), new BlockTossData(id, data, System.currentTimeMillis())); // Effect player.getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, id); @@ -137,7 +135,7 @@ public class PerkBlockToss extends SmashPerk implements IThrown return; } - Set throwSet = new HashSet(); + Set throwSet = new HashSet<>(); for (UUID key : _hold.keySet()) { @@ -157,7 +155,7 @@ public class PerkBlockToss extends SmashPerk implements IThrown // Charged Tick if (!_charged.contains(key)) { - if (System.currentTimeMillis() - _charge.get(key) > CHARGE_TIME) + if (System.currentTimeMillis() - _hold.get(key).Time > CHARGE_TIME) { _charged.add(key); player.getWorld().playEffect(player.getLocation(), Effect.CLICK1, 0); @@ -180,12 +178,10 @@ public class PerkBlockToss extends SmashPerk implements IThrown _charged.remove(key); - long charge = System.currentTimeMillis() - _charge.remove(key); + long charge = System.currentTimeMillis() - data.Time; // Throw - double mult = 1.4 * (charge / CHARGE_TIME); - - Bukkit.broadcastMessage("mult = " + mult); + double mult = Math.min(1.4, 1.4 * ((double) charge / CHARGE_TIME)); // Action UtilAction.velocity(block, cur.getLocation().getDirection(), mult, false, 0.2, 0, 1, true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkEndermanTeleport.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkEndermanTeleport.java index a135b38d5..5fcc81787 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkEndermanTeleport.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkEndermanTeleport.java @@ -49,14 +49,14 @@ public class PerkEndermanTeleport extends SmashPerk for (Player player : UtilServer.getPlayers()) { - if (!hasPerk(player)) + if (!hasPerk(player) || UtilPlayer.isSpectator(player)) { continue; } UUID key = player.getUniqueId(); - if (!(player.isSneaking() || Recharge.Instance.usable(player, GetName()))) + if (!player.isSneaking() || !Recharge.Instance.usable(player, GetName())) { _target.remove(key); _charge.remove(key); @@ -88,7 +88,7 @@ public class PerkEndermanTeleport extends SmashPerk { _charge.put(key, _charge.get(key) + CHARGE_PER_TICK); - UtilTextMiddle.display(null, UtilTextMiddle.progress(_charge.get(player)), 0, 10, 10, player); + UtilTextMiddle.display(null, UtilTextMiddle.progress(_charge.get(key)), 0, 10, 10, player); if (_charge.get(key) >= 1) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/SmashEnderman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/SmashEnderman.java index bd45991da..04f76be18 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/SmashEnderman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/SmashEnderman.java @@ -135,20 +135,6 @@ public class SmashEnderman extends SmashUltimate } } - @EventHandler(priority = EventPriority.LOW) - public void dragonDamageeCancel(CustomDamageEvent event) - { - if (event.GetDamagerEntity(false) == null) - { - return; - } - - if (_dragons.values().contains(event.GetDamagerEntity(false))) - { - event.SetCancelled("Enderman Dragon Damagee"); - } - } - @EventHandler(priority = EventPriority.LOW) public void dragonDamagerCancel(CustomDamageEvent event) { @@ -169,8 +155,10 @@ public class SmashEnderman extends SmashUltimate public void updateDamageAoe(UpdateEvent event) { if (event.getType() != UpdateType.TICK) + { return; - + } + for (UUID key : _dragons.keySet()) { Player player = UtilPlayer.searchExact(key); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java index f8c820570..cd2460f3a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java @@ -122,7 +122,7 @@ public class PerkTargetLazer extends SmashPerk { if (data.getTimeElapsed() < MAX_TIME) { - break; + return; } contained = true; @@ -132,7 +132,7 @@ public class PerkTargetLazer extends SmashPerk if (best == null) { - player.sendMessage(F.main("Game", "There are no targets within the range.")); + player.sendMessage(F.main("Game", "There are no targets within range.")); return; } @@ -184,7 +184,7 @@ public class PerkTargetLazer extends SmashPerk long time = data.getTimeElapsed() / 1000; double damage = 0.5 * time; - data.getAttacker().sendMessage(F.main("Game", "Your laser ended dealing damage to " + F.name(data.getTarget().getName())) + "."); + data.getAttacker().sendMessage(F.main("Game", "Your laser broke dealing damage to " + F.name(data.getTarget().getName())) + "."); Manager.GetDamage().NewDamageEvent(data.getTarget(), data.getAttacker(), null, DamageCause.CUSTOM, damage, false, true, false, data.getAttacker().getName(), GetName()); setLazerTarget(data.getAttacker(), null); Recharge.Instance.use(data.getAttacker(), GetName(), COOLDOWN, true, true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java index f8bbcfb7f..c47293d16 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java @@ -38,7 +38,7 @@ public class PerkWhirlpoolBlade extends Perk implements IThrown private static final int COOLDOWN = 5000; private static final int EXPIRE_TIME = 3000; private static final float VELOCITY = 1.2F; - private static final int HIT_BOX = 1; + private static final float HIT_BOX = 0.5F; private static final int DAMAGE = 2; private Set _items = new HashSet<>(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/BlockTossData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/BlockTossData.java index bd1130267..98fda9f0d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/BlockTossData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/BlockTossData.java @@ -4,10 +4,12 @@ public class BlockTossData { public int Type; public byte Data; + public long Time; - public BlockTossData(int type, byte data) + public BlockTossData(int type, byte data, long time) { Type = type; Data = data; + Time = time; } } From 53c6c072083f3146faebf9dd1cea31be4627461b Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 3 Oct 2016 23:17:14 +0100 Subject: [PATCH 012/147] Lazer to Laser --- .../game/arcade/game/games/smash/kits/KitGuardian.java | 10 +++++----- .../game/arcade/game/games/smash/kits/KitSheep.java | 2 +- .../games/smash/perks/guardian/PerkTargetLazer.java | 2 +- .../games/smash/perks/guardian/PerkWhirlpoolBlade.java | 2 +- .../src/nautilus/game/arcade/kit/perks/PerkLazer.java | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java index 2bf87668a..6b396586e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java @@ -55,11 +55,11 @@ public class KitGuardian extends SmashKit C.Reset + "nearby players." }), ItemStackFactory.Instance.CreateStack(Material.IRON_PICKAXE, (byte) 0, 1, - C.cYellowB + "Right-Click" + C.cWhiteB + " - " + C.cGreenB + "Target Lazer", + C.cYellowB + "Right-Click" + C.cWhiteB + " - " + C.cGreenB + "Target Laser", new String[] { - C.Reset + "You target the nearest player with your lazer.", + C.Reset + "You target the nearest player with your laser.", C.Reset + "That player takes increased damage and knockback from you.", - C.Reset + "Your lazer breaks if you get too far away or after some time." + C.Reset + "Your laser breaks if you get too far away or after some time." }), ItemStackFactory.Instance.CreateStack(Material.PRISMARINE_SHARD, (byte) 0, 1, C.cYellowB + "Passive" + C.cWhiteB + " - " + C.cGreenB + "Thorns", @@ -70,10 +70,10 @@ public class KitGuardian extends SmashKit ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 1, C.cYellowB + "Smash Crystal" + C.cWhiteB + " - " + C.cGreenB + "Rise of the Guardian", new String[] { - C.Reset + "You call upon Gwen who begins to charge their lazer.", + C.Reset + "You call upon Gwen who begins to charge her laser.", C.Reset + "Any player near the laser is drawn to it and cannot", C.Reset + "escape from it.", - C.Reset + "Once the lazer has charged all players nearby get hit", + C.Reset + "Once the laser has charged all players nearby get hit", C.Reset + "with HUGE damage and knockback!" }), }; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java index 4df7192d0..00dd730ee 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java @@ -39,7 +39,7 @@ public class KitSheep extends SmashKit private static final ItemStack[] PLAYER_ITEMS = { ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte) 0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Static Lazer", + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Static Laser", new String[]{ ChatColor.RESET + "Charge up static electricity in your", ChatColor.RESET + "wooly coat, and then unleash it upon", diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java index cd2460f3a..7f6be4637 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java @@ -46,7 +46,7 @@ public class PerkTargetLazer extends SmashPerk public PerkTargetLazer() { - super("Target Lazer", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Pickaxe to use " + C.cGreen + "Target Lazer" }); + super("Target Laser", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Pickaxe to use " + C.cGreen + "Target Laser" }); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java index c47293d16..83e8f7a7a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java @@ -45,7 +45,7 @@ public class PerkWhirlpoolBlade extends Perk implements IThrown public PerkWhirlpoolBlade() { - super("Whirlpool Axe", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Whirlpool Blade" }); + super("Whirlpool Axe", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Whirlpool Axe" }); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLazer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLazer.java index e962d477b..3d416b319 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLazer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLazer.java @@ -56,7 +56,7 @@ public class PerkLazer extends Perk public PerkLazer(double range, long recharge) { - super("Static Lazer", new String[] { C.cYellow + "Hold Block" + C.cGray + " with Sword to use " + C.cGreen + "Static Lazer" }); + super("Static Laser", new String[] { C.cYellow + "Hold Block" + C.cGray + " with Sword to use " + C.cGreen + "Static Laser" }); _range = range; _recharge = recharge; From a4e1fb3c8d7c7a90e4ed674acb591795f110369e Mon Sep 17 00:00:00 2001 From: Keir Nellyer Date: Wed, 5 Oct 2016 14:31:01 +0100 Subject: [PATCH 013/147] Prepare database for snapshot tokens --- Plugins/Mineplex.ReportSite/sql/snapshot-tokens.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 Plugins/Mineplex.ReportSite/sql/snapshot-tokens.sql diff --git a/Plugins/Mineplex.ReportSite/sql/snapshot-tokens.sql b/Plugins/Mineplex.ReportSite/sql/snapshot-tokens.sql new file mode 100644 index 000000000..cca1ffe91 --- /dev/null +++ b/Plugins/Mineplex.ReportSite/sql/snapshot-tokens.sql @@ -0,0 +1,3 @@ +ALTER TABLE Account.snapshots ADD token CHAR(6); +ALTER TABLE Account.snapshots + MODIFY COLUMN creator INT(11) AFTER token; \ No newline at end of file From bb9ca490b1c0527cde8902bf5a374e4f6fc1a3a6 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 6 Oct 2016 15:03:51 +0100 Subject: [PATCH 014/147] GI changes --- .../game/games/smash/kits/KitGuardian.java | 6 +- .../game/games/smash/perks/SmashKit.java | 2 +- .../smash/perks/enderman/PerkBlockToss.java | 1 - .../smash/perks/enderman/SmashEnderman.java | 2 +- .../smash/perks/guardian/PerkTargetLazer.java | 8 +- .../perks/guardian/PerkWhirlpoolBlade.java | 2 +- .../smash/perks/guardian/TargetLazerData.java | 4 +- .../smash/perks/spider/PerkSpiderLeap.java | 2 +- .../smash/perks/squid/PerkFishFlurry.java | 2 +- .../games/smash/perks/witch/PerkBatWave.java | 6 +- .../smash/perks/witch/PerkWitchPotion.java | 134 ++++++++++-------- 11 files changed, 97 insertions(+), 72 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java index 6b396586e..0e4471cdb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java @@ -26,7 +26,7 @@ public class KitGuardian extends SmashKit { private static final Perk[] PERKS = { - new PerkSmashStats(4, 1.25, 0.25, 4), + new PerkSmashStats(4, 1.25, 0.25, 4.5), new PerkDoubleJump("Double Jump", 0.9, 0.9, false), new PerkWhirlpoolBlade(), new PerkWaterSplash(), @@ -79,10 +79,10 @@ public class KitGuardian extends SmashKit }; private static final ItemStack[] PLAYER_ARMOR = { + new ItemStack(Material.DIAMOND_BOOTS), + new ItemStack(Material.DIAMOND_LEGGINGS), null, null, - new ItemStack(Material.DIAMOND_CHESTPLATE), - null, }; public KitGuardian(ArcadeManager manager) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashKit.java index 17ac0ada2..c79cd2660 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashKit.java @@ -80,7 +80,7 @@ public abstract class SmashKit extends ProgressingKit if (gameTeam != null) { - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); + disguise.setName(gameTeam.GetColor() + player.getName()); } else { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java index adb43f296..e843ae6d4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java @@ -6,7 +6,6 @@ import java.util.Map; import java.util.Set; import java.util.UUID; -import org.bukkit.Bukkit; import org.bukkit.Effect; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/SmashEnderman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/SmashEnderman.java index 04f76be18..254343602 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/SmashEnderman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/SmashEnderman.java @@ -168,7 +168,7 @@ public class SmashEnderman extends SmashUltimate continue; } - EnderDragon dragon = _dragons.get(player); + EnderDragon dragon = _dragons.get(key); UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, dragon.getLocation(), 0, 0, 0, 0, 1, ViewDist.LONGER); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java index 7f6be4637..e9f964077 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java @@ -6,6 +6,7 @@ import java.util.Set; import org.bukkit.Effect; import org.bukkit.Material; +import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; @@ -183,11 +184,15 @@ public class PerkTargetLazer extends SmashPerk { long time = data.getTimeElapsed() / 1000; double damage = 0.5 * time; + ArmorStand targetPlaceholder = data.update(Manager); + + targetPlaceholder.remove(); data.getAttacker().sendMessage(F.main("Game", "Your laser broke dealing damage to " + F.name(data.getTarget().getName())) + "."); Manager.GetDamage().NewDamageEvent(data.getTarget(), data.getAttacker(), null, DamageCause.CUSTOM, damage, false, true, false, data.getAttacker().getName(), GetName()); - setLazerTarget(data.getAttacker(), null); + Recharge.Instance.use(data.getAttacker(), GetName(), COOLDOWN, true, true); + iterator.remove(); } } @@ -250,6 +255,7 @@ public class PerkTargetLazer extends SmashPerk if (target == null) { disguise.setTarget(0); + data.update(Manager).remove(); } else { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java index 83e8f7a7a..96a03a2e9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java @@ -37,7 +37,7 @@ public class PerkWhirlpoolBlade extends Perk implements IThrown private static final int COOLDOWN = 5000; private static final int EXPIRE_TIME = 3000; - private static final float VELOCITY = 1.2F; + private static final float VELOCITY = 1.6F; private static final float HIT_BOX = 0.5F; private static final int DAMAGE = 2; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/TargetLazerData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/TargetLazerData.java index b089f4f72..04f5c8500 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/TargetLazerData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/TargetLazerData.java @@ -26,7 +26,7 @@ public class TargetLazerData public ArmorStand update(ArcadeManager manager) { - if (_targetPlaceholder == null) + if (_targetPlaceholder == null || !_targetPlaceholder.isValid()) { manager.GetGame().CreatureAllowOverride = true; _targetPlaceholder = _target.getWorld().spawn(_target.getLocation(), ArmorStand.class); @@ -51,7 +51,7 @@ public class TargetLazerData { return _target; } - + public long getTimeElapsed() { return System.currentTimeMillis() - _startTime; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java index 41bdc1f68..7783f96c2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java @@ -61,7 +61,7 @@ public class PerkSpiderLeap extends Perk if (!player.isSneaking()) { - if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) + if (UtilEnt.isGrounded(player)) { player.setExp((float) Math.min(0.999, player.getExp() + ENERGY_PER_TICK)); _secondJump.remove(player.getUniqueId()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkFishFlurry.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkFishFlurry.java index 335f7c7ae..539e98cf9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkFishFlurry.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkFishFlurry.java @@ -47,7 +47,7 @@ public class PerkFishFlurry extends SmashPerk implements IThrown { private static final int COOLDOWN = 24000; - private static final int DAMAGE = 3; + private static final float DAMAGE = 2.6F; private static final int START_TIME = 2000; private static final int END_TIME = 6000; private static final float KNOCKBACK_MAGNITUDE = 1.5F; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java index 2b628c182..5ba2be470 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java @@ -58,7 +58,7 @@ public class PerkBatWave extends SmashPerk private Map _active = new HashMap<>(); private Map _direction = new HashMap<>(); private Map> _bats = new HashMap<>(); - private Map _damageTaken = new HashMap<>(); + private Map _damageTaken = new HashMap<>(); private Set _pulling = new HashSet<>(); private Set _allowLeash = new HashSet<>(); @@ -315,10 +315,10 @@ public class PerkBatWave extends SmashPerk if (!_damageTaken.containsKey(key)) { - _damageTaken.put(key, 0); + _damageTaken.put(key, 0D); } - _damageTaken.put(key, (int) (_damageTaken.get(key) + event.GetDamage())); + _damageTaken.put(key, (_damageTaken.get(key) + event.GetDamage())); if (_damageTaken.get(key) >= DISABLE_DAMAGE) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java index 073c8b282..825948c9a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java @@ -3,21 +3,23 @@ package nautilus.game.arcade.game.games.smash.perks.witch; import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.Set; +import org.bukkit.block.Block; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; import org.bukkit.entity.ThrownPotion; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.player.PlayerInteractEvent; +import com.google.common.collect.Sets; + import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilItem; @@ -27,22 +29,25 @@ import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.game.games.smash.perks.SmashPerk; -public class PerkWitchPotion extends SmashPerk +public class PerkWitchPotion extends SmashPerk implements IThrown { - + private static final int COOLDOWN = 2000; private static final int RANGE_NOMRAL = 3; private static final int RANGE_SMASH = 4; - private static final int DAMAGE_NORMAL = 7; + private static final int DAMAGE_NORMAL = 6; private static final int DAMAGE_SMASH = 10; private static final int KNOCKBACK_MAGNITUDE = 2; - + private List _proj = new ArrayList<>(); public PerkWitchPotion() @@ -89,65 +94,19 @@ public class PerkWitchPotion extends SmashPerk { return; } - + // Start ThrownPotion potion = player.launchProjectile(ThrownPotion.class); UtilAction.velocity(potion, player.getLocation().getDirection(), 1, false, 0, 0.2, 10, false); _proj.add(potion); + Manager.GetProjectile().AddThrow(potion, player, this, 10000, true, true, true, false, false, 0.5F); + // Inform UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); } - @EventHandler - public void Hit(ProjectileHitEvent event) - { - if (!_proj.remove(event.getEntity())) - { - return; - } - - for (Player player : Manager.GetGame().GetPlayers(true)) - { - if (player.equals(event.getEntity().getShooter())) - { - continue; - } - - if (!(event.getEntity().getShooter() instanceof Player)) - { - continue; - } - - Player thrower = (Player) event.getEntity().getShooter(); - - if (UtilMath.offset(player.getLocation().add(0, 1, 0), event.getEntity().getLocation()) > (isSuperActive(thrower) ? RANGE_SMASH : RANGE_NOMRAL)) - { - continue; - } - - String name = UtilEnt.getName((LivingEntity) event.getEntity().getShooter()); - - // Standard - if (!isSuperActive(thrower)) - { - // Damage Event - Manager.GetDamage().NewDamageEvent(player, thrower, null, DamageCause.CUSTOM, DAMAGE_NORMAL, true, true, false, name, GetName()); - - Manager.GetCondition().Factory().Slow(GetName(), player, null, 3, 1, true, false, false, false); - } - // Super Effect - else - { - // Damage Event - Manager.GetDamage().NewDamageEvent(player, thrower, null, DamageCause.CUSTOM, DAMAGE_SMASH, true, true, false, name, GetName()); - - Manager.GetCondition().Factory().Slow(GetName(), player, null, 7, 2, true, false, false, false); - } - } - } - @EventHandler public void Update(UpdateEvent event) { @@ -155,7 +114,7 @@ public class PerkWitchPotion extends SmashPerk { return; } - + Iterator potionIterator = _proj.iterator(); while (potionIterator.hasNext()) @@ -179,7 +138,68 @@ public class PerkWitchPotion extends SmashPerk { return; } - + event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + Set players = Sets.newHashSet(target); + Player thrower = (Player) data.getThrower(); + + if (!(data.getThrower() instanceof Player)) + { + return; + } + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (player.equals(data.getThrower())) + { + continue; + } + + double d = UtilMath.offset(player.getLocation().add(0, 1, 0), target.getLocation()); + + if (d > (isSuperActive(thrower) ? RANGE_SMASH : RANGE_NOMRAL)) + { + continue; + } + + players.add(player); + } + + boolean smash = isSuperActive(thrower); + int i = 0; + + for (LivingEntity entity : players) + { + if (smash) + { + // Damage Event + Manager.GetDamage().NewDamageEvent(entity, thrower, null, DamageCause.CUSTOM, (i++ == 0 ? DAMAGE_NORMAL + 1 : DAMAGE_NORMAL), true, true, false, thrower.getName(), GetName()); + + Manager.GetCondition().Factory().Slow(GetName(), entity, null, 3, 1, true, false, false, false); + } + // Super Effect + else + { + // Damage Event + Manager.GetDamage().NewDamageEvent(entity, thrower, null, DamageCause.CUSTOM, DAMAGE_SMASH, true, true, false, thrower.getName(), GetName()); + + Manager.GetCondition().Factory().Slow(GetName(), entity, null, 7, 2, true, false, false, false); + } + } + } + + @Override + public void Idle(ProjectileUser data) + { + } + + @Override + public void Expire(ProjectileUser data) + { + } } From 86c15af8d6d497f549df28b3bff8b6405e5c6410 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Thu, 6 Oct 2016 12:01:15 -0300 Subject: [PATCH 015/147] Fixes for the CustomerSupport server --- .../customerSupport/CustomerSupport.java | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index cef1030bf..bdda4acb5 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -10,8 +10,6 @@ import java.util.List; import java.util.Locale; import java.util.UUID; -import mineplex.core.Managers; -import mineplex.core.powerplayclub.PowerPlayData; import org.bukkit.GameMode; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -24,6 +22,7 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; +import mineplex.core.Managers; import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClientManager; @@ -37,21 +36,11 @@ import mineplex.core.donation.Donor; import mineplex.core.donation.repository.token.CoinTransactionToken; import mineplex.core.donation.repository.token.TransactionToken; import mineplex.core.powerplayclub.PowerPlayClubRepository; +import mineplex.core.powerplayclub.PowerPlayData; import mineplex.core.stats.PlayerStats; import mineplex.core.stats.StatsManager; import mineplex.serverdata.database.ResultSetCallable; import mineplex.staffServer.salespackage.SalesPackageManager; -import org.bukkit.GameMode; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.entity.FoodLevelChangeEvent; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.plugin.java.JavaPlugin; public class CustomerSupport extends MiniPlugin implements ResultSetCallable { @@ -256,9 +245,9 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable if (transaction.Coins == 0 && transaction.Gems == 0) { if (transaction.SalesPackageName.split(" ").length == 3) - omegaChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); + hauntedChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); else if (transaction.SalesPackageName.split(" ").length == 2) - omegaChestsReceived += 1; + hauntedChestsReceived += 1; } } From 353a64e1d41114fbb32078140193e2c90cbcf3ec Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Thu, 6 Oct 2016 13:15:23 -0300 Subject: [PATCH 016/147] Made Haunted Chests buyable --- .../src/mineplex/core/treasure/TreasureType.java | 2 +- .../mineplex/core/treasure/gui/TreasurePage.java | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java index 2c66054f5..3e3549344 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java @@ -22,7 +22,7 @@ public enum TreasureType OMEGA(C.cAqua + "Omega Chest", "Omega Chest", "Omega", RewardType.OMEGA_CHEST, Material.ENDER_CHEST, TreasureStyle.OMEGA, RewardPool.Type.OMEGA, false, 50000), - HAUNTED(C.cGold + "Haunted Chest", "Haunted Chest", "Haunted", RewardType.HAUNTED_CHEST, Material.CHEST, TreasureStyle.HALLOWEEN, RewardPool.Type.HAUNTED, false, 100000); + HAUNTED(C.cGold + "Haunted Chest", "Haunted Chest", "Haunted", RewardType.HAUNTED_CHEST, Material.CHEST, TreasureStyle.HALLOWEEN, RewardPool.Type.HAUNTED, true, 35000); private final String _name; private final RewardType _rewardType; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java index 0b1aef8e6..ca64c99c2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java @@ -3,6 +3,11 @@ package mineplex.core.treasure.gui; import java.util.ArrayList; import java.util.List; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + import mineplex.core.account.CoreClientManager; import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.skin.SkinData; @@ -24,10 +29,6 @@ import mineplex.core.shop.page.ShopPageBase; import mineplex.core.treasure.TreasureLocation; import mineplex.core.treasure.TreasureManager; import mineplex.core.treasure.TreasureType; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; public class TreasurePage extends ShopPageBase { @@ -204,6 +205,12 @@ public class TreasurePage extends ShopPageBase { hauntedLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); } + else + { + hauntedLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + "35000 Treasure Shards"); + hauntedLore.add(" "); + hauntedLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop"); + } ShopItem shards = new ShopItem(Material.PRISMARINE_SHARD, C.cAqua + C.Bold + treasureShards + " Treasure Shards", shardLore.toArray(new String[0]), 0, false); ShopItem basic = new ShopItem(Material.CHEST, C.cGreen + C.Bold + "Old Treasure", basicLore.toArray(new String[0]), 0, false, false); From 8ab61b2b06ed03e63fd085a2d08bbd3d81751191 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Thu, 6 Oct 2016 14:19:44 -0300 Subject: [PATCH 017/147] Public: - Added Chicken Mount - Added Turkey Morph Internal: - Changed the Morph system (Using UtilMorph) --- .../mineplex/core/common/skin/SkinData.java | 13 +-- .../core/gadget/gadgets/morph/MorphBat.java | 14 ++-- .../core/gadget/gadgets/morph/MorphBlaze.java | 10 +-- .../core/gadget/gadgets/morph/MorphBunny.java | 47 +++++++---- .../gadget/gadgets/morph/MorphChicken.java | 12 +-- .../core/gadget/gadgets/morph/MorphCow.java | 12 +-- .../gadget/gadgets/morph/MorphCreeper.java | 14 ++-- .../gadget/gadgets/morph/MorphEnderman.java | 8 +- .../gadget/gadgets/morph/MorphMetalMan.java | 32 ++++--- .../core/gadget/gadgets/morph/MorphPig.java | 19 ++--- .../gadgets/morph/MorphPumpkinKing.java | 6 +- .../core/gadget/gadgets/morph/MorphSlime.java | 14 ++-- .../gadget/gadgets/morph/MorphSnowman.java | 6 +- .../core/gadget/gadgets/morph/MorphSquid.java | 38 +++++---- .../core/gadget/gadgets/morph/MorphTitan.java | 10 +-- .../gadget/gadgets/morph/MorphTurkey.java | 63 ++++++++++++++ .../gadget/gadgets/morph/MorphUncleSam.java | 31 +++---- .../gadget/gadgets/morph/MorphVillager.java | 36 ++++---- .../core/gadget/gadgets/morph/MorphWitch.java | 7 +- .../gadget/gadgets/morph/MorphWither.java | 54 ++++++------ .../gadgets/morph/managers/UtilMorph.java | 47 +++++++---- .../core/mount/types/MountChicken.java | 84 +++++++++++++++++++ 22 files changed, 355 insertions(+), 222 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTurkey.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountChicken.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java index 29abc2b86..910849f06 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java @@ -5,19 +5,20 @@ import java.util.List; import java.util.Map; import java.util.UUID; -import com.google.common.collect.Maps; -import com.mojang.authlib.minecraft.InsecureTextureException; -import com.mojang.authlib.minecraft.MinecraftProfileTexture; -import mineplex.core.common.util.UtilPlayer; import net.minecraft.server.v1_8_R3.MinecraftServer; + import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.SkullMeta; +import com.google.common.collect.Maps; import com.mojang.authlib.GameProfile; +import com.mojang.authlib.minecraft.InsecureTextureException; +import com.mojang.authlib.minecraft.MinecraftProfileTexture; import com.mojang.authlib.properties.Property; -import org.bukkit.inventory.meta.SkullMeta; +import mineplex.core.common.util.UtilPlayer; public class SkinData { @@ -57,10 +58,10 @@ public class SkinData public final static SkinData UNCLE_SAM = new SkinData("eyJ0aW1lc3RhbXAiOjE0NjYxODA0NjY4NTcsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9jYzM1YWRmZTQ3ODBjNmU2NTk4YTJlYzk2ZjdhZGQ5ZDc4NjljMjBlZjRmYjEyNjk2NmJhOGFlMDRlOWRhIn19fQ==", "NmJ+hXmvwQlYFYY7YVQWRr11yBbAfJP+jk11SQ91gUUtJJjb4v8RFbNu5UXNCKxYj3BPtldqshG1maNB0NWJRud7ZyAdHc0JMmR1vtHEge9Hhet4fLyyaZ9rZn4BvD9Guqgv9H/mZzUzrft9TIho0Qbu/U++lVsbZXC2GrJDDMyLnYr9C7f+FUnr0z4WvkNcg23SHBOYkOYT95NSdykIka3c3v+/HvSvuwOnMsfVxqLyCZLpo20vamBJ1uK1dmx2+TVGnUPlofFHRdOXOpJc+YmicJvrsQR6a9zlvnTbU4MYClMOKvjLe6aX5Af+n8Gw3oKcm0PuR8CPLyf9kjcmUF6XMiEXAWWJtCgvhCiFV5/mQQH3cQ1kqk4BDLUxMVhG5tzjKLoQQy39cFM32ee+QFjXlzy59meC8jgvPmOVU3GpJ32XWOtaXMCyeJrhz2QVKRLEr2KZgz8Pd8VrHARXVZsNYEasj8z0cHjgSJqTU9kD90CC+4YpvdyRBRqbNQig5KuGCqUHKgflsEsM7YrFRKP5As1LgqYQfqRAMmLSo47eW0onOwchC9wCqqisPlYSuDRt4Mun/KFGqYh1Sghn8/gzu49La8BpwlekjVEoPEcDaIIgnFzOvgmmgMANkoJ3PzhHoHMoXtObe3eSTi+eYp4qAQVzkTxfF3WXY2fui1M="); public final static SkinData METAL_MAN = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzM5OTExNTk3OTQsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS84ZDdlOGQ3MmI0MzI3MjIzZmI1ZjI5OWViN2NiNTVhMTU4OTM4MGYxMWE2ZDIzYmVmZTQ1OWFjNzg3YWY2YTcifX19", "EYXUVtnqtDhaSjBE313TpxriRtW0X7wNdmVR0ARa9qvE8CtP//AhnNxyKkERue1XIyefrYApzM4DWGzU5ZvzraOXg98p/3PSFW5p0PAp14ud/1uJWoq0FuEiJDn7Qo/+K0cuoCVsAn6Bx8nWexxr0XB8ANq/0vpRZpDOPO+irFFGwF8CPbt+7sh09glaHD9q7CM4JzPXrNjLt+ZkhYt7wEuevCXuOONT50tH0BlmfHajs9ai0IiwEwC3R+o0DooMVdCViuVEKWQfMnBDNHN4ZLwEazAcRiFO4VXOG0k/+dbKfX0EwnnygN0qmHKyhQeuR7PUumaRUMHn7sCvWmvgpNzzJMv4f9Biw2SWSI2gpaxHdCoCfFMjCdal+/BbXue6jCvDYq6yQEu+C9BjB3vT633/mbXZZMCl7bRjBzqG/jfeI1ove9o0oSqc4Nx3aA1cOnRE2iMEE74ChgY/sVk4aRVx+GTxKtyRGSzt2V7AvOVlfJh17FQhT/PkiztJ6L1RFLsFKaxQxyiCPgZSXpQ4Dz0iPonxFZl0FjAluElHYb3zn4Uop9sPBqOIeskVUl9zbdlRb7CgDG8a57YkUfs7ZyzzYYmZyt6t08H/PQr++cflY0kfy9eOBDmf9gtes7FLrHHRTE6GJ1+xAkLi5gNEkEUZKZy2embgI5JzuwCIIY8="); public final static SkinData OMEGA_CHEST = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzI1MTAzNzAwOTksInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS85MDM2MjNjMmRkMjdhNWM0Y2NlYzY5MWY3NjM0YTNkMzVkNTRiNDg0YjIzNTdhNWQ1ZWFmYmYwNTRkY2NlIn19fQ==", "cQty4zNF2QgzNuVOHTGGX5YVofApKr01KkQ70bO1n+I9nlkc9qqhcigA+uBYdw4THANFsTRwIrskgTS3TTmuaXYmMUoNnj7gr2Gp7D2t7L53QyJJhIw0hHNDvQucf19SOxhtR9FvW+xnh1JcgOTF3VZxIeRaN4bCtqkeFitCJwts4Z7SlDxB4EFZVsifM+gK4iel9YWYGNnZiQm48lxU+dMFd0cCa4L00ngBExQoWC8zbJc3K9LGdqI1YOMh3bCt81F4jcrPnDycxWwOTj/tBri4yeXK1htq5dAixHwq1EF86gQMnfeIIk6D/BREtVKoXK9K4lstYPHLFiBqkwpijArbC0sZp8s/j88NYUz9PgSJ2z/b5jhPChH2OkoGQOL0/QrxqUZUet+WHaIQtvFoqmcFRCKJQembgJGZV0X86XQxEEtevkNgXPigJVyQ5GVuDCeowRkMGfSadQCBsnmdOVZNshS60tBSDcbd2oWeQUJn1+OJkmz+OktbMbP4ttN6x3+MPMSZoGT1bc1BSRNFRYOBZuNz1zLWsHFRyNLaVS3ep/ktE+Rt5sbapo+r4GjrKGV7Unx6pbfoxcnMVxWZ9X/sMgztQdwYEQlnvAxGvCY/1ZIm3/izqB2zAgG7ZfWzKjU2P5VseKokMjHXrzZX9Uqtn0zpITEaG5HjUpRSaJg="); - public final static SkinData HEADLESS_HORSEMAN = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzM4ODc2MjAzODksInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS8zZGM2M2M5NWFjOTA1YjEyMWU5YTE3NmY5ZDFiN2M0MDc2ZGJjMTk3NzhkYjgzMzBlOWIzNTdhOTQ3MzMxZCJ9fX0=", "pQgM6o3nO6+NaxEmkoK33gQefe726HeVA5TVcbnGRY99S8l1UVlTu1W9Unc4IczHRYZ29I75aXUz6UDA7kIRQj4NOQHBXOxlw4cah34WkDECXYwKbgcM3HkRI/JGQf6Uooe5Mz/IaWlisEdXp9i7+WPeqz1qvzwuJ2jUqF8gaJyCbgKSWE8135k+YwinFVA78+so5meRZ6qBNfSeU48Bhf9j3H+Jmq/vwi9EJGDXKAzjYSufdYWQA7gXJQHiUFVgVKSC0wBAMHBVK7ABE2g5GIaLxOfjhOKN8Gdea9dqOUN+uXrGvg7uHxJd9Obw7MbBDVPgXnYDWYDU18DAWJcGVA8tnuPnN2a+mQrbTn9UPftYReUYJA4zpkfEKkljW6lkQ5DkVN/ueQg9QDYjxvjLblSyKHV8lX/ATt4aGiQrCcaQn6c8EeLWijPwozO+pI3MX26ydF8l+B9lTvGvQOqfUS4+TgEI5SEKlKFF4i6rTBAYCHAH8uXry7fZQDoIkcpWiB5b+e7Tr29WoScyFNuR3BMIh0Nky1TPadLxxhkqht8o9AXtccYOmtoMMh06kKWZK5m8w16j+VTUNDYwTV+jxtSFBMh4FPuiH+TzpeHY6P2Cb4gT2UlozWj8ZxZHYIGbYXAFOlDT8IQmRh5zyrXeAZrwoXJPP2OoXl31roChTxw="); public final static SkinData GHOST = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzM5NjQxOTY3ODYsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS84NjViODU3N2NlNmFhYzY4N2IxNGQ0ZGIzYmQ1MGU1NjdlZGY4Njc4MDU3ZWM2NjMyZDcxMDQ4MzFhNDk3MmIifX19", "J3nw3OIZYuYxbhOKgPGL+Kn4kWv9cjEB9ygBD07xVJUY/rdPW/BeE15qKpZQt5d8kjj0VGp1Q7g3uIS24NuiQxDZ82l1GT4dLyUN2eOj0im6VGA2yXrnGPaedfu1oPAiG+STFq0ST2IYQKYuOcncsdovxHLrpNHF6ud3WJMnSOYSfAX5NOny1UNkswzCN2OCX+QzW9hwQ+gKOc2U6g47hIcpBcTNlmD3lqXjP7OTn0Ul3kJG5J3lnwBkPnNI5OV9+oI9OWs/fbTee3pK6UVHjgH2w+fO/0jlRnShw7o1BKv/ILBkWZYuq31YiAMWKRm508SS3+kjqU37t6mqBc9AUcAeKfR4G6UiW18+eRfDPaaSnY2mTBwD3boWHYI7fM7pnPF1LmSxwSa9QSu3wsrYF9ID0QI7vyyrPIeZU/eUXE+WbFZ+Nuo/2LlZMjUmcLWa/SuuPo6lA5zJtgkVc/Rgkph+s/sZnPwgeHTFmCr2VJqgWg+J9dnO/fLPkddgzjoy5uOCAO70E/cwbpqGxKD+0iQU0Vk9TzQnCMAUDtzeoyNkuk204cDSqPKtH5JIoQHa6wFAEgaKZoSETBJMZmKzZhne5pVr+NVkmGHOuZ/uE6JH1F4T+vTeeLSEroPDhrNfwVtrrqBFnI/xijfEHdPmtP9OTSDju7MHnEZu4RS7y6Q="); public final static SkinData HAUNTED_CHEST = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzUyNTUzOTE3OTcsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9lZWM5MmU4ODNiOGFjODI0MDU5YTk5NGM5NTNjNTQ0NDQ0Yjk3ZWFkZDdhNWFjNGY3ZTZhOTUxOGQ5YTkxMSJ9fX0=", "GqycEQvWoZeXDLAJ6ricUx3coA4Y6AswL0GV1KebetoTkd9XNtkJJ9eUf6ViwpSgmL0H89sdMjghThHKczUEmjaFeNl2Z9cwGnR1WOK3KpD+v8C7f10l2DNd7z8s1clJfkVay/5KkgNMneu+ZStF8mCt+uyOSfZX4toLRBba6ZDaz4RlmcNt3e6h+dCaB/npbrWxddX7YZWsAMEKxmMKrG/Rm1Gx7ZOchmd4l6+pypA3Vrjoc0LVjqDV/TsePiNxV9LWFB7Rc6YGkIyz2+z5m168iLnn4+qMMXOYndwH7RGcTLEJDPRfNjawuPNcRlYZ6bf30S540MQdC0dJbRLu0uT9CAyi1vjxezdKjGJZSiY5WmtWrhkiRRtCMr9fGxBRNxPDdf5bs7IgWClFgafkGFZKZjLlOV8qtlMrPQSduPtGBCM64veJchSMFS6MfxgE2O/+4EZ246ZN1bdV6KiLRDIzFmy9PBn2o6MNtcdFc/G5XdD7aCTwuGD6sbG2T97Aiai56CN1vYsc6yXUfeZafSm6qviXAx3zTEd1aw1oAZLj3PAt0uZRHggsBEKvwPVKsgHsOVFj5vu0BfHFbdaSdhL3GFotk06Ilr5cLxOrTwqoVNp/hiIJ8pu7T0AEWy1pMYD1+RszsTjJ76l305cQ3UHvinjnbXllsFQIIVE899s="); public final static SkinData WITCH = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzM5OTEyMTE1NDQsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS81NDg1ZDZlMTBhNmNmMmY3Mzg2NmZhMGRiNjEzOWQ5NWViZDM0ZGZiMGY0YzAxMmRkM2YzYWYxMWQ5ZjQxYyJ9fX0=", "cojkGLflVWxwnhDXmHMke7crkeA78iUYOWY7H3YvMJFD+VZi9E7vUahLTTx5ELH+PvcaHJerSDmuV+Nasc3K2n6zlXXb0B7RB/ose/kdPxHAIJee7IbZX0iFNDn6irUSOS4wOYF/BwaqG3HmpoSxV52SGMs6kqTer2Rjg3X+XwYFFiDHAR/gwhfXLzrM1iBc171vgu6T+kx65iBHa/YB/V/mj8FSxwM0f5IsLpgAEdxDL9PvEKQWgWeZ1CAqEXlGnjPkd9oGzW0TgDz2MksBbYZ2kmn/S53kK9vCrVB7egZPS4VBtKpq1P7Jeu8rtgjnAKVFQJZ2lMHnVRuvGTd8JKoPHarUPpU2LURUMaCtHzSv9v/4gjkafnDhqxG4TTcr5hxFV+ho72HQchoeaUXzIO+Yo71zrVqkrS0hw6OtgMIBlvaGaEUsFvGiCZePBEiHojO43AKqJcJAVeT2RAzHcAaBAO79ACGjNKw/oj02rOurLha9i+99bKui96Eg7SS/nPchbmu5YQ9nSpkW+JeYXnBzGGzNG4y02VWgz15L718+8161zXobhuK07qlY9i1nipFbEJedqG0cfS+AUzauETFvS9nMtxhtftYPCIxm40GQj6e77asNCAEElGssaUGKO3bjm348+oF9tR/eBOYWJQ8kL46IQLDRoop7UhG4ewY="); + public final static SkinData TURKEY = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzU3NzM2MTc5MDQsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS8xYzdmYjczMTRkNmY1ZTMzNmVjN2ViNTI1ZGM0ODMzOWNhMjI4ZDk3ODU1MDM3ZDZhNDIwOGZjNzYwNDc1NiJ9fX0=", "eZWi1LOD8ke7MCUAfhspBCnyfCoGM8suFLKtbW6b27CURoRBG3eKIfwLYYeMp3ObjoZ8gCB90s28Qyw5XMzwvvowy9W/b5cYC0OzQ8+GR7tDZoWc28tGqGBM8cmDJIFQgZdceBIIr2lXeAvEJfLbyrus46hPjk8YTiQW2DsBq88BhKIy6Igb1rGqJ1goVERF07b6+/yMdLKCaT8OZFzKLXfo5rY5gr6HLnvsQiNL9aTrl74agXn1GUcP+QVNe7/c9lYmv5vLCBst1YiIPq27NZASZ++Fwyv6+PRlaFZZYtMHVd4UZeYPl7ak1Cdi/1sUcRpkBbJM8AHIrqq0iuXxrLbc6ldQ2cYQKHg9ljIpW/EZanuf6Wgm/LK1JnxXne9GUb/xPzB1EnZ95i8/u9WJa+NixEcfc3pAzDPYncIR8lishFwyBRta6BCG76U3UY2lQr3YD/48AJ49r7+WVU0gOP/h2SDSdAZHEdvkpVJ0w/xA+SevJ7Y7xA5EJ655YMQ0F8f3WUFTf1pFklE5E+fwkMVCWOPw7UMy558IcRSpdWAPPyf8sc7CpDqRk37/vXWRDa+7YBfgskK6B2eXowrzThUOBx+AmDTF3Rv8ZSr1Un0FWGi+GQ5ny7W9dJBMomzyMUbzz9stsCml5XB+6xLP2MD+9lO1bHipKS6qkhtZChE="); // Comments this out for now, so it doesn't load the player profile // A better way to do this would check for the properties when getting the skull or the skin diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBat.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBat.java index ae9608fe1..4225b2c6b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBat.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBat.java @@ -1,6 +1,5 @@ package mineplex.core.gadget.gadgets.morph; -import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.EntityEffect; import org.bukkit.GameMode; import org.bukkit.Material; @@ -24,18 +23,19 @@ import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilText; -import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.disguise.disguises.DisguiseBat; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; +import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.MorphGadget; -import mineplex.core.itemstack.ItemStackFactory; public class MorphBat extends MorphGadget implements IThrown { @@ -60,9 +60,6 @@ public class MorphBat extends MorphGadget implements IThrown this.applyArmor(player, message); DisguiseBat disguise = new DisguiseBat(player); - //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - //disguise.setCustomNameVisible(true); - //Manager.getDisguiseManager().disguise(disguise); UtilMorph.disguise(player, disguise, Manager); } @@ -70,7 +67,6 @@ public class MorphBat extends MorphGadget implements IThrown public void disableCustom(Player player, boolean message) { this.removeArmor(player); - //Manager.getDisguiseManager().undisguise(player); UtilMorph.undisguise(player, Manager.getDisguiseManager()); player.setAllowFlight(false); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlaze.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlaze.java index a0c3dad2a..c7f1f5b01 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlaze.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlaze.java @@ -1,6 +1,5 @@ package mineplex.core.gadget.gadgets.morph; -import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -12,12 +11,13 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; import mineplex.core.disguise.disguises.DisguiseBlaze; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import mineplex.core.gadget.types.MorphGadget; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -43,9 +43,6 @@ public class MorphBlaze extends MorphGadget this.applyArmor(player, message); DisguiseBlaze disguise = new DisguiseBlaze(player); - //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - //disguise.setCustomNameVisible(true); - //Manager.getDisguiseManager().disguise(disguise); UtilMorph.disguise(player, disguise, Manager); } @@ -53,7 +50,6 @@ public class MorphBlaze extends MorphGadget public void disableCustom(Player player, boolean message) { this.removeArmor(player); - //Manager.getDisguiseManager().undisguise(player); UtilMorph.undisguise(player, Manager.getDisguiseManager()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBunny.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBunny.java index 08252f554..7516326f1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBunny.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBunny.java @@ -4,21 +4,12 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; -import mineplex.core.common.currency.GlobalCurrency; -import mineplex.core.common.util.*; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.disguise.disguises.DisguiseRabbit; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; -import mineplex.core.gadget.types.MorphGadget; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import org.bukkit.*; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Color; import org.bukkit.FireworkEffect.Type; +import org.bukkit.Material; +import org.bukkit.Sound; import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -30,6 +21,30 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; +import mineplex.core.common.currency.GlobalCurrency; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; +import mineplex.core.disguise.disguises.DisguiseRabbit; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; +import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + public class MorphBunny extends MorphGadget { private HashSet _jumpCharge = new HashSet(); @@ -56,9 +71,6 @@ public class MorphBunny extends MorphGadget this.applyArmor(player, message); DisguiseRabbit disguise = new DisguiseRabbit(player); - //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - //disguise.setCustomNameVisible(true); - //Manager.getDisguiseManager().disguise(disguise); UtilMorph.disguise(player, disguise, Manager); player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 999999999, 1)); @@ -70,7 +82,6 @@ public class MorphBunny extends MorphGadget { _jumpCharge.remove(player); this.removeArmor(player); - //Manager.getDisguiseManager().undisguise(player); UtilMorph.undisguise(player, Manager.getDisguiseManager()); player.removePotionEffect(PotionEffectType.SPEED); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphChicken.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphChicken.java index 1b033eabb..ce37ddde3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphChicken.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphChicken.java @@ -1,6 +1,5 @@ package mineplex.core.gadget.gadgets.morph; -import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.Sound; @@ -19,14 +18,15 @@ import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilText; import mineplex.core.disguise.disguises.DisguiseChicken; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; +import mineplex.core.gadget.types.MorphGadget; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.MorphGadget; public class MorphChicken extends MorphGadget { @@ -49,9 +49,6 @@ public class MorphChicken extends MorphGadget this.applyArmor(player, message); DisguiseChicken disguise = new DisguiseChicken(player); - //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - //disguise.setCustomNameVisible(true); - //Manager.getDisguiseManager().disguise(disguise); UtilMorph.disguise(player, disguise, Manager); } @@ -59,7 +56,6 @@ public class MorphChicken extends MorphGadget public void disableCustom(Player player, boolean message) { this.removeArmor(player); - //Manager.getDisguiseManager().undisguise(player); UtilMorph.undisguise(player, Manager.getDisguiseManager()); player.setAllowFlight(false); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCow.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCow.java index c8597bc3e..f8d334a12 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCow.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCow.java @@ -1,21 +1,21 @@ package mineplex.core.gadget.gadgets.morph; -import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.player.*; +import org.bukkit.event.player.PlayerInteractEvent; import mineplex.core.common.util.C; import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilText; import mineplex.core.disguise.disguises.DisguiseCow; -import mineplex.core.recharge.Recharge; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.recharge.Recharge; public class MorphCow extends MorphGadget { @@ -37,9 +37,6 @@ public class MorphCow extends MorphGadget this.applyArmor(player, message); DisguiseCow disguise = new DisguiseCow(player); - //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - //disguise.setCustomNameVisible(true); - //Manager.getDisguiseManager().disguise(disguise); UtilMorph.disguise(player, disguise, Manager); } @@ -47,7 +44,6 @@ public class MorphCow extends MorphGadget public void disableCustom(Player player, boolean message) { this.removeArmor(player); - //Manager.getDisguiseManager().undisguise(player); UtilMorph.undisguise(player, Manager.getDisguiseManager()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCreeper.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCreeper.java index af1aa5cb6..13f6a91b4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCreeper.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCreeper.java @@ -2,7 +2,6 @@ package mineplex.core.gadget.gadgets.morph; import java.util.HashMap; -import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.EntityEffect; import org.bukkit.Material; import org.bukkit.Sound; @@ -17,17 +16,18 @@ import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilText; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseCreeper; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; +import mineplex.core.gadget.types.MorphGadget; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.MorphGadget; public class MorphCreeper extends MorphGadget { @@ -51,9 +51,6 @@ public class MorphCreeper extends MorphGadget this.applyArmor(player, message); DisguiseCreeper disguise = new DisguiseCreeper(player); - //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - //disguise.setCustomNameVisible(true); - //Manager.getDisguiseManager().disguise(disguise); UtilMorph.disguise(player, disguise, Manager); } @@ -61,7 +58,6 @@ public class MorphCreeper extends MorphGadget public void disableCustom(Player player, boolean message) { this.removeArmor(player); - //Manager.getDisguiseManager().undisguise(player); UtilMorph.undisguise(player, Manager.getDisguiseManager()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphEnderman.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphEnderman.java index 616364633..761003e4d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphEnderman.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphEnderman.java @@ -1,14 +1,13 @@ package mineplex.core.gadget.gadgets.morph; -import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.Color; import org.bukkit.Effect; import org.bukkit.FireworkEffect; +import org.bukkit.FireworkEffect.Type; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.FireworkEffect.Type; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; @@ -23,6 +22,7 @@ import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilText; import mineplex.core.disguise.disguises.DisguiseEnderman; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import mineplex.core.gadget.types.MorphGadget; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; @@ -48,9 +48,6 @@ public class MorphEnderman extends MorphGadget this.applyArmor(player, message); DisguiseEnderman disguise = new DisguiseEnderman(player); - //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - //disguise.setCustomNameVisible(true); - //Manager.getDisguiseManager().disguise(disguise); UtilMorph.disguise(player, disguise, Manager); } @@ -58,7 +55,6 @@ public class MorphEnderman extends MorphGadget public void disableCustom(Player player, boolean message) { this.removeArmor(player); - //Manager.getDisguiseManager().undisguise(player); UtilMorph.undisguise(player, Manager.getDisguiseManager()); player.setAllowFlight(false); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphMetalMan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphMetalMan.java index 3722be911..d130b1c04 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphMetalMan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphMetalMan.java @@ -5,16 +5,6 @@ import java.util.HashSet; import java.util.Map; import java.util.UUID; -import com.mojang.authlib.GameProfile; -import mineplex.core.common.skin.SkinData; -import mineplex.core.common.util.*; -import mineplex.core.disguise.disguises.DisguisePlayer; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.event.GadgetSelectLocationEvent; -import mineplex.core.gadget.gadgets.particle.unrelated.MetalManEffect; -import mineplex.core.gadget.types.MorphGadget; -import mineplex.core.recharge.Recharge; -import mineplex.core.utils.UtilGameProfile; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -22,6 +12,24 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerInteractEvent; +import com.mojang.authlib.GameProfile; + +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; +import mineplex.core.disguise.disguises.DisguisePlayer; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.event.GadgetSelectLocationEvent; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; +import mineplex.core.gadget.gadgets.particle.unrelated.MetalManEffect; +import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.recharge.Recharge; +import mineplex.core.utils.UtilGameProfile; + public class MorphMetalMan extends MorphGadget { @@ -45,7 +53,7 @@ public class MorphMetalMan extends MorphGadget DisguisePlayer disguisePlayer = new DisguisePlayer(player, gameProfile); disguisePlayer.showInTabList(true, 0); - Manager.getDisguiseManager().disguise(disguisePlayer); + UtilMorph.disguise(player, disguisePlayer, Manager); } @Override @@ -53,7 +61,7 @@ public class MorphMetalMan extends MorphGadget { removeArmor(player); - Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPig.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPig.java index f4584bcee..5ca077a14 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPig.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPig.java @@ -2,12 +2,14 @@ package mineplex.core.gadget.gadgets.morph; import java.util.HashSet; -import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.player.*; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerToggleFlightEvent; import mineplex.core.common.Rank; import mineplex.core.common.util.C; @@ -16,16 +18,17 @@ import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; import mineplex.core.disguise.disguises.DisguisePig; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; +import mineplex.core.gadget.types.MorphGadget; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.MorphGadget; public class MorphPig extends MorphGadget { @@ -50,9 +53,6 @@ public class MorphPig extends MorphGadget this.applyArmor(player, message); DisguisePig disguise = new DisguisePig(player); - //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - //disguise.setCustomNameVisible(true); - //Manager.getDisguiseManager().disguise(disguise); UtilMorph.disguise(player, disguise, Manager); } @@ -60,7 +60,6 @@ public class MorphPig extends MorphGadget public void disableCustom(Player player, boolean message) { this.removeArmor(player); - //Manager.getDisguiseManager().undisguise(player); UtilMorph.undisguise(player, Manager.getDisguiseManager()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPumpkinKing.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPumpkinKing.java index 21c28ec95..2da37bc5d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPumpkinKing.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPumpkinKing.java @@ -1,6 +1,5 @@ package mineplex.core.gadget.gadgets.morph; -import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.entity.Skeleton.SkeletonType; @@ -12,6 +11,7 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilText; import mineplex.core.disguise.disguises.DisguiseSkeleton; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import mineplex.core.gadget.types.MorphGadget; import mineplex.core.visibility.VisibilityManager; @@ -38,10 +38,7 @@ public class MorphPumpkinKing extends MorphGadget DisguiseSkeleton disguise = new DisguiseSkeleton(player); disguise.showArmor(); - //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - //disguise.setCustomNameVisible(true); disguise.SetSkeletonType(SkeletonType.WITHER); - //Manager.getDisguiseManager().disguise(disguise); UtilMorph.disguise(player, disguise, Manager); player.getInventory().setHelmet(new ItemStack(Material.JACK_O_LANTERN)); @@ -54,7 +51,6 @@ public class MorphPumpkinKing extends MorphGadget public void disableCustom(Player player, boolean message) { this.removeArmor(player); - //Manager.getDisguiseManager().undisguise(player); UtilMorph.undisguise(player, Manager.getDisguiseManager()); player.getInventory().setHelmet(null); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSlime.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSlime.java index 0c41fc0a2..925934a72 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSlime.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSlime.java @@ -1,11 +1,10 @@ package mineplex.core.gadget.gadgets.morph; -import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.player.*; +import org.bukkit.event.player.PlayerInteractEvent; import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; @@ -14,12 +13,13 @@ import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilText; import mineplex.core.disguise.disguises.DisguiseSlime; -import mineplex.core.recharge.Recharge; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.recharge.Recharge; public class MorphSlime extends MorphGadget { @@ -49,8 +49,6 @@ public class MorphSlime extends MorphGadget this.applyArmor(player, message); DisguiseSlime disguise = new DisguiseSlime(player); - //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - //disguise.setCustomNameVisible(true); int size = 1 + (_achievementManager.getMineplexLevelNumber(player, _clientManager.Get(player).GetRank())) / 8; @@ -61,8 +59,7 @@ public class MorphSlime extends MorphGadget size = 12; disguise.SetSize(size); - - //Manager.getDisguiseManager().disguise(disguise); + UtilMorph.disguise(player, disguise, Manager); } @@ -70,7 +67,6 @@ public class MorphSlime extends MorphGadget public void disableCustom(Player player, boolean message) { this.removeArmor(player); - //Manager.getDisguiseManager().undisguise(player); UtilMorph.undisguise(player, Manager.getDisguiseManager()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSnowman.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSnowman.java index e103f0d0c..25326feff 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSnowman.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSnowman.java @@ -2,7 +2,6 @@ package mineplex.core.gadget.gadgets.morph; import java.util.WeakHashMap; -import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -28,6 +27,7 @@ import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilText; import mineplex.core.disguise.disguises.DisguiseSnowman; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import mineplex.core.gadget.types.MorphGadget; import mineplex.core.recharge.Recharge; import mineplex.core.recharge.RechargeData; @@ -60,9 +60,6 @@ public class MorphSnowman extends MorphGadget this.applyArmor(player, message); DisguiseSnowman disguise = new DisguiseSnowman(player); - //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - //disguise.setCustomNameVisible(true); - //Manager.getDisguiseManager().disguise(disguise); UtilMorph.disguise(player, disguise, Manager); } @@ -70,7 +67,6 @@ public class MorphSnowman extends MorphGadget public void disableCustom(Player player, boolean message) { this.removeArmor(player); - //Manager.getDisguiseManager().undisguise(player); UtilMorph.undisguise(player, Manager.getDisguiseManager()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java index 618e48fd9..0098be412 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java @@ -1,19 +1,5 @@ package mineplex.core.gadget.gadgets.morph; -import mineplex.core.common.util.*; -import mineplex.core.disguise.disguises.DisguiseSquid; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.event.PlayerToggleSwimEvent; -import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; -import mineplex.core.gadget.gadgets.morph.managers.SwimManager; -import mineplex.core.gadget.types.MorphGadget; -import mineplex.core.gadget.types.OutfitGadget; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.projectile.IThrown; -import mineplex.core.projectile.ProjectileUser; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.enchantments.Enchantment; @@ -26,6 +12,26 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; +import mineplex.core.disguise.disguises.DisguiseSquid; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.event.PlayerToggleSwimEvent; +import mineplex.core.gadget.gadgets.morph.managers.SwimManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; +import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.gadget.types.OutfitGadget; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + public class MorphSquid extends MorphGadget implements IThrown { @@ -45,9 +51,6 @@ public class MorphSquid extends MorphGadget implements IThrown { applyArmor(player, message); DisguiseSquid disguiseSquid = new DisguiseSquid(player); - //disguiseSquid.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); - //disguiseSquid.setCustomNameVisible(true); - //Manager.getDisguiseManager().disguise(disguiseSquid); UtilMorph.disguise(player, disguiseSquid, Manager); onToggleSwim(new PlayerToggleSwimEvent(player, SwimManager.isSwimming(player.getUniqueId()))); } @@ -56,7 +59,6 @@ public class MorphSquid extends MorphGadget implements IThrown public void disableCustom(Player player, boolean message) { removeArmor(player); - //Manager.getDisguiseManager().undisguise(player); UtilMorph.undisguise(player, Manager.getDisguiseManager()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java index d175ef849..03076725c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java @@ -4,7 +4,6 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; -import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -25,17 +24,18 @@ import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilText; import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseGuardian; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.event.GadgetSelectLocationEvent; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import mineplex.core.gadget.types.MorphGadget; import mineplex.core.recharge.Recharge; import mineplex.core.recharge.RechargedEvent; @@ -64,10 +64,7 @@ public class MorphTitan extends MorphGadget this.applyArmor(player, message); DisguiseGuardian disguise = new DisguiseGuardian(player); - //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - //disguise.setCustomNameVisible(true); disguise.setElder(true); - //Manager.getDisguiseManager().disguise(disguise); UtilMorph.disguise(player, disguise, Manager); } @@ -75,7 +72,6 @@ public class MorphTitan extends MorphGadget public void disableCustom(Player player, boolean message) { this.removeArmor(player); - //Manager.getDisguiseManager().undisguise(player); UtilMorph.undisguise(player, Manager.getDisguiseManager()); player.setAllowFlight(false); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTurkey.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTurkey.java new file mode 100644 index 000000000..323603fc4 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTurkey.java @@ -0,0 +1,63 @@ +package mineplex.core.gadget.gadgets.morph; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerToggleSneakEvent; + +import com.mojang.authlib.GameProfile; + +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.disguise.disguises.DisguisePlayer; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; +import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.utils.UtilGameProfile; + +public class MorphTurkey extends MorphGadget +{ + + public MorphTurkey(GadgetManager manager) + { + super(manager, "Turkey Morph", UtilText.splitLinesToArray(new String[]{"Placeholder"}, + LineFormat.LORE), 0, Material.GLASS, (byte) 0); + } + + @Override + public void enableCustom(Player player, boolean message) + { + applyArmor(player, message); + + GameProfile profile = UtilGameProfile.getGameProfile(player); + profile.getProperties().clear(); + profile.getProperties().put("textures", SkinData.TURKEY.getProperty()); + + DisguisePlayer disguisePlayer = new DisguisePlayer(player, profile); + disguisePlayer.showInTabList(true, 0); + UtilMorph.disguise(player, disguisePlayer, Manager); + } + + @Override + public void disableCustom(Player player, boolean message) + { + removeArmor(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); + } + + @EventHandler + public void onSneak(PlayerToggleSneakEvent event) + { + if (!isActive(event.getPlayer())) + return; + + if (!event.isSneaking()) + return; + + Player player = event.getPlayer(); + player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_IDLE, 1f, 1.25f); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphUncleSam.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphUncleSam.java index fd47f1695..55ea3a9ba 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphUncleSam.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphUncleSam.java @@ -1,6 +1,13 @@ package mineplex.core.gadget.gadgets.morph; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; + import com.mojang.authlib.GameProfile; + import mineplex.core.common.skin.SkinData; import mineplex.core.common.util.C; import mineplex.core.common.util.LineFormat; @@ -9,24 +16,13 @@ import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilText; import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import mineplex.core.gadget.types.MorphGadget; import mineplex.core.recharge.Recharge; import mineplex.core.utils.UtilGameProfile; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; -import java.util.WeakHashMap; public class MorphUncleSam extends MorphGadget { - private Map _disguises = new HashMap<>(); public MorphUncleSam(GadgetManager manager) { @@ -53,9 +49,7 @@ public class MorphUncleSam extends MorphGadget DisguisePlayer disguisePlayer = new DisguisePlayer(player, profile); disguisePlayer.showInTabList(true, 0); - Manager.getDisguiseManager().disguise(disguisePlayer); - - this._disguises.put(player.getUniqueId(), disguisePlayer); + UtilMorph.disguise(player, disguisePlayer, Manager); } @Override @@ -63,7 +57,7 @@ public class MorphUncleSam extends MorphGadget { this.removeArmor(player); - Manager.getDisguiseManager().undisguise(this._disguises.remove(player.getUniqueId())); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); } @EventHandler @@ -84,9 +78,4 @@ public class MorphUncleSam extends MorphGadget UtilFirework.playFreedomFirework(player.getLocation().clone().add(0, 2, 0)); } - @EventHandler - public void quit(PlayerQuitEvent event) - { - this._disguises.remove(event.getPlayer().getUniqueId()); - } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java index f50043402..9c0777d38 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java @@ -3,18 +3,6 @@ package mineplex.core.gadget.gadgets.morph; import java.util.HashSet; import java.util.Iterator; -import mineplex.core.common.currency.GlobalCurrency; -import mineplex.core.common.util.*; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.disguise.disguises.DisguiseVillager; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; -import mineplex.core.gadget.types.MorphGadget; -import mineplex.core.projectile.IThrown; -import mineplex.core.projectile.ProjectileUser; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; import org.bukkit.ChatColor; import org.bukkit.EntityEffect; import org.bukkit.Material; @@ -28,6 +16,26 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.inventory.ItemStack; +import mineplex.core.common.currency.GlobalCurrency; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; +import mineplex.core.disguise.disguises.DisguiseVillager; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; +import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + public class MorphVillager extends MorphGadget implements IThrown { private HashSet _gems = new HashSet(); @@ -52,9 +60,6 @@ public class MorphVillager extends MorphGadget implements IThrown this.applyArmor(player, message); DisguiseVillager disguise = new DisguiseVillager(player); - //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - //disguise.setCustomNameVisible(true); - //Manager.getDisguiseManager().disguise(disguise); UtilMorph.disguise(player, disguise, Manager); } @@ -62,7 +67,6 @@ public class MorphVillager extends MorphGadget implements IThrown public void disableCustom(Player player, boolean message) { this.removeArmor(player); - //Manager.getDisguiseManager().undisguise(player); UtilMorph.undisguise(player, Manager.getDisguiseManager()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWitch.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWitch.java index 3b457ee01..cda2d17c1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWitch.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWitch.java @@ -17,6 +17,7 @@ import mineplex.core.common.util.UtilText; import mineplex.core.disguise.disguises.DisguiseWitch; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.event.GadgetSelectLocationEvent; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import mineplex.core.gadget.types.MorphGadget; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; @@ -35,9 +36,7 @@ public class MorphWitch extends MorphGadget { this.applyArmor(player, message); DisguiseWitch disguiseWitch = new DisguiseWitch(player); - disguiseWitch.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); - disguiseWitch.setCustomNameVisible(true); - Manager.getDisguiseManager().disguise(disguiseWitch); + UtilMorph.disguise(player, disguiseWitch, Manager); } @Override @@ -49,7 +48,7 @@ public class MorphWitch extends MorphGadget { witchEffectManager.stop(); } - Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); } public ItemStack getWitchItem() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWither.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWither.java index 6bca2d624..59f9bcb46 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWither.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWither.java @@ -4,31 +4,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; -import mineplex.core.common.Rank; -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilText; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.disguise.disguises.DisguiseBase; -import mineplex.core.disguise.disguises.DisguiseWither; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; -import mineplex.core.gadget.types.MorphGadget; -import mineplex.core.inventory.ClientItem; -import mineplex.core.inventory.data.Item; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; - import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -40,6 +15,31 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.util.Vector; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseWither; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; +import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.inventory.ClientItem; +import mineplex.core.inventory.data.Item; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + public class MorphWither extends MorphGadget { private ArrayList _skulls = new ArrayList(); @@ -65,9 +65,6 @@ public class MorphWither extends MorphGadget player.setHealth(300); DisguiseWither disguise = new DisguiseWither(player); - //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - //disguise.setCustomNameVisible(true); - //Manager.getDisguiseManager().disguise(disguise); UtilMorph.disguise(player, disguise, Manager, true); player.setMaxHealth(20); @@ -78,7 +75,6 @@ public class MorphWither extends MorphGadget public void disableCustom(Player player, boolean message) { this.removeArmor(player); - //Manager.getDisguiseManager().undisguise(player); UtilMorph.undisguise(player, Manager.getDisguiseManager()); player.setAllowFlight(false); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/UtilMorph.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/UtilMorph.java index 828e096eb..e186e7845 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/UtilMorph.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/UtilMorph.java @@ -4,11 +4,12 @@ import java.util.HashMap; import java.util.Map; import java.util.UUID; +import org.bukkit.entity.Player; + import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseInsentient; import mineplex.core.gadget.GadgetManager; -import org.bukkit.entity.Player; public class UtilMorph { @@ -17,38 +18,54 @@ public class UtilMorph * UtilMorph helps disguising and undisguising players, avoiding the use of deprecated methods */ - private static Map _disguises = new HashMap<>(); + private static Map _disguises = new HashMap<>(); /** * Disguises a player with custom name * @param player The player that will be disguised - * @param disguiseInsentient The disguise that will be applied + * @param disguiseBase The disguise that will be applied * @param gadgetManager The gadget manager */ - public static void disguise(Player player, DisguiseInsentient disguiseInsentient, GadgetManager gadgetManager) + public static void disguise(Player player, DisguiseBase disguiseBase, GadgetManager gadgetManager) { - _disguises.put(player.getUniqueId(), disguiseInsentient); - disguiseInsentient.setName(player.getName(), gadgetManager.getClientManager().Get(player).getRealOrDisguisedRank()); - disguiseInsentient.setCustomNameVisible(true); - gadgetManager.getDisguiseManager().disguise(disguiseInsentient); + _disguises.put(player.getUniqueId(), disguiseBase); + if (disguiseBase instanceof DisguiseInsentient) + { + DisguiseInsentient disguiseInsentient = (DisguiseInsentient) disguiseBase; + disguiseInsentient.setName(player.getName(), gadgetManager.getClientManager().Get(player).getRealOrDisguisedRank()); + disguiseInsentient.setCustomNameVisible(true); + gadgetManager.getDisguiseManager().disguise(disguiseInsentient); + } + else + { + gadgetManager.getDisguiseManager().disguise(disguiseBase); + } } /** * Disguises a player with custom name (special case for the Wither Morph) * @param player The player that will be disguised - * @param disguiseInsentient The disguise that will be applied + * @param disguiseBase The disguise that will be applied * @param gadgetManager The gadget manager * @param wither */ - public static void disguise(Player player, DisguiseInsentient disguiseInsentient, GadgetManager gadgetManager, boolean wither) + public static void disguise(Player player, DisguiseBase disguiseBase, GadgetManager gadgetManager, boolean wither) { - _disguises.put(player.getUniqueId(), disguiseInsentient); - disguiseInsentient.setName(player.getName(), gadgetManager.getClientManager().Get(player).getRealOrDisguisedRank()); - if (!wither) + _disguises.put(player.getUniqueId(), disguiseBase); + if (disguiseBase instanceof DisguiseInsentient) { - disguiseInsentient.setCustomNameVisible(true); + DisguiseInsentient disguiseInsentient = (DisguiseInsentient) disguiseBase; + disguiseInsentient.setName(player.getName(), gadgetManager.getClientManager().Get(player).getRealOrDisguisedRank()); + if (!wither) + { + disguiseInsentient.setCustomNameVisible(true); + } + gadgetManager.getDisguiseManager().disguise(disguiseInsentient); + } + else + { + gadgetManager.getDisguiseManager().disguise(disguiseBase); } - gadgetManager.getDisguiseManager().disguise(disguiseInsentient); } /** diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountChicken.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountChicken.java new file mode 100644 index 000000000..dbcad568f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountChicken.java @@ -0,0 +1,84 @@ +package mineplex.core.mount.types; + +import org.bukkit.Material; +import org.bukkit.entity.Chicken; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEntityEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; +import mineplex.core.mount.Mount; +import mineplex.core.mount.MountManager; +import mineplex.core.mount.SingleEntityMountData; + +public class MountChicken extends Mount> +{ + + public MountChicken(MountManager manager) + { + super(manager, "Chicken Mount", Material.SLIME_BALL, (byte)0, + UtilText.splitLineToArray(C.cGray + "Placeholder", LineFormat.LORE), + 15000); + + KnownPackage = false; + } + + public void enableCustom(Player player) + { + player.leaveVehicle(); + player.eject(); + + //Remove other mounts + Manager.DeregisterAll(player); + + SingleEntityMountData mount = new SingleEntityMountData<>(player, player.getWorld().spawn(player.getLocation(), Chicken.class)); + mount.getEntity().setBaby(); + + mount.getEntity().setCustomName(player.getName() + "'s " + getName()); + + //Inform + UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(getName()) + ".")); + + //Store + _active.put(player, mount); + } + + public void disable(Player player) + { + SingleEntityMountData mount = _active.remove(player); + if (mount != null) + { + mount.remove(); + + //Inform + UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(getName()) + ".")); + + Manager.removeActive(player); + } + } + + @EventHandler + public void interactMount(PlayerInteractEntityEvent event) + { + if (event.getRightClicked() == null) + return; + + SingleEntityMountData data = getActive().get(event.getPlayer()); + + if(data == null) return; + + if(!data.ownsMount(event.getPlayer())) return; + + if(!data.isPartOfMount(event.getRightClicked())) return; + + event.getPlayer().leaveVehicle(); + event.getPlayer().eject(); + + event.getRightClicked().setPassenger(event.getPlayer()); + } + +} From e4d36215129a48149209402683074e2cb2b85401 Mon Sep 17 00:00:00 2001 From: Keir Nellyer Date: Fri, 7 Oct 2016 18:25:20 +0100 Subject: [PATCH 018/147] Create SnapshotMetadata class in prepartion of snapshot tokens --- .../core/chatsnap/SnapshotMetadata.java | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotMetadata.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotMetadata.java b/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotMetadata.java new file mode 100644 index 000000000..b85b706ab --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotMetadata.java @@ -0,0 +1,43 @@ +package mineplex.core.chatsnap; + +import java.util.Optional; + +public class SnapshotMetadata +{ + private final int _id; + protected String _token = null; + protected Integer _creatorId = null; + + public SnapshotMetadata(int id, String token, int creatorId) + { + _id = id; + _token = token; + _creatorId = creatorId; + } + + public SnapshotMetadata(int id, int creatorId) + { + _id = id; + _creatorId = creatorId; + } + + public SnapshotMetadata(int id) + { + _id = id; + } + + public int getId() + { + return _id; + } + + public Optional getToken() + { + return Optional.ofNullable(_token); + } + + public Optional getCreatorId() + { + return Optional.ofNullable(_creatorId); + } +} From 28a2a8c098b1e2693ea6d75a642f1f6eeb86815f Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 8 Oct 2016 11:14:55 +0100 Subject: [PATCH 019/147] More from GI testing --- .../games/smash/perks/chicken/PerkEggGun.java | 6 +++ .../smash/perks/enderman/PerkBlockToss.java | 2 +- .../games/smash/perks/golem/SmashGolem.java | 42 +++++++++++++------ .../smash/perks/guardian/PerkTargetLazer.java | 2 +- .../smash/perks/guardian/PerkWaterSplash.java | 6 ++- .../smash/perks/spider/PerkSpiderLeap.java | 3 +- .../games/smash/perks/witch/PerkBatWave.java | 19 ++++----- .../smash/perks/witch/PerkWitchPotion.java | 34 +++++---------- 8 files changed, 61 insertions(+), 53 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkEggGun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkEggGun.java index 81831fabf..df35fda05 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkEggGun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkEggGun.java @@ -19,6 +19,7 @@ import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; @@ -63,6 +64,11 @@ public class PerkEggGun extends SmashPerk Player player = event.getPlayer(); + if (!UtilItem.isSword(player.getItemInHand())) + { + return; + } + if (isSuperActive(event.getPlayer())) { return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java index e843ae6d4..50ccb7630 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java @@ -44,7 +44,7 @@ public class PerkBlockToss extends SmashPerk implements IThrown private static final int COOLDOWN = 2000; private static final int CHARGE_TIME = 1200; - private static final int DAMAGE = 12; + private static final int DAMAGE = 11; private static final float KNOCKBACK_MAGNITUDE = 2.5F; private Map _hold = new HashMap<>(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashGolem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashGolem.java index 07560abd9..e28bc8aea 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashGolem.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashGolem.java @@ -1,8 +1,10 @@ package nautilus.game.arcade.game.games.smash.perks.golem; import java.util.List; +import java.util.Map; import org.bukkit.Effect; +import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; @@ -13,10 +15,11 @@ import org.bukkit.util.Vector; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; + import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashGolem extends SmashUltimate @@ -24,6 +27,7 @@ public class SmashGolem extends SmashUltimate private static final int DURATION = 16000; private static final int HIT_FREQUENCY = 400; + private static final int DAMAGE_RADIUS = 2; private static final int EFFECT_RADIUS = 5; public SmashGolem() @@ -40,7 +44,7 @@ public class SmashGolem extends SmashUltimate @EventHandler public void update(UpdateEvent event) { - if (event.getType() != UpdateType.TICK) + if (event.getType() != UpdateType.FASTEST) { return; } @@ -49,33 +53,45 @@ public class SmashGolem extends SmashUltimate for (Player player : alivePlayers) { - if (!isUsingUltimate(player)) { continue; } - + for (Player other : alivePlayers) { - if (player.equals(other)) + if (player.equals(other) || UtilPlayer.isSpectator(player)) { continue; } other.playSound(other.getLocation(), Sound.MINECART_BASE, 0.2f, 0.2f); - - if (UtilEnt.isGrounded(other)) - { - // Damage Event - Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, 1 + 2 * Math.random(), false, false, false, other.getName(), GetName()); - // Velocity - if (Recharge.Instance.use(other, GetName() + " Hit", HIT_FREQUENCY, false, false)) + boolean grounded = false; + + for (Block block : UtilBlock.getInRadius(other.getLocation(), DAMAGE_RADIUS).keySet()) + { + if (block.getType() != Material.AIR) { - UtilAction.velocity(other, new Vector(Math.random() - 0.5, Math.random() * 0.2, Math.random() - 0.5), Math.random() * 1 + 1, false, 0, 0.1 + Math.random() * 0.2, 2, true); + grounded = true; + break; } } + if (!grounded) + { + continue; + } + + // Damage Event + Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, 1 + 2 * Math.random(), false, false, false, other.getName(), GetName()); + + // Velocity + if (Recharge.Instance.use(other, GetName() + " Hit", HIT_FREQUENCY, false, false)) + { + UtilAction.velocity(other, new Vector(Math.random() - 0.5, Math.random() * 0.2, Math.random() - 0.5), Math.random() * 1 + 1, false, 0, 0.1 + Math.random() * 0.2, 2, true); + } + // Effect for (Block block : UtilBlock.getInRadius(other.getLocation(), EFFECT_RADIUS).keySet()) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java index e9f964077..bcd0362d4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java @@ -187,6 +187,7 @@ public class PerkTargetLazer extends SmashPerk ArmorStand targetPlaceholder = data.update(Manager); targetPlaceholder.remove(); + setLazerTarget(data.getAttacker(), null); data.getAttacker().sendMessage(F.main("Game", "Your laser broke dealing damage to " + F.name(data.getTarget().getName())) + "."); Manager.GetDamage().NewDamageEvent(data.getTarget(), data.getAttacker(), null, DamageCause.CUSTOM, damage, false, true, false, data.getAttacker().getName(), GetName()); @@ -255,7 +256,6 @@ public class PerkTargetLazer extends SmashPerk if (target == null) { disguise.setTarget(0); - data.update(Manager).remove(); } else { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java index 77212581b..b39d9ff3b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java @@ -38,7 +38,7 @@ import nautilus.game.arcade.kit.Perk; public class PerkWaterSplash extends Perk { - private static final int COOLDOWN = 18000; + private static final int COOLDOWN = 12000; private static final int VELOCITY_Y = 1; private static final int RADIUS = 5; private static final int MIN_AIR_TIME = 750; @@ -173,7 +173,9 @@ public class PerkWaterSplash extends Perk { _usedSecondBoost.add(uuid); - UtilAction.velocity(player, new Vector(0, VELOCITY_Y, 0)); + Vector direction = player.getLocation().getDirection().setY(0.2); + + UtilAction.velocity(player, direction); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java index 7783f96c2..161bc9446 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java @@ -65,9 +65,8 @@ public class PerkSpiderLeap extends Perk { player.setExp((float) Math.min(0.999, player.getExp() + ENERGY_PER_TICK)); _secondJump.remove(player.getUniqueId()); + continue; } - - continue; } player.setExp((float) Math.max(0, player.getExp() - ENERGY_PER_TICK)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java index 5ba2be470..8f54c49a8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java @@ -8,6 +8,7 @@ import java.util.Map; import java.util.Set; import java.util.UUID; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Sound; import org.bukkit.entity.Bat; @@ -285,7 +286,8 @@ public class PerkBatWave extends SmashPerk _active.remove(key); _direction.remove(key); _pulling.remove(key); - + _damageTaken.remove(key); + if (_bats.containsKey(key)) { for (Bat bat : _bats.get(key)) @@ -308,20 +310,17 @@ public class PerkBatWave extends SmashPerk if (event.GetDamageePlayer() != null) { Player player = event.GetDamageePlayer(); + UUID key = player.getUniqueId(); + + _damageTaken.putIfAbsent(key, 0D); - if (hasPerk(player)) - { - UUID key = player.getUniqueId(); - - if (!_damageTaken.containsKey(key)) - { - _damageTaken.put(key, 0D); - } - + if (hasPerk(player) && _damageTaken.containsKey(key)) + { _damageTaken.put(key, (_damageTaken.get(key) + event.GetDamage())); if (_damageTaken.get(key) >= DISABLE_DAMAGE) { + Bukkit.broadcastMessage("cleared!!! " + _damageTaken.get(key)); Clear(player); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java index 825948c9a..133bc6dc5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java @@ -1,6 +1,7 @@ package nautilus.game.arcade.game.games.smash.perks.witch; import java.util.ArrayList; +import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; @@ -14,8 +15,6 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; -import com.google.common.collect.Sets; - import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; @@ -45,7 +44,6 @@ public class PerkWitchPotion extends SmashPerk implements IThrown private static final int RANGE_NOMRAL = 3; private static final int RANGE_SMASH = 4; private static final int DAMAGE_NORMAL = 6; - private static final int DAMAGE_SMASH = 10; private static final int KNOCKBACK_MAGNITUDE = 2; private List _proj = new ArrayList<>(); @@ -101,7 +99,7 @@ public class PerkWitchPotion extends SmashPerk implements IThrown _proj.add(potion); - Manager.GetProjectile().AddThrow(potion, player, this, 10000, true, true, true, false, false, 0.5F); + Manager.GetProjectile().AddThrow(potion, player, this, 10000, true, true, true, false, false, 1); // Inform UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); @@ -145,12 +143,12 @@ public class PerkWitchPotion extends SmashPerk implements IThrown @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { - Set players = Sets.newHashSet(target); + Set players = new HashSet<>(); Player thrower = (Player) data.getThrower(); - - if (!(data.getThrower() instanceof Player)) + + if (target != null) { - return; + players.add(target); } for (Player player : Manager.GetGame().GetPlayers(true)) @@ -170,26 +168,14 @@ public class PerkWitchPotion extends SmashPerk implements IThrown players.add(player); } - boolean smash = isSuperActive(thrower); int i = 0; - + for (LivingEntity entity : players) { - if (smash) - { - // Damage Event - Manager.GetDamage().NewDamageEvent(entity, thrower, null, DamageCause.CUSTOM, (i++ == 0 ? DAMAGE_NORMAL + 1 : DAMAGE_NORMAL), true, true, false, thrower.getName(), GetName()); + // Damage Event + Manager.GetDamage().NewDamageEvent(entity, thrower, null, DamageCause.CUSTOM, (i++ == 0 ? DAMAGE_NORMAL + 1 : DAMAGE_NORMAL), true, true, false, thrower.getName(), GetName()); - Manager.GetCondition().Factory().Slow(GetName(), entity, null, 3, 1, true, false, false, false); - } - // Super Effect - else - { - // Damage Event - Manager.GetDamage().NewDamageEvent(entity, thrower, null, DamageCause.CUSTOM, DAMAGE_SMASH, true, true, false, thrower.getName(), GetName()); - - Manager.GetCondition().Factory().Slow(GetName(), entity, null, 7, 2, true, false, false, false); - } + Manager.GetCondition().Factory().Slow(GetName(), entity, null, 3, 1, true, false, false, false); } } From 2b124cb16ccbfeddb8959f730e6fc8d0482ea24e Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 9 Oct 2016 12:24:49 +0100 Subject: [PATCH 020/147] I have really lost track on what I'm doing... --- .../util/particles/effects/LineParticle.java | 7 +- .../game/games/smash/SoloSuperSmash.java | 4 +- .../arcade/game/games/smash/SuperSmash.java | 351 ++++++++---- .../game/games/smash/TeamSuperSmash.java | 115 ++-- .../game/games/smash/kits/KitGuardian.java | 2 +- .../game/games/smash/kits/KitMagmaCube.java | 29 + .../game/games/smash/kits/KitSpider.java | 3 +- .../arcade/game/games/smash/kits/KitWolf.java | 2 + .../game/games/smash/modes/RandomKitSSM.java | 12 +- .../game/games/smash/perks/SmashUltimate.java | 5 + .../smash/perks/guardian/PerkWaterSplash.java | 5 + .../perks/guardian/SmashAnimationData.java | 5 +- .../smash/perks/guardian/SmashGuardian.java | 15 + .../games/smash/perks/sheep/PerkLazer.java | 1 + .../smash/perks/spider/PerkSpiderLeap.java | 97 ++-- .../games/smash/perks/spider/SmashSpider.java | 2 +- .../games/smash/perks/witch/PerkBatWave.java | 24 +- .../smash/perks/witch/PerkWitchPotion.java | 4 +- .../game/games/smash/perks/wolf/PerkWolf.java | 527 ++++++++++++++++++ .../games/smash/perks/wolf/SmashWolf.java | 512 +---------------- .../game/arcade/kit/perks/PerkSpiderLeap.java | 183 ------ 21 files changed, 982 insertions(+), 923 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/PerkWolf.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpiderLeap.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/effects/LineParticle.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/effects/LineParticle.java index a19623df1..5eb91a337 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/effects/LineParticle.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/effects/LineParticle.java @@ -75,12 +75,7 @@ public class LineParticle if (!(UtilBlock.airFoliage(newTarget.getBlock()) || UtilBlock.airFoliage(newTarget.getBlock().getRelative(BlockFace.UP)))) { - if (_ignoredTypes == null) - { - done = true; - } - - if (!_ignoredTypes.contains(newTarget.getBlock().getType())) + if (_ignoredTypes == null || !_ignoredTypes.contains(newTarget.getBlock().getType())) { done = true; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java index fd1262539..d9d81048f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java @@ -98,11 +98,11 @@ public class SoloSuperSmash extends SuperSmash if (GetPlayers(true).size() > 14) { Scoreboard.writeNewLine(); - Scoreboard.write(C.cGreen + "Players Alive"); + Scoreboard.write(C.cGreenB + "Players Alive"); Scoreboard.write(GetPlayers(true).size() + " "); Scoreboard.writeNewLine(); - Scoreboard.write(C.cRed + "Players Dead"); + Scoreboard.write(C.cRedB + "Players Dead"); Scoreboard.write((GetPlayers(false).size() - GetPlayers(true).size()) + " "); } else 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 cbd4e822e..62269d1a0 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 @@ -1,7 +1,6 @@ package nautilus.game.arcade.game.games.smash; import java.util.HashMap; -import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.concurrent.TimeUnit; @@ -12,8 +11,9 @@ import org.bukkit.FireworkEffect.Type; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.block.BlockFace; +import org.bukkit.block.Block; import org.bukkit.entity.EnderCrystal; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -23,12 +23,18 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; +import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.scheduler.BukkitRunnable; -import mineplex.core.common.block.BlockData; +import com.google.common.collect.Sets; + +import mineplex.core.blockrestore.BlockRestore; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAlg; @@ -38,11 +44,13 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.hologram.Hologram; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.ArcadeFormat; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; @@ -76,29 +84,50 @@ import nautilus.game.arcade.kit.Perk; public abstract class SuperSmash extends Game { + + private static final int MAX_LIVES = 4; + private static final int POWERUP_SPAWN_Y_INCREASE = 120; + private static final int HUNGER_DELAY = 250; + + private static final String DATA_POINT_POWERUP = "RED"; + private Map _lives = new HashMap<>(); - + private Location _powerupCurrent = null; private Location _powerupTarget = null; private EnderCrystal _powerup = null; + private Hologram _powerupHologram = null; + private boolean _powerupHologramColour; private long _nextPowerup = 0; - - private Set _restoreBlock = new HashSet<>(); - + + private static final Set REMOVE_ON_ITEM_SPAWN = Sets.newHashSet(Material.CACTUS, Material.BROWN_MUSHROOM, Material.RED_MUSHROOM, Material.YELLOW_FLOWER, Material.RED_ROSE); + public SuperSmash(ArcadeManager manager, GameType type, String[] description) { this(manager, new Kit[] { - new KitSkeleton(manager), new KitGolem(manager), new KitSpider(manager), new KitSlime(manager), - - new KitCreeper(manager), new KitEnderman(manager), new KitSnowman(manager), new KitWolf(manager), - - new KitBlaze(manager), new KitWitch(manager), new KitChicken(manager), new KitSkeletalHorse(manager), new KitPig(manager), new KitSkySquid(manager), new KitWitherSkeleton( - manager), new KitMagmaCube(manager), new KitZombie(manager), new KitCow(manager), - - new KitSheep(manager), new KitGuardian(manager) + new KitSkeleton(manager), + new KitGolem(manager), + new KitSpider(manager), + new KitSlime(manager), + new KitCreeper(manager), + new KitEnderman(manager), + new KitSnowman(manager), + new KitWolf(manager), + new KitBlaze(manager), + new KitWitch(manager), + new KitChicken(manager), + new KitSkeletalHorse(manager), + new KitPig(manager), + new KitSkySquid(manager), + new KitWitherSkeleton(manager), + new KitMagmaCube(manager), + new KitZombie(manager), + new KitCow(manager), + new KitSheep(manager), + new KitGuardian(manager) }, type, description); } @@ -116,7 +145,7 @@ public abstract class SuperSmash extends Game } @EventHandler(priority = EventPriority.HIGH) - public void onGameStateChange(GameStateChangeEvent event) + public void gameStart(GameStateChangeEvent event) { if (event.GetState() != GameState.Prepare) { @@ -125,21 +154,36 @@ public abstract class SuperSmash extends Game for (Player player : GetPlayers(true)) { - _lives.put(player, 4); + _lives.put(player, MAX_LIVES); } _nextPowerup = getNewSmashTime(); } @EventHandler(priority = EventPriority.LOWEST) - public void onPlayerOut(PlayerDeathEvent event) + public void playerDeath(PlayerDeathEvent event) { if (!loseLife(event.getEntity())) { - this.SetPlayerState(event.getEntity(), PlayerState.OUT); + SetPlayerState(event.getEntity(), PlayerState.OUT); } - - Manager.GetDisguise().undisguise(Manager.GetDisguise().getActiveDisguise(event.getEntity())); + + //I think this causes players to sometimes be invisible +// DisguiseManager disguiseManager = Manager.GetDisguise(); +// DisguiseBase disguise = disguiseManager.getActiveDisguise(event.getEntity()); +// +// if (disguise == null) +// { +// return; +// } +// +// disguiseManager.undisguise(disguise); + } + + @EventHandler + public void playerQuit(PlayerQuitEvent event) + { + _lives.remove(event.getPlayer()); } public int getLives(Player player) @@ -163,8 +207,10 @@ public abstract class SuperSmash extends Game if (lives > 0) { + String livesString = (lives == 1 ? "life" : "lives"); + UtilPlayer.message(player, C.cRedB + "You have died!"); - UtilPlayer.message(player, C.cRedB + "You have " + lives + " " + (lives == 1 ? "life" : "lives") + " left!"); + UtilPlayer.message(player, C.cRedB + "You have " + lives + " " + livesString + " left!"); player.playSound(player.getLocation(), Sound.NOTE_BASS_GUITAR, 2f, 0.5f); _lives.put(player, lives); @@ -175,19 +221,20 @@ public abstract class SuperSmash extends Game @Override public void run() { - UtilTextMiddle.display(getLiveColour(lives) + lives, (lives == 1 ? "life" : "lives") + " left!", 10, 30, 10, player); + UtilTextMiddle.display(getLiveColour(lives) + lives, livesString + " left!", 10, 30, 10, player); } }.runTaskLater(Manager.getPlugin(), (long) DeathSpectateSecs * 20 + 2); return true; } - else - { - UtilPlayer.message(player, C.cRed + C.Bold + "You are out of the game!"); - player.playSound(player.getLocation(), Sound.EXPLODE, 2f, 1f); - - return false; - } + + String gameOver = "You ran out of lives!"; + + UtilTextMiddle.display(C.cRedB + "GAME OVER", gameOver, 10, 50, 10, player); + UtilPlayer.message(player, C.cRedB + gameOver); + player.playSound(player.getLocation(), Sound.EXPLODE, 2f, 1f); + + return false; } @EventHandler @@ -205,8 +252,6 @@ public abstract class SuperSmash extends Game Player player = event.getPlayer(); - UtilInv.remove(player, Material.NETHER_STAR, (byte) 0, 1); - for (Perk perk : GetKit(player).GetPerks()) { if (perk instanceof SmashUltimate) @@ -214,11 +259,13 @@ public abstract class SuperSmash extends Game SmashUltimate ultimate = (SmashUltimate) perk; String name = ultimate.GetName(); - if (ultimate.isUsingUltimate(player)) + if (ultimate.isUsingUltimate(player) || !ultimate.isUsable(player)) { continue; } + UtilInv.remove(player, Material.NETHER_STAR, (byte) 0, 1); + player.setHealth(player.getMaxHealth()); player.playSound(player.getLocation(), ultimate.getSound(), 10, 1); @@ -230,64 +277,86 @@ public abstract class SuperSmash extends Game } } + @SuppressWarnings("deprecation") @EventHandler public void powerupSpawn(UpdateEvent event) { if (event.getType() != UpdateType.FASTER) + { return; - + } + if (!IsLive()) + { return; - + } + + if (_powerupHologram != null) + { + _powerupHologram.setText((_powerupHologramColour ? C.cGreenB : C.cWhiteB) + "SMASH CRYSTAL"); + _powerupHologramColour = !_powerupHologramColour; + } + if (_powerup == null) { if (System.currentTimeMillis() < _nextPowerup) + { return; - - if (WorldData.GetDataLocs("RED").isEmpty()) + } + + if (WorldData.GetDataLocs(DATA_POINT_POWERUP).isEmpty()) + { return; - + } + if (_powerupTarget == null) { - Location newTarget = UtilAlg.Random(WorldData.GetDataLocs("RED")); - - _powerupTarget = newTarget; - _powerupCurrent = _powerupTarget.clone().add(0, 120, 0); + BlockRestore blockRestore = Manager.GetBlockRestore(); + Location newTarget = UtilAlg.Random(WorldData.GetDataLocs(DATA_POINT_POWERUP)); + Block targetBlock = newTarget.getBlock(); + + // This relies on this method being called 4 times a second (5 ticks, UpdateType.FASTER). + long restoreTime = (POWERUP_SPAWN_Y_INCREASE / 4 / 2) * 1000 + 500; + + _powerupTarget = newTarget.clone(); + _powerupCurrent = newTarget.clone().add(0, POWERUP_SPAWN_Y_INCREASE, 0); // Blocks for (int x = -1; x <= 1; x++) + { for (int z = -1; z <= 1; z++) { - _restoreBlock.add(new BlockData(_powerupTarget.getBlock().getRelative(x, -2, z))); - _restoreBlock.add(new BlockData(_powerupTarget.getBlock().getRelative(x, -1, z))); - - _powerupTarget.getBlock().getRelative(x, -2, z).setType(Material.IRON_BLOCK); - _powerupTarget.getBlock().getRelative(x, -1, z).setType(Material.QUARTZ_BLOCK); + blockRestore.add(targetBlock.getRelative(x, -3, z), Material.IRON_BLOCK.getId(), (byte) 0, restoreTime); + + if (x == 0 && z == 0) + { + continue; + } + + blockRestore.add(targetBlock.getRelative(x, -1, z), Material.QUARTZ_BLOCK.getId(), (byte) 0, restoreTime); } - - _powerupTarget.getBlock().getRelative(BlockFace.DOWN).setType(Material.BEACON); + } + + blockRestore.add(targetBlock.getRelative(0, -2, 0), Material.BEACON.getId(), (byte) 0, restoreTime); + blockRestore.add(targetBlock.getRelative(0, -1, 0), Material.STAINED_GLASS.getId(), (byte) 5, restoreTime); } - + if (_powerupTarget.getY() < _powerupCurrent.getY()) { - _powerupCurrent.add(0, -2, 0); - UtilFirework.playFirework(_powerupCurrent, Type.BURST, Color.RED, false, true); + _powerupCurrent.subtract(0, 2, 0); + UtilFirework.playFirework(_powerupCurrent, Type.BURST, Color.LIME, false, true); } else { CreatureAllowOverride = true; _powerup = _powerupTarget.getWorld().spawn(_powerupTarget, EnderCrystal.class); + _powerupHologram = new Hologram(Manager.getHologramManager(), _powerupTarget.add(0, 2, 0), true, "SMASH CRYSTAL").start(); CreatureAllowOverride = false; - - _powerupTarget.getBlock().getRelative(BlockFace.DOWN).setType(Material.GLASS); - + + UtilFirework.playFirework(_powerupTarget, Type.BURST, Color.YELLOW, false, true); + _powerupTarget = null; _powerupCurrent = null; - - // Restore Blocks - for (BlockData block : _restoreBlock) - block.restore(true); - _restoreBlock.clear(); } } } @@ -295,15 +364,21 @@ public abstract class SuperSmash extends Game @EventHandler public void powerupPickup(UpdateEvent event) { - if (event.getType() != UpdateType.TICK) + if (event.getType() != UpdateType.FASTEST) + { return; - + } + if (!IsLive()) + { return; - + } + if (_powerup == null) + { return; - + } + Player best = null; double bestDist = 0; @@ -317,8 +392,10 @@ public abstract class SuperSmash extends Game double dist = UtilMath.offset(player, _powerup); if (dist > 2) + { continue; - + } + if (best == null || dist < bestDist) { best = player; @@ -328,6 +405,9 @@ public abstract class SuperSmash extends Game if (best != null) { + _powerupHologram.stop(); + _powerupHologram = null; + _powerup.remove(); _powerup = null; @@ -346,52 +426,72 @@ public abstract class SuperSmash extends Game public void powerupDamage(EntityDamageEvent event) { if (_powerup != null && _powerup.equals(event.getEntity())) + { event.setCancelled(true); + } } @EventHandler(priority = EventPriority.LOWEST) - public void FallDamage(CustomDamageEvent event) + public void fallDamage(CustomDamageEvent event) { if (event.IsCancelled()) + { return; - + } + if (event.GetCause() == DamageCause.FALL) + { event.SetCancelled("No Fall Damage"); + } } @EventHandler(priority = EventPriority.HIGH) - public void Knockback(CustomDamageEvent event) + public void knockback(CustomDamageEvent event) { if (event.IsCancelled()) + { return; - + } + if (event.GetDamageePlayer() != null) - event.AddKnockback("Smash Knockback", 1 + 0.1 * (20 - event.GetDamageePlayer().getHealth())); + { + Player player = event.GetDamageePlayer(); + + event.AddKnockback("Smash Knockback", 1 + 0.1 * (player.getMaxHealth() - player.getHealth())); + } } @EventHandler(priority = EventPriority.HIGH) - public void ArenaWalls(CustomDamageEvent event) + public void arenaBoundry(CustomDamageEvent event) { if (event.IsCancelled()) + { return; - + } + if (event.GetCause() == DamageCause.VOID || event.GetCause() == DamageCause.LAVA) { - event.GetDamageeEntity().eject(); - event.GetDamageeEntity().leaveVehicle(); + LivingEntity entity = event.GetDamageeEntity(); + + entity.eject(); + entity.leaveVehicle(); if (event.GetDamageePlayer() != null) - event.GetDamageeEntity().getWorld().strikeLightningEffect(event.GetDamageeEntity().getLocation()); - + { + entity.getWorld().strikeLightningEffect(entity.getLocation()); + } + event.AddMod("Smash", "Super Smash Mobs", 5000, false); } } @EventHandler - public void HealthChange(EntityRegainHealthEvent event) + public void healthRegen(EntityRegainHealthEvent event) { if (event.getRegainReason() == RegainReason.SATIATED) + { event.setCancelled(true); + } } @EventHandler(priority = EventPriority.MONITOR) @@ -427,31 +527,48 @@ public abstract class SuperSmash extends Game } @EventHandler(priority = EventPriority.LOWEST) - public void AbilityDescription(PlayerInteractEvent event) + public void abilityDescription(PlayerInteractEvent event) { if (event.isCancelled()) + { return; - + } + Player player = event.getPlayer(); - - if (player.getItemInHand() == null) + ItemStack itemStack = player.getItemInHand(); + + if (itemStack == null) + { return; - - if (player.getItemInHand().getItemMeta() == null) + } + + if (itemStack.getItemMeta() == null) + { return; - - if (player.getItemInHand().getItemMeta().getDisplayName() == null) + } + + ItemMeta itemMeta = itemStack.getItemMeta(); + + if (itemMeta.getDisplayName() == null) + { return; - - if (player.getItemInHand().getItemMeta().getLore() == null) + } + + if (itemMeta.getLore() == null) + { return; - - if (Manager.GetGame() == null || Manager.GetGame().GetState() != GameState.Recruit) + } + + if (GetState() != GameState.Recruit) + { return; - + } + for (int i = player.getItemInHand().getItemMeta().getLore().size(); i <= 7; i++) - UtilPlayer.message(player, " "); - + { + UtilPlayer.message(player, ""); + } + UtilPlayer.message(player, ArcadeFormat.Line); UtilPlayer.message(player, "§aAbility - §f§l" + player.getItemInHand().getItemMeta().getDisplayName()); @@ -476,7 +593,7 @@ public abstract class SuperSmash extends Game } @EventHandler - public void BlockFade(BlockFadeEvent event) + public void blockFade(BlockFadeEvent event) { event.setCancelled(true); } @@ -484,14 +601,18 @@ public abstract class SuperSmash extends Game private int hungerTick = 0; @EventHandler - public void Hunger(UpdateEvent event) + public void hunger(UpdateEvent event) { if (event.getType() != UpdateType.SEC) + { return; - + } + if (!IsLive()) + { return; - + } + hungerTick = (hungerTick + 1) % 10; for (Player player : GetPlayers(true)) @@ -507,33 +628,55 @@ public abstract class SuperSmash extends Game } if (hungerTick == 0) + { UtilPlayer.hunger(player, -1); + } } } @EventHandler(priority = EventPriority.MONITOR) - public void HungerRestore(CustomDamageEvent event) + public void hungerRestore(CustomDamageEvent event) { if (event.IsCancelled()) + { return; - + } + Player damager = event.GetDamagerPlayer(true); + if (damager == null) + { return; - + } + if (damager.equals(event.GetDamageeEntity())) + { return; - + } + if (!(event.GetDamageeEntity() instanceof Player)) + { return; - - if (!Recharge.Instance.use(damager, "Hunger Restore", 250, false, false)) + } + + if (!Recharge.Instance.use(damager, "Hunger Restore", HUNGER_DELAY, false, false)) + { return; - + } + int amount = Math.max(1, (int) (event.GetDamage() / 2)); UtilPlayer.hunger(damager, amount); } + @EventHandler + public void itemSpawn(ItemSpawnEvent event) + { + if (REMOVE_ON_ITEM_SPAWN.contains(event.getEntity().getItemStack().getType())) + { + event.setCancelled(true); + } + } + public long getNewSmashTime() { return (long) (System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(3) + TimeUnit.MINUTES.toMillis(5) * Math.random()); @@ -622,7 +765,7 @@ public abstract class SuperSmash extends Game { event.setCancelled(true); - _lives.put(player, 4); + _lives.put(player, MAX_LIVES); Announce(C.cWhiteB + player.getName() + C.cAquaB + " reset their lives!"); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java index 102ccd267..d86ad4429 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java @@ -6,13 +6,19 @@ import java.util.List; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.scheduler.BukkitRunnable; +import mineplex.core.common.Pair; import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.modules.TeamModule; import nautilus.game.arcade.managers.chat.ChatStatData; @@ -56,52 +62,95 @@ public class TeamSuperSmash extends SuperSmash if (event.getType() != UpdateType.FAST) return; - ArrayList alive = new ArrayList(); + //Wipe Last + Scoreboard.reset(); + + List aliveTeams = new ArrayList<>(); + for (GameTeam team : GetTeamList()) { - if (team.IsTeamAlive()) - alive.add(team); - } - - // Wipe Last - Scoreboard.reset(); - Scoreboard.writeNewLine(); - - if (GetPlayers(true).size() < 16) - { - - for (GameTeam team : GetTeamList()) + if (team.GetPlayers(true).isEmpty()) { - for (Player player : team.GetPlayers(true)) - { - int lives = getLives(player); - - Scoreboard.write(C.cWhite + lives + " " + team.GetColor() + player.getName()); - } + continue; } + + aliveTeams.add(team); } - else if (alive.size() < 16) + + if (aliveTeams.size() > 7) { - for (GameTeam team : alive) - { - int lives = 0; - - for (Player player : team.GetPlayers(true)) - { - lives += getLives(player); - } - - Scoreboard.write(C.cWhite + lives + " " + team.GetColor() + team.GetName()); - } + Scoreboard.writeNewLine(); + Scoreboard.write(C.cYellowB + "Teams Alive"); + Scoreboard.write(aliveTeams.size() + " "); } else { - Scoreboard.write(C.cYellow + C.Bold + "Teams Alive"); - Scoreboard.write(C.cWhite + alive.size()); + Scoreboard.writeNewLine(); + + for (GameTeam team : GetTeamList()) + { + Scoreboard.writeGroup(team.GetPlayers(true), player -> + { + int lives = getLives(player); + + return Pair.create(team.GetColor() + player.getName(), lives); + }, true); + } } Scoreboard.draw(); } + + @EventHandler + public void gameStart(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Prepare) + { + return; + } + + new BukkitRunnable() + { + + @Override + public void run() + { + for (Player player : GetPlayers(true)) + { + if (UtilPlayer.isSpectator(player)) + { + continue; + } + + GameTeam team = GetTeam(player); + Player bestTeamMember = null; + + if (team == null) + { + continue; + } + + for (Player teamMember : team.GetPlayers(true)) + { + if (player.equals(teamMember)) + { + continue; + } + + bestTeamMember = teamMember; + } + + if (bestTeamMember == null) + { + UtilTextMiddle.display(C.cRedB + "No one", "You don\'t have a teamamte :(", 10, 50, 10); + return; + } + + UtilTextMiddle.display(team.GetColor() + bestTeamMember.getName(), "Is your teammate", 10, 50, 10); + } + } + }.runTaskLater(Manager.getPlugin(), 40); + } @EventHandler public void onCustomDamage(CustomDamageEvent event) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java index 0e4471cdb..e21263ed3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java @@ -87,7 +87,7 @@ public class KitGuardian extends SmashKit public KitGuardian(ArcadeManager manager) { - super(manager, "Guardian", KitAvailability.Free, PERKS, EntityType.GUARDIAN, IN_HAND, DisguiseGuardian.class); + super(manager, "Guardian", KitAvailability.Gem, 8000, PERKS, EntityType.GUARDIAN, IN_HAND, DisguiseGuardian.class); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java index 438cd0f9c..3836b1640 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java @@ -4,12 +4,16 @@ import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseMagmaCube; import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; @@ -99,4 +103,29 @@ public class KitMagmaCube extends SmashKit player.getInventory().setArmorContents(PLAYER_ARMOR);; } + + @EventHandler + public void FireItemResist(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + { + return; + } + + if (Manager.GetGame() == null) + { + return; + } + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!HasKit(player)) + { + continue; + } + + Manager.GetCondition().Factory().FireItemImmunity(GetName(), player, player, 1.9, false); + } + } + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java index 656144692..67cac165b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java @@ -10,16 +10,17 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseSpider; import mineplex.core.itemstack.ItemStackFactory; + import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; import nautilus.game.arcade.game.games.smash.perks.SmashKit; import nautilus.game.arcade.game.games.smash.perks.spider.PerkNeedler; +import nautilus.game.arcade.game.games.smash.perks.spider.PerkSpiderLeap; import nautilus.game.arcade.game.games.smash.perks.spider.PerkWebShot; import nautilus.game.arcade.game.games.smash.perks.spider.SmashSpider; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkSpiderLeap; public class KitSpider extends SmashKit { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java index 89597d808..0de6382fa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java @@ -14,6 +14,7 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.smash.perks.PerkSmashStats; import nautilus.game.arcade.game.games.smash.perks.SmashKit; +import nautilus.game.arcade.game.games.smash.perks.wolf.PerkWolf; import nautilus.game.arcade.game.games.smash.perks.wolf.SmashWolf; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; @@ -25,6 +26,7 @@ public class KitWolf extends SmashKit private static final Perk[] PERKS = { new PerkSmashStats(5, 1.6, 0.25, 5), new PerkDoubleJump("Wolf Jump", 1.0, 1.0, true), + new PerkWolf(), new SmashWolf() }; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/modes/RandomKitSSM.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/modes/RandomKitSSM.java index 1e570cc22..c47040297 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/modes/RandomKitSSM.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/modes/RandomKitSSM.java @@ -18,6 +18,7 @@ import nautilus.game.arcade.game.games.smash.kits.KitCow; import nautilus.game.arcade.game.games.smash.kits.KitCreeper; import nautilus.game.arcade.game.games.smash.kits.KitEnderman; import nautilus.game.arcade.game.games.smash.kits.KitGolem; +import nautilus.game.arcade.game.games.smash.kits.KitGuardian; import nautilus.game.arcade.game.games.smash.kits.KitMagmaCube; import nautilus.game.arcade.game.games.smash.kits.KitPig; import nautilus.game.arcade.game.games.smash.kits.KitSheep; @@ -60,13 +61,10 @@ public class RandomKitSSM extends SoloSuperSmash new KitGolem(manager), new KitSpider(manager), new KitSlime(manager), - new KitCreeper(manager), new KitEnderman(manager), new KitSnowman(manager), new KitWolf(manager), - - new KitBlaze(manager), new KitWitch(manager), new KitChicken(manager), @@ -77,17 +75,17 @@ public class RandomKitSSM extends SoloSuperSmash new KitMagmaCube(manager), new KitZombie(manager), new KitCow(manager), - - new KitSheep(manager) + new KitSheep(manager), + new KitGuardian(manager) }; } @Override @EventHandler(priority = EventPriority.HIGH) - public void onGameStateChange(GameStateChangeEvent event) + public void gameStart(GameStateChangeEvent event) { - super.onGameStateChange(event); + super.gameStart(event); if (event.GetState() != GameState.Prepare) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashUltimate.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashUltimate.java index eb76419eb..6bd2aa444 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashUltimate.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashUltimate.java @@ -66,6 +66,11 @@ public class SmashUltimate extends Perk Kit.GiveItems(player); } + public boolean isUsable(Player player) + { + return true; + } + @EventHandler public void onUpdate(UpdateEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java index b39d9ff3b..5f182f534 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java @@ -149,6 +149,11 @@ public class PerkWaterSplash extends Perk for (Block block : UtilBlock.getInRadius(player.getLocation(), RADIUS).keySet()) { + if (Math.random() > 0.5) + { + continue; + } + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType()); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashAnimationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashAnimationData.java index 6a4de9246..1a243a989 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashAnimationData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashAnimationData.java @@ -113,10 +113,7 @@ public class SmashAnimationData blockRestore.add(block, Material.PRISMARINE.getId(), (byte) random.nextInt(3), (long) (_duration + 5000 * Math.random())); } - } - - if (_ticks % 12 == 0) - { + for (Player player : UtilPlayer.getNearby(_target.getLocation(), DAMAGE_RADIUS)) { if (player.equals(_player)) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashGuardian.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashGuardian.java index 1e312ddf7..920ba62e4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashGuardian.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashGuardian.java @@ -11,6 +11,8 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; @@ -87,6 +89,19 @@ public class SmashGuardian extends SmashUltimate } } } + + @Override + public boolean isUsable(Player player) + { + boolean grounded = UtilEnt.isGrounded(player); + + if (!grounded) + { + player.sendMessage(F.main("Game", "You need to be on the ground to use " + F.skill(GetName()) + ".")); + } + + return grounded; + } @EventHandler public void update(UpdateEvent event) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkLazer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkLazer.java index 1ff82cc2d..afec5a96c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkLazer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkLazer.java @@ -118,6 +118,7 @@ public class PerkLazer extends Perk if (player == null) { playerIterator.remove(); + continue; } if (player.isBlocking()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java index 161bc9446..dc62b516e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/PerkSpiderLeap.java @@ -4,10 +4,8 @@ import java.util.HashSet; import java.util.Set; import java.util.UUID; -import org.bukkit.GameMode; import org.bukkit.Sound; import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerToggleFlightEvent; @@ -22,21 +20,22 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; + import nautilus.game.arcade.kit.Perk; public class PerkSpiderLeap extends Perk { - - private static final float ENERGY_PER_TICK = 1 / 80; - private static final float ENERGY_PER_LEAP = 1 / 6; + + private static final float ENERGY_PER_TICK = 0.005F; + private static final float ENERGY_PER_LEAP = 0.17F; private Set _secondJump = new HashSet<>(); + private Set _finalJump = new HashSet<>(); public PerkSpiderLeap() { super("Spider Leap", new String[] { C.cYellow + "Tap Jump Twice" + C.cGray + " to " + C.cGreen + "Spider Leap", C.cYellow + "Hold Crouch" + C.cGray + " to " + C.cGreen + "Wall Climb", C.cWhite - + "Wall Climb requires Energy (Experience Bar)." - }); + + "Wall Climb requires Energy (Experience Bar)." }); } @EventHandler @@ -46,41 +45,45 @@ public class PerkSpiderLeap extends Perk { return; } - + for (Player player : UtilServer.getPlayers()) { - if (UtilPlayer.isSpectator(player)) + if (UtilPlayer.isSpectator(player) || !hasPerk(player)) { continue; } - - if (!hasPerk(player)) - { - continue; - } - - if (!player.isSneaking()) - { - if (UtilEnt.isGrounded(player)) - { - player.setExp((float) Math.min(0.999, player.getExp() + ENERGY_PER_TICK)); - _secondJump.remove(player.getUniqueId()); - continue; - } - } - player.setExp((float) Math.max(0, player.getExp() - ENERGY_PER_TICK)); + if (!player.isSneaking()) + { + boolean grounded = UtilEnt.isGrounded(player); + + if (grounded) + { + _secondJump.remove(player.getUniqueId()); + } + + player.setExp(Math.min(0.999F, player.getExp() + (grounded ? ENERGY_PER_TICK * 2 : ENERGY_PER_TICK))); + + continue; + } + + player.setExp(Math.max(0, player.getExp() - ENERGY_PER_TICK)); if (player.getExp() <= 0) { continue; } - + + if (player.getExp() >= ENERGY_PER_LEAP) + { + _finalJump.remove(player.getUniqueId()); + } + if (!Recharge.Instance.usable(player, GetName())) { continue; } - + for (Block block : UtilBlock.getSurrounding(player.getLocation().getBlock(), true)) { if (!UtilBlock.airFoliage(block) && !block.isLiquid()) @@ -92,8 +95,6 @@ public class PerkSpiderLeap extends Perk player.setAllowFlight(true); _secondJump.add(player.getUniqueId()); } - - continue; } } } @@ -104,21 +105,11 @@ public class PerkSpiderLeap extends Perk { Player player = event.getPlayer(); - if (!hasPerk(player)) + if (UtilPlayer.isSpectator(player) || !hasPerk(player)) { return; } - - if (UtilPlayer.isSpectator(player)) - { - return; - } - - if (player.getGameMode() == GameMode.CREATIVE) - { - return; - } - + event.setCancelled(true); player.setFlying(false); @@ -127,9 +118,16 @@ public class PerkSpiderLeap extends Perk if (player.getExp() < ENERGY_PER_LEAP) { - return; + if (!_finalJump.contains(player.getUniqueId())) + { + _finalJump.add(player.getUniqueId()); + } + else + { + return; + } } - + // Velocity UtilAction.velocity(player, 1.0, 0.2, 1.0, true); @@ -146,21 +144,18 @@ public class PerkSpiderLeap extends Perk public void FlightUpdate(UpdateEvent event) { if (event.getType() != UpdateType.TICK) + { return; + } for (Player player : UtilServer.getPlayers()) { - if (UtilPlayer.isSpectator(player)) + if (UtilPlayer.isSpectator(player) || !hasPerk(player)) { continue; } - - if (!hasPerk(player)) - { - continue; - } - - if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) + + if (UtilEnt.isGrounded(player)) { player.setAllowFlight(true); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java index 5b5297bc6..71833fcb6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java @@ -140,7 +140,7 @@ public class SmashSpider extends SmashUltimate } damager.setMaxHealth(Math.min(30, damager.getMaxHealth() + diff)); - damager.setHealth(damager.getHealth() + diff); + damager.setHealth(Math.min(damagee.getMaxHealth(), damager.getHealth() + diff)); UtilParticle.PlayParticle(ParticleType.HEART, damager.getLocation().add(0, 1, 0), 0, 0, 0, 0, 1, ViewDist.LONG, UtilServer.getPlayers()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java index 8f54c49a8..6433024c5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkBatWave.java @@ -8,7 +8,6 @@ import java.util.Map; import java.util.Set; import java.util.UUID; -import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Sound; import org.bukkit.entity.Bat; @@ -40,6 +39,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkBatWave extends SmashPerk @@ -69,25 +69,6 @@ public class PerkBatWave extends SmashPerk + C.cGreen + "Bat Leash" }); } - @EventHandler - public void Deactivate(CustomDamageEvent event) - { - Player player = event.GetDamageePlayer(); - - if (player == null) - { - return; - } - - if (_pulling.remove(player.getUniqueId())) - { - for (Bat bat : _bats.get(player.getUniqueId())) - { - bat.setLeashHolder(null); - } - } - } - @EventHandler public void Activate(PlayerInteractEvent event) { @@ -314,13 +295,12 @@ public class PerkBatWave extends SmashPerk _damageTaken.putIfAbsent(key, 0D); - if (hasPerk(player) && _damageTaken.containsKey(key)) + if (hasPerk(player) && _damageTaken.containsKey(key) && _pulling.contains(key)) { _damageTaken.put(key, (_damageTaken.get(key) + event.GetDamage())); if (_damageTaken.get(key) >= DISABLE_DAMAGE) { - Bukkit.broadcastMessage("cleared!!! " + _damageTaken.get(key)); Clear(player); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java index 133bc6dc5..57ebb1a7f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java @@ -99,7 +99,7 @@ public class PerkWitchPotion extends SmashPerk implements IThrown _proj.add(potion); - Manager.GetProjectile().AddThrow(potion, player, this, 10000, true, true, true, false, false, 1); + Manager.GetProjectile().AddThrow(potion, player, this, 10000, true, true, true, false, false, 0.5F); // Inform UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); @@ -158,7 +158,7 @@ public class PerkWitchPotion extends SmashPerk implements IThrown continue; } - double d = UtilMath.offset(player.getLocation().add(0, 1, 0), target.getLocation()); + double d = UtilMath.offset(player.getLocation().add(0, 1, 0), data.getThrown().getLocation()); if (d > (isSuperActive(thrower) ? RANGE_SMASH : RANGE_NOMRAL)) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/PerkWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/PerkWolf.java new file mode 100644 index 000000000..eeab53826 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/PerkWolf.java @@ -0,0 +1,527 @@ +package nautilus.game.arcade.game.games.smash.perks.wolf; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Wolf; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; + +import nautilus.game.arcade.game.games.smash.perks.SmashPerk; + +public class PerkWolf extends SmashPerk +{ + + private static final int TACKLE_COOLDOWN_NORMAL = 8000; + private static final int TACKLE_COOLDOWN_SMASH = 1600; + private static final int WOLF_HEALTH = 30; + private static final float WOLF_HIT_BOX = 2.5F; + private static final int WOLF_MAX_TICKS = 70; + private static final int TACKLE_DAMAGE = 5; + private static final int STRIKE_DAMAGE = 7; + + private static final String CUB_TACKLE = "Cub Tackle"; + private static final String WOLF_STRIKE = "Wolf Strike"; + + private Map _owner = new HashMap<>(); + private Map _tackle = new HashMap<>(); + + private Map _strike = new HashMap<>(); + + private Map> _repeat = new HashMap<>(); + + private Map _tacklestrike = new HashMap<>(); + + public PerkWolf() + { + super("Wolf", new String[] { C.cGray + "Attacks give +1 Damage for 3 seconds. Stacks.", C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + CUB_TACKLE, C.cYellow + + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + WOLF_STRIKE, C.cGray + "Wolf Strike deals 300% Knockback to tackled opponents.", }); + } + + @EventHandler + public void tackleTrigger(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isAxe(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + boolean smash = isSuperActive(player); + + if (!Recharge.Instance.use(player, CUB_TACKLE, smash ? TACKLE_COOLDOWN_SMASH : TACKLE_COOLDOWN_NORMAL, !smash, !smash)) + { + return; + } + + // Get Nearest Wolf + Manager.GetGame().CreatureAllowOverride = true; + Wolf wolf = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Wolf.class); + Manager.GetGame().CreatureAllowOverride = false; + + wolf.setBaby(); + + wolf.setAngry(true); + + UtilEnt.Vegetate(wolf); + + wolf.setMaxHealth(WOLF_HEALTH); + wolf.setHealth(wolf.getMaxHealth()); + + UtilAction.velocity(wolf, player.getLocation().getDirection(), 1.8, false, 0, 0.2, 1.2, true); + + player.getWorld().playSound(wolf.getLocation(), Sound.WOLF_BARK, 1f, 1.8f); + + // Record + _owner.put(wolf, player.getUniqueId()); + + // Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(CUB_TACKLE) + ".")); + } + + @EventHandler + public void tackleCollide(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + // Collide + Iterator wolfIterator = _owner.keySet().iterator(); + + while (wolfIterator.hasNext()) + { + Wolf wolf = wolfIterator.next(); + + // Hit Player + for (Player other : Manager.GetGame().GetPlayers(true)) + { + if (Manager.isSpectator(other)) + { + continue; + } + + if (UtilEnt.hitBox(wolf.getLocation(), other, WOLF_HIT_BOX, null)) + { + if (other.equals(tackleGetOwner(wolf))) + { + continue; + + } + + tackleCollideAction(tackleGetOwner(wolf), other, wolf); + wolfIterator.remove(); + return; + } + + if (!wolf.isValid() || (UtilEnt.isGrounded(wolf) && wolf.getTicksLived() > WOLF_MAX_TICKS)) + { + wolf.remove(); + wolfIterator.remove(); + } + } + } + } + + public void tackleCollideAction(Player damager, LivingEntity damagee, Wolf wolf) + { + if (damager == null) + { + return; + } + + if (damagee instanceof Player) + { + if (isTeamDamage(damager, (Player) damagee)) + { + return; + } + } + + _tackle.put(wolf, damagee); + + wolf.setVelocity(new Vector(0, -0.6, 0)); + UtilAction.zeroVelocity(damagee); + + // Damage + Manager.GetDamage().NewDamageEvent(damagee, damager, null, DamageCause.CUSTOM, TACKLE_DAMAGE, false, true, false, damager.getName(), CUB_TACKLE); + + // Sound + damagee.getWorld().playSound(damagee.getLocation(), Sound.WOLF_GROWL, 1.5f, 1.5f); + + // Inform + UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(CUB_TACKLE) + ".")); + UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill(CUB_TACKLE) + ".")); + } + + @EventHandler + public void tackleUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + Iterator wolfIterator = _tackle.keySet().iterator(); + + while (wolfIterator.hasNext()) + { + Wolf wolf = wolfIterator.next(); + LivingEntity ent = _tackle.get(wolf); + + if (!wolf.isValid() || !ent.isValid() || wolf.getTicksLived() > WOLF_MAX_TICKS) + { + wolf.remove(); + wolfIterator.remove(); + continue; + } + + if (UtilMath.offset(wolf, ent) < WOLF_HIT_BOX) + { + Manager.GetCondition().Factory().Slow(CUB_TACKLE, ent, wolf, 0.9, 1, false, false, false, false); + UtilAction.velocity(ent, new Vector(0, -0.3, 0)); + } + + // Move + Location loc = ent.getLocation(); + loc.add(UtilAlg.getTrajectory2d(ent, wolf).multiply(1)); + + UtilEnt.CreatureMove(wolf, loc, 1); + } + } + + public Player tackleGetOwner(Wolf wolf) + { + if (_owner.containsKey(wolf)) + { + return UtilPlayer.searchExact(_owner.get(wolf)); + } + + return null; + } + + @EventHandler + public void tackleTargetCancel(EntityTargetEvent event) + { + if (_owner.containsKey(event.getEntity())) + { + if (_owner.get(event.getEntity()).equals(event.getTarget())) + { + event.setCancelled(true); + } + } + } + + @EventHandler + public void tackleDamage(CustomDamageEvent event) + { + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + { + return; + } + + LivingEntity damager = event.GetDamagerEntity(false); + + if (damager == null) + { + return; + } + + if (damager instanceof Wolf) + { + event.SetCancelled("Wolf Cub"); + } + } + + @EventHandler + public void strikeTrigger(PlayerInteractEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (UtilBlock.usable(event.getClickedBlock())) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilItem.isSpade(player.getItemInHand())) + { + return; + } + + if (!hasPerk(player)) + { + return; + } + + boolean smash = isSuperActive(player); + + if (!Recharge.Instance.use(player, WOLF_STRIKE, smash ? 1600 : 8000, !smash, !smash)) + { + return; + } + + // Velocity + UtilAction.velocity(player, player.getLocation().getDirection(), 1.6, false, 1, 0.2, 1.2, true); + + // Record + _strike.put(player.getUniqueId(), System.currentTimeMillis()); + + player.getWorld().playSound(player.getLocation(), Sound.WOLF_BARK, 1f, 1.2f); + + // Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(WOLF_STRIKE) + ".")); + } + + @EventHandler + public void strikeEnd(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + // Collide + Iterator playerIterator = _strike.keySet().iterator(); + + while (playerIterator.hasNext()) + { + UUID uuid = playerIterator.next(); + Player player = UtilPlayer.searchExact(uuid); + + if (player == null) + { + playerIterator.remove(); + continue; + } + + for (Player other : Manager.GetGame().GetPlayers(true)) + { + if (player.equals(other)) + { + continue; + } + + if (Manager.isSpectator(other)) + { + continue; + } + + if (UtilEnt.hitBox(player.getLocation().add(0, 1, 0), other, WOLF_HIT_BOX, null)) + { + strikeHit(player, other); + playerIterator.remove(); + return; + } + } + + if (!UtilEnt.isGrounded(player)) + { + continue; + } + + if (!UtilTime.elapsed(_strike.get(uuid), 1500)) + { + continue; + } + + playerIterator.remove(); + } + } + + public void strikeHit(Player damager, LivingEntity damagee) + { + UtilAction.zeroVelocity(damager); + + // Remove tackle + Iterator wolfIterator = _tackle.keySet().iterator(); + + while (wolfIterator.hasNext()) + { + Wolf wolf = wolfIterator.next(); + + if (_tackle.get(wolf).equals(damagee)) + { + wolf.remove(); + wolfIterator.remove(); + + _tacklestrike.put(damagee, System.currentTimeMillis()); + } + } + + Manager.GetDamage().NewDamageEvent(damagee, damager, null, DamageCause.CUSTOM, STRIKE_DAMAGE, true, true, false, damager.getName(), WOLF_STRIKE); + + // Sound + damagee.getWorld().playSound(damagee.getLocation(), Sound.WOLF_BARK, 1.5f, 1f); + + // Inform + UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(WOLF_STRIKE) + ".")); + UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill(WOLF_STRIKE) + ".")); + } + + @EventHandler + public void strikeKnockback(CustomDamageEvent event) + { + if (event.GetReason() != null && event.GetReason().contains(WOLF_STRIKE)) + { + if (_tacklestrike.containsKey(event.GetDamageeEntity()) && !UtilTime.elapsed(_tacklestrike.get(event.GetDamageeEntity()), 100)) + { + event.AddKnockback(GetName(), 3.0); + + // Blood + event.GetDamageeEntity().getWorld().playEffect(event.GetDamageeEntity().getLocation(), Effect.STEP_SOUND, 55); + + // Double Sound + event.GetDamageeEntity().getWorld().playSound(event.GetDamageeEntity().getLocation(), Sound.WOLF_BARK, 2f, 1.5f); + } + else + { + event.AddKnockback(GetName(), 1.5); + } + } + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void RepeatDamage(CustomDamageEvent event) + { + if (event.IsCancelled()) + { + return; + } + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + { + return; + } + + Player damager = event.GetDamagerPlayer(false); + + if (damager == null) + { + return; + } + + if (!hasPerk(damager)) + { + return; + } + + if (!_repeat.containsKey(damager.getUniqueId())) + { + _repeat.put(damager.getUniqueId(), new ArrayList()); + _repeat.get(damager.getUniqueId()).add(System.currentTimeMillis()); + + // Exp + damager.setExp(Math.min(0.99F, _repeat.get(damager.getUniqueId()).size() / 9f)); + + return; + } + + int count = _repeat.get(damager.getUniqueId()).size(); + + if (count > 0) + { + event.AddMod(damager.getName(), "Ravage", Math.min(2, count), false); + + // Sound + damager.getWorld().playSound(damager.getLocation(), Sound.WOLF_BARK, (float) (0.5 + count * 0.25), (float) (1 + count * 0.25)); + } + + _repeat.get(damager.getUniqueId()).add(System.currentTimeMillis()); + + // Exp + damager.setExp(Math.min(0.9999f, _repeat.get(damager.getUniqueId()).size() / 9f)); + } + + @EventHandler + public void RepeatExpire(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + Iterator playerIterator = _repeat.keySet().iterator(); + + while (playerIterator.hasNext()) + { + UUID uuid = playerIterator.next(); + Player player = UtilPlayer.searchExact(uuid); + + Iterator timeIterator = _repeat.get(uuid).iterator(); + + while (timeIterator.hasNext()) + { + long time = timeIterator.next(); + + if (UtilTime.elapsed(time, 3000)) + { + timeIterator.remove(); + } + } + + // Exp + player.setExp(Math.min(0.9999f, _repeat.get(player).size() / 9f)); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/SmashWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/SmashWolf.java index 20fda8f14..eee6b9ca7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/SmashWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/SmashWolf.java @@ -1,525 +1,25 @@ package nautilus.game.arcade.game.games.smash.perks.wolf; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.UUID; - -import org.bukkit.Effect; -import org.bukkit.Location; import org.bukkit.Sound; -import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; -import org.bukkit.entity.Wolf; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.entity.EntityTargetEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.util.Vector; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilItem; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilTime; import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseWolf; import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.condition.ConditionFactory; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashWolf extends SmashUltimate { private static final int DURATION = 30000; - private static final int TACKLE_COOLDOWN_NORMAL = 8000; - private static final int TACKLE_COOLDOWN_SMASH = 1600; - private static final int WOLF_HEALTH = 30; - private static final float WOLF_HIT_BOX = 2.5F; - private static final int WOLF_MAX_TICKS = 70; - private static final int TACKLE_DAMAGE = 5; - private static final int STRIKE_DAMAGE = 7; - - private static final String CUB_TACKLE = "Cub Tackle"; - private static final String WOLF_STRIKE = "Wolf Strike"; - - private Map _owner = new HashMap<>(); - private Map _tackle = new HashMap<>(); - - private Map _strike = new HashMap<>(); - - private Map> _repeat = new HashMap<>(); - - private Map _tacklestrike = new HashMap<>(); - + public SmashWolf() { - super("Frenzy", new String[] { C.cGray + "Attacks give +1 Damage for 3 seconds. Stacks.", C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + CUB_TACKLE, C.cYellow - + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + WOLF_STRIKE, C.cGray + "Wolf Strike deals 300% Knockback to tackled opponents.", }, Sound.WOLF_HOWL, DURATION); + super("Frenzy", new String[] {}, Sound.WOLF_HOWL, DURATION); } - - @EventHandler - public void tackleTrigger(PlayerInteractEvent event) - { - if (event.isCancelled()) - { - return; - } - - if (!UtilEvent.isAction(event, ActionType.R)) - { - return; - } - - if (UtilBlock.usable(event.getClickedBlock())) - { - return; - } - - Player player = event.getPlayer(); - - if (!UtilItem.isAxe(player.getItemInHand())) - { - return; - } - - if (!hasPerk(player)) - { - return; - } - - boolean smash = isUsingUltimate(player); - - if (!Recharge.Instance.use(player, CUB_TACKLE, smash ? TACKLE_COOLDOWN_SMASH : TACKLE_COOLDOWN_NORMAL, !smash, !smash)) - { - return; - } - - // Get Nearest Wolf - Manager.GetGame().CreatureAllowOverride = true; - Wolf wolf = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Wolf.class); - Manager.GetGame().CreatureAllowOverride = false; - - wolf.setBaby(); - - wolf.setAngry(true); - - UtilEnt.Vegetate(wolf); - - wolf.setMaxHealth(WOLF_HEALTH); - wolf.setHealth(wolf.getMaxHealth()); - - UtilAction.velocity(wolf, player.getLocation().getDirection(), 1.8, false, 0, 0.2, 1.2, true); - - player.getWorld().playSound(wolf.getLocation(), Sound.WOLF_BARK, 1f, 1.8f); - - // Record - _owner.put(wolf, player.getUniqueId()); - - // Inform - UtilPlayer.message(player, F.main("Game", "You used " + F.skill(CUB_TACKLE) + ".")); - } - - @EventHandler - public void tackleCollide(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - { - return; - } - - // Collide - Iterator wolfIterator = _owner.keySet().iterator(); - - while (wolfIterator.hasNext()) - { - Wolf wolf = wolfIterator.next(); - - // Hit Player - for (Player other : Manager.GetGame().GetPlayers(true)) - { - if (Manager.isSpectator(other)) - { - continue; - } - - if (UtilEnt.hitBox(wolf.getLocation(), other, WOLF_HIT_BOX, null)) - { - if (other.equals(tackleGetOwner(wolf))) - { - continue; - - } - - tackleCollideAction(tackleGetOwner(wolf), other, wolf); - wolfIterator.remove(); - return; - } - - if (!wolf.isValid() || (UtilEnt.isGrounded(wolf) && wolf.getTicksLived() > WOLF_MAX_TICKS)) - { - wolf.remove(); - wolfIterator.remove(); - } - } - } - } - - public void tackleCollideAction(Player damager, LivingEntity damagee, Wolf wolf) - { - if (damager == null) - { - return; - } - - _tackle.put(wolf, damagee); - - wolf.setVelocity(new Vector(0, -0.6, 0)); - UtilAction.zeroVelocity(damagee); - - // Damage - Manager.GetDamage().NewDamageEvent(damagee, damager, null, DamageCause.CUSTOM, TACKLE_DAMAGE, false, true, false, damager.getName(), CUB_TACKLE); - - // Sound - damagee.getWorld().playSound(damagee.getLocation(), Sound.WOLF_GROWL, 1.5f, 1.5f); - - // Inform - UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(CUB_TACKLE) + ".")); - UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill(CUB_TACKLE) + ".")); - } - - @EventHandler - public void tackleUpdate(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - { - return; - } - - Iterator wolfIterator = _tackle.keySet().iterator(); - - while (wolfIterator.hasNext()) - { - Wolf wolf = wolfIterator.next(); - LivingEntity ent = _tackle.get(wolf); - - if (!wolf.isValid() || !ent.isValid() || wolf.getTicksLived() > WOLF_MAX_TICKS) - { - wolf.remove(); - wolfIterator.remove(); - continue; - } - - if (UtilMath.offset(wolf, ent) < WOLF_HIT_BOX) - { - Manager.GetCondition().Factory().Slow(CUB_TACKLE, ent, wolf, 0.9, 1, false, false, false, false); - UtilAction.velocity(ent, new Vector(0, -0.3, 0)); - } - - // Move - Location loc = ent.getLocation(); - loc.add(UtilAlg.getTrajectory2d(ent, wolf).multiply(1)); - - UtilEnt.CreatureMove(wolf, loc, 1); - } - } - - public Player tackleGetOwner(Wolf wolf) - { - if (_owner.containsKey(wolf)) - { - return UtilPlayer.searchExact(_owner.get(wolf)); - } - - return null; - } - - @EventHandler - public void tackleTargetCancel(EntityTargetEvent event) - { - if (_owner.containsKey(event.getEntity())) - { - if (_owner.get(event.getEntity()).equals(event.getTarget())) - { - event.setCancelled(true); - } - } - } - - @EventHandler - public void tackleDamage(CustomDamageEvent event) - { - if (event.GetCause() != DamageCause.ENTITY_ATTACK) - { - return; - } - - LivingEntity damager = event.GetDamagerEntity(false); - - if (damager == null) - { - return; - } - - if (damager instanceof Wolf) - { - event.SetCancelled("Wolf Cub"); - } - } - - @EventHandler - public void strikeTrigger(PlayerInteractEvent event) - { - if (event.isCancelled()) - { - return; - } - - if (!UtilEvent.isAction(event, ActionType.R)) - { - return; - } - - if (UtilBlock.usable(event.getClickedBlock())) - { - return; - } - - Player player = event.getPlayer(); - - if (!UtilItem.isSpade(player.getItemInHand())) - { - return; - } - - if (!hasPerk(player)) - { - return; - } - - boolean smash = isUsingUltimate(player); - - if (!Recharge.Instance.use(player, WOLF_STRIKE, smash ? 1600 : 8000, !smash, !smash)) - { - return; - } - - // Velocity - UtilAction.velocity(player, player.getLocation().getDirection(), 1.6, false, 1, 0.2, 1.2, true); - - // Record - _strike.put(player.getUniqueId(), System.currentTimeMillis()); - - player.getWorld().playSound(player.getLocation(), Sound.WOLF_BARK, 1f, 1.2f); - - // Inform - UtilPlayer.message(player, F.main("Game", "You used " + F.skill(WOLF_STRIKE) + ".")); - } - - @EventHandler - public void strikeEnd(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - { - return; - } - - // Collide - Iterator playerIterator = _strike.keySet().iterator(); - - while (playerIterator.hasNext()) - { - UUID uuid = playerIterator.next(); - Player player = UtilPlayer.searchExact(uuid); - - if (player == null) - { - playerIterator.remove(); - continue; - } - - for (Player other : Manager.GetGame().GetPlayers(true)) - { - if (player.equals(other)) - { - continue; - } - - if (Manager.isSpectator(other)) - { - continue; - } - - if (UtilEnt.hitBox(player.getLocation().add(0, 1, 0), other, WOLF_HIT_BOX, null)) - { - strikeHit(player, other); - playerIterator.remove(); - return; - } - } - - if (!UtilEnt.isGrounded(player)) - { - continue; - } - - if (!UtilTime.elapsed(_strike.get(uuid), 1500)) - { - continue; - } - - playerIterator.remove(); - } - } - - public void strikeHit(Player damager, LivingEntity damagee) - { - UtilAction.zeroVelocity(damager); - - // Remove tackle - Iterator wolfIterator = _tackle.keySet().iterator(); - - while (wolfIterator.hasNext()) - { - Wolf wolf = wolfIterator.next(); - - if (_tackle.get(wolf).equals(damagee)) - { - wolf.remove(); - wolfIterator.remove(); - - _tacklestrike.put(damagee, System.currentTimeMillis()); - } - } - - Manager.GetDamage().NewDamageEvent(damagee, damager, null, DamageCause.CUSTOM, STRIKE_DAMAGE, true, true, false, damager.getName(), WOLF_STRIKE); - - // Sound - damagee.getWorld().playSound(damagee.getLocation(), Sound.WOLF_BARK, 1.5f, 1f); - - // Inform - UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(WOLF_STRIKE) + ".")); - UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill(WOLF_STRIKE) + ".")); - } - - @EventHandler - public void strikeKnockback(CustomDamageEvent event) - { - if (event.GetReason() != null && event.GetReason().contains(WOLF_STRIKE)) - { - if (_tacklestrike.containsKey(event.GetDamageeEntity()) && !UtilTime.elapsed(_tacklestrike.get(event.GetDamageeEntity()), 100)) - { - event.AddKnockback(GetName(), 3.0); - - // Blood - event.GetDamageeEntity().getWorld().playEffect(event.GetDamageeEntity().getLocation(), Effect.STEP_SOUND, 55); - - // Double Sound - event.GetDamageeEntity().getWorld().playSound(event.GetDamageeEntity().getLocation(), Sound.WOLF_BARK, 2f, 1.5f); - } - else - { - event.AddKnockback(GetName(), 1.5); - } - } - } - - @EventHandler(priority = EventPriority.HIGHEST) - public void RepeatDamage(CustomDamageEvent event) - { - if (event.IsCancelled()) - { - return; - } - - if (event.GetCause() != DamageCause.ENTITY_ATTACK) - { - return; - } - - Player damager = event.GetDamagerPlayer(false); - - if (damager == null) - { - return; - } - - if (!hasPerk(damager)) - { - return; - } - - if (!_repeat.containsKey(damager.getUniqueId())) - { - _repeat.put(damager.getUniqueId(), new ArrayList()); - _repeat.get(damager.getUniqueId()).add(System.currentTimeMillis()); - - // Exp - damager.setExp(Math.min(0.99F, _repeat.get(damager.getUniqueId()).size() / 9f)); - - return; - } - - int count = _repeat.get(damager.getUniqueId()).size(); - - if (count > 0) - { - event.AddMod(damager.getName(), "Ravage", Math.min(2, count), false); - - // Sound - damager.getWorld().playSound(damager.getLocation(), Sound.WOLF_BARK, (float) (0.5 + count * 0.25), (float) (1 + count * 0.25)); - } - - _repeat.get(damager.getUniqueId()).add(System.currentTimeMillis()); - - // Exp - damager.setExp(Math.min(0.9999f, _repeat.get(damager.getUniqueId()).size() / 9f)); - } - - @EventHandler - public void RepeatExpire(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - { - return; - } - - Iterator playerIterator = _repeat.keySet().iterator(); - - while (playerIterator.hasNext()) - { - UUID uuid = playerIterator.next(); - Player player = UtilPlayer.searchExact(uuid); - - Iterator timeIterator = _repeat.get(uuid).iterator(); - - while (timeIterator.hasNext()) - { - long time = timeIterator.next(); - - if (UtilTime.elapsed(time, 3000)) - { - timeIterator.remove(); - } - } - - // Exp - player.setExp(Math.min(0.9999f, _repeat.get(player).size() / 9f)); - } - } - + @Override public void activate(Player player) { @@ -539,8 +39,8 @@ public class SmashWolf extends SmashUltimate Manager.GetDisguise().updateDisguise(disguise); } - Recharge.Instance.recharge(player, WOLF_STRIKE); - Recharge.Instance.recharge(player, CUB_TACKLE); + Recharge.Instance.recharge(player, "Wolf Strike"); + Recharge.Instance.recharge(player, "Cub Tackle"); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpiderLeap.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpiderLeap.java deleted file mode 100644 index 11b6804c0..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpiderLeap.java +++ /dev/null @@ -1,183 +0,0 @@ -package nautilus.game.arcade.kit.perks; - -import java.util.HashSet; -import java.util.Set; -import java.util.UUID; - -import org.bukkit.GameMode; -import org.bukkit.Sound; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerToggleFlightEvent; -import org.bukkit.util.Vector; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.kit.Perk; - -public class PerkSpiderLeap extends Perk -{ - - private static final float ENERGY_PER_TICK = 1 / 200; - private static final float ENERGY_PER_LEAP = 1 / 6; - - private Set _secondJump = new HashSet<>(); - private Set _finalJump = new HashSet<>(); - - public PerkSpiderLeap() - { - super("Spider Leap", new String[] { C.cYellow + "Tap Jump Twice" + C.cGray + " to " + C.cGreen + "Spider Leap", C.cYellow + "Hold Crouch" + C.cGray + " to " + C.cGreen + "Wall Climb", C.cWhite - + "Wall Climb requires Energy (Experience Bar)." }); - } - - @EventHandler - public void WallClimb(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - { - return; - } - - for (Player player : UtilServer.getPlayers()) - { - if (UtilPlayer.isSpectator(player)) - { - continue; - } - - if (!hasPerk(player)) - { - continue; - } - - if (!player.isSneaking()) - { - if (UtilEnt.isGrounded(player)) - { - _secondJump.remove(player.getUniqueId()); - } - - player.setExp((float) Math.min(0.999, player.getExp() + (UtilEnt.isGrounded(player) ? ENERGY_PER_TICK * 2 : ENERGY_PER_TICK))); - - continue; - } - - player.setExp((float) Math.max(0, player.getExp() - ENERGY_PER_TICK)); - - if (player.getExp() <= 0) - { - continue; - } - - if (player.getExp() >= ENERGY_PER_LEAP) - { - _finalJump.remove(player.getUniqueId()); - } - - if (!Recharge.Instance.usable(player, GetName())) - { - continue; - } - - for (Block block : UtilBlock.getSurrounding(player.getLocation().getBlock(), true)) - { - if (!UtilBlock.airFoliage(block) && !block.isLiquid()) - { - UtilAction.velocity(player, new Vector(0, 0.2, 0)); - - if (!_secondJump.contains(player.getUniqueId())) - { - player.setAllowFlight(true); - _secondJump.add(player.getUniqueId()); - } - } - } - } - } - - @EventHandler - public void FlightHop(PlayerToggleFlightEvent event) - { - Player player = event.getPlayer(); - - if (!hasPerk(player)) - { - return; - } - - if (UtilPlayer.isSpectator(player)) - { - return; - } - - if (player.getGameMode() == GameMode.CREATIVE) - { - return; - } - - event.setCancelled(true); - player.setFlying(false); - - // Disable Flight - player.setAllowFlight(false); - - if (player.getExp() < ENERGY_PER_LEAP) - { - if (!_finalJump.contains(player.getUniqueId())) - { - _finalJump.add(player.getUniqueId()); - } - else - { - return; - } - } - - // Velocity - UtilAction.velocity(player, 1.0, 0.2, 1.0, true); - - // Energy - player.setExp((float) Math.max(0, player.getExp() - ENERGY_PER_LEAP)); - - // Sound - player.getWorld().playSound(player.getLocation(), Sound.SPIDER_IDLE, 1f, 1.5f); - - Recharge.Instance.use(player, GetName(), 500, false, false); - } - - @EventHandler - public void FlightUpdate(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - { - return; - } - - for (Player player : UtilServer.getPlayers()) - { - if (UtilPlayer.isSpectator(player)) - { - continue; - } - - if (!hasPerk(player)) - { - continue; - } - - if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) - { - player.setAllowFlight(true); - } - } - } -} From 5c5c159ee3b6db29cab3300a46f602e2621363fe Mon Sep 17 00:00:00 2001 From: Keir Nellyer Date: Tue, 11 Oct 2016 00:22:29 +0100 Subject: [PATCH 021/147] Add support for assigning tokens to snapshots (excluding actual generation part) --- .../core/chatsnap/SnapshotMetadata.java | 4 +- .../core/chatsnap/SnapshotRepository.java | 65 +++++++++++++++---- .../mineplex/core/report/ReportManager.java | 5 +- .../sql/snapshot-tokens.sql | 1 + 4 files changed, 60 insertions(+), 15 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotMetadata.java b/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotMetadata.java index b85b706ab..d46cc2796 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotMetadata.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotMetadata.java @@ -8,14 +8,14 @@ public class SnapshotMetadata protected String _token = null; protected Integer _creatorId = null; - public SnapshotMetadata(int id, String token, int creatorId) + public SnapshotMetadata(int id, String token, Integer creatorId) { _id = id; _token = token; _creatorId = creatorId; } - public SnapshotMetadata(int id, int creatorId) + public SnapshotMetadata(int id, Integer creatorId) { _id = id; _creatorId = creatorId; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotRepository.java index 2b055cca1..e353d8bba 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotRepository.java @@ -20,17 +20,24 @@ import mineplex.serverdata.database.DBPool; */ public class SnapshotRepository { + private static final String URL_PREFIX = "http://report.mineplex.com/chatsnap/view.php?id="; + public static String getURL(long reportId) { return URL_PREFIX + reportId; } - private static final String URL_PREFIX = "http://report.mineplex.com/chatsnap/view.php?id="; + public static String generateToken() + { + // TODO: implement + return null; + } - private static final String INSERT_SNAPSHOT = "INSERT INTO snapshots (creator) VALUES (?);"; + private static final String INSERT_SNAPSHOT = "INSERT INTO snapshots (token, creator) VALUES (?, ?);"; private static final String INSERT_MESSAGE = "INSERT INTO snapshotMessages (senderId, `server`, `time`, message, snapshotType) VALUES (?, ?, ?, ?, ?);"; private static final String INSERT_MESSAGE_RECIPIENT = "INSERT INTO snapshotRecipients (messageId, recipientId) VALUES (?, ?);"; private static final String INSERT_MESSAGE_MAPPING = "INSERT INTO snapshotMessageMap (snapshotId, messageId) VALUES (?, ?);"; + private static final String GET_ID_FROM_TOKEN = "SELECT snapshots.id FROM snapshots WHERE snapshots.token = ?;"; private final String _serverName; private final Logger _logger; @@ -60,15 +67,15 @@ public class SnapshotRepository }); } - public CompletableFuture saveSnapshot(Collection messages) + public CompletableFuture saveSnapshot(Collection messages) { return CompletableFuture.supplyAsync(() -> { try (Connection connection = DBPool.getAccount().getConnection()) { - int snapshotId = createSnapshot(connection, null); - insertMessages(snapshotId, messages, connection); - return snapshotId; + SnapshotMetadata snapshotMetadata = createSnapshot(connection, null); + insertMessages(snapshotMetadata.getId(), messages, connection); + return snapshotMetadata; } catch (SQLException e) { @@ -77,7 +84,7 @@ public class SnapshotRepository }); } - public CompletableFuture createSnapshot(Integer creatorAccountId) + public CompletableFuture createSnapshot(Integer creatorAccountId) { return CompletableFuture.supplyAsync(() -> { @@ -92,17 +99,19 @@ public class SnapshotRepository }); } - private int createSnapshot(Connection connection, Integer creatorAccount) throws SQLException + private SnapshotMetadata createSnapshot(Connection connection, Integer creatorAccount) throws SQLException { + String token = getToken(connection); PreparedStatement insertSnapshotStatement = connection.prepareStatement(INSERT_SNAPSHOT, new String[]{"id"}); + insertSnapshotStatement.setString(1, token); // TODO: correct data type if (creatorAccount != null) { - insertSnapshotStatement.setInt(1, creatorAccount); + insertSnapshotStatement.setInt(2, creatorAccount); } else { - insertSnapshotStatement.setNull(1, Types.INTEGER); + insertSnapshotStatement.setNull(2, Types.INTEGER); } insertSnapshotStatement.execute(); @@ -111,7 +120,7 @@ public class SnapshotRepository { if (resultSet.next()) { - return resultSet.getInt(1); + return new SnapshotMetadata(resultSet.getInt(1), token, creatorAccount); } else { @@ -120,6 +129,40 @@ public class SnapshotRepository } } + private String getToken(Connection connection) throws SQLException + { + String token; + + do + { + token = generateToken(); + } + while(getByToken(connection, token).isPresent()); + + return token; + } + + private Optional getByToken(Connection connection, String token) throws SQLException + { + try (PreparedStatement statement = connection.prepareStatement(GET_ID_FROM_TOKEN)) + { + statement.setString(1, token); // TODO: correct data type + + try (ResultSet resultSet = statement.executeQuery()) + { + if (resultSet.next()) + { + int snapshotId = resultSet.getInt("id"); + return Optional.of(snapshotId); + } + else + { + return Optional.empty(); + } + } + } + } + private void insertMessages(int snapshotId, Collection messages, Connection connection) throws SQLException { try (PreparedStatement insertSnapshotStatement = connection.prepareStatement(INSERT_MESSAGE, new String[]{"id"})) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java index 4f5a2e263..e91ebfeed 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java @@ -20,6 +20,7 @@ import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClientManager; import mineplex.core.chatsnap.SnapshotManager; +import mineplex.core.chatsnap.SnapshotMetadata; import mineplex.core.chatsnap.command.PushSnapshotsCommand; import mineplex.core.chatsnap.command.PushSnapshotsHandler; import mineplex.core.command.CommandCenter; @@ -149,8 +150,8 @@ public class ReportManager // create snapshot id ahead of time if (category == ReportCategory.CHAT_ABUSE) { - int snapshotId = _snapshotManager.getSnapshotRepository().createSnapshot(null).join(); - report.setSnapshotId(snapshotId); + SnapshotMetadata snapshotMetadata = _snapshotManager.getSnapshotRepository().createSnapshot(null).join(); + report.setSnapshotId(snapshotMetadata.getId()); } saveReport(report).join(); diff --git a/Plugins/Mineplex.ReportSite/sql/snapshot-tokens.sql b/Plugins/Mineplex.ReportSite/sql/snapshot-tokens.sql index cca1ffe91..3dcb33f5d 100644 --- a/Plugins/Mineplex.ReportSite/sql/snapshot-tokens.sql +++ b/Plugins/Mineplex.ReportSite/sql/snapshot-tokens.sql @@ -1,3 +1,4 @@ ALTER TABLE Account.snapshots ADD token CHAR(6); +CREATE UNIQUE INDEX snapshots_token_uindex ON snapshots (token); ALTER TABLE Account.snapshots MODIFY COLUMN creator INT(11) AFTER token; \ No newline at end of file From f39ee7c247d7997615c812387fcfbb85163e1166 Mon Sep 17 00:00:00 2001 From: Keir Nellyer Date: Tue, 11 Oct 2016 00:45:33 +0100 Subject: [PATCH 022/147] Update chatsnap site to handle new token system --- Plugins/Mineplex.ReportSite/report.php | 15 +--- Plugins/Mineplex.ReportSite/view.php | 99 ++++++++++++++++++-------- 2 files changed, 69 insertions(+), 45 deletions(-) diff --git a/Plugins/Mineplex.ReportSite/report.php b/Plugins/Mineplex.ReportSite/report.php index fe1b1a216..c38325d2a 100644 --- a/Plugins/Mineplex.ReportSite/report.php +++ b/Plugins/Mineplex.ReportSite/report.php @@ -15,9 +15,6 @@ /** @var Int */ private $category; - /** @var Snapshot */ - private $snapshot; - /** * Report constructor. * @param Int $id @@ -25,16 +22,14 @@ * @param User $suspect * @param UserReport[] $reporters * @param Int $category - * @param Snapshot $snapshot */ - function __construct($id, $handler, $suspect, $reporters, $category, $snapshot) + function __construct($id, $handler, $suspect, $reporters, $category) { $this->id = $id; $this->handler = $handler; $this->suspect = $suspect; $this->reporters = $reporters; $this->category = $category; - $this->snapshot = $snapshot; } /** @@ -103,12 +98,4 @@ { return $this->category; } - - /** - * @return Snapshot - */ - public function getSnapshot() - { - return $this->snapshot; - } } \ No newline at end of file diff --git a/Plugins/Mineplex.ReportSite/view.php b/Plugins/Mineplex.ReportSite/view.php index 8e7d50d1a..a292ea9d7 100644 --- a/Plugins/Mineplex.ReportSite/view.php +++ b/Plugins/Mineplex.ReportSite/view.php @@ -89,7 +89,7 @@ function getReport($reportId) { $connection = getConnection("ACCOUNT"); - $statement = $connection->prepare('SELECT reports.suspectId, reports.categoryId, reports.snapshotId, reportHandlers.handlerId FROM reports + $statement = $connection->prepare('SELECT reports.suspectId, reports.categoryId, reportHandlers.handlerId FROM reports LEFT JOIN reportHandlers ON reports.id = reportHandlers.reportId AND reportHandlers.aborted IS FALSE LEFT JOIN reportResults ON reports.id = reportResults.reportId WHERE reports.id = ?;'); @@ -97,26 +97,20 @@ $statement->bind_param('i', $reportId); $statement->execute(); $statement->store_result(); - $statement->bind_result($suspectId, $categoryId, $snapshotId, $handlerId); + $statement->bind_result($suspectId, $categoryId, $handlerId); if ($statement->fetch()) { $suspectUser = getUser($suspectId); $reportReasons = getReporters($reportId); - $snapshot = null; $handlerUser = null; - if (!is_null($snapshotId)) - { - $snapshot = getSnapshot($snapshotId); - } - if (!is_null($handlerId)) { $handlerUser = getUser($handlerId); } - return new Report($reportId, $handlerUser, $suspectUser, $reportReasons, $categoryId, $snapshot); + return new Report($reportId, $handlerUser, $suspectUser, $reportReasons, $categoryId); } $statement->close(); @@ -124,7 +118,39 @@ return null; } - function getSnapshot($messageId) + /** + * @param string $token + * @return int|null + */ + function getSnapshotId($token) + { + $connection = getConnection('ACCOUNT'); + $statement = $connection->prepare('SELECT id FROM snapshots WHERE token = ?;'); + $statement->bind_param('s', $token); // TODO: correct data type + $statement->execute(); + $statement->bind_result($snapshotId); + $statement->store_result(); + $statement->fetch(); + return $snapshotId; + } + + /** + * @param int $snapshotId + * @return int|null + */ + function getSnapshotReportId($snapshotId) + { + $connection = getConnection('ACCOUNT'); + $statement = $connection->prepare('SELECT reportId FROM reports WHERE snapshotId = ?;'); + $statement->bind_param('i', $snapshotId); + $statement->execute(); + $statement->bind_result($reportId); + $statement->store_result(); + $statement->fetch(); + return $reportId; + } + + function getSnapshot($snapshotId) { /** @var $messages Message[] */ $messages = array(); @@ -135,14 +161,14 @@ WHERE snapshotMessageMap.snapshotId = snapshots.id AND snapshotMessages.id = snapshotMessageMap.messageId AND snapshots.id = ?;"); - $statement->bind_param('i', $messageId); + $statement->bind_param('i', $snapshotId); $statement->execute(); - $statement->bind_result($messageId, $senderId, $snapshotType, $server, $time, $message); + $statement->bind_result($snapshotId, $senderId, $snapshotType, $server, $time, $message); $statement->store_result(); while ($statement->fetch()) { - $recipients = getUsers(getMessageRecipients($messageId)); + $recipients = getUsers(getMessageRecipients($snapshotId)); $message = new Message(getUser($senderId), $recipients, $time, $snapshotType, $message, $server); array_push($messages, $message); } @@ -161,20 +187,20 @@ WHERE snapshotMessageMap.snapshotId = snapshots.id } } - return new Snapshot($messageId, $messages, $snapshotUsers); + return new Snapshot($snapshotId, $messages, $snapshotUsers); } /** - * @param $messageId + * @param $snapshotId * @return Integer[] array */ - function getMessageRecipients($messageId) + function getMessageRecipients($snapshotId) { $recipientIds = array(); $connection = getConnection("ACCOUNT"); $statement = $connection->prepare("SELECT recipientId FROM snapshotRecipients WHERE messageId = ?"); - $statement->bind_param('i', $messageId); + $statement->bind_param('i', $snapshotId); $statement->execute(); $statement->bind_result($recipientId); @@ -355,28 +381,39 @@ WHERE snapshotMessageMap.snapshotId = snapshots.id return '?' . http_build_query($vars); } - $validId = isset($_GET['id']); + $validToken = isset($_GET['token']); $idError = ""; - $id = null; + $token = null; $expanded = null; $report = null; $snapshot = null; - if ($validId) + if ($validToken) { - $id = $_GET['id']; + $token = $_GET['token']; $expanded = isset($_GET['expanded']) && $_GET['expanded']; - $report = getReport($id); + $snapshotId = getSnapshotId($token); - if ($report) + if ($snapshotId != null) { - $snapshot = $report->getSnapshot(); + $snapshot = getSnapshot($snapshotId); + $reportId = getSnapshotReportId($snapshotId); + + if ($reportId) + { + $report = getReport($reportId); + } + else + { + $validToken = false; + $idError = 'Associated report not found.'; // TODO: Allow snapshots without reports in future + } } else { - $validId = false; - $idError = "Invalid id."; + $validToken = false; + $idError = 'Invalid token.'; } } ?> @@ -389,7 +426,7 @@ WHERE snapshotMessageMap.snapshotId = snapshots.id - <?php if ($validId): ?> + <?php if ($validToken): ?> Report #<?= $report->getId() ?> <?php else: ?> Report System @@ -405,17 +442,17 @@ WHERE snapshotMessageMap.snapshotId = snapshots.id <h1>Report System</h1> </div> <div id="search"> - <form id="id-input" name="id-input" action="view.php" method="get"> + <form id="token-input" name="token-input" action="view.php" method="get"> <div class="input-group"> - <input name="id" type="text" class="form-control" placeholder="Enter snapshot id..."> + <input name="token" type="text" class="form-control" placeholder="Enter snapshot token..."> <span class="input-group-btn"> - <button class="btn btn-secondary" type="submit" form="id-input"><i class="fa fa-search"></i> Search</button> + <button class="btn btn-secondary" type="submit" form="token-input"><i class="fa fa-search"></i> Search</button> </span> </div> </form> </div> - <?php if (isset($_GET['id']) && !$validId && !empty($idError)): ?> + <?php if (isset($_GET['id']) && !$validToken && !empty($idError)): ?> <div id="content" class="center-block" style="text-align: center; background-color: rgba(204, 34, 42, 0.52);"> <p class="error-oh-no" style="font-size: 60px;">What did you do?!?!?</p> <img src="img/shaun.gif" /> From 3dc9038bae37f872048389ce18a11ad8833f7104 Mon Sep 17 00:00:00 2001 From: Keir Nellyer <keir@nellyer.co.uk> Date: Tue, 11 Oct 2016 01:22:43 +0100 Subject: [PATCH 023/147] Fix incorrect column name in statement --- Plugins/Mineplex.ReportSite/view.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Plugins/Mineplex.ReportSite/view.php b/Plugins/Mineplex.ReportSite/view.php index 53f81fd68..c039365a8 100644 --- a/Plugins/Mineplex.ReportSite/view.php +++ b/Plugins/Mineplex.ReportSite/view.php @@ -141,7 +141,7 @@ function getSnapshotReportId($snapshotId) { $connection = getConnection('ACCOUNT'); - $statement = $connection->prepare('SELECT reportId FROM reports WHERE snapshotId = ?;'); + $statement = $connection->prepare('SELECT id FROM reports WHERE snapshotId = ?;'); $statement->bind_param('i', $snapshotId); $statement->execute(); $statement->bind_result($reportId); @@ -382,7 +382,7 @@ WHERE snapshotMessageMap.snapshotId = snapshots.id } $validToken = isset($_GET['token']); - $idError = ""; + $errorMsg = ""; $token = null; $expanded = null; @@ -399,6 +399,7 @@ WHERE snapshotMessageMap.snapshotId = snapshots.id if ($snapshotId != null) { $snapshot = getSnapshot($snapshotId); + $messages = $snapshot->getMessages(); $reportId = getSnapshotReportId($snapshotId); if ($reportId) @@ -408,13 +409,13 @@ WHERE snapshotMessageMap.snapshotId = snapshots.id else { $validToken = false; - $idError = 'Associated report not found.'; // TODO: Allow snapshots without reports in future + $errorMsg = 'Associated report not found.'; // TODO: Allow snapshots without reports in future } } else { $validToken = false; - $idError = 'Invalid token.'; + $errorMsg = 'Invalid token.'; } } ?> @@ -453,7 +454,7 @@ WHERE snapshotMessageMap.snapshotId = snapshots.id </form> </div> - <?php if ((isset($_GET['token']) && !$validId) || !empty($errorMsg)): ?> + <?php if ((isset($_GET['token']) && !$validToken) || !empty($errorMsg)): ?> <div id="content" class="center-block" style="text-align: center; background-color: rgba(204, 34, 42, 0.52);"> <p class="error-oh-no" style="font-size: 60px;">What did you do?!?!?</p> <img src="img/shaun.gif" /> @@ -464,7 +465,7 @@ WHERE snapshotMessageMap.snapshotId = snapshots.id <?php endif; ?> </div> <?php else: ?> - <?php if (!isset($_GET['id'])) exit(); ?> + <?php if (!isset($_GET['token'])) exit(); ?> <div id="content"> <div> From 15cf3a2bee76f55fd17c4018fb8732802f03bcbc Mon Sep 17 00:00:00 2001 From: Keir Nellyer <keir@nellyer.co.uk> Date: Tue, 11 Oct 2016 14:30:43 +0100 Subject: [PATCH 024/147] PC-1019 Give indication of when a report is forwarded to a team --- .../src/mineplex/core/report/ReportHandlerTask.java | 2 ++ .../Mineplex.Core/src/mineplex/core/report/ReportTeam.java | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportHandlerTask.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportHandlerTask.java index b68907c23..9b06529e5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportHandlerTask.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportHandlerTask.java @@ -80,6 +80,8 @@ public class ReportHandlerTask extends BukkitRunnable .add(prefix + C.cAqua + "Suspect - " + C.cGold + suspectName) .add("\n") .add(prefix + C.cAqua + "Type - " + C.cGold + report.getCategory().getName()) + .add("\n") + .add(prefix + C.cAqua + "Team - " + C.cGold + report.getAssignedTeam().map(ReportTeam::getName).orElse("None")) .add("\n" + prefix + "\n") .add(prefix + C.cGold + report.getMessages().size() + C.cAqua + " total reports") .add("\n") diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportTeam.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportTeam.java index 1a6cc4f06..bb6f060b2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportTeam.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportTeam.java @@ -16,6 +16,11 @@ public enum ReportTeam _initialPriority = initialPriority; } + public String getName() + { + return name(); + } + public short getDatabaseId() { return _databaseId; From eb6d893414e5820dace8fdfd521eeb018f0aee09 Mon Sep 17 00:00:00 2001 From: Keir Nellyer <keir@nellyer.co.uk> Date: Wed, 12 Oct 2016 17:15:48 +0100 Subject: [PATCH 025/147] PC-954 Allow staff to select what kind of report they'd like to handle --- .../mineplex/core/report/ReportCategory.java | 14 +- .../core/report/command/ReportCommand.java | 7 +- .../report/command/ReportHandleCommand.java | 83 +----------- .../core/report/data/ReportRepository.java | 14 +- .../core/report/ui/ReportCategoryButton.java | 19 ++- .../report/ui/ReportCategoryCallback.java | 13 ++ ...ategoryPage.java => ReportCreatePage.java} | 9 +- .../core/report/ui/ReportHandlePage.java | 128 ++++++++++++++++++ 8 files changed, 181 insertions(+), 106 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportCategoryCallback.java rename Plugins/Mineplex.Core/src/mineplex/core/report/ui/{ReportCategoryPage.java => ReportCreatePage.java} (90%) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportHandlePage.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportCategory.java index ea271ba0a..f48ca9b16 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportCategory.java @@ -10,27 +10,27 @@ public enum ReportCategory /** * Global category, used for representing values which aren't tied to a specific category (such as abusive report statistics). */ - GLOBAL(0), + GLOBAL((short) 0), /** * Hacking category, for reports involving cheats of any sort. */ - HACKING(1), + HACKING((short) 1), /** * Chat Abuse category, for reports involving offensive comments made in chat. */ - CHAT_ABUSE(2), + CHAT_ABUSE((short) 2), /** * Gameplay category, for reports specific to gameplay (such as bug exploits or issues with the map). */ - GAMEPLAY(3); + GAMEPLAY((short) 3); - private final int _id; + private final short _id; private final String _name; - ReportCategory(int id) + ReportCategory(short id) { _id = id; _name = WordUtils.capitalizeFully(name().replace('_', ' ')); @@ -41,7 +41,7 @@ public enum ReportCategory * * @return the id */ - public int getId() + public short getId() { return _id; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportCommand.java index 6587db136..ac1e5ec34 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportCommand.java @@ -6,13 +6,12 @@ import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClientManager; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; -import mineplex.core.common.util.BukkitFuture; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.report.ReportManager; import mineplex.core.report.ReportPlugin; -import mineplex.core.report.ui.ReportCategoryPage; +import mineplex.core.report.ui.ReportCreatePage; /** * The command used by players to create a report. @@ -62,7 +61,7 @@ public class ReportCommand extends CommandBase<ReportPlugin> else { CoreClient suspectClient = clientManager.Get(suspect); - new ReportCategoryPage(Plugin, reporter, reporterId, suspectClient, reason).openInventory(); + new ReportCreatePage(Plugin, reporter, reporterId, suspectClient, reason).openInventory(); } } else @@ -71,7 +70,7 @@ public class ReportCommand extends CommandBase<ReportPlugin> { if (suspectClient != null) { - new ReportCategoryPage(Plugin, reporter, reporterId, suspectClient, reason).openInventory(); + new ReportCreatePage(Plugin, reporter, reporterId, suspectClient, reason).openInventory(); } else { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportHandleCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportHandleCommand.java index a988ab3d5..4241202b2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportHandleCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportHandleCommand.java @@ -1,24 +1,14 @@ package mineplex.core.report.command; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.CompletableFuture; -import java.util.logging.Level; - -import org.bukkit.Bukkit; import org.bukkit.entity.Player; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; -import mineplex.core.common.util.BukkitFuture; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; -import mineplex.core.report.ReportManager; import mineplex.core.report.ReportPlugin; -import mineplex.core.report.data.Report; -import mineplex.core.report.data.ReportRepository; +import mineplex.core.report.ui.ReportHandlePage; /** * When executed, the user is appointed handler of the most important report in the report queue (if any). @@ -36,76 +26,9 @@ public class ReportHandleCommand extends CommandBase<ReportPlugin> { if (args == null || args.length == 0) { - ReportManager reportManager = Plugin.getReportManager(); - ReportRepository reportRepository = reportManager.getReportRepository(); int accountId = _commandCenter.GetClientManager().getAccountId(player); - - reportManager.isHandlingReport(player).whenComplete((handlingReport, throwable) -> - { - if (throwable == null) - { - if (!handlingReport) - { - Map<Report, Double> reportPriorities = Collections.synchronizedMap(new HashMap<>()); - boolean devMode = reportManager.isDevMode(player.getUniqueId()); - - // the below fetches the ids of all unhandled reports and gets a Report object for each of these ids - // the priority of the report is then calculated and the results placed in a map - reportRepository.getUnhandledReports(accountId, devMode).thenCompose(reportRepository::getReports).thenAccept(reports -> - CompletableFuture.allOf(reports.stream().map(report -> - reportManager.calculatePriority(report).thenAccept(priority -> - { - if (priority > 0) - { - reportPriorities.put(report, priority); - } - else - { - // mark the report as expired to keep the database clean - // and reduce future query time - reportManager.expireReport(report); - } - } - ) - ).toArray(CompletableFuture[]::new)).join() - ).thenApply(aVoid -> - { - Map.Entry<Report, Double> mostImportant = null; - - for (Map.Entry<Report, Double> entry : reportPriorities.entrySet()) - { - if (mostImportant == null || (double) entry.getValue() > mostImportant.getValue()) - { - mostImportant = entry; - } - } - - return mostImportant == null ? null : mostImportant.getKey(); - }).thenCompose(BukkitFuture.accept(report -> - { - if (report != null) - { - reportManager.handleReport(report, player); - } - else - { - UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "No report found, report queue is empty.")); - } - })); - } - else - { - Bukkit.getScheduler().runTask(Plugin.getPlugin(), () -> - UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "You are already handling a report."))); - - } - } - else - { - UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "An error occurred, please try again later.")); - Plugin.getPlugin().getLogger().log(Level.SEVERE, "Error whilst checking for reports being handled by " + player.getName(), throwable); - } - }); + ReportHandlePage reportHandlePage = new ReportHandlePage(Plugin, player, accountId); + reportHandlePage.openInventory(); } else { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java index 2f7373bac..cd1043e70 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java @@ -77,7 +77,8 @@ public class ReportRepository " LEFT JOIN reportResults ON reports.id = reportResults.reportId\n" + " LEFT JOIN reportHandlers ON reports.id = reportHandlers.reportId\n" + " LEFT JOIN reportReasons ON reports.id = reportReasons.reportId\n" + - "WHERE reportResults.reportId IS NULL\n" + + "WHERE reports.categoryId = ?\n" + + " AND reportResults.reportId IS NULL\n" + " /* Bypass for testing purposes or check player isn't suspect */\n" + " AND (? IS TRUE OR reports.suspectId != ?)\n" + " /* If team is assigned, make sure user is member of team */\n" + @@ -157,7 +158,7 @@ public class ReportRepository * @param devMode if true, allows various restrictions to be bypassed * @return the ids of unhandled reports the supplied account is allowed to handle */ - public CompletableFuture<List<Long>> getUnhandledReports(int accountId, boolean devMode) + public CompletableFuture<List<Long>> getUnhandledReports(int accountId, ReportCategory category, boolean devMode) { CompletableFuture<List<Long>> future = CompletableFuture.supplyAsync(() -> { @@ -166,12 +167,13 @@ public class ReportRepository try (Connection connection = DBPool.getAccount().getConnection()) { PreparedStatement preparedStatement = connection.prepareStatement(GET_UNHANDLED_REPORTS); - preparedStatement.setBoolean(1, devMode); - preparedStatement.setInt(2, accountId); + preparedStatement.setShort(1, category.getId()); + preparedStatement.setBoolean(2, devMode); preparedStatement.setInt(3, accountId); preparedStatement.setInt(4, accountId); - preparedStatement.setBoolean(5, devMode); - preparedStatement.setInt(6, accountId); + preparedStatement.setInt(5, accountId); + preparedStatement.setBoolean(6, devMode); + preparedStatement.setInt(7, accountId); ResultSet resultSet = preparedStatement.executeQuery(); while (resultSet.next()) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportCategoryButton.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportCategoryButton.java index 21e6a0df9..d38229f39 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportCategoryButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportCategoryButton.java @@ -13,7 +13,7 @@ import mineplex.core.itemstack.ItemBuilder; import mineplex.core.report.ReportCategory; /** - * Represents a clickable button in a {@link ReportCategoryPage} which determines the type of infraction a player has committed. + * Represents a clickable button in a {@link ReportCreatePage} which determines the type of infraction a player has committed. */ public class ReportCategoryButton extends SimpleGuiItem { @@ -39,24 +39,29 @@ public class ReportCategoryButton extends SimpleGuiItem put(ReportCategory.GAMEPLAY, itemGameplay); }}; - private final ReportCategoryPage _reportCategoryPage; + private final ReportCategoryCallback _callback; private final ReportCategory _category; - public ReportCategoryButton(ReportCategoryPage reportCategoryPage, ReportCategory reportCategory) + public ReportCategoryButton(ReportCategoryCallback callback, ReportCategory reportCategory) { - this(reportCategoryPage, reportCategory, ITEM_STACKS.get(reportCategory)); + this(callback, reportCategory, ITEM_STACKS.get(reportCategory)); } - public ReportCategoryButton(ReportCategoryPage reportCategoryPage, ReportCategory reportCategory, ItemStack itemStack) + public ReportCategoryButton(ReportCategoryCallback callback, ReportCategory reportCategory, ItemStack itemStack) { super(itemStack); - _reportCategoryPage = reportCategoryPage; + _callback = callback; _category = reportCategory; } + public ReportCategory getCategory() + { + return _category; + } + @Override public void click(ClickType clickType) { - _reportCategoryPage.addReport(_category); + _callback.click(this); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportCategoryCallback.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportCategoryCallback.java new file mode 100644 index 000000000..ad8f2ff4c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportCategoryCallback.java @@ -0,0 +1,13 @@ +package mineplex.core.report.ui; + +/** + * Allows re-use of the {@link ReportCategoryButton} class. + */ +public interface ReportCategoryCallback +{ + /** + * Invoked when a category button is clicked. + * @param button The button that was clicked + */ + void click(ReportCategoryButton button); +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportCategoryPage.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportCreatePage.java similarity index 90% rename from Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportCategoryPage.java rename to Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportCreatePage.java index d7d1dbfd5..cc85826db 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportCategoryPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportCreatePage.java @@ -21,7 +21,7 @@ import mineplex.core.report.ReportPlugin; /** * User interface shown to a player when reporting another player. */ -public class ReportCategoryPage extends SimpleGui +public class ReportCreatePage extends SimpleGui implements ReportCategoryCallback { private final ReportPlugin _plugin; private final Player _reporter; @@ -29,7 +29,7 @@ public class ReportCategoryPage extends SimpleGui private final CoreClient _suspect; private final String _reason; - public ReportCategoryPage(ReportPlugin plugin, Player reporter, int reporterId, CoreClient suspect, String reason) + public ReportCreatePage(ReportPlugin plugin, Player reporter, int reporterId, CoreClient suspect, String reason) { super(plugin.getPlugin(), reporter, "Report " + suspect.getName(), 9 * 3); @@ -111,4 +111,9 @@ public class ReportCategoryPage extends SimpleGui HandlerList.unregisterAll(this); } + @Override + public void click(ReportCategoryButton button) + { + addReport(button.getCategory()); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportHandlePage.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportHandlePage.java new file mode 100644 index 000000000..2decd4ff4 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportHandlePage.java @@ -0,0 +1,128 @@ +package mineplex.core.report.ui; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.logging.Level; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.BukkitFuture; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.gui.SimpleGui; +import mineplex.core.report.ReportCategory; +import mineplex.core.report.ReportManager; +import mineplex.core.report.ReportPlugin; +import mineplex.core.report.data.Report; +import mineplex.core.report.data.ReportRepository; + +/** + * An interface which allows the user to select the type of report they'd like to handle. + */ +public class ReportHandlePage extends SimpleGui implements ReportCategoryCallback +{ + private final ReportPlugin _plugin; + private final Player _handler; + private final int _handlerId; + + public ReportHandlePage(ReportPlugin plugin, Player handler, int handlerId) + { + super(plugin.getPlugin(), handler, "Report Type Selection", 9); + + _plugin = plugin; + _handler = handler; + _handlerId = handlerId; + + buildPage(); + } + + private void buildPage() + { + setItem(11, new ReportCategoryButton(this, ReportCategory.HACKING)); + setItem(13, new ReportCategoryButton(this, ReportCategory.CHAT_ABUSE)); + setItem(15, new ReportCategoryButton(this, ReportCategory.GAMEPLAY)); + } + + @Override + public void click(ReportCategoryButton button) + { + handleReport(button.getCategory()); + } + + public void handleReport(ReportCategory category) + { + ReportManager reportManager = _plugin.getReportManager(); + ReportRepository reportRepository = reportManager.getReportRepository(); + + reportManager.isHandlingReport(_handler).whenComplete((handlingReport, throwable) -> + { + if (throwable == null) + { + if (!handlingReport) + { + Map<Report, Double> reportPriorities = Collections.synchronizedMap(new HashMap<>()); + boolean devMode = reportManager.isDevMode(_handler.getUniqueId()); + + // the below fetches the ids of all unhandled reports and gets a Report object for each of these ids + // the priority of the report is then calculated and the results placed in a map + reportRepository.getUnhandledReports(_handlerId, category, devMode).thenCompose(reportRepository::getReports).thenAccept(reports -> + CompletableFuture.allOf(reports.stream().map(report -> + reportManager.calculatePriority(report).thenAccept(priority -> + { + if (priority > 0) + { + reportPriorities.put(report, priority); + } + else + { + // mark the report as expired to keep the database clean + // and reduce future query time + reportManager.expireReport(report); + } + } + ) + ).toArray(CompletableFuture[]::new)).join() + ).thenApply(aVoid -> + { + Map.Entry<Report, Double> mostImportant = null; + + for (Map.Entry<Report, Double> entry : reportPriorities.entrySet()) + { + if (mostImportant == null || (double) entry.getValue() > mostImportant.getValue()) + { + mostImportant = entry; + } + } + + return mostImportant == null ? null : mostImportant.getKey(); + }).thenCompose(BukkitFuture.accept(report -> + { + if (report != null) + { + reportManager.handleReport(report, _handler); + } + else + { + UtilPlayer.message(_handler, F.main(_plugin.getName(), C.cRed + "No report found, report queue is empty.")); + } + })); + } + else + { + Bukkit.getScheduler().runTask(_plugin.getPlugin(), () -> + UtilPlayer.message(_handler, F.main(_plugin.getName(), C.cRed + "You are already handling a report."))); + + } + } + else + { + UtilPlayer.message(_handler, F.main(_plugin.getName(), C.cRed + "An error occurred, please try again later.")); + _plugin.getPlugin().getLogger().log(Level.SEVERE, "Error whilst checking for reports being handled by " + _handler.getName(), throwable); + } + }); + } +} From f42678a9ef67cd9e4b35e6d64a653092d95dd804 Mon Sep 17 00:00:00 2001 From: Keir Nellyer <keir@nellyer.co.uk> Date: Wed, 12 Oct 2016 17:23:42 +0100 Subject: [PATCH 026/147] PC-954 Fix incorrectly sized inventory --- .../src/mineplex/core/report/ui/ReportHandlePage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportHandlePage.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportHandlePage.java index 2decd4ff4..dfdeb3fca 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportHandlePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportHandlePage.java @@ -31,7 +31,7 @@ public class ReportHandlePage extends SimpleGui implements ReportCategoryCallbac public ReportHandlePage(ReportPlugin plugin, Player handler, int handlerId) { - super(plugin.getPlugin(), handler, "Report Type Selection", 9); + super(plugin.getPlugin(), handler, "Report Type Selection", 9 * 3); _plugin = plugin; _handler = handler; From ca0925329200f12470724d7beaedfd2c1d3a1fb7 Mon Sep 17 00:00:00 2001 From: Keir Nellyer <keir@nellyer.co.uk> Date: Wed, 12 Oct 2016 17:30:19 +0100 Subject: [PATCH 027/147] PC-954 Tweak error message when no reports are available for handling Also close gui after clicking item and remove old un-necessary code. --- .../src/mineplex/core/report/ui/ReportCreatePage.java | 10 +--------- .../src/mineplex/core/report/ui/ReportHandlePage.java | 3 ++- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportCreatePage.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportCreatePage.java index cc85826db..4ee980e93 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportCreatePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportCreatePage.java @@ -5,7 +5,6 @@ import java.util.Optional; import java.util.stream.Collectors; import org.bukkit.entity.Player; -import org.bukkit.event.HandlerList; import mineplex.core.account.CoreClient; import mineplex.core.chatsnap.SnapshotManager; @@ -51,9 +50,6 @@ public class ReportCreatePage extends SimpleGui implements ReportCategoryCallba public void addReport(ReportCategory category) { - _reporter.closeInventory(); - unregisterListener(); - if (category == ReportCategory.CHAT_ABUSE) { if (hasSentMessage(_suspect.getAccountId())) @@ -106,14 +102,10 @@ public class ReportCreatePage extends SimpleGui implements ReportCategoryCallba }); } - public void unregisterListener() - { - HandlerList.unregisterAll(this); - } - @Override public void click(ReportCategoryButton button) { + _reporter.closeInventory(); addReport(button.getCategory()); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportHandlePage.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportHandlePage.java index dfdeb3fca..05e355caf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportHandlePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportHandlePage.java @@ -50,6 +50,7 @@ public class ReportHandlePage extends SimpleGui implements ReportCategoryCallbac @Override public void click(ReportCategoryButton button) { + _handler.closeInventory(); handleReport(button.getCategory()); } @@ -107,7 +108,7 @@ public class ReportHandlePage extends SimpleGui implements ReportCategoryCallbac } else { - UtilPlayer.message(_handler, F.main(_plugin.getName(), C.cRed + "No report found, report queue is empty.")); + UtilPlayer.message(_handler, F.main(_plugin.getName(), C.cRed + "No open " + F.elem(category.getName()) + " report(s) found.")); } })); } From 76539648da35dfd11c93fad6e793a83fdf782a1c Mon Sep 17 00:00:00 2001 From: Keir Nellyer <keir@nellyer.co.uk> Date: Wed, 12 Oct 2016 17:36:54 +0100 Subject: [PATCH 028/147] PC-1109 Fix /reportstats if player doesn't have at least 5 reports in each role --- .../src/mineplex/core/report/command/ReportStatsCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportStatsCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportStatsCommand.java index 2ba759f95..18cc0fc4c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportStatsCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportStatsCommand.java @@ -54,7 +54,7 @@ public class ReportStatsCommand extends CommandBase<ReportPlugin> ChildJsonMessage jsonMessage = new JsonMessage(F.main(Plugin.getName(), "")) .extra(C.mElem); - int displayAmount = 5; + int displayAmount = Math.min(idArray.length, 5); for (int i = 0; i < displayAmount; i++) { From 2e16eef5d95da7019a1424e3b1f318bf94233b13 Mon Sep 17 00:00:00 2001 From: Keir Nellyer <keir@nellyer.co.uk> Date: Thu, 13 Oct 2016 01:18:23 +0100 Subject: [PATCH 029/147] Make /reportstats work with offline players and other small improvements --- .../report/command/ReportStatsCommand.java | 77 ++++++++++--------- .../core/report/data/ReportRepository.java | 72 ++++++++++++++--- 2 files changed, 99 insertions(+), 50 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportStatsCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportStatsCommand.java index 18cc0fc4c..77619e680 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportStatsCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportStatsCommand.java @@ -1,6 +1,5 @@ package mineplex.core.report.command; -import org.bukkit.Bukkit; import org.bukkit.entity.Player; import com.google.common.primitives.Longs; @@ -32,53 +31,55 @@ public class ReportStatsCommand extends CommandBase<ReportPlugin> if (args != null && args.length == 1) { String playerName = args[0]; - Player target = Bukkit.getPlayer(playerName); - if (target != null) + Plugin.getReportManager().getReportRepository().getAccountId(playerName).thenAccept(accountIdOptional -> { - int accountId = _commandCenter.GetClientManager().getAccountId(target); + if (accountIdOptional.isPresent()) + { + int accountId = accountIdOptional.get(); - Plugin.getReportManager().getReportRepository().getAccountStatistics(accountId).thenCompose(BukkitFuture.accept(stats -> - stats.keySet().forEach(role -> - { - long[] idArray = stats.get(role).stream() - .sorted((l1, l2) -> Longs.compare(l2, l1)) - .mapToLong(l -> l) - .toArray(); - int reportCount = idArray.length; - - // don't show handler statistics if user has never handled a report - if (role != ReportRole.HANDLER || reportCount > 0) + Plugin.getReportManager().getReportRepository().getAccountStatistics(accountId).thenCompose(BukkitFuture.accept(stats -> + stats.keySet().forEach(role -> { - // create clickable report ids - ChildJsonMessage jsonMessage = new JsonMessage(F.main(Plugin.getName(), "")) - .extra(C.mElem); + long[] idArray = stats.get(role).stream() + .sorted((l1, l2) -> Longs.compare(l2, l1)) + .mapToLong(l -> l) + .toArray(); + int reportCount = idArray.length; - int displayAmount = Math.min(idArray.length, 5); - - for (int i = 0; i < displayAmount; i++) + // don't show handler statistics if user has never handled a report + if (role != ReportRole.HANDLER || reportCount > 0) { - long reportId = idArray[i]; + // create clickable report ids + ChildJsonMessage jsonMessage = new JsonMessage(F.main(Plugin.getName(), "")) + .extra(C.mElem); - jsonMessage = jsonMessage.add(String.valueOf(reportId)) - .click(ClickEvent.RUN_COMMAND, "/reportinfo " + reportId); + int displayAmount = Math.min(idArray.length, 5); - if (reportId != displayAmount) + for (int i = 0; i < displayAmount; i++) { - jsonMessage = jsonMessage.add(", "); - } - } + long reportId = idArray[i]; - UtilPlayer.message(player, F.main(Plugin.getName(), F.elem(role.getHumanName()) + " (" + reportCount + ")")); - jsonMessage.sendToPlayer(player); - } - }) - )); - } - else - { - UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "Player not found.")); - } + jsonMessage = jsonMessage.add(String.valueOf(reportId)) + .click(ClickEvent.RUN_COMMAND, "/reportinfo " + reportId); + + if (i != displayAmount - 1) + { + jsonMessage = jsonMessage.add(", "); + } + } + + UtilPlayer.message(player, F.main(Plugin.getName(), F.elem(role.getHumanName()) + " (" + reportCount + ")")); + jsonMessage.sendToPlayer(player); + } + }) + )); + } + else + { + UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "Player not found.")); + } + }); } else { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java index cd1043e70..6e8507925 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java @@ -123,6 +123,9 @@ public class ReportRepository private static final String GET_ACCOUNT_UUID = "SELECT id, uuid FROM accounts" + " WHERE id IN (%s);"; + private static final String GET_ACCOUNT_ID = "SELECT id, `name` FROM accounts\n" + + "WHERE `name` = ?;"; + /** STATISTICS **/ private static final String STATISTICS_GET_REPORTS_MADE = "SELECT reports.id FROM reports, reportReasons\n" + @@ -825,13 +828,17 @@ public class ReportRepository { try (Connection connection = DBPool.getAccount().getConnection()) { - PreparedStatement preparedStatement = connection.prepareStatement(GET_ACCOUNT_NAME); - preparedStatement.setInt(1, accountId); - - ResultSet resultSet = preparedStatement.executeQuery(); - if (resultSet.next()) + try (PreparedStatement preparedStatement = connection.prepareStatement(GET_ACCOUNT_NAME)) { - return resultSet.getString("name"); + preparedStatement.setInt(1, accountId); + + try (ResultSet resultSet = preparedStatement.executeQuery()) + { + if (resultSet.next()) + { + return resultSet.getString("name"); + } + } } } catch (SQLException e) @@ -866,14 +873,18 @@ public class ReportRepository try (Connection connection = DBPool.getAccount().getConnection()) { String query = String.format(GET_ACCOUNT_UUID, StringUtils.join(accountIds, ", ")); - PreparedStatement preparedStatement = connection.prepareStatement(query); - ResultSet resultSet = preparedStatement.executeQuery(); - while (resultSet.next()) + try (PreparedStatement preparedStatement = connection.prepareStatement(query)) { - int accountId = resultSet.getInt("id"); - UUID accountUUID = UUID.fromString(resultSet.getString("uuid")); - accountUUIDs.put(accountId, accountUUID); + try (ResultSet resultSet = preparedStatement.executeQuery()) + { + while (resultSet.next()) + { + int accountId = resultSet.getInt("id"); + UUID accountUUID = UUID.fromString(resultSet.getString("uuid")); + accountUUIDs.put(accountId, accountUUID); + } + } } } catch (SQLException e) @@ -893,4 +904,41 @@ public class ReportRepository return future; } + public CompletableFuture<Optional<Integer>> getAccountId(String name) + { + CompletableFuture<Optional<Integer>> future = CompletableFuture.supplyAsync(() -> + { + try (Connection connection = DBPool.getAccount().getConnection()) + { + try (PreparedStatement statement = connection.prepareStatement(GET_ACCOUNT_ID)) + { + statement.setString(1, name); + + try (ResultSet resultSet = statement.executeQuery()) + { + if (resultSet.next()) + { + return Optional.of(resultSet.getInt("id")); + } + else + { + return Optional.empty(); + } + } + } + } + catch (SQLException e) + { + throw new RuntimeException(e); + } + }); + + future.exceptionally(throwable -> + { + _logger.log(Level.SEVERE, "Error whilst fetching id from name: " + name, throwable); + return Optional.empty(); + }); + + return future; + } } \ No newline at end of file From 03e219f552a8491dd56605666d454e612772dd92 Mon Sep 17 00:00:00 2001 From: Keir Nellyer <keir@nellyer.co.uk> Date: Thu, 13 Oct 2016 02:15:49 +0100 Subject: [PATCH 030/147] Add header to /reportstats and further improvements --- .../report/command/ReportStatsCommand.java | 41 +++++++++++-------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportStatsCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportStatsCommand.java index 77619e680..e02de3ae1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportStatsCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportStatsCommand.java @@ -39,40 +39,47 @@ public class ReportStatsCommand extends CommandBase<ReportPlugin> int accountId = accountIdOptional.get(); Plugin.getReportManager().getReportRepository().getAccountStatistics(accountId).thenCompose(BukkitFuture.accept(stats -> - stats.keySet().forEach(role -> { - long[] idArray = stats.get(role).stream() - .sorted((l1, l2) -> Longs.compare(l2, l1)) - .mapToLong(l -> l) - .toArray(); - int reportCount = idArray.length; + UtilPlayer.message(player, F.main(Plugin.getName(), "Report Statistics for " + F.elem(playerName))); - // don't show handler statistics if user has never handled a report - if (role != ReportRole.HANDLER || reportCount > 0) + for (ReportRole role : ReportRole.values()) { + long[] idArray = stats.get(role).stream() + .sorted((l1, l2) -> Longs.compare(l2, l1)) + .mapToLong(l -> l) + .toArray(); + int reportCount = idArray.length; + // create clickable report ids ChildJsonMessage jsonMessage = new JsonMessage(F.main(Plugin.getName(), "")) .extra(C.mElem); int displayAmount = Math.min(idArray.length, 5); - for (int i = 0; i < displayAmount; i++) + if (displayAmount > 0) { - long reportId = idArray[i]; - - jsonMessage = jsonMessage.add(String.valueOf(reportId)) - .click(ClickEvent.RUN_COMMAND, "/reportinfo " + reportId); - - if (i != displayAmount - 1) + for (int i = 0; i < displayAmount; i++) { - jsonMessage = jsonMessage.add(", "); + long reportId = idArray[i]; + + jsonMessage = jsonMessage.add(String.valueOf(reportId)) + .click(ClickEvent.RUN_COMMAND, "/reportinfo " + reportId); + + if (i != displayAmount - 1) + { + jsonMessage = jsonMessage.add(", "); + } } } + else + { + jsonMessage = jsonMessage.add("N/A"); + } UtilPlayer.message(player, F.main(Plugin.getName(), F.elem(role.getHumanName()) + " (" + reportCount + ")")); jsonMessage.sendToPlayer(player); } - }) + } )); } else From 2ac7f72327cbd01a071814cc9399413485c55236 Mon Sep 17 00:00:00 2001 From: AlexTheCoder <alexjmeech@gmail.com> Date: Sun, 18 Sep 2016 21:31:35 -0400 Subject: [PATCH 031/147] Fix clans water exploit and ruined pickaxe duping exploit --- .../game/clans/gameplay/Gameplay.java | 49 ------------------- .../game/clans/items/rares/RunedPickaxe.java | 5 +- 2 files changed, 4 insertions(+), 50 deletions(-) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/Gameplay.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/Gameplay.java index df5d6e2cb..2c7a971f1 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/Gameplay.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/Gameplay.java @@ -86,8 +86,6 @@ public class Gameplay extends MiniPlugin private WeightSet<Boolean> _foodDecrease; // Weighted probability sets for // food decrease event outcomes - private Map<Block, Long> _bucketWater = new HashMap<Block, Long>(); - public Gameplay(JavaPlugin plugin, ClansManager clansManager, BlockRestore blockRestore, DamageManager damageManager) { super("PvP Gameplay", plugin); @@ -179,29 +177,6 @@ public class Gameplay extends MiniPlugin } } } - @EventHandler - public void BucketEmpty(PlayerBucketEmptyEvent event) - { - event.setCancelled(true); - - Block block = event.getBlockClicked().getRelative(event.getBlockFace()); - - if (event.getBucket() == Material.WATER_BUCKET) - { - block.setTypeIdAndData(8, (byte) 1, true); - _blockRestore.add(event.getBlockClicked().getRelative(event.getBlockFace()), 8, (byte) 0, 1000); - _bucketWater.put(block, System.currentTimeMillis()); - } - - if (event.getBucket() == Material.LAVA_BUCKET) - { - block.setTypeIdAndData(10, (byte) 6, true); - _blockRestore.add(event.getBlockClicked().getRelative(event.getBlockFace()), 10, (byte) 0, 2000); - } - - event.getPlayer().setItemInHand(ItemStackFactory.Instance.CreateStack(Material.BUCKET)); - UtilInv.Update(event.getPlayer()); - } /** * Decreases the hunger rate decrease speed by arbitrarily canceling a @@ -222,30 +197,6 @@ public class Gameplay extends MiniPlugin } } - @EventHandler - public void BucketFill(PlayerBucketFillEvent event) - { - event.setCancelled(true); - - if (event.getItemStack().getType() == Material.WATER_BUCKET) if (!_bucketWater.containsKey(event.getBlockClicked())) event.getPlayer().setItemInHand(ItemStackFactory.Instance.CreateStack(Material.WATER_BUCKET)); - - UtilInv.Update(event.getPlayer()); - } - - @EventHandler - public void BucketWaterExpire(UpdateEvent event) - { - if (event.getType() != UpdateType.FAST) return; - - HashSet<Block> remove = new HashSet<Block>(); - - for (Block cur : _bucketWater.keySet()) - if (UtilTime.elapsed(_bucketWater.get(cur).longValue(), 2000)) remove.add(cur); - - for (Block cur : remove) - _bucketWater.remove(cur); - } - @EventHandler(priority = EventPriority.LOWEST) public void ObsidianCancel(BlockPlaceEvent event) { diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/rares/RunedPickaxe.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/rares/RunedPickaxe.java index 8905742d1..9072d0dfe 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/rares/RunedPickaxe.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/rares/RunedPickaxe.java @@ -87,12 +87,15 @@ public class RunedPickaxe extends RareItem if (territory != null && !territory.Owner.equals(playerClan)) return; - if (event.getBlock().getType() == Material.BEDROCK) + if (event.getBlock().getType() == Material.BEDROCK || event.getBlock().getType() == Material.BARRIER) return; if (ClansManager.getInstance().getNetherManager().getNetherWorld().equals(event.getBlock().getWorld())) return; + if (ClansManager.getInstance().getBlockRestore().contains(event.getBlock())) + return; + if (!UtilTime.elapsed(pick._instamineEnabled, 12000)) { event.getBlock().breakNaturally(); From 66dfe06b34bb36e12e570020b2266a3f502e7f95 Mon Sep 17 00:00:00 2001 From: AlexTheCoder <alexjmeech@gmail.com> Date: Thu, 6 Oct 2016 01:27:32 -0400 Subject: [PATCH 032/147] Clean up bucket fixing in clans --- .../src/mineplex/game/clans/clans/ClansGame.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java index c7dbf9104..e1bf068c2 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java @@ -29,6 +29,7 @@ import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.event.inventory.InventoryPickupItemEvent; import org.bukkit.event.player.PlayerBucketEmptyEvent; +import org.bukkit.event.player.PlayerBucketFillEvent; import org.bukkit.event.player.PlayerFishEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerPickupItemEvent; @@ -229,15 +230,18 @@ public class ClansGame extends MiniPlugin } } + @SuppressWarnings("deprecation") @EventHandler - public void onPlayerFillBucket(PlayerInteractEvent event) + public void onPlayerFillBucket(PlayerBucketFillEvent event) { - ItemStack itemInHand = event.getPlayer().getItemInHand(); - - if (UtilItem.matchesMaterial(itemInHand, Material.BUCKET) && UtilEvent.isAction(event, ActionType.R)) + event.setCancelled(true); + UtilPlayer.message(event.getPlayer(), F.main("Clans", "You cannot fill buckets!")); + _clans.runSyncLater(() -> { - event.setCancelled(true); - } + event.getPlayer().updateInventory(); + Block block = event.getBlockClicked().getRelative(event.getBlockFace()); + event.getPlayer().sendBlockChange(block.getLocation(), block.getType(), block.getData()); + }, 1L); } @EventHandler From 311751cc390ece412cbd2888af9a5002a1ea3a0e Mon Sep 17 00:00:00 2001 From: xADudex <kissan12@live.no> Date: Thu, 13 Oct 2016 04:40:05 +0200 Subject: [PATCH 033/147] Pumpkin's Revenge (#237) * Initial Commit * Update * Bunch of new stuff * Fixed fletcher arrow typo * Added reward pet, fixed typo, tweaked lose cinematic * Lots of tweaks and fixes with QA * Cleaning up a little code * Removed debug message on prince death * Added nighttime to halloween game lobby maps * Tweaked spawn rates and mob caps * Typo * Tweaked texts, cleaned import and cleared all mobs from boss cinematic * Fixed creepers not getting properly removed during boss cinematic * Reward typo * Fixed rare NPE * Typos * Tweaked mini zombie * Typo * Prevent zombie from spawning minis after being removed * Tweaked wave announcements + formated WaveVictory * Changed color of prince tag + formated ZombieSpawner * Fixed (another) rare NPE * Tweaked boss wave cinematic --- .../core/common/animation/AnimationPoint.java | 6 + .../core/common/animation/Animator.java | 11 +- .../core/common/animation/AnimatorEntity.java | 5 + .../common/animation/AnimatorFactory.java | 48 ++ .../mineplex/core/common/util/UtilEnt.java | 111 ++- .../mineplex/core/common/util/UtilFuture.java | 2 +- .../mineplex/core/common/util/UtilPlayer.java | 80 +- .../core/common/util/UtilReflection.java | 33 + .../src/mineplex/core/game/GameDisplay.java | 1 + .../src/mineplex/mapparser/GameType.java | 1 + .../src/nautilus/game/arcade/GameType.java | 2 + .../game/games/halloween/Halloween.java | 189 +++-- .../game/games/halloween/HalloweenAudio.java | 4 +- .../game/games/halloween/NamedAudio.java | 8 + .../halloween/creatures/CreatureBase.java | 72 +- .../games/halloween/kits/KitRobinHood.java | 4 +- .../game/games/halloween/kits/KitThor.java | 2 +- .../game/games/halloween/waves/WaveBase.java | 112 ++- .../games/halloween/waves/WaveVictory.java | 9 +- .../game/games/halloween2016/Crypt.java | 139 ++++ .../games/halloween2016/Halloween2016.java | 715 ++++++++++++++++++ .../games/halloween2016/PumpkinPlant.java | 107 +++ .../halloween2016/creatures/CryptBreaker.java | 256 +++++++ .../halloween2016/creatures/MobBlaze.java | 23 + .../halloween2016/creatures/MobCreeper.java | 83 ++ .../halloween2016/creatures/MobGiant.java | 190 +++++ .../creatures/MobMiniZombie.java | 70 ++ .../halloween2016/creatures/MobPigZombie.java | 72 ++ .../creatures/MobPrinceGuard.java | 236 ++++++ .../creatures/MobPumpkinPrince.java | 478 ++++++++++++ .../halloween2016/creatures/MobPumpling.java | 97 +++ .../creatures/MobSkeletonArcher.java | 53 ++ .../halloween2016/creatures/MobWitch.java | 295 ++++++++ .../halloween2016/creatures/MobZombie.java | 32 + .../creatures/MobZombieSpawner.java | 75 ++ .../tutorial/TutorialHalloween2016.java | 44 ++ .../tutorial/TutorialPhaseHalloween.java | 67 ++ .../game/games/halloween2016/wave/Wave1.java | 46 ++ .../game/games/halloween2016/wave/Wave2.java | 56 ++ .../game/games/halloween2016/wave/Wave3.java | 68 ++ .../game/games/halloween2016/wave/Wave4.java | 56 ++ .../game/games/halloween2016/wave/Wave5.java | 84 ++ .../games/halloween2016/wave/WaveBase.java | 46 ++ .../games/halloween2016/wave/WaveBoss.java | 253 +++++++ .../games/halloween2016/wave/WaveVictory.java | 52 ++ .../game/arcade/kit/perks/PerkFletcher.java | 10 +- .../arcade/kit/perks/PerkHammerThrow.java | 2 +- .../arcade/managers/NextBestGameManager.java | 2 + .../lobby/current/NewGameLobbyManager.java | 6 + 49 files changed, 4290 insertions(+), 123 deletions(-) create mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/animation/AnimatorFactory.java create mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilReflection.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/NamedAudio.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/Crypt.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/Halloween2016.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/PumpkinPlant.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/CryptBreaker.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobBlaze.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobCreeper.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobGiant.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobMiniZombie.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobPigZombie.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobPrinceGuard.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobPumpkinPrince.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobPumpling.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobSkeletonArcher.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobWitch.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobZombie.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobZombieSpawner.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/tutorial/TutorialHalloween2016.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/tutorial/TutorialPhaseHalloween.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/Wave1.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/Wave2.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/Wave3.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/Wave4.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/Wave5.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/WaveBase.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/WaveBoss.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/WaveVictory.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/animation/AnimationPoint.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/animation/AnimationPoint.java index 82d819295..a02e78796 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/animation/AnimationPoint.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/animation/AnimationPoint.java @@ -33,6 +33,12 @@ public class AnimationPoint return _tick; } + @Override + public String toString() + { + return "AnimationPoint[tick" + _tick + ", motion:[" + _move + "], dir:[" + _dir + "]]"; + } + @Override public boolean equals(Object obj) { diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/animation/Animator.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/animation/Animator.java index 2e2461fda..335f327a4 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/animation/Animator.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/animation/Animator.java @@ -1,5 +1,6 @@ package mineplex.core.common.animation; +import java.util.Collection; import java.util.HashSet; import java.util.PriorityQueue; import java.util.Set; @@ -36,6 +37,11 @@ public abstract class Animator _plugin = plugin; } + public void addPoints(Collection<AnimationPoint> points) + { + for(AnimationPoint p : points) _points.add(p); + } + public void addPoint(AnimationPoint point) { _points.add(point); } @@ -48,7 +54,9 @@ public abstract class Animator * @return Returns a cloned list of the animator points for this instance. */ public Set<AnimationPoint> getSet() { - return new HashSet<AnimationPoint>(_points); + Set<AnimationPoint> set = new HashSet<>(); + set.addAll(_points); + return set; } /** @@ -110,6 +118,7 @@ public abstract class Animator prev.setDirection(_prev.getDirection()); double diff = ((double)_tick-_prev.getTick())/(_next.getTick()-_prev.getTick()); + if(!Double.isFinite(diff)) diff = 0; prev.add(next.clone().subtract(prev).toVector().multiply(diff)); Vector dirDiff = _next.getDirection().subtract(prev.getDirection()); diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/animation/AnimatorEntity.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/animation/AnimatorEntity.java index d418a337c..9f4aa27c6 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/animation/AnimatorEntity.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/animation/AnimatorEntity.java @@ -35,5 +35,10 @@ public class AnimatorEntity extends Animator @Override protected void finish(Location loc) {} + + public Entity getEntity() + { + return _ent; + } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/animation/AnimatorFactory.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/animation/AnimatorFactory.java new file mode 100644 index 000000000..8f23274c0 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/animation/AnimatorFactory.java @@ -0,0 +1,48 @@ +package mineplex.core.common.animation; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.bukkit.Location; +import org.bukkit.util.Vector; + +/** + * A small factory class to build animations using location inputs with embedded directions. It then calculates the vector difference + * between the locations in an ordered fashion when building the list. + */ +public class AnimatorFactory +{ + + private Map<Integer, Location> _locations = new HashMap<>(); + + public void addLocation(Location loc, int tick) + { + _locations.put(tick, loc.clone()); + } + + public List<AnimationPoint> getBuildList(Location base) + { + List<AnimationPoint> list = new ArrayList<>(); + + Iterator<Entry<Integer, Location>> it = _locations.entrySet().stream() + .sorted((e1, e2) + -> Integer.compare(e1.getKey(), e2.getKey()) + ) + .iterator(); + + while(it.hasNext()) + { + Entry<Integer, Location> e = it.next(); + Vector diff = e.getValue().clone().subtract(base).toVector(); + + list.add(new AnimationPoint(e.getKey(), diff, e.getValue().getDirection())); + } + + return list; + } + +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java index 0e78782db..712eacdf4 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java @@ -1,6 +1,7 @@ package mineplex.core.common.util; import java.lang.reflect.Field; +import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; import java.util.List; @@ -132,6 +133,53 @@ public class UtilEnt } + /** + * See {@link #getEntitiesInsideEntity(Entity, List)} + * Uses all players in the same world as the entity as input + */ + public static List<Player> getPlayersInsideEntity(Entity ent) + { + return getEntitiesInsideEntity(ent, ent.getWorld().getPlayers()); + } + + /** + * See {@link #getEntitiesInsideEntity(Entity, List)} + * Uses all entities in the same world as the entity as input + */ + public static List<Entity> getEntitiesInsideEntity(Entity ent) + { + return getEntitiesInsideEntity(ent, ent.getWorld().getEntities()); + } + + /** + * See {@link #getEntitiesInsideEntity(Entity, List)} + * Auto cast to list of players + */ + public static List<Player> getPlayersInsideEntity(Entity ent, List<Player> players) + { + return getEntitiesInsideEntity(ent, players); + } + + /** + * Returns entities which are inside the provided entity's boundingbox + * @param ent The entity to check inside + * @param entities List of entities to check + * @return Returns a sublist of entities which are inside the entity's boundingbox + */ + public static <T extends Entity> List<T> getEntitiesInsideEntity(Entity ent, List<T> entities) + { + AxisAlignedBB box = ((CraftEntity)ent).getHandle().getBoundingBox(); + + List<T> list = new ArrayList<>(); + + for(T e : entities) + { + AxisAlignedBB box2 = ((CraftEntity)e).getHandle().getBoundingBox(); + if(box2.b(box)) list.add(e); + } + return list; + } + public static void Vegetate(Entity entity) { Vegetate(entity, false); @@ -345,6 +393,35 @@ public class UtilEnt } } + /** + * Set whether this entity should be ticked normally when far away. By default entities are only ticked once every 20 ticks + * when they are outside the activation range. + * + * Default ranges are calculated in a AABB fashion from their closest player: + * animalActivationRange = 32 + * monsterActivationRange = 32 + * miscActivationRange = 16 + * + * Entities that are unaffected by range (always active): + * Players, Projectiles, Enderdragon, Wither, Fireballs, Lightning strikes, TNT, Ender Crystals and Fireworks. + * + * You can make entities which are by default active (Projectiles etc) not load when far away + * or make entities that are not active by default (mobs, animals etc) load when far away + */ + public static void setTickWhenFarAway(Entity ent, boolean loadWhenFar) + { + try + { + Field state = net.minecraft.server.v1_8_R3.Entity.class.getDeclaredField("defaultActivationState"); + state.setAccessible(true); + state.setBoolean(((CraftEntity)ent).getHandle(), loadWhenFar); + } + catch(Exception e) + { + e.printStackTrace(); + } + } + public static String getName(Entity ent) { if (ent == null) @@ -578,6 +655,16 @@ public class UtilEnt return false; } + public static float getStepHeight(Entity ent) + { + return ((CraftEntity)ent).getHandle().S; + } + + public static void setStepHeight(Entity ent, float stepHeight) + { + ((CraftEntity)ent).getHandle().S = stepHeight; + } + public static boolean isGrounded(Entity ent) { @@ -813,6 +900,18 @@ public class UtilEnt return true; } + + /** + * Returns true if the entity got a path that will lead it closer to the current navigation path finding target. + * It will return false, it it is as close as it can get. Using this got an advantage compared to distance checking, as the target + * might be inside blocks, leaving the entity unable to get any closer. + * @param ent The entity to check + * @return Returns whether the entity can walk any closer to the current navigation target. + */ + public static boolean canEntityWalkCloserToNavigationTarget(Creature ent) + { + return ((CraftCreature)ent).getHandle().getNavigation().m(); + } public static int getNewEntityId() { @@ -887,7 +986,17 @@ public class UtilEnt { ((CraftEntity)ent).getHandle().setSize((float) width, (float)height); } - + + public static double getHeight(Entity ent) + { + return ((CraftEntity)ent).getHandle().length; + } + + public static double getWidth(Entity ent) + { + return ((CraftEntity)ent).getHandle().width; + } + public static void SetMetadata(Entity entity, String key, Object value) { entity.setMetadata(key, new FixedMetadataValue(UtilServer.getPlugin(), value)); diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilFuture.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilFuture.java index 2b25f9a5e..d7906385b 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilFuture.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilFuture.java @@ -86,7 +86,7 @@ public class UtilFuture CompletableFuture.allOf(values.toArray(new CompletableFuture[values.size()])); return futuresCompleted.thenApply(v -> - seqValues.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().join()))); + (Map<K, Collection<V>>) seqValues.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, entry -> (Collection<V>) entry.getValue().join()))); } /** diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java index 773fcf442..5f7e00ddc 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java @@ -1,16 +1,17 @@ package mineplex.core.common.util; -import mineplex.core.common.MinecraftVersion; -import mineplex.core.common.events.PlayerMessageEvent; -import net.md_5.bungee.api.chat.ClickEvent; -import net.md_5.bungee.api.chat.ClickEvent.Action; -import net.md_5.bungee.api.chat.HoverEvent; -import net.md_5.bungee.api.chat.TextComponent; -import net.minecraft.server.v1_8_R3.EntityPlayer; -import net.minecraft.server.v1_8_R3.Packet; -import net.minecraft.server.v1_8_R3.PacketPlayOutWorldBorder; -import net.minecraft.server.v1_8_R3.PlayerConnection; -import net.minecraft.server.v1_8_R3.WorldBorder; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; + import org.bukkit.ChatColor; import org.bukkit.GameMode; import org.bukkit.Location; @@ -26,9 +27,23 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.InventoryView; import org.bukkit.potion.PotionEffect; +import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.util.BlockIterator; import org.bukkit.util.Vector; +import mineplex.core.common.MinecraftVersion; +import mineplex.core.common.events.PlayerMessageEvent; +import net.md_5.bungee.api.chat.ClickEvent; +import net.md_5.bungee.api.chat.ClickEvent.Action; +import net.md_5.bungee.api.chat.HoverEvent; +import net.md_5.bungee.api.chat.TextComponent; +import net.minecraft.server.v1_8_R3.EntityPlayer; +import net.minecraft.server.v1_8_R3.EntityTracker; +import net.minecraft.server.v1_8_R3.EntityTrackerEntry; +import net.minecraft.server.v1_8_R3.Packet; +import net.minecraft.server.v1_8_R3.PacketPlayOutWorldBorder; +import net.minecraft.server.v1_8_R3.PlayerConnection; +import net.minecraft.server.v1_8_R3.WorldBorder; import java.util.*; public class UtilPlayer @@ -73,6 +88,49 @@ public class UtilPlayer return true; } + public static void setSpectating(Player player, Entity ent) + { + if(!ent.isValid()) return; + + player.setGameMode(GameMode.SPECTATOR); + + if(player.getSpectatorTarget() != null) + { + player.setSpectatorTarget(null); + } + + player.teleport(ent); + + if(isTracked(player, ent)) + { + player.setSpectatorTarget(ent); + } + else + { + new BukkitRunnable() + { + public void run() + { + setSpectating(player, ent); + } + }.runTaskLater(UtilServer.getPlugin(), 1); + } + } + + /** + * Returns true if the given player is tracking the given target, meaning that the player + * got the entity loaded and knows about the entity. + */ + public static boolean isTracked(Player player, Entity target) + { + EntityPlayer ep = ((CraftPlayer) player).getHandle(); + + EntityTracker tracker = ep.u().getTracker(); + EntityTrackerEntry entry = tracker.trackedEntities.get(target.getEntityId()); + + return entry.trackedPlayers.contains(ep); + } + public static void hideFrom(Player player, Collection<Player> players) { players.stream().forEach(p->p.hidePlayer(player)); } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilReflection.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilReflection.java new file mode 100644 index 000000000..079182304 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilReflection.java @@ -0,0 +1,33 @@ +package mineplex.core.common.util; + +import java.lang.reflect.Field; + +public class UtilReflection +{ + /** + * Returns the value of the field from the given object instance + */ + public static Object getValueOfField(Object object, String fieldName) + { + return getValueOfField(object.getClass(), object, fieldName); + } + + /** + * Returns the value of the field from the given object instance + */ + public static Object getValueOfField(Class<?> className, Object object, String fieldName) + { + try + { + Field f = className.getDeclaredField(fieldName); + f.setAccessible(true); + return f.get(object); + } + catch (Exception e) + { + e.printStackTrace(); + return null; + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java index aef40f7c1..136d324ab 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java @@ -25,6 +25,7 @@ public enum GameDisplay Evolution("Evolution", Material.EMERALD, (byte)0, GameCategory.ARCADE, 16), Gravity("Gravity", Material.ENDER_PORTAL_FRAME, (byte)0, GameCategory.EXTRA, 18), Halloween("Halloween Horror", Material.PUMPKIN, (byte)0, GameCategory.CLASSICS, 19), + Halloween2016("Pumpkin's Revenge", Material.PUMPKIN, (byte)0, GameCategory.CLASSICS, 63), HideSeek("Block Hunt", Material.GRASS, (byte)0, GameCategory.CLASSICS, 20), HoleInTheWall("Hole in the Wall", Material.STAINED_GLASS, (byte) 2, GameCategory.ARCADE, 52), Horse("Horseback", Material.IRON_BARDING, (byte)0, GameCategory.ARCADE, 21), diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/GameType.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/GameType.java index 006d485b0..1f4262d28 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/GameType.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/GameType.java @@ -31,6 +31,7 @@ public enum GameType Gladiators("Gladiators"), Gravity("Gravity"), Halloween("Halloween Horror"), + Halloween2016("Halloween Horror 2016"), HideSeek("Block Hunt"), Horse("Horseback"), Lobbers("Bomb Lobbers"), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java index 517358bd0..41613e265 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java @@ -40,6 +40,7 @@ import nautilus.game.arcade.game.games.gladiators.modes.OverpoweredGladiators; import nautilus.game.arcade.game.games.gladiators.modes.SmashGladiators; import nautilus.game.arcade.game.games.gravity.Gravity; import nautilus.game.arcade.game.games.halloween.Halloween; +import nautilus.game.arcade.game.games.halloween2016.Halloween2016; import nautilus.game.arcade.game.games.hideseek.HideSeek; import nautilus.game.arcade.game.games.hideseek.modes.Countdown; import nautilus.game.arcade.game.games.holeinwall.HoleInTheWall; @@ -143,6 +144,7 @@ public enum GameType { Pair.create(MinecraftVersion.ALL, "http://file.mineplex.com/ResHalloween.zip") }, true), + Halloween2016(Halloween2016.class, GameDisplay.Halloween2016), HideSeek(HideSeek.class, GameDisplay.HideSeek), HoleInTheWall(HoleInTheWall.class, GameDisplay.HoleInTheWall), Horse(Horse.class, GameDisplay.Horse), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java index 3f4c10226..a2160dda5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java @@ -1,7 +1,37 @@ package nautilus.game.arcade.game.games.halloween; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; + +import org.bukkit.ChatColor; +import org.bukkit.Difficulty; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Fireball; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityDeathEvent; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.entity.ItemSpawnEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; + import mineplex.core.common.currency.GlobalCurrency; -import mineplex.core.common.util.*; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime.TimeUnit; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; @@ -17,36 +47,38 @@ import nautilus.game.arcade.game.games.halloween.creatures.InterfaceMove; import nautilus.game.arcade.game.games.halloween.kits.KitFinn; import nautilus.game.arcade.game.games.halloween.kits.KitRobinHood; import nautilus.game.arcade.game.games.halloween.kits.KitThor; -import nautilus.game.arcade.game.games.halloween.waves.*; +import nautilus.game.arcade.game.games.halloween.waves.Wave1; +import nautilus.game.arcade.game.games.halloween.waves.Wave2; +import nautilus.game.arcade.game.games.halloween.waves.Wave3; +import nautilus.game.arcade.game.games.halloween.waves.Wave4; +import nautilus.game.arcade.game.games.halloween.waves.Wave5; +import nautilus.game.arcade.game.games.halloween.waves.WaveBase; +import nautilus.game.arcade.game.games.halloween.waves.WaveBoss; +import nautilus.game.arcade.game.games.halloween.waves.WaveVictory; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.chat.ChatStatData; import net.minecraft.server.v1_8_R3.PacketPlayOutNamedSoundEffect; -import org.bukkit.*; -import org.bukkit.block.Block; -import org.bukkit.entity.Fireball; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.*; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; - -import java.util.*; public class Halloween extends SoloGame { //Wave Data - private ArrayList<ArrayList<Location>> _spawns; + protected ArrayList<ArrayList<Location>> _spawns; - private ArrayList<WaveBase> _waves; - private int _wave = 0; + protected ArrayList<WaveBase> _waves; + protected int _wave = 0; - private int _maxMobs = 80; - private ArrayList<CreatureBase> _mobs = new ArrayList<CreatureBase>(); + protected int _maxMobs = 80; + protected ArrayList<CreatureBase<?>> _mobs = new ArrayList<>(); - private HashMap<Player, Long> _damageTime = new HashMap<Player, Long>(); + protected HashMap<Player, Long> _damageTime = new HashMap<Player, Long>(); - private HashSet<Player> _soundOff = new HashSet<Player>(); + protected HashSet<Player> _soundOff = new HashSet<Player>(); + + protected UpdateType _updateCreatureMoveRate = UpdateType.FASTEST; + + protected boolean doVoices = true; + + public String Objective = null; public long total = 0; public long move = 0; @@ -78,7 +110,7 @@ public class Halloween extends SoloGame public Halloween(ArcadeManager manager) { - super(manager, GameType.Halloween, + this(manager, GameType.Halloween, new Kit[] { @@ -94,6 +126,12 @@ public class Halloween extends SoloGame "Defeat the waves of monsters", "Kill the Pumpkin King" }); + } + + protected Halloween(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc) + { + super(manager, gameType, kits, gameDesc); + this.DamagePvP = false; @@ -116,6 +154,19 @@ public class Halloween extends SoloGame BlankLine, new ChatStatData("kit", "Kit", true) ); + + _help = new String[] + { + C.cGreen + "Giants one hit kill you! Stay away!!!", + C.cAqua + "Work together with your team mates.", + C.cGreen + "Each kit gives a buff to nearby allies.", + C.cAqua + "Kill monsters to keep their numbers down.", + C.cGreen + "Kill giants quickly.", + C.cAqua + "Defend your team mates from monsters.", + C.cGreen + "Zombies, Giants and Spiders get faster over time.", + C.cAqua + "Stick together to survive.", + C.cGreen + "The Pumpkin King gets harder over time!", + }; } @Override @@ -134,7 +185,7 @@ public class Halloween extends SoloGame _waves.add(new Wave4(this)); _waves.add(new Wave5(this)); _waves.add(new WaveBoss(this)); - _waves.add(new WaveVictory(this)); + _waves.add(new WaveVictory(this, GetSpawnSet(3))); //Make zombies break doors WorldData.World.setDifficulty(Difficulty.HARD); @@ -146,13 +197,20 @@ public class Halloween extends SoloGame if (event.GetState() != GameState.End) return; - for (CreatureBase ent : _mobs) - ent.GetEntity().remove(); + for (CreatureBase<?> ent : _mobs) + { + ent.remove(); + } _mobs.clear(); _spawns.clear(); } + public ArrayList<CreatureBase<?>> getMobs() + { + return _mobs; + } + @EventHandler(priority = EventPriority.MONITOR) public void TeamGen(GameStateChangeEvent event) { @@ -168,6 +226,8 @@ public class Halloween extends SoloGame if (event.GetState() != GameState.Live) return; + if(!doVoices) return; + Announce(C.Bold + "Type " + C.cGreen + C.Bold + "/voice" + C.cWhite + C.Bold + " to disable voice audio."); } @@ -253,8 +313,12 @@ public class Halloween extends SoloGame if (!IsLive()) return; + + if(_waves.get(_wave) instanceof WaveVictory || + _waves.get(_wave) instanceof nautilus.game.arcade.game.games.halloween2016.wave.WaveVictory) + return; - if (Math.random() > 0.6) + if (Math.random() > 0.2) return; for (Player player : UtilServer.getPlayers()) @@ -297,12 +361,12 @@ public class Halloween extends SoloGame return locSet.get(UtilMath.r(locSet.size())); } - public void AddCreature(CreatureBase mob) + public void AddCreature(CreatureBase<?> mob) { _mobs.add(0, mob); } - public ArrayList<CreatureBase> GetCreatures() + public ArrayList<CreatureBase<?>> GetCreatures() { return _mobs; } @@ -310,7 +374,7 @@ public class Halloween extends SoloGame @EventHandler public void CreatureMoveUpdate(UpdateEvent event) { - if (event.getType() != UpdateType.FASTEST) + if (event.getType() != _updateCreatureMoveRate) return; if (_mobs.isEmpty()) @@ -318,7 +382,7 @@ public class Halloween extends SoloGame long start = System.currentTimeMillis(); - CreatureBase base = _mobs.remove(0); + CreatureBase<?> base = _mobs.remove(0); if (base instanceof InterfaceMove) { @@ -342,25 +406,33 @@ public class Halloween extends SoloGame return; //Clean - Iterator<CreatureBase> mobIterator = _mobs.iterator(); + Iterator<CreatureBase<?>> mobIterator = _mobs.iterator(); while (mobIterator.hasNext()) { - CreatureBase base = mobIterator.next(); + CreatureBase<?> base = mobIterator.next(); if (base.Updater(event)) + { + onRemove(base); + base.remove(); mobIterator.remove(); + } } total += System.currentTimeMillis() - start; update += System.currentTimeMillis() - start; } + + public void onRemove(CreatureBase<?> mob) + { + } @EventHandler public void CreatureDamage(CustomDamageEvent event) { long start = System.currentTimeMillis(); - for (CreatureBase base : _mobs) + for (CreatureBase<?> base : _mobs) base.Damage(event); total += System.currentTimeMillis() - start; @@ -372,7 +444,7 @@ public class Halloween extends SoloGame { long start = System.currentTimeMillis(); - for (CreatureBase base : _mobs) + for (CreatureBase<?> base : _mobs) base.Target(event); total += System.currentTimeMillis() - start; @@ -451,7 +523,7 @@ public class Halloween extends SoloGame { Block block = blockIterator.next(); - if (block.getY() < 4) + if (block.getY() < 4 || block.getY() <= WorldData.MinY) blockIterator.remove(); } @@ -494,40 +566,6 @@ public class Halloween extends SoloGame { return _maxMobs; } - - private long _helpTimer = 0; - private int _helpIndex = 0; - private String[] _help = new String[] - { - C.cGreen + "Giants one hit kill you! Stay away!!!", - C.cAqua + "Work together with your team mates.", - C.cGreen + "Each kit gives a buff to nearby allies.", - C.cAqua + "Kill monsters to keep their numbers down.", - C.cGreen + "Kill giants quickly.", - C.cAqua + "Defend your team mates from monsters.", - C.cGreen + "Zombies, Giants and Spiders get faster over time.", - C.cAqua + "Stick together to survive.", - C.cGreen + "The Pumpkin King gets harder over time!", - }; - - @EventHandler - public void StateUpdate(UpdateEvent event) - { - if (event.getType() != UpdateType.SEC) - return; - - if (this.GetState() != GameState.Recruit) - return; - - if (!UtilTime.elapsed(_helpTimer, 8000)) - return; - - _helpTimer = System.currentTimeMillis(); - - Announce(C.cWhite + C.Bold + "TIP " + ChatColor.RESET + _help[_helpIndex]); - - _helpIndex = (_helpIndex + 1)%_help.length; - } @Override @EventHandler @@ -552,7 +590,7 @@ public class Halloween extends SoloGame Scoreboard.writeNewLine(); Scoreboard.write(C.cYellow + C.Bold + "Players"); - if (GetPlayers(true).size() < 8) + if (GetPlayers(true).size() < 5) { for (Player player : GetPlayers(true)) { @@ -564,12 +602,21 @@ public class Halloween extends SoloGame Scoreboard.write(GetPlayers(true).size() + " Alive"); } + if(Objective != null) + { + Scoreboard.writeNewLine(); + Scoreboard.write(C.cYellow + C.Bold + "Objective"); + Scoreboard.write(Objective); + } + Scoreboard.draw(); } @EventHandler public void soundOff(PlayerCommandPreprocessEvent event) { + if(!doVoices) return; + if (event.getMessage().equalsIgnoreCase("/voice")) { if (_soundOff.remove(event.getPlayer())) @@ -587,12 +634,12 @@ public class Halloween extends SoloGame } } - public void playSound(HalloweenAudio audio) + public void playSound(NamedAudio audio) { for (Player player : UtilServer.getPlayers()) if (!_soundOff.contains(player)) { - PacketPlayOutNamedSoundEffect packet = new PacketPlayOutNamedSoundEffect(audio.getName(), + PacketPlayOutNamedSoundEffect packet = new PacketPlayOutNamedSoundEffect(audio.getAudioPath(), player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ(), 20f, 1F); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/HalloweenAudio.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/HalloweenAudio.java index c737a3a68..0b51ac003 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/HalloweenAudio.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/HalloweenAudio.java @@ -1,6 +1,6 @@ package nautilus.game.arcade.game.games.halloween; -public enum HalloweenAudio +public enum HalloweenAudio implements NamedAudio { WAVE_1("halloween.wave1"), WAVE_2("halloween.wave2"), @@ -25,7 +25,7 @@ public enum HalloweenAudio _name = name; } - public String getName() + public String getAudioPath() { return _name; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/NamedAudio.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/NamedAudio.java new file mode 100644 index 000000000..ab4b6f987 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/NamedAudio.java @@ -0,0 +1,8 @@ +package nautilus.game.arcade.game.games.halloween; + +public interface NamedAudio +{ + + public String getAudioPath(); + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/CreatureBase.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/CreatureBase.java index fb4b3232c..69dd85093 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/CreatureBase.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/CreatureBase.java @@ -1,18 +1,22 @@ package nautilus.game.arcade.game.games.halloween.creatures; +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.Location; +import org.bukkit.entity.Creature; +import org.bukkit.entity.Damageable; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.entity.EntityTargetEvent; + import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.halloween.Halloween; -import org.bukkit.Location; -import org.bukkit.entity.Creature; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityTargetEvent; -import org.bukkit.util.Vector; - public abstract class CreatureBase<T extends LivingEntity> { public Halloween Host; @@ -22,6 +26,8 @@ public abstract class CreatureBase<T extends LivingEntity> private Location _target; private long _targetTime; + + private List<Entity> _parts = new ArrayList<>(); public CreatureBase(Halloween game, String name, Class<T> mobClass, Location loc) { @@ -37,11 +43,39 @@ public abstract class CreatureBase<T extends LivingEntity> _ent.setCustomName(name); _ent.setCustomNameVisible(true); } + + addEntityPart(_ent); SpawnCustom(_ent); game.CreatureAllowOverride = false; } + + protected void addEntityPart(Entity ent) + { + if(_parts.contains(ent)) return; + _parts.add(ent); + } + + public List<Entity> getEntityParts() + { + return new ArrayList<>(_parts); + } + + public List<Player> getInsideBoundingBox() + { + List<Player> players = Host.GetPlayers(true); + List<Player> list = UtilEnt.getPlayersInsideEntity(_ent, players); + for(Entity ent : _parts) + { + players.removeAll(list); + if(players.isEmpty()) break; + + list.addAll(UtilEnt.getPlayersInsideEntity(ent, players)); + } + + return list; + } public abstract void SpawnCustom(T ent); @@ -114,8 +148,13 @@ public abstract class CreatureBase<T extends LivingEntity> public abstract void Damage(CustomDamageEvent event); public abstract void Target(EntityTargetEvent event); - + public void CreatureMove(Creature creature) + { + CreatureMove(creature, 1); + } + + public void CreatureMove(Creature creature, float speed) { //New Target SetTarget(GetRoamTarget()); @@ -131,8 +170,23 @@ public abstract class CreatureBase<T extends LivingEntity> //Move else { - UtilEnt.CreatureMove(creature, GetTarget(), 1f); + UtilEnt.CreatureMove(creature, GetTarget(), speed); Host.moves++; } } + + public void remove() + { + for(Entity ent : _parts) + { + if(ent instanceof Damageable) + { + ((Damageable) ent).damage(((Damageable) ent).getHealth()); + } + else + { + ent.remove(); + } + } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitRobinHood.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitRobinHood.java index cd31b70d3..c7dcb1f32 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitRobinHood.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitRobinHood.java @@ -31,8 +31,8 @@ public class KitRobinHood extends ProgressingKit }; private static final Perk[] PERKS = { - new PerkFletcher(1, 8, true), - new PerkBarrage(8, 125, true, true), + new PerkFletcher(3, 6, true), + new PerkBarrage(8, 125, true, false), new PerkQuickshotRobinHood() }; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitThor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitThor.java index 58bba7619..84ffe7f24 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitThor.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitThor.java @@ -32,7 +32,7 @@ public class KitThor extends ProgressingKit private static final Perk[] PERKS = { new PerkKnockbackAttack(2), - new PerkFletcher(2, 2, true, 9), + new PerkFletcher(2, 2, true, 8), new PerkSeismicHammer(), new PerkHammerThrow(), }; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/WaveBase.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/WaveBase.java index 3a8a07c4a..9d5a06b62 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/WaveBase.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/WaveBase.java @@ -1,6 +1,6 @@ package nautilus.game.arcade.game.games.halloween.waves; -import java.util.ArrayList; +import java.util.List; import org.bukkit.Location; import org.bukkit.Material; @@ -9,29 +9,40 @@ import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; import org.bukkit.util.Vector; -import nautilus.game.arcade.game.games.halloween.Halloween; -import nautilus.game.arcade.game.games.halloween.HalloweenAudio; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.common.util.UtilTime; +import nautilus.game.arcade.game.games.halloween.Halloween; +import nautilus.game.arcade.game.games.halloween.NamedAudio; public abstract class WaveBase { protected Halloween Host; protected String _name; - protected HalloweenAudio _audio; + protected boolean _displayWaveNumber = true; + protected boolean _announceWaveChat = true; + protected boolean _announceWaveTitle = true; + protected NamedAudio _audio; protected long _start; protected long _duration; private int _tick = 0; - protected ArrayList<Location> _spawns; + protected List<Location> _spawns; - public WaveBase(Halloween host, String name, long duration, ArrayList<Location> spawns, HalloweenAudio audio) + private boolean _spawnBeacons = true; + private boolean _announceStart = true; + private boolean _displayProgress = true; + + protected String _titleColor = C.cYellow; + + protected String[] _desc = null; + + public WaveBase(Halloween host, String name, long duration, List<Location> spawns, NamedAudio audio) { Host = host; @@ -66,22 +77,57 @@ public abstract class WaveBase if (_tick == 0) { System.out.println("Wave " + wave + " has started."); - Host.Announce(C.cRed + C.Bold + "Wave " + wave + ": " + C.cYellow + _name); - - UtilTextMiddle.display(C.cYellow + "Wave " + wave, _name, 10, 100, 20); - - if (_audio != null) - { - Host.playSound(_audio); + if(_announceStart) + { + if(_announceWaveChat) + { + String number = C.cRed + C.Bold + "Wave " + wave; + String name = C.cYellow + _name; + if(name != null) + { + number += ": "; + } + if(_name == null) name = ""; + if(!_displayWaveNumber) number = ""; + + String waveName = number + name; + + Host.Announce(waveName); + } + if(_desc != null) + { + for(String l : _desc) + { + Host.Announce(C.cGray + " ● " + C.cYellow + l); + } + } + + if(_announceWaveTitle) + { + String waveTitle = _displayWaveNumber ? _titleColor + "Wave " + wave : _name; + String waveSub = _displayWaveNumber ? _name : ""; + UtilTextMiddle.display(waveTitle, waveSub, 10, 100, 20); + } + + + if (_audio != null) + { + Host.playSound(_audio); + } } } //Display - for (Player player : UtilServer.getPlayers()) - player.setExp(Math.min(0.999f, (float)(_duration - (System.currentTimeMillis() - _start)) / (float)_duration)); + if(_displayProgress) + { + for (Player player : UtilServer.getPlayers()) + { + player.setExp(Math.min(0.999f, (float)(_duration - (System.currentTimeMillis() - _start)) / (float)_duration)); + } + } //Spawn Beacons - if (_tick == 0) + if (_tick == 0 && _spawnBeacons) SpawnBeacons(_spawns); //Spawn @@ -92,7 +138,7 @@ public abstract class WaveBase return false; } - public void SpawnBeacons(ArrayList<Location> locs) + public void SpawnBeacons(List<Location> locs) { //Average Location Vector total = new Vector(0,0,0); @@ -121,6 +167,36 @@ public abstract class WaveBase { return true; } + + public void setAnnounceStart(boolean announceStart) + { + _announceStart = announceStart; + } + + public void setDisplayProgress(boolean displayProgress) + { + _displayProgress = displayProgress; + } + + public void setSpawnBeacons(boolean spawnBeacons) + { + _spawnBeacons = spawnBeacons; + } + + public boolean getAnnounceStart() + { + return _announceStart; + } + + public boolean getDisplayProgress() + { + return _displayProgress; + } + + public boolean getSpawnBeacons() + { + return _spawnBeacons; + } public abstract void Spawn(int tick); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/WaveVictory.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/WaveVictory.java index 618658947..dada174c5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/WaveVictory.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/WaveVictory.java @@ -1,6 +1,9 @@ package nautilus.game.arcade.game.games.halloween.waves; +import java.util.List; + import org.bukkit.Effect; +import org.bukkit.Location; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -11,9 +14,9 @@ import nautilus.game.arcade.game.games.halloween.creatures.CreatureBase; public class WaveVictory extends WaveBase { - public WaveVictory(Halloween host) + public WaveVictory(Halloween host, List<Location> beaconSpawn) { - super(host, "Celebration!", 15000, host.GetSpawnSet(3), null); + super(host, "Celebration!", 15000, beaconSpawn, null); } @Override @@ -28,7 +31,7 @@ public class WaveVictory extends WaveBase player.playEffect(Host.WorldData.GetDataLocs("BLACK").get(0), Effect.RECORD_PLAY, 2259); //Mobs - for (CreatureBase<LivingEntity> mob : Host.GetCreatures()) + for (CreatureBase<? extends LivingEntity> mob : Host.GetCreatures()) mob.GetEntity().damage(5); //Time diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/Crypt.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/Crypt.java new file mode 100644 index 000000000..562bd08cc --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/Crypt.java @@ -0,0 +1,139 @@ +package nautilus.game.arcade.game.games.halloween2016; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.entity.Entity; + +import mineplex.core.common.block.schematic.Schematic; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextTop; +import mineplex.core.common.util.UtilTime; + +public class Crypt +{ + + private int _maxHealth = 2000; + private int _health = _maxHealth; + + private List<Schematic> _states; + private int _stateIndex = 0; + private Location _schematicBase; + + private Map<Entity, Integer> _damageCooldown = new HashMap<>(); + + private Halloween2016 _host; + + public Crypt(Halloween2016 host, Location base, List<Schematic> states) + { + _host = host; + _states = new ArrayList<>(); + _states.addAll(states); + _schematicBase = base.clone(); + } + + public boolean tryDamage(Entity mob, int damage, int cooldown) + { + if(isDestroyed()) return false; + Integer lastTime = _damageCooldown.get(mob); + if(lastTime != null && lastTime > UtilTime.getServerTick()) return false; + + _health -= damage; + _damageCooldown.put(mob, UtilTime.getServerTick() + cooldown); + + updateState(damage); + + return true; + } + + public void setHealth(int health) + { + int diff = _health-health; + _health = health; + updateState(diff); + } + + public void updateHealthDisplay() + { + UtilTextTop.displayProgress(C.cRed + C.Bold + "Crypt", getHealthProgress(), UtilServer.getPlayers()); + } + + public float getHealthProgress() + { + return Math.max(0, _health/ (float) _maxHealth); + } + + public int getMaxHealth() + { + return _maxHealth; + } + + public int getHealth() + { + return _health; + } + + public int getStateIndex() + { + return _stateIndex; + } + + public Location getSchematicBase() + { + return _schematicBase.clone(); + } + + public void updateState(int damage) + { + float prevProg = (damage + _health) / (float) _maxHealth; + float progress = getHealthProgress(); + + int state = (int) (_states.size() * (1-progress)); + if(state != _stateIndex && state < _states.size()) + { + _stateIndex = state; + _states.get(state).paste(_schematicBase, false, true); + } + + int iprog = (int) Math.ceil(progress*100); + int iprevProg = (int) Math.ceil(prevProg*100); + + if((iprog%10 == 0 || iprog <= 5) && iprevProg > iprog) + { + String color = C.cGreen; + if(iprog <= 60) color = C.cYellow; + if(iprog <= 30) color = C.cGold; + if(iprog <= 10) color = C.cRed; + + if(iprog == 0) + { + _host.Announce(F.main("Crypt", "The crypt has been destroyed!"), true); + } + else + { + _host.Announce(F.main("Crypt", "The crypt only has " + color + C.Bold + iprog + "%" + C.mBody + " left!"), true); + } + + if(iprog == 0) + { + for(Location loc : _host.getInfrontOfDoorTargets()) + { + loc.getWorld().playEffect(loc, Effect.EXPLOSION_HUGE, 0); + loc.getWorld().strikeLightningEffect(loc); + } + } + } + } + + public boolean isDestroyed() + { + return _health <= 0; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/Halloween2016.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/Halloween2016.java new file mode 100644 index 000000000..4fef083cc --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/Halloween2016.java @@ -0,0 +1,715 @@ +package nautilus.game.arcade.game.games.halloween2016; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.block.Block; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDeathEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +import mineplex.core.common.animation.AnimationPoint; +import mineplex.core.common.animation.Animator; +import mineplex.core.common.animation.AnimatorFactory; +import mineplex.core.common.block.schematic.Schematic; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.reward.RewardRarity; +import mineplex.core.reward.rewards.PetReward; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +import javafx.util.Pair; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.games.halloween.Halloween; +import nautilus.game.arcade.game.games.halloween.creatures.CreatureBase; +import nautilus.game.arcade.game.games.halloween.kits.KitFinn; +import nautilus.game.arcade.game.games.halloween.kits.KitRobinHood; +import nautilus.game.arcade.game.games.halloween.kits.KitThor; +import nautilus.game.arcade.game.games.halloween2016.creatures.MobPumpling; +import nautilus.game.arcade.game.games.halloween2016.tutorial.TutorialHalloween2016; +import nautilus.game.arcade.game.games.halloween2016.wave.Wave1; +import nautilus.game.arcade.game.games.halloween2016.wave.Wave2; +import nautilus.game.arcade.game.games.halloween2016.wave.Wave3; +import nautilus.game.arcade.game.games.halloween2016.wave.Wave4; +import nautilus.game.arcade.game.games.halloween2016.wave.Wave5; +import nautilus.game.arcade.game.games.halloween2016.wave.WaveBoss; +import nautilus.game.arcade.game.games.halloween2016.wave.WaveVictory; +import nautilus.game.arcade.kit.Kit; + +public class Halloween2016 extends Halloween +{ + + private List<PumpkinPlant> _pumpkins = new ArrayList<>(); + private Crypt _crypt; + + private Animator _introAnimator; + + private int _maxPumplings = 30; + private int _maxNonPumplings = 65; + + private double _mobCapMultiplier = 1; + private int _defaultMaxPlayerCount = 16; + + private List<MobPumpling> _pumplings = new ArrayList<>(); + private List<CreatureBase<?>> _nonPumplings = new ArrayList<>(); + + private List<List<Location>> _lanes = new ArrayList<>(); + + private Location _cryptView; + + private Location _lockAllPlayers = null; + private Map<Player, Pair<Location, GameMode>> _playerPreLockData = new HashMap<>(); + + private static boolean DO_TUTORIALS = true; + + public Halloween2016(ArcadeManager manager) + { + super(manager, GameType.Halloween2016, + new Kit[] + { + new KitFinn(manager), + new KitRobinHood(manager), + new KitThor(manager) + }, + new String[] + { + "Do not die.", + "Work as a team!", + "Defeat the waves of monsters", + "Kill the Pumpkin Prince", + "Destroy pumpkins by hitting them 3 times", + "Protect the crypt!" + } + ); + + _help = new String[] + { + C.cGreen + "Giants one hit kill you! Stay away!!!", + C.cAqua + "Work together with your teammates.", + C.cGreen + "Each kit gives a buff to nearby allies.", + C.cAqua + "Kill monsters to keep their numbers down.", + C.cGreen + "Giants instantly destroy the crypt! Kill them quickly!", + C.cAqua + "Defend your teammates from monsters.", + C.cGreen + "Zombies, Giants and Spiders get faster over time.", + C.cAqua + "Stick together to survive.", + C.cGreen + "The Pumpkin Prince gets harder over time!", + C.cAqua + "Protect the crypt to not lose the game!", + C.cGreen + "Pumplings spawn from pumpkins. Hit the pumpkins 3 times to prevent it from spawning.", + }; + + _updateCreatureMoveRate = UpdateType.TICK; + EnableTutorials = DO_TUTORIALS; + + doVoices = false; + } + + public void setObjective(String objective) + { + Objective = objective; + Announce(F.main("Objective", C.cYellow + C.Bold + objective)); + } + + public void unlockAllPlayers() + { + if(_lockAllPlayers == null) return; + + _lockAllPlayers = null; + for(Entry<Player, Pair<Location, GameMode>> e : _playerPreLockData.entrySet()) + { + e.getKey().teleport(e.getValue().getKey()); + e.getKey().setGameMode(e.getValue().getValue()); + if(IsAlive(e.getKey())) + { + UtilPlayer.showForAll(e.getKey()); + } + } + _playerPreLockData.clear(); + + Manager.getCosmeticManager().setHideParticles(false); + } + + public void lockAllPlayers(Location loc) + { + unlockAllPlayers(); + + _lockAllPlayers = loc; + + Manager.getCosmeticManager().setHideParticles(true); + } + + @EventHandler + public void lockPlayerTask(UpdateEvent event) + { + if(event.getType() != UpdateType.TICK) return; + + if(_lockAllPlayers != null) + { + for(Player p : Bukkit.getOnlinePlayers()) + { + if(!_playerPreLockData.containsKey(p)) + { + _playerPreLockData.put(p, new Pair<Location, GameMode>(p.getLocation(), p.getGameMode())); + p.setGameMode(GameMode.SPECTATOR); + } + p.teleport(_lockAllPlayers); + if(IsAlive(p)) + { + UtilPlayer.hideFromAll(p); + } + } + } + } + + @EventHandler + @Override + public void onGameStart(GameStateChangeEvent event) + { + super.onGameStart(event); + + if(event.GetState() != GameState.Live) return; + + _mobCapMultiplier = (double) GetPlayers(true).size() / (double) _defaultMaxPlayerCount; + if(_mobCapMultiplier < 0.5) + { + _mobCapMultiplier = 0.5; + } + + _maxNonPumplings *= _mobCapMultiplier; + _maxPumplings *= _mobCapMultiplier; + _maxMobs *= _mobCapMultiplier; + } + + public int getMaxPumplings() + { + return _maxPumplings; + } + + public void setMaxPumplings(int maxPumplings) + { + _maxPumplings = maxPumplings; + } + + @Override + public void ParseData() + { + List<Schematic> schematics = new ArrayList<>(); + Location doorSchematicLocation = getDoorSchematicLocation(); + _crypt = new Crypt(this, getDoorSchematicLocation(), schematics); + + for(Location loc : getPumkinSpawns()) + { + _pumpkins.add(new PumpkinPlant(this, loc)); + } + + _lanes.add(getBackLane()); + _lanes.add(getLeftLane()); + _lanes.add(getRightLane()); + _lanes.add(getMainLane()); + _lanes.add(getGraveLane()); + + _waves = new ArrayList<>(); + _waves.add(new Wave1(this)); + _waves.add(new Wave2(this)); + _waves.add(new Wave3(this)); + _waves.add(new Wave4(this)); + _waves.add(new Wave5(this)); + _waves.add(new WaveBoss(this)); + _waves.add(new WaveVictory(this, getMobSpawns())); + + _spawns = new ArrayList<>(); + + + CreatureAllowOverride = true; + ArmorStand bat = doorSchematicLocation.getWorld().spawn(doorSchematicLocation, ArmorStand.class); + CreatureAllowOverride = false; + UtilEnt.Vegetate(bat, true); + UtilEnt.setAI(bat, false); + UtilEnt.setTickWhenFarAway(bat, true); + bat.setRemoveWhenFarAway(false); + bat.setVisible(false); + + _introAnimator = new Animator(Manager.getPlugin()) + { + private int _tick = 0; + @Override + protected void tick(Location loc) + { + if(loc == null) return; + + for(Player p : Halloween2016.this.GetPlayers(false)) + { + if(p.getGameMode() != GameMode.SPECTATOR) p.setGameMode(GameMode.SPECTATOR); + if(!p.getAllowFlight()) p.setAllowFlight(true); + if(!p.isFlying()) p.setFlying(true); + + if(_tick%3 == 0) p.teleport(loc); + } + + _tick++; + } + + @Override + protected void finish(Location loc) + {} + }; + + _cryptView = WorldData.GetCustomLocs("CryptView").get(0); + _cryptView.setDirection(getClosest(_cryptView, "PINK").subtract(_cryptView).toVector()); + + AnimatorFactory factory = new AnimatorFactory(); + + double lastEntry = 0; + double firstEntry = Double.MAX_VALUE; + Location first = null; + + for(Entry<String, ArrayList<Location>> point : WorldData.GetAllCustomLocs().entrySet()) + { + String[] args = point.getKey().split(" "); + if(args.length < 2) continue; + if(args[0].equals("Intro")) + { + try + { + double sec = Double.parseDouble(args[1]); + double delay = 0; + try + { + delay = Double.parseDouble(args[2]); + } + catch(Exception e1) {} + int tick = (int) (sec*20); + int tickdelay = (int) (delay*20); + + Location loc = point.getValue().get(0); + Location lookingAt = getClosest(loc, "PINK"); + + loc.setDirection(lookingAt.subtract(loc).toVector()); + + factory.addLocation(loc, tick); + if(tickdelay > 0) factory.addLocation(loc, tickdelay); + + if(sec > lastEntry) lastEntry = sec; + if(delay > lastEntry) lastEntry = delay; + + if(sec < firstEntry) + { + firstEntry = sec; + first = loc.clone(); + } + } + catch(Exception e2) {} + } + } + + System.out.print("Scanned " + WorldData.GetAllCustomLocs().entrySet().size() + " data points"); + + List<AnimationPoint> animation = factory.getBuildList(first); + _introAnimator.addPoints(animation); + + System.out.println("Loaded intro animation with " + _introAnimator.getSet().size() + " | " + animation.size() + " points and duration of " + lastEntry + "s"); + + GameTeam team = GetTeamList().get(0); + team.setTutorial(new TutorialHalloween2016(this, _introAnimator, team, first, (int) (lastEntry * 20))); + } + + public Location getInfrontOfCrypt() + { + return WorldData.GetCustomLocs("PumpkinKing Win").get(0).clone(); + } + + public Location getPrinceTargetInfrontOfCrypt() + { + return WorldData.GetCustomLocs("PrinceTarget").get(0).clone(); + } + + public Location getPrinceSpawn() + { + return WorldData.GetCustomLocs("PrinceSpawn").get(0).clone(); + } + + + public Location getClosest(Location loc, String dataSet) + { + Location c = null; + double dist = 0; + for(Location l : WorldData.GetDataLocs(dataSet)) + { + double ldist = loc.distanceSquared(l); + if(c == null || ldist <= dist) + { + c = l; + dist = ldist; + } + } + if(c == null) return null; + return c.clone(); + } + + public Crypt getCrypt() + { + return _crypt; + } + + public Location getGiantSpawn() + { + return getMainLane().get(UtilMath.r(getMainLane().size())); + } + + public List<Location> getMainLane() + { + return WorldData.GetDataLocs("RED"); + } + + public List<Location> getLeftLane() + { + return WorldData.GetDataLocs("MAGENTA"); + } + + public List<Location> getBackLane() + { + return WorldData.GetDataLocs("LIGHT_BLUE"); + } + + public List<Location> getRightLane() + { + return WorldData.GetDataLocs("YELLOW"); + } + + public List<Location> getGraveLane() + { + return WorldData.GetDataLocs("MAGENTA"); + } + + public List<Location> getRandomLane() + { + List<Location> lane = new ArrayList<>(); + lane.addAll(_lanes.get(UtilMath.r(_lanes.size()))); + return lane; + } + + public List<Location> getMobSpawns() + { + List<Location> list = new ArrayList<>(); + for(List<Location> lane : _lanes) + { + list.addAll(lane); + } + return list; + } + + public List<Location> getPumkinSpawns() + { + return new ArrayList<>(WorldData.GetDataLocs("ORANGE")); + } + + public List<Location> getInfrontOfDoorTargets() + { + return new ArrayList<>(WorldData.GetDataLocs("BLUE")); + } + + public Location getDoorSchematicLocation() + { + return WorldData.GetCustomLocs("Door Schematic Paste").get(0).clone(); + } + + @EventHandler + public void updatePumpkinPlants(UpdateEvent event) + { + if(!IsLive()) return; + + if(event.getType() != UpdateType.TICK) return; + + List<PumpkinPlant> notGrowing = new ArrayList<>(); + int growing = 0; + for(PumpkinPlant plant : _pumpkins) + { + if(plant.isGrowing()) + { + growing++; + } + else + { + notGrowing.add(plant); + } + plant.tick(); + } + + if(!notGrowing.isEmpty() && growing + getPumplings().size() < getMaxPumplings()) + { + notGrowing.get(UtilMath.r(notGrowing.size())).startGrow(); + } + } + + public Location getCryptView() + { + return _cryptView.clone(); + } + + + @Override + @EventHandler + public void WaveUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (!IsLive()) + return; + + if(_crypt.isDestroyed() && !(_waves.get(_wave) instanceof WaveBoss) && !(_waves.get(_wave) instanceof WaveVictory)) + { + for(CreatureBase<?> c : _mobs) + { + c.remove(); + } + + Announce(F.main("Objective", C.cRed + C.Bold + "Objective failed!")); + endGame(GetTeam(ChatColor.RED)); + + return; + } + + super.WaveUpdate(event); + } + + + @EventHandler + public void onUpdateCrypt(UpdateEvent event) + { + if(event.getType() != UpdateType.TICK) return; + if(!IsLive()) return; + if(_crypt.isDestroyed()) return; + _crypt.updateHealthDisplay(); + } + + @EventHandler + public void onInteract(PlayerInteractEvent event) + { + if(event.getAction() != Action.LEFT_CLICK_BLOCK) return; + if(event.getClickedBlock() == null) return; + + Block block = event.getClickedBlock(); + + for(PumpkinPlant plant : _pumpkins) + { + plant.hit(block); + } + } + + @Override + public void AddCreature(CreatureBase<?> mob) + { + AddCreature(mob, true); + } + + public void AddCreature(CreatureBase<?> mob, boolean cap) + { + super.AddCreature(mob); + if(!cap) return; + + if(mob instanceof MobPumpling) + { + _pumplings.add((MobPumpling) mob); + } + else + { + _nonPumplings.add(mob); + } + } + + public List<MobPumpling> getPumplings() + { + return _pumplings; + } + + public List<CreatureBase<?>> getNonPumplings() + { + return _nonPumplings; + } + + + public int getMaxNonPumplings() + { + return _maxNonPumplings; + } + + @Override + public void onRemove(CreatureBase<?> mob) + { + _pumplings.remove(mob); + _nonPumplings.remove(mob); + } + + + @EventHandler + public void onCommand(PlayerCommandPreprocessEvent event) + { + if(!UtilServer.isTestServer()) return; + + + String[] args = event.getMessage().split(" "); + boolean orig = event.isCancelled(); + event.setCancelled(true); + if(args[0].equalsIgnoreCase("/setwave")) + { + if(event.getMessage().matches("/setwave [0-9]+")) + { + Announce(event.getPlayer().getName() + " set wave to " + args[1], true); + _wave = Integer.parseInt(args[1]); + } + else + { + event.getPlayer().sendMessage("Use /setwave #Wave"); + } + } + else if(args[0].equalsIgnoreCase("/god")) + { + Announce(event.getPlayer().getName() + " made everyone 'gods'", true); + for(Player p : GetPlayers(false)) + { + p.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 99999, 200, true, false), true); + p.addPotionEffect(new PotionEffect(PotionEffectType.SATURATION, 99999, 200, true, false), true); + p.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 99999, 200, true, false), true); + } + } + else if(args[0].equalsIgnoreCase("/degod")) + { + Announce(event.getPlayer().getName() + " made everyone no longer 'gods'", true); + for(Player p : GetPlayers(false)) + { + p.removePotionEffect(PotionEffectType.REGENERATION); + p.removePotionEffect(PotionEffectType.SATURATION); + p.removePotionEffect(PotionEffectType.NIGHT_VISION); + } + } + else if(args[0].equals("/tutorial")) + { + if(args.length != 2) + { + event.getPlayer().sendMessage("Use /tutorial <true/false> - true = tutorial enabled before game"); + return; + } + if(args[1].equalsIgnoreCase("true") || args[1].equalsIgnoreCase("on")) + { + DO_TUTORIALS = true; + Announce(event.getPlayer().getName() + " enabled tutorials before games starts"); + } + else if(args[1].equalsIgnoreCase("false") || args[1].equalsIgnoreCase("off")) + { + DO_TUTORIALS = false; + Announce(event.getPlayer().getName() + " disabled tutorials before games starts"); + } + else + { + event.getPlayer().sendMessage("Use /tutorial <true/false> - true = tutorial enabled before game"); + } + + EnableTutorials = DO_TUTORIALS; + } + else + { + event.setCancelled(orig); + } + } + + @EventHandler + public void onDeath(EntityDeathEvent event) + { + if(event.getEntity().getKiller() != null) + { + AddGems(event.getEntity().getKiller(), 0.2, "Mobs Killed", true, true); + } + } + + @EventHandler(priority = EventPriority.MONITOR) + public void Clean(GameStateChangeEvent event) + {} + + @Override + @EventHandler(priority = EventPriority.MONITOR) + public void TeamGen(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Live) + return; + + GetTeamList().add(new GameTeam(this, "Pumpkin Prince", ChatColor.RED, WorldData.GetDataLocs("RED"))); + } + + @Override + public void EndCheck() + { + if (!IsLive()) + return; + + if (_wave >= _waves.size()) + { + for (Player player : GetPlayers(false)) + { + Manager.GetGame().AddGems(player, 30, "Killing the Pumpkin Prince", false, false); + Manager.GetGame().AddGems(player, 10, "Participation", false, false); + } + + if (Manager.IsRewardItems()) + { + SetCustomWinLine("You earned the Grim Reaper Pet!"); + + for (Player player : GetPlayers(false)) + { + //Prevent game hopping + if (!player.isOnline()) + continue; + + PetReward pr = new PetReward(Manager.getCosmeticManager().getPetManager(), Manager.getInventoryManager(), Manager.GetDonation(), "Grim Reaper", "Grim Reaper", EntityType.BLAZE, RewardRarity.OTHER, 0, 0); + + if (pr.canGiveReward(player)) + { + pr.giveReward(null, player, data -> {}); + } + } + } + + AnnounceEnd(this.GetTeamList().get(0)); + + SetState(GameState.End); + } + + else if (GetPlayers(true).size() == 0) + { + for (Player player : GetPlayers(false)) + { + Manager.GetGame().AddGems(player, 10, "Participation", false, false); + } + + AnnounceEnd(this.GetTeamList().get(1)); + + SetState(GameState.End); + } + } + + + + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/PumpkinPlant.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/PumpkinPlant.java new file mode 100644 index 000000000..0b2a18ad9 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/PumpkinPlant.java @@ -0,0 +1,107 @@ +package nautilus.game.arcade.game.games.halloween2016; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.material.MaterialData; + +import nautilus.game.arcade.game.games.halloween2016.creatures.MobPumpling; + +public class PumpkinPlant +{ + + /** + * Defines how fast the pumpkin is going to blink. the closer to 1, the faster the blinking. + */ + private static final double BLINK_SPEED = 0.95; + + private Halloween2016 _game; + + private int _growTicksTotal = 30 * 20; + private int _growTick; + private int _sleep; + private Block _growing = null; + private int _health; + + public PumpkinPlant(Halloween2016 game, Location loc) + { + _growing = loc.getBlock(); + _game = game; + } + + public void startGrow() + { + if(isGrowing()) return; + + _growing.setType(Material.PUMPKIN); + + _growTick = _growTicksTotal; + _sleep = _growTick; + _health = 3; + } + + public boolean isGrowing() + { + return _growing != null &&_growing.getType() != Material.AIR; + } + + public void tick() + { + if(!isGrowing()) return; + + if(_sleep > _growTick) + { + _sleep *= BLINK_SPEED; + Material old = _growing.getType(); + _growing.setType(old == Material.PUMPKIN ? Material.JACK_O_LANTERN : Material.PUMPKIN); + } + _growTick--; + + if(_growTick == 0) + { + spawn(); + } + } + + public void spawn() + { + _growing.setType(Material.AIR); + _growTick = 0; + _sleep = 0; + + Location loc = _growing.getLocation().add(0.5, 0, 0.5); + + _game.AddCreature(new MobPumpling(_game, loc)); + + loc.getWorld().playEffect(loc, Effect.LARGE_SMOKE, 4); + } + + public void hit(Block block) + { + if(block.equals(_growing)) + { + _health--; + + Location loc = _growing.getLocation().add(0.5, 0, 0.5); + + if(_health <= 0) + { + _growing.setType(Material.AIR); + _growTick = 0; + _sleep = 0; + + + loc.getWorld().playEffect(loc, Effect.TILE_BREAK, new MaterialData(Material.PUMPKIN)); + + _growing = null; + } + else + { + loc.getWorld().playSound(loc, Sound.DIG_WOOL, 1, 1); + } + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/CryptBreaker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/CryptBreaker.java new file mode 100644 index 000000000..5dd31ea1c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/CryptBreaker.java @@ -0,0 +1,256 @@ +package nautilus.game.arcade.game.games.halloween2016.creatures; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.entity.Creature; +import org.bukkit.entity.Player; +import org.bukkit.event.entity.EntityTargetEvent; + +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.halloween.creatures.CreatureBase; +import nautilus.game.arcade.game.games.halloween.creatures.InterfaceMove; +import nautilus.game.arcade.game.games.halloween2016.Crypt; +import nautilus.game.arcade.game.games.halloween2016.Halloween2016; +import net.minecraft.server.v1_8_R3.PacketPlayOutAnimation; + +public abstract class CryptBreaker<T extends Creature> extends CreatureBase<T> implements InterfaceMove +{ + + protected final Crypt _crypt; + protected final List<Location> _doorLocations = new ArrayList<>(); + + protected final int _cryptDamage; + protected final int _cryptDamageRate; + + protected double _playerTargetForwardRange = 4; + protected double _playerTargetBackRange = 1; + protected double _playerFollowRange = 5; + + protected double _customCryptRange = -1; + + protected double _extraDamage; + + protected float _speed; + + protected boolean _targetPlayers = true; + + protected Halloween2016 Host16; + + public CryptBreaker(Halloween2016 game, String name, Class<T> mobClass, Location loc, int cryptDamage, int cryptDamageRate, float speed) + { + super(game, name, mobClass, loc); + _crypt = game.getCrypt(); + _doorLocations.addAll(game.getInfrontOfDoorTargets()); + _cryptDamage = cryptDamage; + _cryptDamageRate = cryptDamageRate; + _speed = speed; + Host16 = game; + + Creature ent = GetEntity(); + UtilEnt.setTickWhenFarAway(ent, true); + ent.setRemoveWhenFarAway(false); + } + + @Override + public void SpawnCustom(T ent) + {} + + @Override + public void Update(UpdateEvent event) + { + if(event.getType() != UpdateType.TICK) return; + + if(inCryptRange()) + { + attackCrypt(); + } + } + + public boolean inCryptRange() + { + double width = UtilEnt.getWidth(GetEntity()); + if(_customCryptRange != -1) + { + width = _customCryptRange; + } + + if(getClosestDoor().distanceSquared(GetEntity().getLocation()) <= width*width) + { + return true; + } + return false; + } + + public void attackCrypt() + { + if(!_crypt.tryDamage(GetEntity(), _cryptDamage, _cryptDamageRate)) return; + + GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.ZOMBIE_WOODBREAK, 1, 0.7f + UtilMath.random.nextFloat() * 0.5f); + swingArms(); + } + + public void swingArms() + { + PacketPlayOutAnimation packet = new PacketPlayOutAnimation(); + packet.a = GetEntity().getEntityId(); + packet.b = 0; + + for(Player p : Host.GetPlayers(false)) + { + UtilPlayer.sendPacket(p, packet); + } + } + + @Override + public void Damage(CustomDamageEvent event) + { + if(_extraDamage > 0) + { + if(GetEntity().equals(event.GetDamagerEntity(true))) + { + event.AddMod("Mod", _extraDamage); + } + } + } + + @Override + public void Target(EntityTargetEvent event) + { + if(_crypt.isDestroyed()) return; + + if(!event.getEntity().equals(GetEntity())) return; + if(event.getTarget() == null) return; + + if(!_targetPlayers) + { + event.setCancelled(true); + return; + } + + if(!(event.getTarget() instanceof Player)) + { + event.setCancelled(true); + return; + } + + if(inCryptRange()) + { + event.setCancelled(true); + return; + } + + Location door = getClosestDoor(); + Location target = event.getTarget().getLocation(); + if(target.distanceSquared(door) - _playerTargetBackRange*_playerTargetBackRange > door.distanceSquared(GetEntity().getLocation())) + { + event.setCancelled(true); + return; + } + if(target.distanceSquared(GetEntity().getLocation()) <= _playerTargetForwardRange*_playerTargetForwardRange) + { + event.setCancelled(true); + return; + } + } + + @Override + public Location GetRoamTarget() + { + if(_crypt.isDestroyed()) return GetPlayerTarget(); + + Location door = getClosestDoor(); + double distDoor = door.distanceSquared(GetEntity().getLocation()); + + if(!_targetPlayers) return door; + + Player player = null; + double distance = -1; + + for(Player p : Host.GetPlayers(true)) + { + if(p.getLocation().distanceSquared(door) - _playerTargetBackRange*_playerTargetBackRange > distDoor) continue; + + double dist = GetEntity().getLocation().distanceSquared(p.getLocation()); + if(player == null || dist < distance) + { + player = p; + distance = dist; + } + } + + if(player != null && distance <= _playerTargetForwardRange*_playerTargetForwardRange) + { + GetEntity().setTarget(player); + return player.getLocation(); + } + + return door; + } + + @Override + public void Move() + { + if(_crypt.isDestroyed()) + { + CreatureMove(GetEntity()); + return; + } + + Location door = getClosestDoor(); + double distDoor = door.distanceSquared(GetEntity().getLocation()); + if(GetEntity().getTarget() != null) + { + Location target = GetEntity().getTarget().getLocation(); + if(target.distanceSquared(door) - _playerFollowRange*_playerFollowRange > distDoor) + { + GetEntity().setTarget(null); + SetTarget(GetRoamTarget()); + } + } + + if(GetEntity().getTarget() == null) + { + SetTarget(GetRoamTarget()); + } + + if(_customCryptRange > 0) + { + if(distDoor <= _customCryptRange*_customCryptRange) + { + SetTarget(GetEntity().getLocation()); + } + } + + if(GetTarget() != null) + { + UtilEnt.CreatureMove(GetEntity(), GetTarget(), _speed); + Host.moves++; + } + } + + public Location getClosestDoor() + { + Location loc = GetEntity().getLocation(); + Location door = null; + double dist = -1; + for(Location d : _doorLocations) + { + double testDist = d.distanceSquared(loc); + if(door == null || testDist < dist) + { + door = d; + dist = testDist; + } + } + return door.clone(); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobBlaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobBlaze.java new file mode 100644 index 000000000..af79dd420 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobBlaze.java @@ -0,0 +1,23 @@ +package nautilus.game.arcade.game.games.halloween2016.creatures; + +import org.bukkit.Location; +import org.bukkit.entity.Blaze; + +import mineplex.core.common.util.C; + +import nautilus.game.arcade.game.games.halloween2016.Halloween2016; + +public class MobBlaze extends CryptBreaker<Blaze> +{ + + private static int CRYPT_DAMAGE = 10; + private static int CRYPT_RATE = 30; + + private static float SPEED = 1; + + public MobBlaze(Halloween2016 game, Location loc) + { + super(game, C.cYellow + "Blaze", Blaze.class, loc, CRYPT_DAMAGE, CRYPT_RATE, SPEED); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobCreeper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobCreeper.java new file mode 100644 index 000000000..01af9bb08 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobCreeper.java @@ -0,0 +1,83 @@ +package nautilus.game.arcade.game.games.halloween2016.creatures; + +import java.lang.reflect.Method; + +import net.minecraft.server.v1_8_R3.EntityCreeper; + +import org.bukkit.Location; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreeper; +import org.bukkit.entity.Creeper; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilReflection; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +import nautilus.game.arcade.game.games.halloween2016.Halloween2016; + +public class MobCreeper extends CryptBreaker<Creeper> +{ + + public static final int CRYPT_DAMAGE = 200; + public static float SPEED = 0.8f; + + private boolean exploded = false; + + public MobCreeper(Halloween2016 game, Location loc) + { + super(game, C.cYellow + "Creeper", Creeper.class, loc, 0, 0, SPEED); + + _extraDamage = 5; + + _targetPlayers = false; + } + + + @Override + public void Update(UpdateEvent event) + { + if(event.getType() != UpdateType.TICK) return; + + if(_crypt.isDestroyed()) return; + + double width = UtilEnt.getWidth(GetEntity()); + + EntityCreeper c = ((CraftCreeper)GetEntity()).getHandle(); + if(getClosestDoor().distanceSquared(GetEntity().getLocation()) <= width*width) + { + c.co(); + } + + int fuse = (int) UtilReflection.getValueOfField(c, "fuseTicks"); + int max = (int) UtilReflection.getValueOfField(c, "maxFuseTicks"); + + if(fuse >= max-1) + { + _crypt.tryDamage(GetEntity(), CRYPT_DAMAGE, 0); + exploded = true; + } + } + + @Override + public void remove() + { + if(!exploded && GetEntity().isDead()) + { + //Make creeper explode, even if dead using NMS code + try + { + EntityCreeper nms = ((CraftCreeper)GetEntity()).getHandle(); + Method explodeMethod = nms.getClass().getDeclaredMethod("cr"); + explodeMethod.setAccessible(true); + explodeMethod.invoke(nms); + } + catch(Exception e) + { + e.printStackTrace(); + } + } + super.remove(); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobGiant.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobGiant.java new file mode 100644 index 000000000..6f6a41af4 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobGiant.java @@ -0,0 +1,190 @@ +package nautilus.game.arcade.game.games.halloween2016.creatures; + +import java.util.List; + +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.entity.Giant; +import org.bukkit.entity.Player; +import org.bukkit.entity.Zombie; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilText; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.halloween2016.Halloween2016; + +public class MobGiant extends CryptBreaker<Giant> +{ + + //Instant destroy crypt + public static final int CRYPT_DAMAGE = 100000; + public static final int CRYPT_DAMAGE_COOLDOWN = 1; + public static final float SPEED = 0.5f; + + private static double DAMAGE = 9000; + private static double KNOCKBACK = 8; + private static double HEALTH = 200; + + private static float EXTRA_EXPLOSION_DAMAGE = 10; + + private boolean _cryptDestroyed = false; + + private Zombie _pathDummy; + + private Player _target; + + public MobGiant(Halloween2016 game, Location loc) + { + super(game, null, Giant.class, loc, CRYPT_DAMAGE, CRYPT_DAMAGE_COOLDOWN, SPEED); + + _customCryptRange = 3; + } + + @Override + public void SpawnCustom(Giant ent) + { + _pathDummy = ent.getWorld().spawn(ent.getLocation(), Zombie.class); + + super.Host.Manager.GetCondition().Factory().Invisible("Cloak", _pathDummy, _pathDummy, 999999, 0, false, false, false); + _pathDummy.setCustomNameVisible(true); + + ent.setMaxHealth(HEALTH); + ent.setHealth(ent.getMaxHealth()); + + UtilEnt.setBoundingBox(_pathDummy, 0, 0); + UtilEnt.Vegetate(_pathDummy, true); + UtilEnt.setStepHeight(_pathDummy, 1); + + //Prevent other mobs from pushing the giant + UtilEnt.ghost(_pathDummy, true, true); + + _pathDummy.setRemoveWhenFarAway(false); + UtilEnt.setTickWhenFarAway(_pathDummy, true); + + addEntityPart(_pathDummy); + } + + @Override + public void Update(UpdateEvent event) + { + if(event.getType() == UpdateType.TICK) + { + move(); + updateHealthBar(); + } + + if(!_cryptDestroyed && _crypt.isDestroyed()) + { + SetTarget(null); + _cryptDestroyed = true; + } + + } + + private Player getRandomPlayer() + { + List<Player> players = Host.GetPlayers(true); + return players.get(UtilMath.r(players.size())); + } + + private void move() + { + if(_target != null) + { + if(!_target.isOnline() || !_target.isValid() || !Host.GetPlayers(true).contains(_target)) + { + _target = null; + } + } + + Location target = GetTarget(); + if(target == null && _target == null) + { + if(_crypt.isDestroyed()) + { + _target = getRandomPlayer(); + } + else + { + target = getClosestDoor(); + + } + SetTarget(target); + } + if(_target != null) + { + target = _target.getLocation(); + } + UtilEnt.CreatureMove(_pathDummy, target, SPEED); + GetEntity().teleport(_pathDummy); + + if(!_crypt.isDestroyed()) + { + if(getClosestDoor().distanceSquared(GetEntity().getLocation()) <= _customCryptRange*_customCryptRange) + { + if(!_crypt.tryDamage(GetEntity(), _cryptDamage, _cryptDamageRate)) return; + + GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.ZOMBIE_WOODBREAK, 1, 0.7f + UtilMath.random.nextFloat() * 0.5f); + swingArms(); + } + } + + boolean hit = false; + + for(Player p : getInsideBoundingBox()) + { + Host.getArcadeManager().GetDamage().NewDamageEvent(p, GetEntity(), null, GetEntity().getLocation(), DamageCause.ENTITY_ATTACK, DAMAGE, true, false, false, "Giant", "Giant Damage", false); + hit = true; + } + if(hit) + { + swingArms(); + GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.ZOMBIE_IDLE, 2, 0.5f); + } + } + + @Override + public void Move() + {} + + @Override + public void Damage(CustomDamageEvent event) + { + if(_pathDummy.equals(event.GetDamageeEntity())) + { + event.SetCancelled("Invalid Entity"); + return; + } + if(event.GetDamageeEntity().equals(GetEntity())) + { + event.SetKnockback(false); + + if(event.GetCause() == DamageCause.SUFFOCATION) + { + event.SetCancelled("Invalid Giant Damage"); + return; + } + else if(event.GetCause() == DamageCause.ENTITY_EXPLOSION) + { + event.AddMod("Explosion", EXTRA_EXPLOSION_DAMAGE); + } + } + + if(!GetEntity().equals(event.GetDamagerEntity(false))) return; + + event.SetKnockback(true); + event.AddKnockback("Giant Knockback", KNOCKBACK); + } + + public void updateHealthBar() + { + _pathDummy.setCustomName(UtilText.getProgress(C.cGreen, GetEntity().getHealth()/GetEntity().getMaxHealth(), C.cGray, false)); + } + + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobMiniZombie.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobMiniZombie.java new file mode 100644 index 000000000..63a4bad70 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobMiniZombie.java @@ -0,0 +1,70 @@ +package nautilus.game.arcade.game.games.halloween2016.creatures; + +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.entity.Zombie; +import org.bukkit.event.entity.EntityTargetEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; + +import nautilus.game.arcade.game.games.halloween.Halloween; +import nautilus.game.arcade.game.games.halloween.creatures.CreatureBase; +import nautilus.game.arcade.game.games.halloween.creatures.InterfaceMove; + +public class MobMiniZombie extends CreatureBase<Zombie> implements InterfaceMove +{ + + private static final double HEALTH = 5; + + public MobMiniZombie(Halloween game, Location loc) + { + super(game, C.cYellow + "Baby Zombie", Zombie.class, loc); + } + + @Override + public void SpawnCustom(Zombie ent) + { + ent.setBaby(true); + + ent.setMaxHealth(HEALTH); + ent.setHealth(HEALTH); + } + + @Override + public void Update(UpdateEvent event) + { + + } + + @Override + public void Damage(CustomDamageEvent event) + { + + } + + @Override + public void Target(EntityTargetEvent event) + { + + } + + @Override + public void Move() + { + CreatureMove(GetEntity(), 1f); + } + + @Override + public void remove() + { + super.remove(); + UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, GetEntity().getLocation(), null, 0.1f, 10, ViewDist.NORMAL); + GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.FIZZ, 0.8f, 0.3f); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobPigZombie.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobPigZombie.java new file mode 100644 index 000000000..369f7e102 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobPigZombie.java @@ -0,0 +1,72 @@ +package nautilus.game.arcade.game.games.halloween2016.creatures; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.entity.Zombie; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.disguise.disguises.DisguisePigZombie; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.halloween2016.Halloween2016; + +public class MobPigZombie extends CryptBreaker<Zombie> +{ + + private static float SPEED = 1; + private static int CRYPT_DAMAGE = 3; + private static int CRYPT_RATE = 20; + + private static int FIRE_TICKS = 60; + + public MobPigZombie(Halloween2016 game, Location loc) + { + super(game, C.cYellow + "Pigman Warrior", Zombie.class, loc, CRYPT_DAMAGE, CRYPT_RATE, SPEED); + + _extraDamage = 5; + } + + @Override + public void SpawnCustom(Zombie ent) + { + ent.getEquipment().setItemInHand(new ItemStack(Material.GOLD_SWORD)); + + DisguisePigZombie disg = new DisguisePigZombie(ent); + Host.getArcadeManager().GetDisguise().disguise(disg); + } + + @Override + public void Update(UpdateEvent event) + { + super.Update(event); + if(event.getType() == UpdateType.TICK) + { + GetEntity().setFireTicks(5); + } + } + + @Override + public void Damage(CustomDamageEvent event) + { + if(event.GetDamageeEntity() instanceof Player) + { + if(GetEntity().equals(event.GetDamagerEntity(false))) + { + event.GetDamageeEntity().setFireTicks(FIRE_TICKS); + } + } + + else if(GetEntity().equals(event.GetDamageeEntity())) + { + if(event.GetCause() == DamageCause.FIRE || event.GetCause() == DamageCause.FIRE_TICK) + { + event.SetCancelled("Cancel Fire"); + } + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobPrinceGuard.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobPrinceGuard.java new file mode 100644 index 000000000..36c04abfa --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobPrinceGuard.java @@ -0,0 +1,236 @@ +package nautilus.game.arcade.game.games.halloween2016.creatures; + +import java.util.List; + +import net.minecraft.server.v1_8_R3.PacketPlayOutAnimation; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Horse.Variant; +import org.bukkit.entity.Player; +import org.bukkit.entity.Skeleton; +import org.bukkit.entity.Zombie; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; +import org.spigotmc.event.entity.EntityDismountEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.disguise.disguises.DisguiseHorse; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; + +import nautilus.game.arcade.game.games.halloween.Halloween; +import nautilus.game.arcade.game.games.halloween.creatures.CreatureBase; + +public class MobPrinceGuard extends CreatureBase<Skeleton> +{ + + private Zombie _horse; + private DisguiseHorse _horseDisguise; + + private MobPumpkinPrince _prince; + private Entity _target; + + private Location _strikeTarget; + private long _strikeStamp; + + private boolean _AI = true; + + private final static float HORSE_SPEED = 1.8f; + private final static float HORSE_SPEED_CHARGE = 2.3f; + private final static double STRIKE_RANGE = 10; + private final static long MAX_STRIKE_TIME = 10_000; + private final static long STRIKE_COOLDOWN = 15_000; + private final static double DAMAGE = 5; + private final static double KNOCKBACK = 3; + private final static double HEALTH = 50; + + public MobPrinceGuard(Halloween game, Location loc, MobPumpkinPrince prince) + { + super(game, C.cYellow + C.Bold + "Prince Guard", Skeleton.class, loc); + _prince = prince; + } + + public Zombie getHorse() + { + return _horse; + } + + @Override + public void SpawnCustom(Skeleton ent) + { + ent.getEquipment().setItemInHand(new ItemStack(Material.IRON_SWORD)); + ent.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN)); + + _horse = ent.getWorld().spawn(ent.getLocation(), Zombie.class); + + _horseDisguise = new DisguiseHorse(_horse); + _horseDisguise.setType(Variant.SKELETON_HORSE); + Host.getArcadeManager().GetDisguise().disguise(_horseDisguise); + + _horse.setRemoveWhenFarAway(false); + UtilEnt.setTickWhenFarAway(_horse, true); + + UtilEnt.setStepHeight(_horse, 1); + UtilEnt.setBoundingBox(_horse, 0, 0); + + UtilEnt.setTickWhenFarAway(ent, true); + ent.setRemoveWhenFarAway(true); + + ent.setMaxHealth(HEALTH); + ent.setHealth(ent.getMaxHealth()); + + _horse.setPassenger(ent); + + _horse.setVegetated(true); + //UtilEnt#silence doesn't seem to work. Using native silence instead + ((CraftEntity)_horse).getHandle().b(true); + + addEntityPart(_horse); + } + + public void setAI(boolean aI) + { + _AI = aI; + } + + public boolean getAI() + { + return _AI; + } + + @Override + public void Update(UpdateEvent event) + { + if(event.getType() != UpdateType.TICK) return; + + if(!_AI) return; + + if(_strikeTarget != null) + { + if(_strikeStamp < System.currentTimeMillis()) + { + _strikeTarget = null; + } + else if(UtilEnt.canEntityWalkCloserToNavigationTarget(_horse)) + { + _strikeTarget = null; + return; + } + else + { + _horse.getWorld().playSound(_horse.getLocation(), Sound.FIZZ, 0.2f, 1f); + _horse.getWorld().playSound(_horse.getLocation(), Sound.SKELETON_WALK, 0.2f, 0.5f); + + UtilParticle.PlayParticleToAll(ParticleType.SMOKE, _horse.getLocation(), null, 0.1f, 5, ViewDist.NORMAL); + UtilParticle.PlayParticleToAll(ParticleType.FLAME, _horse.getLocation(), null, 0.1f, 5, ViewDist.NORMAL); + } + } + + List<Player> inGame = Host.GetPlayers(true); + if(_target == null || !inGame.contains(_target)) + { + double dist = 0; + for(Player p : inGame) + { + double d = p.getLocation().distanceSquared(_prince.getHorse().getLocation()); + if(_target == null || dist > d) + { + dist = d; + _target = p; + } + } + } + Location target = _target.getLocation(); + Vector diff = target.clone().subtract(_horse.getLocation()).toVector(); + if(_strikeStamp + STRIKE_COOLDOWN > System.currentTimeMillis() || diff.lengthSquared() >= STRIKE_RANGE*STRIKE_RANGE) + { + diff.normalize().multiply(STRIKE_RANGE*2); + target.add(diff); + SetTarget(target); + + UtilEnt.CreatureMove(_horse, GetTarget(), HORSE_SPEED); + } + else + { + _target = null; + + _strikeTarget = target; + _strikeStamp = System.currentTimeMillis() + MAX_STRIKE_TIME; + + UtilEnt.CreatureMove(_horse, GetTarget(), HORSE_SPEED_CHARGE); + } + + for(Player p : getInsideBoundingBox()) + { + Host.getArcadeManager().GetDamage().NewDamageEvent(p, _horse, null, _horse.getLocation(), DamageCause.ENTITY_ATTACK, DAMAGE, true, false, false, "Prince Guard", "Horse Kick", false); + } + } + + @Override + public void Damage(CustomDamageEvent event) + { + if(_horse.equals(event.GetDamageeEntity())) + { + event.setDamagee(GetEntity()); + } + + if(GetEntity().equals(event.GetDamageeEntity())) + { + if(_prince.equals(event.GetDamagerEntity(true))) + { + if(event.GetProjectile() != null) + { + event.GetProjectile().setFireTicks(0); + } + event.SetCancelled("Cancel"); + return; + } + + if(!_AI) + { + event.SetCancelled("No AI"); + return; + } + + if(!event.isCancelled() && _horse != null && _horse.isValid()) + { + PacketPlayOutAnimation hurt = new PacketPlayOutAnimation(); + hurt.a = _horseDisguise.getEntityId(); + hurt.b = 1; + _horseDisguise.sendPacket(hurt); + } + } + + else if(event.GetDamageeEntity() instanceof Player) + { + if(_horse.equals(event.GetDamagerEntity(false))) + { + event.AddKnockback("Horse Knockback", KNOCKBACK); + } + } + } + + @Override + public void Target(EntityTargetEvent event) + {} + + @EventHandler + public void onDismount(EntityDismountEvent event) + { + if(event.getDismounted().equals(GetEntity())) event.setCancelled(true); + } + + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobPumpkinPrince.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobPumpkinPrince.java new file mode 100644 index 000000000..a09970660 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobPumpkinPrince.java @@ -0,0 +1,478 @@ +package nautilus.game.arcade.game.games.halloween2016.creatures; + +import net.minecraft.server.v1_8_R3.PacketPlayOutAnimation; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.BlockFace; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftZombie; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Fireball; +import org.bukkit.entity.Horse.Variant; +import org.bukkit.entity.Player; +import org.bukkit.entity.Skeleton; +import org.bukkit.entity.Skeleton.SkeletonType; +import org.bukkit.entity.Snowball; +import org.bukkit.entity.Zombie; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.util.Vector; +import org.spigotmc.event.entity.EntityDismountEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextTop; +import mineplex.core.disguise.disguises.DisguiseHorse; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; + +import nautilus.game.arcade.game.games.halloween.creatures.CreatureBase; +import nautilus.game.arcade.game.games.halloween2016.Halloween2016; + +public class MobPumpkinPrince extends CreatureBase<Skeleton> implements Listener +{ + + private Halloween2016 Host; + + private Zombie _horse; + private DisguiseHorse _horseDisguise; + + private boolean _AI = false; + private boolean _invulnerable = false; + + private long _horseKick = 0; + private static final long HORSE_KICK_DURATION = 1000; + + private static final double HORSE_KICK_DAMAGE = 5; + + private static final float HORSE_SPEED = 1.5f; + + private static final double STAGE_3_KNOCKBACK = 3; + private static final double HORSE_KNOCKBACK = 3; + + private static final double HEALTH = 1000; + + + public MobPumpkinPrince(Halloween2016 game, Location loc) + { + super(game, C.cRed + C.Bold + "Pumpkin Prince", Skeleton.class, loc); + Host = game; + } + + @Override + public void SpawnCustom(Skeleton ent) + { + ent.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN)); + ent.getEquipment().setItemInHand(new ItemStack(Material.BOW)); + + ent.setMaxHealth(HEALTH); + ent.setHealth(ent.getMaxHealth()); + + ent.setSkeletonType(SkeletonType.WITHER); + + + super.Host.CreatureAllowOverride = true; + _horse = ent.getWorld().spawn(ent.getLocation(), Zombie.class); + super.Host.CreatureAllowOverride = false; + + _horseDisguise = new DisguiseHorse(_horse); + _horseDisguise.setType(Variant.SKELETON_HORSE); + + super.Host.getArcadeManager().GetDisguise().disguise(_horseDisguise); + + UtilEnt.setStepHeight(ent, 1); + UtilEnt.setStepHeight(_horse, 1); + + UtilEnt.setBoundingBox(_horse, 0, 0); + + //For some reason 'UtilEnt.silence' doesn't work, so using native silence instead + //UtilEnt.silence(_horse, true); + ((CraftZombie)_horse).getHandle().b(true); + + _horse.setPassenger(ent); + UtilEnt.Vegetate(_horse); + + UtilServer.RegisterEvents(this); + + UtilEnt.setTickWhenFarAway(ent, true); + ent.setRemoveWhenFarAway(false); + UtilEnt.setTickWhenFarAway(_horse, true); + _horse.setRemoveWhenFarAway(false); + + addEntityPart(_horse); + } + + public void setInvulnerable(boolean invulnerable) + { + _invulnerable = invulnerable; + } + + public boolean isInvulnerable() + { + return _invulnerable; + } + + public void setAI(boolean AI) + { + _AI = AI; + } + + public boolean getAI() + { + return _AI; + } + + @Override + public void Update(UpdateEvent event) + { + if(!_AI) return; + + if(event.getType() != UpdateType.TICK) return; + + UtilTextTop.displayProgress(C.cYellow + C.Bold + "Pumpkin Prince", getHealthProgress(), UtilServer.getPlayers()); + + int state = getState(); + + if(_horse.isValid() && state > 1) + { + _horse.getWorld().playSound(_horse.getLocation(), Sound.BLAZE_DEATH, 3, 1); + UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, _horse.getLocation(), null, 0.5f, 20, ViewDist.NORMAL); + _horse.setHealth(0); + } + + if(state == 1) + { + Entity target = GetEntity().getTarget(); + if(target != null) + { + UtilEnt.CreatureMove(_horse, GetEntity().getTarget().getLocation(), HORSE_SPEED); + + boolean hit = false; + + for(Player p : getInsideBoundingBox()) + { + CustomDamageEvent dmgEvent = Host.getArcadeManager().GetDamage().NewDamageEvent(p, _horse, null, GetEntity().getLocation(), DamageCause.ENTITY_ATTACK, HORSE_KICK_DAMAGE, true, false, false, "Pumpkin Prince", "Horse Kick", false); + if(dmgEvent.isCancelled()) continue; + hit = true; + } + if(hit) + { + _horseKick = System.currentTimeMillis(); + + _horseDisguise.kick(); + Host.getArcadeManager().GetDisguise().updateDisguise(_horseDisguise); + + _horse.getWorld().playSound(_horse.getLocation(), Sound.SKELETON_HURT, 4f, 0.6f); + _horse.getWorld().playSound(_horse.getLocation(), Sound.SKELETON_HURT, 4f, 0.6f); + } + + if(_horseKick + HORSE_KICK_DURATION < System.currentTimeMillis()) + { + _horseDisguise.stopKick(); + Host.getArcadeManager().GetDisguise().updateDisguise(_horseDisguise); + } + + if(GetEntity().getTicksLived() % 15 == 0) + { + if(target.getLocation().distanceSquared(GetEntity().getLocation()) > 40*40) return; + + Arrow a = GetEntity().launchProjectile(Arrow.class); + + Vector force = UtilAlg.getTrajectory(GetEntity(), target).add(new Vector(0, 0.2, 0)); + a.setVelocity(force); + + a.setFireTicks(99999); + } + + } + else + { + GetEntity().setTarget(getRandomPlayer()); + } + } + else if(state == 2) + { + if(GetEntity().getTicksLived() % (20*5) == 0) + { + for(int i = 0; i < 64; i++) + { + if(tryRandomTeleport()) break; + } + } + if(GetEntity().getTicksLived() % 25 == 0) + { + Vector v = GetPlayerTarget().subtract(GetEntity().getLocation()).toVector().multiply(0.01); + + Location loc = GetEntity().getLocation(); + loc.setDirection(v); + GetEntity().teleport(loc); + GetEntity().launchProjectile(Fireball.class, v); + } + } + else if(state == 3) + { + if(GetEntity().getTicksLived() % 20*10 == 0) + { + GetEntity().setTarget(getRandomPlayer()); + } + } + } + + public Player getRandomPlayer() + { + return Host.GetPlayers(true).get(UtilMath.r(Host.GetPlayers(true).size())); + } + + private boolean tryRandomTeleport() + { + Location loc = GetPlayerTarget(); + loc.add((UtilMath.random.nextDouble() - 0.5) * 64, UtilMath.r(64)-32, (UtilMath.random.nextDouble() - 0.5) * 64); + + for(int y = loc.getBlockY(); y > 0; y--) + { + if(!loc.getBlock().getRelative(BlockFace.DOWN).getType().isSolid()) continue; + Material m1 = loc.getBlock().getType(); + Material m2 = loc.getBlock().getRelative(BlockFace.UP).getType(); + if(m1.isSolid()) continue; + if(m2.isSolid()) continue; + if(UtilItem.isLiquid(m1)) continue; + if(UtilItem.isLiquid(m2)) continue; + + loc.getWorld().playEffect(GetEntity().getLocation(), Effect.ENDER_SIGNAL, 0); + loc.getWorld().playSound(GetEntity().getLocation(), Sound.ENDERMAN_TELEPORT, 2, 0); + GetEntity().teleport(loc.getBlock().getLocation().add(0.5, 0, 0.5)); + loc.getWorld().playEffect(GetEntity().getLocation(), Effect.ENDER_SIGNAL, 0); + loc.getWorld().playSound(GetEntity().getLocation(), Sound.ENDERMAN_TELEPORT, 2, 0); + return true; + } + return false; + + } + + @EventHandler + public void onShoot(EntityShootBowEvent event) + { + if(!event.getEntity().equals(GetEntity())) return; + + event.setCancelled(true); + } + + @EventHandler + public void onDismount(EntityDismountEvent event) + { + if(event.getDismounted().equals(GetEntity())) event.setCancelled(true); + } + + public Zombie getHorse() + { + return _horse; + } + + @Override + public void Damage(CustomDamageEvent event) + { + if(event.GetDamageeEntity().equals(_horse)) + { + event.setDamagee(GetEntity()); + _horse.setFireTicks(0); + } + + if(event.GetDamageeEntity() instanceof Player) + { + if(GetEntity().equals(event.GetDamagerEntity(true))) + { + onPrinceDamagePlayer(event); + } + else + { + onOtherDamagePlayer(event); + } + } + + if(GetEntity().equals(event.GetDamageeEntity())) + { + onPrinceTakeDamage(event); + + if(!event.isCancelled() && _horse != null && _horse.isValid()) + { + PacketPlayOutAnimation hurt = new PacketPlayOutAnimation(); + hurt.a = _horseDisguise.getEntityId(); + hurt.b = 1; + _horseDisguise.sendPacket(hurt); + } + } + } + + public void onPrinceTakeDamage(CustomDamageEvent event) + { + if(event.GetCause() == DamageCause.SUFFOCATION || event.GetCause() == DamageCause.FALL) + { + event.SetCancelled("Boss Invalid Damage"); + return; + } + + if(GetEntity().equals(event.GetDamagerEntity(true))) + { + event.SetCancelled("Boss Invalid Damage"); + return; + } + + if(!_AI) + { + event.SetCancelled("AI Disabled"); + return; + } + + if(_invulnerable) + { + event.SetCancelled("Invulnerable"); + Player p = event.GetDamagerPlayer(true); + if(p != null) + { + if(Recharge.Instance.use(p, "Boss Inulnerable Info", 5000, false, false)) + { + p.sendMessage(F.main("Game", "Kill the " + F.item("Guards") + " before you can damage the " + F.color("Pumpkin Prince", C.cYellow + C.Bold))); + } + } + return; + } + + if(event.GetProjectile() instanceof Snowball) + { + event.SetKnockback(false); + } + + updateHealth(GetEntity().getHealth(), GetEntity().getHealth()-event.GetDamage()); + } + + public void onPrinceDamagePlayer(CustomDamageEvent event) + { + int state = getState(); + + if(state == 3) + { + event.AddKnockback("Boss Knockback", STAGE_3_KNOCKBACK); + } + } + + public void onOtherDamagePlayer(CustomDamageEvent event) + { + if(_horse.equals(event.GetDamagerEntity(false))) + { + event.AddKnockback("Horse Kick", HORSE_KNOCKBACK); + } + } + + public void updateHealth(double oldH, double newH) + { + int oldState = getState(getHealthProgress(oldH)); + int newState = getState(getHealthProgress(newH)); + if(oldState != newState) + { + updateState(newState); + } + } + + public void updateState(int state) + { + if(state == 1) + { + + } + if(state == 2) + { + GetEntity().getEquipment().setItemInHand(new ItemStack(Material.DIAMOND_SWORD)); + + GetEntity().addPotionEffect(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 1)); + GetEntity().addPotionEffect(new PotionEffect(PotionEffectType.JUMP, Integer.MAX_VALUE, 1)); + } + if(state == 3) + { + Host.setMaxPumplings(0); + + GetEntity().addPotionEffect(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 2), true); + GetEntity().addPotionEffect(new PotionEffect(PotionEffectType.JUMP, Integer.MAX_VALUE, 2), true); + } + } + + @Override + public void remove() + { + die(); + super.remove(); + } + + public void die() + { + UtilServer.Unregister(this); + } + + @Override + public void Target(EntityTargetEvent event) + { + if(!event.getEntity().equals(GetEntity())) return; + + if(!_AI) + { + event.setCancelled(true); + return; + } + + if(event.getTarget() == null) + { + event.setCancelled(true); + return; + } + + if(event.getTarget().getType() != EntityType.PLAYER) event.setCancelled(true); + } + + public int getState() + { + return getState(getHealthProgress()); + } + + public int getState(double healthProgress) + { + if(healthProgress > 0.6) return 1; + if(healthProgress > 0.4) return 2; + return 3; + } + + public double getHealthProgress(double health) + { + return health / GetEntity().getMaxHealth(); + } + + public double getHealthProgress() + { + return getHealthProgress(GetEntity().getHealth()); + } + + public boolean isDead() + { + return getHealthProgress() <= 0; + } + + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobPumpling.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobPumpling.java new file mode 100644 index 000000000..774cbbecd --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobPumpling.java @@ -0,0 +1,97 @@ +package nautilus.game.arcade.game.games.halloween2016.creatures; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.entity.Skeleton; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.halloween.creatures.CreatureBase; +import nautilus.game.arcade.game.games.halloween.creatures.InterfaceMove; +import nautilus.game.arcade.game.games.halloween2016.Halloween2016; + +public class MobPumpling extends CreatureBase<Skeleton> implements InterfaceMove +{ + private static double EXTRA_DAMAGE = 5; + private static float SPEED = 1; + + public MobPumpling(Halloween2016 game, Location loc) + { + super(game, C.cYellow + "Pumpling", Skeleton.class, loc); + } + + @Override + public void SpawnCustom(Skeleton ent) + { + Host.Manager.GetCondition().Factory().Invisible("Cloak", ent, ent, 999999, 0, false, false, false); + + ent.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN)); + + ent.setMaxHealth(15); + ent.setHealth(ent.getMaxHealth()); + + UtilEnt.setTickWhenFarAway(ent, true); + } + + @Override + public void Damage(CustomDamageEvent event) + { + if(GetEntity().equals(event.GetDamagerEntity(false))) + { + event.AddMod("Damage", EXTRA_DAMAGE); + } + } + + @Override + public void Target(EntityTargetEvent event) + { + + } + + @Override + public void Update(UpdateEvent event) + { + + } + + @Override + public void Move() + { + UtilEnt.CreatureMove(GetEntity(), getClosestPlayer(), SPEED); + } + + public Location getClosestPlayer() + { + Player p = null; + double d = 0; + for(Player pp : Host.GetPlayers(true)) + { + double dd = pp.getLocation().distanceSquared(GetEntity().getLocation()); + if(p == null || dd < d) + { + d = dd; + p = pp; + } + } + return p.getLocation(); + } + + @Override + public void remove() + { + UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, GetEntity().getLocation(), null, 0.3f, 20, ViewDist.NORMAL); + GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.SKELETON_DEATH, 1, 1); + GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.FIZZ, 1, 1); + super.remove(); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobSkeletonArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobSkeletonArcher.java new file mode 100644 index 000000000..fcc6f7235 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobSkeletonArcher.java @@ -0,0 +1,53 @@ +package nautilus.game.arcade.game.games.halloween2016.creatures; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftArrow; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Skeleton; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import nautilus.game.arcade.game.games.halloween2016.Halloween2016; + +public class MobSkeletonArcher extends CryptBreaker<Skeleton> +{ + + private static final int CRYPT_DAMAGE = 3; + private static final int CRYPT_DAMAGE_RATE = 20; + private static final float SPEED = 1; + private static final double HEALTH = 15; + + public MobSkeletonArcher(Halloween2016 game, Location loc) + { + super(game, C.cYellow + "Skeleton Archer", Skeleton.class, loc, CRYPT_DAMAGE, CRYPT_DAMAGE_RATE, SPEED); + + _extraDamage = 1; + _customCryptRange = 3; + + _playerTargetBackRange = 2; + } + + @Override + public void SpawnCustom(Skeleton ent) + { + ent.getEquipment().setItemInHand(new ItemStack(Material.BOW)); + + ent.setMaxHealth(HEALTH); + ent.setHealth(HEALTH); + } + + @Override + public void attackCrypt() + { + if(!_crypt.tryDamage(GetEntity(), _cryptDamage, _cryptDamageRate)) return; + + Location door = getClosestDoor(); + Vector diff = door.toVector().subtract(GetEntity().getLocation().toVector()); + diff.setY(diff.getY() + 0.5); + Arrow a = GetEntity().launchProjectile(Arrow.class, diff); + ((CraftArrow)a).getHandle().noclip = true; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobWitch.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobWitch.java new file mode 100644 index 000000000..3342f1f96 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobWitch.java @@ -0,0 +1,295 @@ +package nautilus.game.arcade.game.games.halloween2016.creatures; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; +import org.bukkit.entity.Bat; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Zombie; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilServer; +import mineplex.core.disguise.disguises.DisguiseWitch; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.halloween.creatures.CreatureBase; +import nautilus.game.arcade.game.games.halloween2016.Halloween2016; +import net.minecraft.server.v1_8_R3.RandomPositionGenerator; +import net.minecraft.server.v1_8_R3.Vec3D; + +public class MobWitch extends CreatureBase<Zombie> +{ + private static int HEALTH = 20; + private static int PANIC_TIME = 100; + + private float SPEED_IDLE = 1f; + private float SPEED_PANIC = 2f; + + private static int BATS_BURST = 10; + private static int BATS_TICKS = 80; + private static double BAT_KNOCKBACK = 1.75; + private static int BAT_FIRE_TICKS = 10; + private static double BAT_DAMAGE = 3; + + private static double HEAL_DISTANCE = 7; + private static double HEAL_AMOUNT = 10; + private static double HEAL_RAY_SPEED = 0.2; + + + + private CreatureBase<?> _healTarget = null; + public Location _healRay = null; + + private int _panicTicks = 0; + private List<Bat> _bats = new ArrayList<>(); + + private Location _panicTarget = null; + + private Halloween2016 _host; + + public MobWitch(Halloween2016 game, Location loc) + { + super(game, C.cYellow + "Witch", Zombie.class, loc); + _host = game; + } + + @Override + public void SpawnCustom(Zombie ent) + { + ent.setMaxHealth(HEALTH); + ent.setHealth(ent.getMaxHealth()); + + UtilEnt.setTickWhenFarAway(ent, true); + ent.setRemoveWhenFarAway(false); + + DisguiseWitch disg = new DisguiseWitch(ent); + Host.getArcadeManager().GetDisguise().disguise(disg); + } + + @Override + public void Update(UpdateEvent event) + { + if(event.getType() == UpdateType.TICK) + { + updateBats(); + move(); + } + } + + @Override + public void Damage(CustomDamageEvent event) + { + if(event.isCancelled()) return; + + if(_bats.contains(event.GetDamageeEntity())) + { + if(event.GetCause() == DamageCause.FIRE_TICK) + { + event.SetCancelled("Fire Imunity"); + return; + } + } + if(event.GetDamageeEntity() instanceof Player) + { + if (event.GetReason() != null && event.GetReason().contains(GetName())) + { + event.AddKnockback(GetName(), BAT_KNOCKBACK); + return; + } + } + if(!GetEntity().equals(event.GetDamageeEntity())) return; + + LivingEntity damager = event.GetDamagerEntity(false); + + if(damager != null && _panicTicks <= 0) + { + shootBats(damager.getEyeLocation().subtract(GetEntity().getEyeLocation()).toVector()); + } + + _panicTicks = PANIC_TIME; + } + + public void shootBats(Vector direction) + { + Location loc = GetEntity().getLocation(); + loc.setDirection(direction); + GetEntity().teleport(loc); + Host.CreatureAllowOverride = true; + for(int i = 0; i < BATS_BURST; i++) + { + Bat bat = GetEntity().getWorld().spawn(GetEntity().getEyeLocation(), Bat.class); + UtilEnt.Vegetate(bat); + _bats.add(bat); + addEntityPart(bat); + } + Host.CreatureAllowOverride = false; + } + + @Override + public void Target(EntityTargetEvent event) + {} + + public void move() + { + if(_panicTicks > 0) + { + movePanic(); + _panicTicks--; + } + else + { + _panicTarget = null; + moveIdle(); + } + } + + public void updateBats() + { + for (Iterator<Bat> it = _bats.iterator(); it.hasNext();) + { + Bat bat = it.next(); + if (!bat.isValid()) + { + it.remove(); + continue; + } + + if(bat.getTicksLived() > BATS_TICKS) + { + bat.remove(); + it.remove(); + UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, bat.getLocation(), 0, 0, 0, 0, 3, + ViewDist.LONG, UtilServer.getPlayers()); + continue; + } + + bat.setFireTicks(10); + + Vector rand = new Vector((Math.random() - 0.5)/2, (Math.random() - 0.5)/2, (Math.random() - 0.5)/2); + bat.setVelocity(bat.getLocation().getDirection().multiply(0.5).add(rand)); + + for(Player p : UtilEnt.getPlayersInsideEntity(bat, Host.GetPlayers(true))) + { + if (!Recharge.Instance.usable(p, "Hit by Bat")) + continue; + + //Damage Event + Host.getArcadeManager().GetDamage().NewDamageEvent(p, GetEntity(), null, + DamageCause.CUSTOM, BAT_DAMAGE, true, true, false, + GetEntity().getName(), GetName()); + p.setFireTicks(p.getFireTicks() + BAT_FIRE_TICKS); + + //Effect + bat.getWorld().playSound(bat.getLocation(), Sound.BAT_HURT, 1f, 1f); + UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, bat.getLocation(), 0, 0, 0, 0, 3, + ViewDist.LONG, UtilServer.getPlayers()); + + bat.remove(); + it.remove(); + + //Recharge on hit + Recharge.Instance.useForce(p, "Hit by Bat", 200); + } + } + } + + public void getNewHealTarget() + { + CreatureBase<?> close = null; + double dist = -1; + for(CreatureBase<?> c : _host.getNonPumplings()) + { + if(c.equals(this)) continue; + if(!c.GetEntity().isValid()) continue; + + if(c.GetEntity().getHealth() < c.GetEntity().getMaxHealth()) + { + double d = GetEntity().getLocation().distanceSquared(c.GetEntity().getLocation()); + if(close == null || d < dist) + { + close = c; + dist = d; + } + } + } + _healTarget = close; + } + + public void moveIdle() + { + if(_healTarget != null && !_healTarget.GetEntity().isValid()) + { + _healTarget = null; + } + if(_healTarget == null) + { + getNewHealTarget(); + } + + if(_healTarget == null) + { + UtilEnt.CreatureMove(GetEntity(), _host.getInfrontOfDoorTargets().get(0), SPEED_IDLE); + + return; + } + + if(_healRay != null) + { + Vector diff = _healTarget.GetEntity().getEyeLocation().subtract(_healRay).toVector(); + double length = diff.lengthSquared(); + if(length <= HEAL_RAY_SPEED * HEAL_RAY_SPEED) + { + LivingEntity ent = _healTarget.GetEntity(); + ent.setHealth(Math.min(ent.getMaxHealth(), ent.getHealth()+HEAL_AMOUNT)); + + UtilParticle.PlayParticleToAll(ParticleType.HEART, ent.getEyeLocation(), 1, 1, 1, 0, 20, ViewDist.NORMAL); + + _healTarget = null; + _healRay = null; + + return; + } + diff.normalize().multiply(HEAL_RAY_SPEED); + + _healRay.add(diff); + UtilParticle.PlayParticleToAll(ParticleType.HEART, _healRay, 0, 0, 0, 0, 1, ViewDist.NORMAL); + + return; + } + + double dist = _healTarget.GetEntity().getLocation().distanceSquared(GetEntity().getLocation()); + if(dist < HEAL_DISTANCE * HEAL_DISTANCE) + { + _healRay = GetEntity().getEyeLocation(); + return; + } + + UtilEnt.CreatureMove(GetEntity(), _healTarget.GetEntity().getLocation(), SPEED_IDLE); + } + + public void movePanic() + { + if(_panicTarget == null || UtilEnt.canEntityWalkCloserToNavigationTarget(GetEntity())) + { + Vec3D v = RandomPositionGenerator.a(((CraftCreature)GetEntity()).getHandle(), 5, 4); + _panicTarget = new Location(GetEntity().getWorld(), v.a, v.b, v.c); + } + + UtilEnt.CreatureMove(GetEntity(), _panicTarget, SPEED_PANIC); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobZombie.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobZombie.java new file mode 100644 index 000000000..5de0819e6 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobZombie.java @@ -0,0 +1,32 @@ +package nautilus.game.arcade.game.games.halloween2016.creatures; + +import org.bukkit.Location; +import org.bukkit.entity.Zombie; + +import mineplex.core.common.util.C; +import nautilus.game.arcade.game.games.halloween2016.Halloween2016; + +public class MobZombie extends CryptBreaker<Zombie> +{ + + private static float SPEED = 1; + private static int CRYPT_DAMAGE = 3; + private static int CRYPT_DAMAGE_COOLDOWN = 20; + + private static double HEALTH = 15; + + public MobZombie(Halloween2016 game, Location loc) + { + super(game, C.cYellow + "Zombie", Zombie.class, loc, CRYPT_DAMAGE, CRYPT_DAMAGE_COOLDOWN, SPEED); + + _extraDamage = 5; + } + + @Override + public void SpawnCustom(Zombie ent) + { + ent.setMaxHealth(HEALTH); + ent.setHealth(HEALTH); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobZombieSpawner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobZombieSpawner.java new file mode 100644 index 000000000..6b5ae9fef --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobZombieSpawner.java @@ -0,0 +1,75 @@ +package nautilus.game.arcade.game.games.halloween2016.creatures; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Zombie; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +import nautilus.game.arcade.game.games.halloween2016.Halloween2016; + +public class MobZombieSpawner extends CryptBreaker<Zombie> +{ + + private static final int CRYPT_DAMAGE = 20; + private static final int CRYPT_RATE = 20; + private static final float SPEED = 0.5f; + private static final int MAX_MINI_ZOMBIES = 4; + + private List<MobMiniZombie> _miniZombies = new ArrayList<>(); + + public MobZombieSpawner(Halloween2016 game, Location loc) + { + super(game, C.cYellow + "Zombie Spawner", Zombie.class, loc, CRYPT_DAMAGE, CRYPT_RATE, SPEED); + } + + @Override + public void SpawnCustom(Zombie ent) + { + ent.setVillager(true); + + ent.getEquipment().setHelmet(new ItemStack(Material.MOB_SPAWNER)); + } + + @Override + public void Update(UpdateEvent event) + { + super.Update(event); + + if(event.getType() == UpdateType.SEC_05) + { + for(Iterator<MobMiniZombie> it = _miniZombies.iterator(); it.hasNext();) + { + if(!it.next().GetEntity().isValid()) it.remove(); + } + + if(_miniZombies.size() >= MAX_MINI_ZOMBIES) return; + + //Combat concurrency issues (can't add mobs while in the "tick" loop of mobs) + Host.Manager.runSync(() -> + { + if(GetEntity().isValid()) + { + Location loc = GetEntity().getLocation().add(GetEntity().getLocation().getDirection().normalize()); + UtilParticle.PlayParticleToAll(ParticleType.SMOKE, loc, null, 0.1f, 20, ViewDist.NORMAL); + loc.getWorld().playSound(loc, Sound.ZOMBIE_INFECT, 1, 0.6f); + MobMiniZombie mini = new MobMiniZombie(Host, loc); + _miniZombies.add(mini); + Host16.AddCreature(mini, false); + } + }); + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/tutorial/TutorialHalloween2016.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/tutorial/TutorialHalloween2016.java new file mode 100644 index 000000000..c38389e25 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/tutorial/TutorialHalloween2016.java @@ -0,0 +1,44 @@ +package nautilus.game.arcade.game.games.halloween2016.tutorial; + +import org.bukkit.Location; + +import mineplex.core.common.animation.Animator; + +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.games.halloween2016.Halloween2016; +import nautilus.game.arcade.gametutorial.GameTutorial; +import nautilus.game.arcade.gametutorial.TutorialPhase; + +public class TutorialHalloween2016 extends GameTutorial +{ + + private Halloween2016 _host; + + public TutorialHalloween2016(Halloween2016 host, Animator animator, GameTeam team, Location start, int duration) + { + super(host.Manager, new TutorialPhase[]{ + new TutorialPhaseHalloween(duration, animator, team, start) + }); + _host = host; + + SetTutorialPositions = false; + } + + @Override + public void onStart() + { + super.onStart(); + + _host.Manager.getCosmeticManager().setHideParticles(true); + } + + @Override + public void onEnd() + { + super.onEnd(); + _host.AllowParticles = true; + + _host.Manager.getCosmeticManager().setHideParticles(false); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/tutorial/TutorialPhaseHalloween.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/tutorial/TutorialPhaseHalloween.java new file mode 100644 index 000000000..5ad45f140 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/tutorial/TutorialPhaseHalloween.java @@ -0,0 +1,67 @@ +package nautilus.game.arcade.game.games.halloween2016.tutorial; + +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.entity.Player; + +import mineplex.core.common.animation.Animator; +import mineplex.core.common.util.C; + +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.gametutorial.TutorialPhase; +import nautilus.game.arcade.gametutorial.TutorialText; + +public class TutorialPhaseHalloween extends TutorialPhase +{ + + private Animator _animator; + private GameTeam _team; + private Location _start; + + public TutorialPhaseHalloween(int duration, Animator animator, GameTeam team, Location start) + { + super(new TutorialText[] + { + new TutorialText(C.cGold + "Legend says that many years ago", 5 * 20, 1), + new TutorialText(C.cGold + "A group of heroes defeated the Pumpkin King", 4 * 20, 2), + new TutorialText(C.cGold + "Since then the world has known peace.", 3 * 20, 3), + new TutorialText("", 2 * 20, 4), + new TutorialText(C.cGold + "My family has guarded this tomb for generations.", 4 * 20, 5), + new TutorialText(C.cGold + "All I know is we must not let it fall.", 4 * 20, 6), + new TutorialText("", 2 * 20, 7), + new TutorialText("", Math.max((duration-(24*20)), 8)) + }); + + _animator = animator; + _team = team; + _start = start; + } + + + @Override + public void onStart() + { + _animator.start(_start); + } + + + + @Override + public void onEnd() + { + for(Player p : _team.GetPlayers(false)) + { + p.setGameMode(GameMode.SURVIVAL); + } + _animator.stop(); + } + + @Override + public int ID() + { + return 1; + } + + + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/Wave1.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/Wave1.java new file mode 100644 index 000000000..b2ed6fd86 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/Wave1.java @@ -0,0 +1,46 @@ +package nautilus.game.arcade.game.games.halloween2016.wave; + +import mineplex.core.common.util.UtilTime; + +import nautilus.game.arcade.game.games.halloween2016.Halloween2016; +import nautilus.game.arcade.game.games.halloween2016.creatures.MobSkeletonArcher; +import nautilus.game.arcade.game.games.halloween2016.creatures.MobZombie; + +public class Wave1 extends WaveBase +{ + + public Wave1(Halloween2016 host) + { + super(host, null, 80000, host.getMobSpawns(), null); + _desc = new String[] + { + "Zombies", + "Skeletons" + }; + } + + @Override + public void Spawn(int tick) + { + if(tick == 0) + { + Host.setObjective("Protect the Crypt"); + } + + if (UtilTime.elapsed(_start, 50000)) + return; + + if (Host.getNonPumplings().size() > Host.getMaxNonPumplings()) return; + + if(tick%10 == 0) + { + Host.AddCreature(new MobZombie(Host, GetSpawn())); + } + + if(tick%15 == 0) + { + Host.AddCreature(new MobSkeletonArcher(Host, GetSpawn())); + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/Wave2.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/Wave2.java new file mode 100644 index 000000000..b716a7095 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/Wave2.java @@ -0,0 +1,56 @@ +package nautilus.game.arcade.game.games.halloween2016.wave; + +import mineplex.core.common.util.UtilTime; + +import nautilus.game.arcade.game.games.halloween.creatures.MobSpiderLeaper; +import nautilus.game.arcade.game.games.halloween.creatures.MobSpiderSmasher; +import nautilus.game.arcade.game.games.halloween2016.Halloween2016; +import nautilus.game.arcade.game.games.halloween2016.creatures.MobGiant; +import nautilus.game.arcade.game.games.halloween2016.creatures.MobZombie; + +public class Wave2 extends WaveBase +{ + + public Wave2(Halloween2016 host) + { + super(host, null, 90000, host.getMobSpawns(), null); + _desc = new String[] + { + "Giants", + "Creepers", + "Zombies", + "Spiders" + }; + } + + @Override + public void Spawn(int tick) + { + if(tick == 0) + { + Host.AddCreature(new MobGiant(Host, getSpawn(Host.getMainLane()))); + } + + if (UtilTime.elapsed(_start, 60000)) + return; + + if(tick%200 == 0) + { + spawnCreepers(); + } + + if (Host.getNonPumplings().size() > Host.getMaxNonPumplings()) return; + + if(tick%7 == 0) + { + Host.AddCreature(new MobZombie(Host, GetSpawn())); + } + + if(tick%20 == 0) + { + Host.AddCreature(new MobSpiderLeaper(Host, GetSpawn())); + Host.AddCreature(new MobSpiderSmasher(Host, GetSpawn())); + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/Wave3.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/Wave3.java new file mode 100644 index 000000000..fef51ae1a --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/Wave3.java @@ -0,0 +1,68 @@ +package nautilus.game.arcade.game.games.halloween2016.wave; + +import mineplex.core.common.util.UtilTime; + +import nautilus.game.arcade.game.games.halloween2016.Halloween2016; +import nautilus.game.arcade.game.games.halloween2016.creatures.MobBlaze; +import nautilus.game.arcade.game.games.halloween2016.creatures.MobGiant; +import nautilus.game.arcade.game.games.halloween2016.creatures.MobWitch; +import nautilus.game.arcade.game.games.halloween2016.creatures.MobZombie; +import nautilus.game.arcade.game.games.halloween2016.creatures.MobZombieSpawner; + +public class Wave3 extends WaveBase +{ + + public Wave3(Halloween2016 host) + { + super(host, null, 90000, host.getMobSpawns(), null); + _desc = new String[] + { + "Giants", + "Creepers", + "Zombies", + "Zombie Spawners", + "Blazes" + }; + } + + @Override + public void Spawn(int tick) + { + if (UtilTime.elapsed(_start, 60000)) + return; + + if(tick%200 == 0) + { + spawnCreepers(); + } + + if(tick%(20*7) == 0) + { + Host.AddCreature(new MobWitch(Host, GetSpawn())); + } + + if(tick%(20 * 10) == 0) + { + Host.AddCreature(new MobGiant(Host, getSpawn(Host.getMainLane()))); + } + + if (Host.getNonPumplings().size() > Host.getMaxNonPumplings()) return; + + if(tick%15 == 0) + { + Host.AddCreature(new MobZombie(Host, GetSpawn())); + } + + if(tick%60 == 0) + { + Host.AddCreature(new MobZombieSpawner(Host, GetSpawn())); + } + + if(tick%30 == 0) + { + Host.AddCreature(new MobBlaze(Host, GetSpawn())); + } + + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/Wave4.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/Wave4.java new file mode 100644 index 000000000..7083c3e87 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/Wave4.java @@ -0,0 +1,56 @@ +package nautilus.game.arcade.game.games.halloween2016.wave; + +import mineplex.core.common.util.UtilTime; +import nautilus.game.arcade.game.games.halloween2016.Halloween2016; +import nautilus.game.arcade.game.games.halloween2016.creatures.MobBlaze; +import nautilus.game.arcade.game.games.halloween2016.creatures.MobGiant; +import nautilus.game.arcade.game.games.halloween2016.creatures.MobPigZombie; +import nautilus.game.arcade.game.games.halloween2016.creatures.MobWitch; + +public class Wave4 extends WaveBase +{ + + public Wave4(Halloween2016 host) + { + super(host, null, 100000, host.getMobSpawns(), null); + _desc = new String[] + { + "Giants", + "Creepers", + "Zombie Pigmen", + "Blazes", + "Witches", + }; + } + + @Override + public void Spawn(int tick) + { + if(tick%(20 * 30) == 0) + { + Host.AddCreature(new MobGiant(Host, getSpawn(Host.getMainLane()))); + } + + if (Host.getNonPumplings().size() > Host.getMaxNonPumplings()) return; + + if (UtilTime.elapsed(_start, 70000)) + return; + + if(tick%15 == 0) + { + Host.AddCreature(new MobPigZombie(Host, GetSpawn())); + } + + if(tick%60 == 0) + { + Host.AddCreature(new MobBlaze(Host, GetSpawn())); + } + + if(tick%100 == 0) + { + Host.AddCreature(new MobWitch(Host, GetSpawn())); + } + + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/Wave5.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/Wave5.java new file mode 100644 index 000000000..176d375b7 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/Wave5.java @@ -0,0 +1,84 @@ +package nautilus.game.arcade.game.games.halloween2016.wave; + +import mineplex.core.common.util.UtilTime; + +import nautilus.game.arcade.game.games.halloween.creatures.MobSpiderLeaper; +import nautilus.game.arcade.game.games.halloween.creatures.MobSpiderSmasher; +import nautilus.game.arcade.game.games.halloween2016.Halloween2016; +import nautilus.game.arcade.game.games.halloween2016.creatures.MobBlaze; +import nautilus.game.arcade.game.games.halloween2016.creatures.MobGiant; +import nautilus.game.arcade.game.games.halloween2016.creatures.MobSkeletonArcher; +import nautilus.game.arcade.game.games.halloween2016.creatures.MobWitch; +import nautilus.game.arcade.game.games.halloween2016.creatures.MobZombie; +import nautilus.game.arcade.game.games.halloween2016.creatures.MobZombieSpawner; + +public class Wave5 extends WaveBase +{ + + public Wave5(Halloween2016 host) + { + super(host, null, 120000, host.getMobSpawns(), null); + _desc = new String[] + { + "Giants", + "Creepers", + "Zombies", + "Zombie Spawners", + "Skeletons", + "Witches", + "Blazes", + "Spiders" + }; + } + + @Override + public void Spawn(int tick) + { + if(tick%(20*30) == 0) + { + Host.AddCreature(new MobGiant(Host, getSpawn(Host.getMainLane()))); + } + + if (UtilTime.elapsed(_start, 100000)) + return; + + if(tick%300 == 0) + { + spawnCreepers(); + } + + if (Host.getNonPumplings().size() > Host.getMaxNonPumplings()) return; + + if(tick%40 == 0) + { + Host.AddCreature(new MobZombie(Host, GetSpawn())); + } + + if(tick%40 == 0) + { + Host.AddCreature(new MobSkeletonArcher(Host, GetSpawn())); + } + + if(tick%50 == 0) + { + Host.AddCreature(new MobZombieSpawner(Host, GetSpawn())); + } + + if(tick%50 == 0) + { + Host.AddCreature(new MobWitch(Host, GetSpawn())); + } + + if(tick%50 == 0) + { + Host.AddCreature(new MobBlaze(Host, GetSpawn())); + } + + if(tick%40 == 0) + { + Host.AddCreature(new MobSpiderLeaper(Host, GetSpawn())); + Host.AddCreature(new MobSpiderSmasher(Host, GetSpawn())); + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/WaveBase.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/WaveBase.java new file mode 100644 index 000000000..95a211c18 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/WaveBase.java @@ -0,0 +1,46 @@ +package nautilus.game.arcade.game.games.halloween2016.wave; + +import java.util.List; + +import org.bukkit.Location; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilMath; + +import nautilus.game.arcade.game.games.halloween.NamedAudio; +import nautilus.game.arcade.game.games.halloween2016.Halloween2016; +import nautilus.game.arcade.game.games.halloween2016.creatures.MobCreeper; + +public abstract class WaveBase extends nautilus.game.arcade.game.games.halloween.waves.WaveBase +{ + + protected Halloween2016 Host; + + protected static final int CREEPER_SPAWN_PACK_SIZE = 5; + + public WaveBase(Halloween2016 host, String name, long duration, List<Location> spawns, NamedAudio audio) + { + super(host, name, duration, spawns, audio); + Host = host; + + _titleColor = C.cRed; + } + + public Location getSpawn(List<Location> lane) + { + return lane.get(UtilMath.r(lane.size())); + } + + public void spawnCreepers() + { + Location loc = GetSpawn(); + for(int i = 0; i < CREEPER_SPAWN_PACK_SIZE; i++) + { + double x = UtilMath.random(-3, 3); + double z = UtilMath.random(-3, 3); + + Host.AddCreature(new MobCreeper(Host, loc.clone().add(x, 0, z)), false); + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/WaveBoss.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/WaveBoss.java new file mode 100644 index 000000000..c390473bc --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/WaveBoss.java @@ -0,0 +1,253 @@ +package nautilus.game.arcade.game.games.halloween2016.wave; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Fireball; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Skeleton; +import org.bukkit.entity.Skeleton.SkeletonType; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; + +import nautilus.game.arcade.game.games.halloween.creatures.CreatureBase; +import nautilus.game.arcade.game.games.halloween2016.Halloween2016; +import nautilus.game.arcade.game.games.halloween2016.creatures.MobPrinceGuard; +import nautilus.game.arcade.game.games.halloween2016.creatures.MobPumpkinPrince; + +public class WaveBoss extends WaveBase implements Listener +{ + private MobPumpkinPrince _prince; + private Halloween2016 Host; + + private Skeleton _pumpkinKing; + + private List<MobPrinceGuard> _guards = new ArrayList<>(); + private int _guardsCount = 4; + private int _guardsCountQueue = _guardsCount; + private double _nextPrinceHealthStageForNewGuards; + + private int _tick = 0; + + private Fireball _fireball; + + private final static float KING_SPEED = 1.7f; + private final static float PRINCE_SPEED = 1.3f; + + private Location _princeTarget; + + public WaveBoss(Halloween2016 host) + { + super(host, "Boss Fight", 0, host.getMobSpawns(), null); + Host = host; + } + + @Override + public void Spawn(int tick) + { + tick = _tick; + _tick++; + if(tick == 0) + { + UtilServer.RegisterEvents(this); + + for(Player p : Host.GetPlayers(true)) + { + p.teleport(Host.getCryptView()); + } + Host.lockAllPlayers(Host.getCryptView()); + + for(CreatureBase<?> c : Host.getMobs()) + { + c.remove(); + } + } + else if(tick == 4) + { + for(CreatureBase<?> c : Host.getMobs()) + { + c.remove(); + } + for(Entity e : Host.WorldData.World.getEntities()) + { + if((e instanceof LivingEntity) && !(e instanceof Player)) + { + e.remove(); + } + } + } + else if(tick == 5) + { + + _princeTarget = Host.getPrinceTargetInfrontOfCrypt(); + + _prince = new MobPumpkinPrince(Host, Host.getPrinceSpawn()); + _prince.setAI(false); + Host.AddCreature(_prince); + + _nextPrinceHealthStageForNewGuards = _prince.GetEntity().getHealth()-200; + } + else if(tick < 20 * 5) + { + UtilEnt.CreatureMove(_prince.getHorse(), _princeTarget, PRINCE_SPEED); + } + else if(tick == 20 * 6) + { + Vector diff = Host.getInfrontOfDoorTargets().get(1).clone().add(0, 1, 0).subtract(_prince.GetEntity().getEyeLocation()).toVector(); + UtilEnt.CreatureLook(_prince.GetEntity(), UtilAlg.GetPitch(diff), UtilAlg.GetYaw(diff)); + _fireball = _prince.GetEntity().launchProjectile(Fireball.class); + } + else if(tick == 20 * 11) + { + Host.Announce("", false); + Host.Announce("", false); + say("Pumpkin King", "I am free! Free at last!"); + } + if(tick == 20 * 12) + { + say("Pumpkin King", "Protect me my son!"); + } + if(tick > 20 * 13 && tick < 20 * 18) + { + UtilEnt.CreatureMove(_pumpkinKing, Host.getGiantSpawn(), KING_SPEED); + + } + else if(tick == 20 * 18) + { + _pumpkinKing.remove(); + + Host.unlockAllPlayers(); + _prince.setAI(true); + for(MobPrinceGuard guard : _guards) + { + guard.setAI(true); + } + + Host.Objective = "Eliminate the Guards"; + Host.Announce(C.cGreen + C.Bold + "Kill the Prince's Guards first!", false); + } + + + + + + + + + if(tick > 20 * 18){ + boolean empt = _guards.isEmpty(); + for(Iterator<MobPrinceGuard> it = _guards.iterator(); it.hasNext();) + { + MobPrinceGuard g = it.next(); + if(!g.GetEntity().isValid()) it.remove(); + } + if(empt != _guards.isEmpty() && !empt) + { + Host.Objective = "Defeat the Pumpkin Prince"; + Host.Announce(C.cGreen + C.Bold + "All the Pumpking Prince's guards are dead!", false); + Host.Announce(C.cGreen + C.Bold + "Kill him while he is unprotected!", true); + } + + _prince.setInvulnerable(!_guards.isEmpty()); + + if(_prince.GetEntity().getHealth() < _nextPrinceHealthStageForNewGuards) + { + Host.Objective = "Eliminate the Guards"; + Host.Announce(C.cGreen + C.Bold + "The Pumpkin Prince's guards are back to protect him", false); + Host.Announce(C.cGreen + C.Bold + "Kill them first before attacking the Prince!", true); + + + _prince.setInvulnerable(true); + _nextPrinceHealthStageForNewGuards -= 200; + _guardsCountQueue = _guardsCount; + } + + if(tick % 20 * 20 == 0) + { + if(_guardsCountQueue > 0) + { + MobPrinceGuard guard = new MobPrinceGuard(Host, Host.getGiantSpawn(), _prince); + _guards.add(guard); + Host.AddCreature(guard); + _guardsCountQueue--; + } + } + } + } + + public void say(String role, String msg) + { + Host.Announce("\n" + C.cGold + C.Bold + role + ": " + C.cGray + msg + "\n"); + UtilTextMiddle.display(C.cGold + msg, null, 0, 40, 0); + } + + @Override + public boolean CanEnd() + { + boolean r = _prince != null && _prince.isDead(); + if(r) + { + end(); + } + return r; + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void onExplode(EntityExplodeEvent event) + { + if(event.getEntity().equals(_fireball)) + { + event.setCancelled(true); + event.blockList().clear(); + Host.getCrypt().setHealth(0); + + + Host.CreatureAllowOverride = true; + _pumpkinKing = GetSpawn().getWorld().spawn(Host.getInfrontOfCrypt(), Skeleton.class); + Host.CreatureAllowOverride = false; + + _pumpkinKing.setSkeletonType(SkeletonType.WITHER); + _pumpkinKing.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN)); + + _pumpkinKing.setCustomName(C.cYellow + C.Bold + "Pumpking King"); + _pumpkinKing.setCustomNameVisible(true); + + UtilEnt.Vegetate(_pumpkinKing); + + _pumpkinKing.getWorld().strikeLightningEffect(_pumpkinKing.getLocation()); + } + } + + public void end() + { + UtilServer.Unregister(this); + + Host.Announce("\n" + C.cYellow + C.Bold + "The Pumpkin Prince has been defeated!\nThe World is safe... for tonight.\n"); + } + + @EventHandler + public void onDamage(CustomDamageEvent event) + { + if(event.GetDamageeEntity().equals(_pumpkinKing)) + { + event.SetCancelled("Invincible Statue"); + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/WaveVictory.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/WaveVictory.java new file mode 100644 index 000000000..fc775aae3 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/WaveVictory.java @@ -0,0 +1,52 @@ +package nautilus.game.arcade.game.games.halloween2016.wave; + +import java.util.List; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import nautilus.game.arcade.game.games.halloween.creatures.CreatureBase; +import nautilus.game.arcade.game.games.halloween2016.Halloween2016; + +public class WaveVictory extends WaveBase +{ + public WaveVictory(Halloween2016 host, List<Location> beaconSpawn) + { + super(host, "Celebration!", 15000, beaconSpawn, null); + + _displayWaveNumber = false; + _announceWaveChat = false; + } + + @Override + public void Spawn(int tick) + { + if (UtilTime.elapsed(_start, 20000)) return; + + // Play + if (tick == 0) + { + for (Player player : UtilServer.getPlayers()) + { + player.playEffect(Host.getDoorSchematicLocation(), Effect.RECORD_PLAY, 2259); + } + } + + // Mobs + for (CreatureBase<? extends LivingEntity> mob : Host.GetCreatures()) + { + mob.GetEntity().damage(5); + } + + // Time + if (Host.WorldTimeSet != 6000) + { + Host.WorldTimeSet = (Host.WorldTimeSet + 50) % 24000; + Host.WorldData.World.setTime(Host.WorldTimeSet); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFletcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFletcher.java index e0bd889de..3867996c0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFletcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFletcher.java @@ -57,7 +57,7 @@ public class PerkFletcher extends Perk public PerkFletcher(int time, int max, boolean remove, int slot, boolean instant) { - this(time, max, remove, slot, instant, "Fletcted Arrow"); + this(time, max, remove, slot, instant, "Fletched Arrow"); } public PerkFletcher(int time, int max, boolean remove, int slot, boolean instant, String name) @@ -162,7 +162,13 @@ public class PerkFletcher extends Perk } else { - cur.getInventory().setItem(_slot, ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item(_name))); + int amount = 1; + ItemStack old = cur.getInventory().getItem(_slot); + if(old != null && old.getType() == Material.ARROW) + { + amount += old.getAmount(); + } + cur.getInventory().setItem(_slot, ItemStackFactory.Instance.CreateStack(262, (byte)0, amount, F.item(_name))); } cur.playSound(cur.getLocation(), Sound.ITEM_PICKUP, 2f, 1f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHammerThrow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHammerThrow.java index 10c87bc33..f8ebc7caa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHammerThrow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHammerThrow.java @@ -87,7 +87,7 @@ public class PerkHammerThrow extends Perk implements IThrown @EventHandler public void Pickup(PlayerPickupItemEvent event) { - if (!_thrown.containsKey(event.getItem())) + if (!event.getPlayer().equals(_thrown.get(event.getItem()))) return; event.setCancelled(true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/NextBestGameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/NextBestGameManager.java index 75a511baa..bc24be374 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/NextBestGameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/NextBestGameManager.java @@ -20,6 +20,7 @@ import nautilus.game.arcade.events.PlayerStateChangeEvent; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.GameTeam.PlayerState; +import nautilus.game.arcade.game.games.halloween2016.Halloween2016; import nautilus.game.arcade.game.games.minestrike.Minestrike; import nautilus.game.arcade.game.games.paintball.Paintball; import nautilus.game.arcade.game.games.wither.WitherGame; @@ -245,6 +246,7 @@ public class NextBestGameManager implements Listener if(event.GetGame() instanceof Minestrike || event.GetGame() instanceof WitherGame || event.GetGame() instanceof Paintball + || event.GetGame() instanceof Halloween2016 || event.GetGame().Manager.GetHost() != null) { return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/current/NewGameLobbyManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/current/NewGameLobbyManager.java index 1711097d6..ca5f05faf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/current/NewGameLobbyManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/current/NewGameLobbyManager.java @@ -528,6 +528,12 @@ public class NewGameLobbyManager extends LobbyManager { _multipleLocs.put(lastName, locations); } + } else if(name.equalsIgnoreCase("MAP_NAME")) + { + if(tokens[1].toLowerCase().contains("halloween")) + { + WORLD.setTime(13850); + } } else { lastName = tokens[1]; From 6d360341152085d02d22ddb6d48e2f6724334c88 Mon Sep 17 00:00:00 2001 From: AlexTheCoder <alexjmeech@gmail.com> Date: Sun, 9 Oct 2016 21:42:30 -0400 Subject: [PATCH 034/147] Remove voting from carl the creeper, move spin tokens to playwire, unify link messages in all carl the creeper links --- .../mineplex/core/bonuses/BonusManager.java | 9 +- .../mineplex/core/bonuses/gui/BonusGui.java | 10 +- .../bonuses/gui/buttons/FacebookButton.java | 27 +- .../bonuses/gui/buttons/PlayWireButton.java | 3 +- .../gui/{ => buttons}/TwitterButton.java | 14 +- .../core/bonuses/gui/buttons/VoteButton.java | 368 +++++++++--------- .../bonuses/gui/buttons/YoutubeButton.java | 23 +- .../core/bonuses/redis/VoteHandler.java | 62 +-- .../core/bonuses/redis/VotifierCommand.java | 56 +-- .../core/playwire/PlayWireManager.java | 31 +- .../mineplex/core/playwire/ResponseType.java | 2 +- 11 files changed, 341 insertions(+), 264 deletions(-) rename Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/{ => buttons}/TwitterButton.java (59%) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java index 9c692c7d1..f7d3f57ea 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java @@ -239,7 +239,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I clientManager.addStoredProcedureLoginProcessor(this); - ServerCommandManager.getInstance().registerCommandType("VotifierCommand", VotifierCommand.class, new VoteHandler(this)); + //ServerCommandManager.getInstance().registerCommandType("VotifierCommand", VotifierCommand.class, new VoteHandler(this)); updateOffSet(); // updateStreakRecord(); @@ -826,7 +826,8 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I int availableRewards = 0; - if (canVote(player)) availableRewards++; + //if (canVote(player)) availableRewards++; + if (_playWireManager.canRedeem(player)) availableRewards++; if (_youtubeManager.canYoutube(player)) availableRewards++; if (canRank(player) && _clientManager.hasRank(player, Rank.ULTRA) && isPastAugust()) availableRewards++; if (canDaily(player)) availableRewards++; @@ -991,7 +992,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I { if (Recharge.Instance.use(player, "Carl Inform", 240000, false, false)) { - if(_pollManager.hasPoll(player) || canVote(player) || (canRank(player) && _clientManager.hasRank(player, Rank.ULTRA) && isPastAugust()) || canDaily(player) || PowerPlayClubButton.isAvailable(player, _powerPlayClubRepository)) + if(_pollManager.hasPoll(player) || /*canVote(player)*/_playWireManager.canRedeem(player) || (canRank(player) && _clientManager.hasRank(player, Rank.ULTRA) && isPastAugust()) || canDaily(player) || PowerPlayClubButton.isAvailable(player, _powerPlayClubRepository)) { if(_showCarl.containsKey(player.getName())) { @@ -1120,4 +1121,4 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I { _carlLocation = carlLocation; } -} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java index 9a6125254..99faaa17a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java @@ -14,10 +14,10 @@ import org.bukkit.plugin.Plugin; public class BonusGui extends SimpleGui { - private final int VOTE_SLOT = 10; - private final int RANK_BONUS_SLOT = 12; - private final int DAILY_BONUS_SLOT = 14; - private final int POLL_SLOT = 16; + //private final int VOTE_SLOT = 10; + private final int RANK_BONUS_SLOT = 11; + private final int DAILY_BONUS_SLOT = 13; + private final int POLL_SLOT = 15; private final int FACEBOOK_SLOT = 19; private final int CLAIM_TIPS_SLOT = 25; private final int POWER_PLAY_SLOT = 21; @@ -32,7 +32,7 @@ public class BonusGui extends SimpleGui { super(plugin, player, player.getName() + "'s Bonuses", INV_SIZE); - setItem(VOTE_SLOT, new VoteButton(plugin, player, this, manager)); + //setItem(VOTE_SLOT, new VoteButton(plugin, player, this, manager)); setItem(RANK_BONUS_SLOT, new RankBonusButton(getPlugin(), player, this, manager)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/FacebookButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/FacebookButton.java index 9b9d41350..d6d54a6aa 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/FacebookButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/FacebookButton.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import org.bukkit.ChatColor; import org.bukkit.Material; +import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; @@ -12,6 +13,7 @@ import mineplex.core.bonuses.BonusAmount; import mineplex.core.common.jsonchat.ClickEvent; import mineplex.core.common.jsonchat.JsonMessage; import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.facebook.FacebookManager; import mineplex.core.gui.GuiItem; import mineplex.core.itemstack.ItemStackFactory; @@ -43,8 +45,31 @@ public class FacebookButton implements GuiItem public void click(ClickType clickType) { _player.closeInventory(); + + _player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1, 1.6f); + + final String message; + if (isAvailable()) + { + message = "claim Facebook Prize!"; + } + else + { + message = "visit our Facebook page!"; + } + + UtilPlayer.message(_player, C.cGold + C.Bold + C.Strike + "============================================="); + UtilPlayer.message(_player, ""); - new JsonMessage(C.cAquaB + "Click here to claim Facebook Prize!").click(ClickEvent.OPEN_URL, "https://www.facebook.com/MineplexGames/app/185301094822359/").sendToPlayer(_player); + new JsonMessage(" " + C.Bold + "Click to Open in Web Browser and " + message).click(ClickEvent.OPEN_URL, "https://www.facebook.com/MineplexGames/app/185301094822359/").sendToPlayer(_player); + new JsonMessage(" " + C.cGreen + C.Line + "https://www.facebook.com/MineplexGames").click(ClickEvent.OPEN_URL, "https://www.facebook.com/MineplexGames/app/185301094822359/").sendToPlayer(_player); + UtilPlayer.message(_player, ""); + if (isAvailable()) + { + UtilPlayer.message(_player, " Please be patient. Prizes may take a few minutes to register."); + UtilPlayer.message(_player, ""); + } + UtilPlayer.message(_player, C.cGold + C.Bold + C.Strike + "============================================="); } private boolean isAvailable() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PlayWireButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PlayWireButton.java index b877b1bb1..a427b793b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PlayWireButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PlayWireButton.java @@ -20,7 +20,7 @@ public class PlayWireButton implements GuiItem .setTitle(C.cGreen + C.Bold + "Watch an Ad!") .addLore( C.cWhite + "You have already redeemed your", - C.cWhite + "100 Shards for watching the Ad!", + C.cWhite + "rewards for watching the Ad!", " ", C.cWhite + "You can watch it again, but you won't earn any shards!", " ", @@ -37,6 +37,7 @@ public class PlayWireButton implements GuiItem .setTitle(C.cGreen + C.Bold + "Watch an Ad!") .addLore( C.cYellow + "Earn a 100 Shard Reward", + C.cYellow + "and 1 Carl Spin Ticket", C.cWhite + "by checking out our partner's Advertisement", " ", C.cWhite + "You can watch the Ad once every hour.", diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/TwitterButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/TwitterButton.java similarity index 59% rename from Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/TwitterButton.java rename to Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/TwitterButton.java index fd9804d5d..4700bad1c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/TwitterButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/TwitterButton.java @@ -1,11 +1,13 @@ -package mineplex.core.bonuses.gui; +package mineplex.core.bonuses.gui.buttons; import mineplex.core.common.jsonchat.ClickEvent; import mineplex.core.common.jsonchat.JsonMessage; import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.gui.GuiItem; import mineplex.core.itemstack.ItemBuilder; import org.bukkit.Material; +import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; @@ -39,8 +41,16 @@ public class TwitterButton implements GuiItem public void click(ClickType clickType) { _player.closeInventory(); + + _player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1, 1.6f); + + UtilPlayer.message(_player, C.cGold + C.Bold + C.Strike + "============================================="); + UtilPlayer.message(_player, ""); - new JsonMessage(C.cAquaB + "Click here to visit our Twitter page!").click(ClickEvent.OPEN_URL, "https://www.twitter.com/Mineplex").sendToPlayer(_player); + new JsonMessage(" " + C.Bold + "Click to Open in Web Browser").click(ClickEvent.OPEN_URL, "https://www.twitter.com/Mineplex").sendToPlayer(_player); + new JsonMessage(" " + C.cGreen + C.Line + "https://www.twitter.com/Mineplex").click(ClickEvent.OPEN_URL, "https://www.twitter.com/Mineplex").sendToPlayer(_player); + UtilPlayer.message(_player, ""); + UtilPlayer.message(_player, C.cGold + C.Bold + C.Strike + "============================================="); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/VoteButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/VoteButton.java index 2d758624e..c84c00787 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/VoteButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/VoteButton.java @@ -1,185 +1,185 @@ -package mineplex.core.bonuses.gui.buttons; - -import java.util.ArrayList; - -import mineplex.core.bonuses.BonusAmount; -import mineplex.core.bonuses.BonusClientData; -import mineplex.core.bonuses.BonusManager; -import mineplex.core.common.jsonchat.ClickEvent; -import mineplex.core.common.jsonchat.JsonMessage; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilTime.TimeUnit; -import mineplex.core.gui.GuiItem; -import mineplex.core.gui.ItemRefresher; -import mineplex.core.shop.item.ShopItem; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.Player; -import org.bukkit.event.HandlerList; -import org.bukkit.event.Listener; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.Plugin; - -public class VoteButton implements GuiItem, Listener { - - private ItemStack _item; - - private String _url; - - private Player _player; - private Plugin _plugin; - private ItemRefresher _gui; - - private BonusManager _bonusManager; - - public VoteButton(Plugin plugin, Player player, ItemRefresher gui, BonusManager bonusManager) - { - this._bonusManager = bonusManager; - this._player = player; - this._plugin = plugin; - this._gui = gui; - } - - @Override - public void setup() - { - //TODO get url from db - _url = _bonusManager.getVoteLink(); - - setItem(); - Bukkit.getPluginManager().registerEvents(this, getPlugin()); - } - - @Override - public void close() - { - HandlerList.unregisterAll(this); - } - - @Override - public void click(ClickType clickType) - { - if (isAvailable()) - { - getPlayer().closeInventory(); - - getPlayer().playSound(getPlayer().getLocation(), Sound.NOTE_PLING, 1, 1.6f); - - UtilPlayer.message(getPlayer(), C.cGold + C.Bold + C.Strike + "============================================="); - UtilPlayer.message(getPlayer(), ""); - - new JsonMessage(" " + C.Bold + "Click to Open in Web Browser").click(ClickEvent.OPEN_URL, _url).sendToPlayer(getPlayer()); - new JsonMessage( " " + C.cGreen + C.Line + _url).click(ClickEvent.OPEN_URL, _url).sendToPlayer(getPlayer()); - UtilPlayer.message(getPlayer(), ""); - UtilPlayer.message(getPlayer(), " Please be patient. Votes may take a few minutes to register."); - UtilPlayer.message(getPlayer(), ""); - UtilPlayer.message(getPlayer(), C.cGold + C.Bold + C.Strike + "============================================="); - - getPlayer().closeInventory(); - - } - else - { - getPlayer().playSound(getPlayer().getLocation(), Sound.ITEM_BREAK, 1, 10); - } - } - - @Override - public ItemStack getObject() - { - return _item; - } - - private void setItem() - { - ArrayList<String> lore = new ArrayList<String>(); - Material material; - String itemName; - byte data = 0; - - if (isAvailable()) - { - material = Material.JUKEBOX; - itemName = C.cGreen + C.Bold + "Vote for Mineplex"; - - lore.add(" "); - lore.add(ChatColor.RESET + "Click to Vote!"); - } - else - { - material = Material.REDSTONE_BLOCK; - itemName = C.cRed + C.Bold + "Vote for Mineplex"; - - lore.add(" "); - lore.add(ChatColor.RESET + "Next vote in " + UtilTime.convertString(timeLeft(), 0, TimeUnit.FIT) + "!"); - } - - lore.add(" "); - - BonusClientData client = _bonusManager.Get(_player); - - BonusAmount bonusAmount = _bonusManager.getVoteBonusAmount(_player); - bonusAmount.addLore(lore); - lore.add(" "); - - lore.add(C.cYellow + "Current Streak: " + C.cWhite + client.getVoteStreak()); - lore.add(C.cYellow + "Streak Bonus: " + C.cWhite + "+" + _bonusManager.getVoteMultiplier(client.getVoteStreak()) + "%"); - if (client.getVoteTime() != null) - { - long lastBonus = _bonusManager.getLocalTime(client.getVoteTime().getTime()); - long timeLeft = _bonusManager.getStreakTimeRemaining(lastBonus, BonusManager.VOTE_STREAK_RESET_TIME); - - if (timeLeft > 0) - { - lore.add(C.cYellow + "Streak Reset: " + C.cWhite + UtilTime.convertString(timeLeft, 1, TimeUnit.FIT)); - } - } - - lore.add(" "); - lore.add(C.cYellow + "Highest Streak: " + C.cWhite + client.getMaxVoteStreak()); - -// StreakRecord streakRecord = _bonusManager.getVoteStreak(); -// if (streakRecord != null) -// { -// lore.add(" "); -// lore.add(C.cYellow + "Record: " + C.cWhite + streakRecord.getPlayerName()); -// lore.add(C.cYellow + "Streak: " + C.cWhite + streakRecord.getStreak()); -// } - - _item = new ShopItem(material, itemName, lore.toArray(new String[0]), 1, false, false); - } - - public long timeLeft() - { - return _bonusManager.nextVoteTime(getPlayer()) - System.currentTimeMillis(); - } - - public boolean isAvailable() - { - if (_url == null) - return false; - - return (timeLeft() <= 0); - } - - public Plugin getPlugin() - { - return _plugin; - } - - public Player getPlayer() - { - return _player; - } - - public ItemRefresher getGui() - { - return _gui; - } +package mineplex.core.bonuses.gui.buttons; + +import java.util.ArrayList; + +import mineplex.core.bonuses.BonusAmount; +import mineplex.core.bonuses.BonusClientData; +import mineplex.core.bonuses.BonusManager; +import mineplex.core.common.jsonchat.ClickEvent; +import mineplex.core.common.jsonchat.JsonMessage; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilTime.TimeUnit; +import mineplex.core.gui.GuiItem; +import mineplex.core.gui.ItemRefresher; +import mineplex.core.shop.item.ShopItem; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.Plugin; + +public class VoteButton implements GuiItem, Listener { + + private ItemStack _item; + + private String _url; + + private Player _player; + private Plugin _plugin; + private ItemRefresher _gui; + + private BonusManager _bonusManager; + + public VoteButton(Plugin plugin, Player player, ItemRefresher gui, BonusManager bonusManager) + { + this._bonusManager = bonusManager; + this._player = player; + this._plugin = plugin; + this._gui = gui; + } + + @Override + public void setup() + { + //TODO get url from db + _url = _bonusManager.getVoteLink(); + + setItem(); + Bukkit.getPluginManager().registerEvents(this, getPlugin()); + } + + @Override + public void close() + { + HandlerList.unregisterAll(this); + } + + @Override + public void click(ClickType clickType) + { + if (isAvailable()) + { + getPlayer().closeInventory(); + + getPlayer().playSound(getPlayer().getLocation(), Sound.NOTE_PLING, 1, 1.6f); + + UtilPlayer.message(getPlayer(), C.cGold + C.Bold + C.Strike + "============================================="); + UtilPlayer.message(getPlayer(), ""); + + new JsonMessage(" " + C.Bold + "Click to Open in Web Browser").click(ClickEvent.OPEN_URL, _url).sendToPlayer(getPlayer()); + new JsonMessage( " " + C.cGreen + C.Line + _url).click(ClickEvent.OPEN_URL, _url).sendToPlayer(getPlayer()); + UtilPlayer.message(getPlayer(), ""); + UtilPlayer.message(getPlayer(), " Please be patient. Votes may take a few minutes to register."); + UtilPlayer.message(getPlayer(), ""); + UtilPlayer.message(getPlayer(), C.cGold + C.Bold + C.Strike + "============================================="); + + getPlayer().closeInventory(); + + } + else + { + getPlayer().playSound(getPlayer().getLocation(), Sound.ITEM_BREAK, 1, 10); + } + } + + @Override + public ItemStack getObject() + { + return _item; + } + + private void setItem() + { + ArrayList<String> lore = new ArrayList<String>(); + Material material; + String itemName; + byte data = 0; + + if (isAvailable()) + { + material = Material.JUKEBOX; + itemName = C.cGreen + C.Bold + "Vote for Mineplex"; + + lore.add(" "); + lore.add(ChatColor.RESET + "Click to Vote!"); + } + else + { + material = Material.REDSTONE_BLOCK; + itemName = C.cRed + C.Bold + "Vote for Mineplex"; + + lore.add(" "); + lore.add(ChatColor.RESET + "Next vote in " + UtilTime.convertString(timeLeft(), 0, TimeUnit.FIT) + "!"); + } + + lore.add(" "); + + BonusClientData client = _bonusManager.Get(_player); + + BonusAmount bonusAmount = _bonusManager.getVoteBonusAmount(_player); + bonusAmount.addLore(lore); + lore.add(" "); + + lore.add(C.cYellow + "Current Streak: " + C.cWhite + client.getVoteStreak()); + lore.add(C.cYellow + "Streak Bonus: " + C.cWhite + "+" + _bonusManager.getVoteMultiplier(client.getVoteStreak()) + "%"); + if (client.getVoteTime() != null) + { + long lastBonus = _bonusManager.getLocalTime(client.getVoteTime().getTime()); + long timeLeft = _bonusManager.getStreakTimeRemaining(lastBonus, BonusManager.VOTE_STREAK_RESET_TIME); + + if (timeLeft > 0) + { + lore.add(C.cYellow + "Streak Reset: " + C.cWhite + UtilTime.convertString(timeLeft, 1, TimeUnit.FIT)); + } + } + + lore.add(" "); + lore.add(C.cYellow + "Highest Streak: " + C.cWhite + client.getMaxVoteStreak()); + +// StreakRecord streakRecord = _bonusManager.getVoteStreak(); +// if (streakRecord != null) +// { +// lore.add(" "); +// lore.add(C.cYellow + "Record: " + C.cWhite + streakRecord.getPlayerName()); +// lore.add(C.cYellow + "Streak: " + C.cWhite + streakRecord.getStreak()); +// } + + _item = new ShopItem(material, itemName, lore.toArray(new String[0]), 1, false, false); + } + + public long timeLeft() + { + return _bonusManager.nextVoteTime(getPlayer()) - System.currentTimeMillis(); + } + + public boolean isAvailable() + { + if (_url == null) + return false; + + return (timeLeft() <= 0); + } + + public Plugin getPlugin() + { + return _plugin; + } + + public Player getPlayer() + { + return _player; + } + + public ItemRefresher getGui() + { + return _gui; + } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/YoutubeButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/YoutubeButton.java index 4a7b1b10e..05382246a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/YoutubeButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/YoutubeButton.java @@ -3,11 +3,13 @@ package mineplex.core.bonuses.gui.buttons; import mineplex.core.common.jsonchat.ClickEvent; import mineplex.core.common.jsonchat.JsonMessage; import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.gui.GuiItem; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.recharge.Recharge; import mineplex.core.youtube.YoutubeManager; import org.bukkit.Material; +import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; @@ -66,18 +68,27 @@ public class YoutubeButton implements GuiItem } _player.closeInventory(); - + + _player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1, 1.6f); + final String message; if (_youtubeManager.canYoutube(_player)) { - message = "Click here to claim YouTube Prize!"; + message = "claim YouTube Prize!"; _youtubeManager.attemptYoutube(_player); - } else - { - message = "Click here to visit our YouTube page!"; } + else + { + message = "visit our YouTube page!"; + } + + UtilPlayer.message(_player, C.cGold + C.Bold + C.Strike + "============================================="); + UtilPlayer.message(_player, ""); - new JsonMessage(C.cAquaB + message).click(ClickEvent.OPEN_URL, "http://youtube.com/mineplexgamesofficial?sub_confirmation=1").sendToPlayer(_player); + new JsonMessage(" " + C.Bold + "Click to Open in Web Browser and " + message).click(ClickEvent.OPEN_URL, "http://youtube.com/mineplexgamesofficial?sub_confirmation=1").sendToPlayer(_player); + new JsonMessage( " " + C.cGreen + C.Line + "http://youtube.com/mineplexgamesofficial").click(ClickEvent.OPEN_URL, "http://youtube.com/mineplexgamesofficial?sub_confirmation=1").sendToPlayer(_player); + UtilPlayer.message(_player, ""); + UtilPlayer.message(_player, C.cGold + C.Bold + C.Strike + "============================================="); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/redis/VoteHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/redis/VoteHandler.java index 0a2d370ba..c6657ec38 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/redis/VoteHandler.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/redis/VoteHandler.java @@ -1,31 +1,31 @@ -package mineplex.core.bonuses.redis; - -import org.bukkit.entity.Player; - -import mineplex.core.bonuses.BonusManager; -import mineplex.core.common.util.UtilPlayer; -import mineplex.serverdata.commands.CommandCallback; -import mineplex.serverdata.commands.ServerCommand; - -public class VoteHandler implements CommandCallback -{ - private BonusManager _bonusManager; - - public VoteHandler(BonusManager bonusManager) - { - _bonusManager = bonusManager; - } - - @Override - public void run(ServerCommand command) - { - VotifierCommand v = ((VotifierCommand) command); - - Player player = UtilPlayer.searchExact(v.getPlayerName()); - - if (player != null) - { - _bonusManager.handleVote(player, v.getShardsReceived()); - } - } -} +package mineplex.core.bonuses.redis; + +import org.bukkit.entity.Player; + +import mineplex.core.bonuses.BonusManager; +import mineplex.core.common.util.UtilPlayer; +import mineplex.serverdata.commands.CommandCallback; +import mineplex.serverdata.commands.ServerCommand; + +public class VoteHandler implements CommandCallback +{ + private BonusManager _bonusManager; + + public VoteHandler(BonusManager bonusManager) + { + _bonusManager = bonusManager; + } + + @Override + public void run(ServerCommand command) + { + VotifierCommand v = ((VotifierCommand) command); + + Player player = UtilPlayer.searchExact(v.getPlayerName()); + + if (player != null) + { + _bonusManager.handleVote(player, v.getShardsReceived()); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/redis/VotifierCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/redis/VotifierCommand.java index 7281d5805..75a07b194 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/redis/VotifierCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/redis/VotifierCommand.java @@ -1,28 +1,28 @@ -package mineplex.core.bonuses.redis; - -import mineplex.serverdata.commands.ServerCommand; - -public class VotifierCommand extends ServerCommand -{ - private String _playerName; - private int _shardsReceived; - - public VotifierCommand(String playerName, int shardsReceived, String... targetServer) - { - super(targetServer); - - _playerName = playerName; - _shardsReceived = shardsReceived; - } - - public String getPlayerName() - { - return _playerName; - } - - public int getShardsReceived() - { - return _shardsReceived; - } - -} +package mineplex.core.bonuses.redis; + +import mineplex.serverdata.commands.ServerCommand; + +public class VotifierCommand extends ServerCommand +{ + private String _playerName; + private int _shardsReceived; + + public VotifierCommand(String playerName, int shardsReceived, String... targetServer) + { + super(targetServer); + + _playerName = playerName; + _shardsReceived = shardsReceived; + } + + public String getPlayerName() + { + return _playerName; + } + + public int getShardsReceived() + { + return _shardsReceived; + } + +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java b/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java index 8f54c7b57..047fd66ed 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java @@ -3,14 +3,21 @@ package mineplex.core.playwire; import mineplex.core.Managers; import mineplex.core.MiniDbClientPlugin; import mineplex.core.account.CoreClientManager; +import mineplex.core.bonuses.BonusManager; +import mineplex.core.common.util.C; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTime.TimeUnit; import mineplex.core.donation.DonationManager; import mineplex.core.inventory.InventoryManager; import mineplex.core.treasure.TreasureType; +import mineplex.database.Tables; +import mineplex.serverdata.database.DBPool; + import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; +import org.jooq.SQLDialect; +import org.jooq.impl.DSL; import java.sql.ResultSet; import java.sql.SQLException; @@ -24,13 +31,15 @@ public class PlayWireManager extends MiniDbClientPlugin<PlayWireClientData> private final long COOL_DOWN = TimeUnit.HOURS.getMilliseconds(); private static final int REWARD_MESSAGE_DELAY_SECONDS = 10; - + + private final CoreClientManager _clientManager; private final DonationManager _donationManager; private final PlayWireRepository _repository; public PlayWireManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager) { super("PlayWire", plugin, clientManager); + _clientManager = clientManager; _donationManager = donationManager; _repository = new PlayWireRepository(this); getPlugin().getCommand("playwire").setExecutor(new PlayWireCommand(this)); @@ -73,6 +82,26 @@ public class PlayWireManager extends MiniDbClientPlugin<PlayWireClientData> _repository.attemptPlayWire(player, client, () -> { _donationManager.RewardCoinsLater("Watching Ad", player, 100); + final int accountId = _clientManager.Get(player).getAccountId(); + runAsync(() -> + { + try + { + final int newTickets = DSL.using(DBPool.getAccount(), SQLDialect.MYSQL).update(Tables.bonus).set(Tables.bonus.tickets, Tables.bonus.tickets.add(1)). + where(Tables.bonus.accountId.eq(accountId)).returning(Tables.bonus.tickets).fetchOne().getTickets(); + runSync(() -> + { + Managers.get(BonusManager.class).Get(player).setTickets(newTickets); + Managers.get(BonusManager.class).updateCreeperVisual(player, true, C.cAqua); + }); + } + catch (Exception e) + { + System.out.println("Failed to award ticket to player: " + player); + e.printStackTrace(); + } + }); + Managers.get(BonusManager.class).addPendingExplosion(player, player.getName()); Bukkit.getScheduler().runTaskLater(getClientManager().getPlugin(), () -> UtilPlayer.message(player, ResponseType.COUNTED.getMessage()), REWARD_MESSAGE_DELAY_SECONDS * 20L); }); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/playwire/ResponseType.java b/Plugins/Mineplex.Core/src/mineplex/core/playwire/ResponseType.java index a4f096bde..c8d229e60 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/playwire/ResponseType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/playwire/ResponseType.java @@ -8,7 +8,7 @@ import mineplex.core.common.util.F; public enum ResponseType { - COUNTED(F.main("Carl", "Rewarded " + F.elem("250 Treasure Shards") + " for watching the Ad")), + COUNTED(F.main("Carl", "Rewarded " + F.elem("100 Treasure Shards") + " and " + F.elem("1 Carl Spin Ticket") + " for watching the Ad")), UNCOUNTED(F.main("Carl", "You already watched the Ad within the past 12 hours!")), BLOCKED(F.main("Carl", "You have an AdBlocker on, but tried to watch the Ad! Ssssssslight problem there!")), UNFILLED(F.main("Carl", "Ssssomething went wrong with the Ad, we'll get it sorted ASAP.")),; From 63c14a99ab1177212d4bb689b016a2db2a64760d Mon Sep 17 00:00:00 2001 From: Alexander Meech <Alex-The-Coder@users.noreply.github.com> Date: Mon, 10 Oct 2016 17:33:02 -0400 Subject: [PATCH 035/147] Update playwire displayed cooldown time --- .../Mineplex.Core/src/mineplex/core/playwire/ResponseType.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/playwire/ResponseType.java b/Plugins/Mineplex.Core/src/mineplex/core/playwire/ResponseType.java index c8d229e60..e35d18c62 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/playwire/ResponseType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/playwire/ResponseType.java @@ -9,7 +9,7 @@ public enum ResponseType { COUNTED(F.main("Carl", "Rewarded " + F.elem("100 Treasure Shards") + " and " + F.elem("1 Carl Spin Ticket") + " for watching the Ad")), - UNCOUNTED(F.main("Carl", "You already watched the Ad within the past 12 hours!")), + UNCOUNTED(F.main("Carl", "You already watched the Ad within the past hour!")), BLOCKED(F.main("Carl", "You have an AdBlocker on, but tried to watch the Ad! Ssssssslight problem there!")), UNFILLED(F.main("Carl", "Ssssomething went wrong with the Ad, we'll get it sorted ASAP.")),; From 87122e9904e0f86dd0682e6a20dc10b7eb24699b Mon Sep 17 00:00:00 2001 From: Alexander Meech <Alex-The-Coder@users.noreply.github.com> Date: Tue, 11 Oct 2016 15:52:53 -0400 Subject: [PATCH 036/147] Update youtube link --- .../src/mineplex/core/bonuses/gui/buttons/YoutubeButton.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/YoutubeButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/YoutubeButton.java index 05382246a..477fa382d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/YoutubeButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/YoutubeButton.java @@ -85,8 +85,8 @@ public class YoutubeButton implements GuiItem UtilPlayer.message(_player, C.cGold + C.Bold + C.Strike + "============================================="); UtilPlayer.message(_player, ""); - new JsonMessage(" " + C.Bold + "Click to Open in Web Browser and " + message).click(ClickEvent.OPEN_URL, "http://youtube.com/mineplexgamesofficial?sub_confirmation=1").sendToPlayer(_player); - new JsonMessage( " " + C.cGreen + C.Line + "http://youtube.com/mineplexgamesofficial").click(ClickEvent.OPEN_URL, "http://youtube.com/mineplexgamesofficial?sub_confirmation=1").sendToPlayer(_player); + new JsonMessage(" " + C.Bold + "Click to Open in Web Browser and " + message).click(ClickEvent.OPEN_URL, "https://www.youtube.com/embed/RW3sOmkiEG-A?list=UU1MtBclG_aHPd0nLmUupCKg&controls=0&showinfo=0&autoplay=1").sendToPlayer(_player); + new JsonMessage( " " + C.cGreen + C.Line + "http://youtube.com/mineplexgamesofficial").click(ClickEvent.OPEN_URL, "https://www.youtube.com/embed/RW3sOmkiEG-A?list=UU1MtBclG_aHPd0nLmUupCKg&controls=0&showinfo=0&autoplay=1").sendToPlayer(_player); UtilPlayer.message(_player, ""); UtilPlayer.message(_player, C.cGold + C.Bold + C.Strike + "============================================="); } From 62d08e74e3a2b33516c14200c565bed79c52cd3e Mon Sep 17 00:00:00 2001 From: Shaun Bennett <me@phinary.ca> Date: Wed, 12 Oct 2016 22:51:46 -0400 Subject: [PATCH 037/147] Remove voting code --- .../mineplex/core/bonuses/BonusManager.java | 172 +---------- .../core/bonuses/gui/buttons/VoteButton.java | 185 ------------ .../core/bonuses/redis/VoteHandler.java | 31 -- .../core/bonuses/redis/VotifierCommand.java | 28 -- Plugins/Mineplex.Votifier/plugin.yml | 3 - Plugins/Mineplex.Votifier/pom.xml | 27 -- .../src/mineplex/votifier/Votifier.java | 33 --- .../mineplex/votifier/VotifierManager.java | 268 ------------------ Plugins/pom.xml | 7 - 9 files changed, 1 insertion(+), 753 deletions(-) delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/VoteButton.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/bonuses/redis/VoteHandler.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/bonuses/redis/VotifierCommand.java delete mode 100644 Plugins/Mineplex.Votifier/plugin.yml delete mode 100644 Plugins/Mineplex.Votifier/pom.xml delete mode 100644 Plugins/Mineplex.Votifier/src/mineplex/votifier/Votifier.java delete mode 100644 Plugins/Mineplex.Votifier/src/mineplex/votifier/VotifierManager.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java index f7d3f57ea..d6ab5acb9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java @@ -14,8 +14,6 @@ import mineplex.core.bonuses.event.CarlSpinnerEvent; import mineplex.core.bonuses.gui.BonusGui; import mineplex.core.bonuses.gui.SpinGui; import mineplex.core.bonuses.gui.buttons.PowerPlayClubButton; -import mineplex.core.bonuses.redis.VoteHandler; -import mineplex.core.bonuses.redis.VotifierCommand; import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.Callback; @@ -48,8 +46,6 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.youtube.YoutubeManager; import mineplex.database.Tables; -import mineplex.database.tables.records.BonusRecord; -import mineplex.serverdata.commands.ServerCommandManager; import mineplex.serverdata.database.DBPool; import net.minecraft.server.v1_8_R3.DataWatcher; import net.minecraft.server.v1_8_R3.EntityCreeper; @@ -93,7 +89,6 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I private ArrayList<Player> _pendingExplosionsPlayers = new ArrayList<>(); private HashMap<String, Boolean> _showCarl = new HashMap<>(); private long _explode; - private boolean _canVote; public static long getSqlTime() { @@ -140,43 +135,10 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I private AnimationCarl _animation; private int _visualTick; - // Streak -// private StreakRecord _dailyStreak; -// private StreakRecord _voteStreak; - - private ArrayList<String> _voteList; - // Donor Queues private Queue<GiveDonorData> _coinQueue; private Queue<GiveDonorData> _gemQueue; - /** - * THIS SHOULD ONLY BE USED FOR VOTIFIER! - */ - public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager) - { - super("Bonus", plugin); - _enabled = false; - - _repository = new BonusRepository(plugin, this, donationManager); - _clientManager = clientManager; - _donationManager = donationManager; - _powerPlayClubRepository = new PowerPlayClubRepository(plugin, clientManager, donationManager); - - System.out.print("VOTIFIER: "); - System.out.print("DONATION MANAGER - > " + _donationManager.toString()); - - _voteList = new ArrayList<>(); - _voteList.add("http://vote1.mineplex.com"); - _voteList.add("http://vote2.mineplex.com"); - _voteList.add("http://vote3.mineplex.com"); - - _coinQueue = new LinkedList<>(); - _gemQueue = new LinkedList<>(); - - updateOffSet(); - } - public BonusManager(JavaPlugin plugin, Location carlLocation, PlayWireManager playWireManager, CoreClientManager clientManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager, FacebookManager facebookManager, YoutubeManager youtubeManager, GadgetManager gadgetManager, ThankManager thankManager) { super("Bonus", plugin); @@ -204,12 +166,6 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I _powerPlayClubRepository = new PowerPlayClubRepository(plugin, _clientManager, _donationManager); - _voteList = new ArrayList<>(); - _voteList.add("http://vote1.mineplex.com"); - _voteList.add("http://vote2.mineplex.com"); - _voteList.add("http://vote3.mineplex.com"); - - _canVote = true; _coinQueue = new LinkedList<>(); _gemQueue = new LinkedList<>(); @@ -239,10 +195,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I clientManager.addStoredProcedureLoginProcessor(this); - //ServerCommandManager.getInstance().registerCommandType("VotifierCommand", VotifierCommand.class, new VoteHandler(this)); - updateOffSet(); -// updateStreakRecord(); } @@ -263,25 +216,6 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I return; updateOffSet(); } - - - public void handleVote(final Player player, final int shardsReceived) - { - final int accountId = _clientManager.getAccountId(player); - - runAsync(() -> _repository.getClientData(accountId, data -> runSync(() -> - { - BonusClientData oldData = Get(player); - if (oldData != null) data.setHologram(oldData.getHologram()); - Set(player, data); - - _statsManager.incrementStat(player, "Global.DailyVote", 1); - addPendingExplosion(player, player.getName()); - UtilPlayer.message(player, F.main("Carl", "Thanks for voting for Mineplex!")); - UtilPlayer.message(player, F.main("Carl", "You received " + F.elem("1 Carl Spinner Ticket") + "!")); - }))); - - } @EventHandler public void fireCreeper(UpdateEvent event) @@ -292,15 +226,11 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I if(_pendingExplosions.isEmpty()) return; - if(!_canVote) - return; - if (!_enabled) return; _explode = System.currentTimeMillis(); _animation.setTicks(0); - _canVote = false; } @EventHandler @@ -311,9 +241,6 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I _animation.itemClean(); - if(_canVote) - return; - if (!_enabled) return; @@ -347,7 +274,6 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I DecreaseSize(creeper); _pendingExplosions.remove(0); _pendingExplosionsPlayers.remove(0); - _canVote = true; } @EventHandler @@ -385,7 +311,6 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I public static final long TIME_BETWEEN_BONUSES = 1000 * 60 * 60 * 20; public static final long DAILY_STREAK_RESET_TIME = 1000 * 60 * 60 * 12; - public static final long VOTE_STREAK_RESET_TIME = 1000 * 60 * 60 * 24; public void attemptDailyBonus(final Player player, final BonusAmount amount, final Callback<Boolean> result) @@ -509,20 +434,6 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I } } - public void updateVoteStreak(BonusRecord client) - { - if (client.getVoteStreak() > 0 && client.getVotetime() != null) - { - long lastBonus = getLocalTime(client.getVotetime().getTime()); - long timeLeft = getStreakTimeRemaining(lastBonus, BonusManager.VOTE_STREAK_RESET_TIME); - - if (timeLeft < 0) - { - client.setVoteStreak(0); - } - } - } - public void incrementDailyStreak(Player player) { BonusClientData data = Get(player); @@ -533,14 +444,6 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I data.setMaxDailyStreak(data.getDailyStreak()); } - public void incrementVoteStreak(BonusRecord client) - { - client.setVoteStreak(client.getVoteStreak() + 1); - - if (client.getVoteStreak() > client.getMaxVoteStreak()) - client.setMaxVoteStreak(client.getVoteStreak()); - } - public boolean continueStreak(long localLastBonus, long extendTime) { long maxTime = localLastBonus + TIME_BETWEEN_BONUSES + extendTime; @@ -581,13 +484,6 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I return multiplier; } - public int getVoteMultiplier(int streak) - { - int multiplier = Math.min(100, 5 * streak); - if (streak >= 20) multiplier += (1 * (streak - 40)); - return multiplier; - } - public BonusAmount getDailyBonusAmount(Player player) { double mult = getDailyMultiplier(player) / 100.0; @@ -607,21 +503,6 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I return amount; } - public BonusAmount getVoteBonusAmount(Player player) - { - return getVoteBonusAmount(Get(player).getVoteStreak()); - } - - public BonusAmount getVoteBonusAmount(int voteStreak) - { - double mult = getVoteMultiplier(voteStreak) / 100.0; - - BonusAmount amount = new BonusAmount(); - amount.setTickets(1); - - return amount; - } - public BonusAmount getRankBonusAmount(Player player) { Rank rank = _clientManager.Get(player).GetRank(); @@ -648,25 +529,6 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I return data; } - //VOTE - - public long timeTillVoteBonus(Player player) - { - return nextVoteTime(player) - getLocalTime(); - } - - // This calculates the the next vote bonus, IT HAS TO MATCH THE MYSQL STORED FUNCTION. - public long nextVoteTime(Player player) - { - Date date = Get(player).getVoteTime(); - if (date == null) - return 0; - long lastBonus = date.getTime(); - - return getNextVoteTime(getLocalTime(lastBonus)); - - } - public void awardBonus(final Player player, BonusAmount amount) { final BonusClientData bonusClient = Get(player); @@ -774,27 +636,6 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I } } - public static long getNextVoteTime(long time) { - - Calendar calendar = Calendar.getInstance(); - calendar.setTimeZone(TIMEZONE); - calendar.setTimeInMillis(time); - - calendar.add(Calendar.DAY_OF_YEAR, 1); - calendar.set(Calendar.HOUR_OF_DAY, 0); - calendar.set(Calendar.MINUTE, 0); - calendar.set(Calendar.SECOND, 0); - calendar.set(Calendar.MILLISECOND, 0); - - return calendar.getTimeInMillis(); - } - - public boolean canVote(Player player) - { - long nextVoteTime = nextVoteTime(player); - return System.currentTimeMillis() >= nextVoteTime; - } - public boolean canDaily(Player player) { long nextDailyTime = nextDailyBonus(player); @@ -826,7 +667,6 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I int availableRewards = 0; - //if (canVote(player)) availableRewards++; if (_playWireManager.canRedeem(player)) availableRewards++; if (_youtubeManager.canYoutube(player)) availableRewards++; if (canRank(player) && _clientManager.hasRank(player, Rank.ULTRA) && isPastAugust()) availableRewards++; @@ -992,7 +832,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I { if (Recharge.Instance.use(player, "Carl Inform", 240000, false, false)) { - if(_pollManager.hasPoll(player) || /*canVote(player)*/_playWireManager.canRedeem(player) || (canRank(player) && _clientManager.hasRank(player, Rank.ULTRA) && isPastAugust()) || canDaily(player) || PowerPlayClubButton.isAvailable(player, _powerPlayClubRepository)) + if(_pollManager.hasPoll(player) || _playWireManager.canRedeem(player) || (canRank(player) && _clientManager.hasRank(player, Rank.ULTRA) && isPastAugust()) || canDaily(player) || PowerPlayClubButton.isAvailable(player, _powerPlayClubRepository)) { if(_showCarl.containsKey(player.getName())) { @@ -1049,16 +889,6 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I } } - public String getVoteLink() - { - long sqlTime = getSqlTime(); - Calendar calendar = Calendar.getInstance(); - calendar.setTimeInMillis(sqlTime); - int date = calendar.get(Calendar.DAY_OF_YEAR); - int index = date % _voteList.size(); - return _voteList.get(index); - } - /** * Used for disabling rank rewards during first month of release * @return diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/VoteButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/VoteButton.java deleted file mode 100644 index c84c00787..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/VoteButton.java +++ /dev/null @@ -1,185 +0,0 @@ -package mineplex.core.bonuses.gui.buttons; - -import java.util.ArrayList; - -import mineplex.core.bonuses.BonusAmount; -import mineplex.core.bonuses.BonusClientData; -import mineplex.core.bonuses.BonusManager; -import mineplex.core.common.jsonchat.ClickEvent; -import mineplex.core.common.jsonchat.JsonMessage; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilTime.TimeUnit; -import mineplex.core.gui.GuiItem; -import mineplex.core.gui.ItemRefresher; -import mineplex.core.shop.item.ShopItem; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.Player; -import org.bukkit.event.HandlerList; -import org.bukkit.event.Listener; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.Plugin; - -public class VoteButton implements GuiItem, Listener { - - private ItemStack _item; - - private String _url; - - private Player _player; - private Plugin _plugin; - private ItemRefresher _gui; - - private BonusManager _bonusManager; - - public VoteButton(Plugin plugin, Player player, ItemRefresher gui, BonusManager bonusManager) - { - this._bonusManager = bonusManager; - this._player = player; - this._plugin = plugin; - this._gui = gui; - } - - @Override - public void setup() - { - //TODO get url from db - _url = _bonusManager.getVoteLink(); - - setItem(); - Bukkit.getPluginManager().registerEvents(this, getPlugin()); - } - - @Override - public void close() - { - HandlerList.unregisterAll(this); - } - - @Override - public void click(ClickType clickType) - { - if (isAvailable()) - { - getPlayer().closeInventory(); - - getPlayer().playSound(getPlayer().getLocation(), Sound.NOTE_PLING, 1, 1.6f); - - UtilPlayer.message(getPlayer(), C.cGold + C.Bold + C.Strike + "============================================="); - UtilPlayer.message(getPlayer(), ""); - - new JsonMessage(" " + C.Bold + "Click to Open in Web Browser").click(ClickEvent.OPEN_URL, _url).sendToPlayer(getPlayer()); - new JsonMessage( " " + C.cGreen + C.Line + _url).click(ClickEvent.OPEN_URL, _url).sendToPlayer(getPlayer()); - UtilPlayer.message(getPlayer(), ""); - UtilPlayer.message(getPlayer(), " Please be patient. Votes may take a few minutes to register."); - UtilPlayer.message(getPlayer(), ""); - UtilPlayer.message(getPlayer(), C.cGold + C.Bold + C.Strike + "============================================="); - - getPlayer().closeInventory(); - - } - else - { - getPlayer().playSound(getPlayer().getLocation(), Sound.ITEM_BREAK, 1, 10); - } - } - - @Override - public ItemStack getObject() - { - return _item; - } - - private void setItem() - { - ArrayList<String> lore = new ArrayList<String>(); - Material material; - String itemName; - byte data = 0; - - if (isAvailable()) - { - material = Material.JUKEBOX; - itemName = C.cGreen + C.Bold + "Vote for Mineplex"; - - lore.add(" "); - lore.add(ChatColor.RESET + "Click to Vote!"); - } - else - { - material = Material.REDSTONE_BLOCK; - itemName = C.cRed + C.Bold + "Vote for Mineplex"; - - lore.add(" "); - lore.add(ChatColor.RESET + "Next vote in " + UtilTime.convertString(timeLeft(), 0, TimeUnit.FIT) + "!"); - } - - lore.add(" "); - - BonusClientData client = _bonusManager.Get(_player); - - BonusAmount bonusAmount = _bonusManager.getVoteBonusAmount(_player); - bonusAmount.addLore(lore); - lore.add(" "); - - lore.add(C.cYellow + "Current Streak: " + C.cWhite + client.getVoteStreak()); - lore.add(C.cYellow + "Streak Bonus: " + C.cWhite + "+" + _bonusManager.getVoteMultiplier(client.getVoteStreak()) + "%"); - if (client.getVoteTime() != null) - { - long lastBonus = _bonusManager.getLocalTime(client.getVoteTime().getTime()); - long timeLeft = _bonusManager.getStreakTimeRemaining(lastBonus, BonusManager.VOTE_STREAK_RESET_TIME); - - if (timeLeft > 0) - { - lore.add(C.cYellow + "Streak Reset: " + C.cWhite + UtilTime.convertString(timeLeft, 1, TimeUnit.FIT)); - } - } - - lore.add(" "); - lore.add(C.cYellow + "Highest Streak: " + C.cWhite + client.getMaxVoteStreak()); - -// StreakRecord streakRecord = _bonusManager.getVoteStreak(); -// if (streakRecord != null) -// { -// lore.add(" "); -// lore.add(C.cYellow + "Record: " + C.cWhite + streakRecord.getPlayerName()); -// lore.add(C.cYellow + "Streak: " + C.cWhite + streakRecord.getStreak()); -// } - - _item = new ShopItem(material, itemName, lore.toArray(new String[0]), 1, false, false); - } - - public long timeLeft() - { - return _bonusManager.nextVoteTime(getPlayer()) - System.currentTimeMillis(); - } - - public boolean isAvailable() - { - if (_url == null) - return false; - - return (timeLeft() <= 0); - } - - public Plugin getPlugin() - { - return _plugin; - } - - public Player getPlayer() - { - return _player; - } - - public ItemRefresher getGui() - { - return _gui; - } -} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/redis/VoteHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/redis/VoteHandler.java deleted file mode 100644 index c6657ec38..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/redis/VoteHandler.java +++ /dev/null @@ -1,31 +0,0 @@ -package mineplex.core.bonuses.redis; - -import org.bukkit.entity.Player; - -import mineplex.core.bonuses.BonusManager; -import mineplex.core.common.util.UtilPlayer; -import mineplex.serverdata.commands.CommandCallback; -import mineplex.serverdata.commands.ServerCommand; - -public class VoteHandler implements CommandCallback -{ - private BonusManager _bonusManager; - - public VoteHandler(BonusManager bonusManager) - { - _bonusManager = bonusManager; - } - - @Override - public void run(ServerCommand command) - { - VotifierCommand v = ((VotifierCommand) command); - - Player player = UtilPlayer.searchExact(v.getPlayerName()); - - if (player != null) - { - _bonusManager.handleVote(player, v.getShardsReceived()); - } - } -} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/redis/VotifierCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/redis/VotifierCommand.java deleted file mode 100644 index 75a07b194..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/redis/VotifierCommand.java +++ /dev/null @@ -1,28 +0,0 @@ -package mineplex.core.bonuses.redis; - -import mineplex.serverdata.commands.ServerCommand; - -public class VotifierCommand extends ServerCommand -{ - private String _playerName; - private int _shardsReceived; - - public VotifierCommand(String playerName, int shardsReceived, String... targetServer) - { - super(targetServer); - - _playerName = playerName; - _shardsReceived = shardsReceived; - } - - public String getPlayerName() - { - return _playerName; - } - - public int getShardsReceived() - { - return _shardsReceived; - } - -} \ No newline at end of file diff --git a/Plugins/Mineplex.Votifier/plugin.yml b/Plugins/Mineplex.Votifier/plugin.yml deleted file mode 100644 index 75a40f893..000000000 --- a/Plugins/Mineplex.Votifier/plugin.yml +++ /dev/null @@ -1,3 +0,0 @@ -name: MineplexVotifier -main: mineplex.votifier.Votifier -version: 0.1 \ No newline at end of file diff --git a/Plugins/Mineplex.Votifier/pom.xml b/Plugins/Mineplex.Votifier/pom.xml deleted file mode 100644 index 0d3e1464c..000000000 --- a/Plugins/Mineplex.Votifier/pom.xml +++ /dev/null @@ -1,27 +0,0 @@ - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>com.mineplex</groupId> - <artifactId>mineplex-plugin</artifactId> - <version>dev-SNAPSHOT</version> - <relativePath>../plugin.xml</relativePath> - </parent> - - <name>MineplexVotifier</name> - <artifactId>mineplex-votifier</artifactId> - - <dependencies> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>mineplex-core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>com.vexsoftware</groupId> - <artifactId>votifier</artifactId> - </dependency> - </dependencies> -</project> diff --git a/Plugins/Mineplex.Votifier/src/mineplex/votifier/Votifier.java b/Plugins/Mineplex.Votifier/src/mineplex/votifier/Votifier.java deleted file mode 100644 index c314bdf85..000000000 --- a/Plugins/Mineplex.Votifier/src/mineplex/votifier/Votifier.java +++ /dev/null @@ -1,33 +0,0 @@ -package mineplex.votifier; - -import mineplex.core.account.CoreClientManager; -import mineplex.core.bonuses.BonusManager; -import mineplex.core.command.CommandCenter; -import mineplex.core.donation.DonationManager; -import org.bukkit.plugin.java.JavaPlugin; - -/** - * Created by shaun on 15-08-05. - */ -public class Votifier extends JavaPlugin -{ - private String WEB_CONFIG = "webServer"; - - @Override - public void onEnable() - { - getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/"); - getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG)); - saveConfig(); - - String webServerAddress = getConfig().getString(WEB_CONFIG); - - CommandCenter.Initialize(this); - CoreClientManager clientManager = new CoreClientManager(this, webServerAddress); - DonationManager donationManager = new DonationManager(this, clientManager, webServerAddress); - BonusManager bonusManager = new BonusManager(this, clientManager, donationManager); - - - VotifierManager vote = new VotifierManager(this, clientManager, donationManager, bonusManager); - } -} diff --git a/Plugins/Mineplex.Votifier/src/mineplex/votifier/VotifierManager.java b/Plugins/Mineplex.Votifier/src/mineplex/votifier/VotifierManager.java deleted file mode 100644 index 5e9393d2a..000000000 --- a/Plugins/Mineplex.Votifier/src/mineplex/votifier/VotifierManager.java +++ /dev/null @@ -1,268 +0,0 @@ -package mineplex.votifier; - -import java.sql.Date; -import java.util.UUID; - -import mineplex.core.MiniPlugin; -import mineplex.core.account.CoreClientManager; -import mineplex.core.bonuses.BonusAmount; -import mineplex.core.bonuses.BonusManager; -import mineplex.core.bonuses.redis.VotifierCommand; -import mineplex.core.common.Pair; -import mineplex.core.common.util.Callback; -import mineplex.core.common.util.UUIDFetcher; -import mineplex.core.donation.DonationManager; -import mineplex.database.Tables; -import mineplex.database.tables.records.BonusRecord; -import mineplex.serverdata.Region; -import mineplex.serverdata.Utility; -import mineplex.serverdata.commands.ServerCommand; -import mineplex.serverdata.data.PlayerStatus; -import mineplex.serverdata.database.DBPool; -import mineplex.serverdata.redis.RedisConfig; -import mineplex.serverdata.redis.RedisDataRepository; -import mineplex.serverdata.servers.ServerManager; - -import org.bukkit.event.EventHandler; -import org.bukkit.plugin.java.JavaPlugin; -import org.jooq.DSLContext; -import org.jooq.Record1; -import org.jooq.SQLDialect; -import org.jooq.impl.DSL; - -import redis.clients.jedis.Jedis; -import redis.clients.jedis.JedisPool; - -import com.vexsoftware.votifier.model.Vote; -import com.vexsoftware.votifier.model.VotifierEvent; - -/** - * Created by shaun on 15-08-05. - */ -public class VotifierManager extends MiniPlugin -{ - private CoreClientManager _clientManager; - private DonationManager _donationManager; - private BonusManager _bonusManager; - - private RedisConfig _usConfig; - private RedisConfig _euConfig; - private RedisDataRepository<PlayerStatus> _usPlayerRepo; - private RedisDataRepository<PlayerStatus> _euPlayerRepo; - private JedisPool _usWritePool; - private JedisPool _euWritePool; - - public VotifierManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, BonusManager bonusManager) - { - super("Votifier", plugin); - - _clientManager = clientManager; - _donationManager = donationManager; - _bonusManager = bonusManager; - - _usConfig = ServerManager.loadConfig("us-redis.dat"); - _euConfig = ServerManager.loadConfig("eu-redis.dat"); - - _usPlayerRepo = new RedisDataRepository<PlayerStatus>(_usConfig.getConnection(true, "DefaultConnection"), - _usConfig.getConnection(false, "DefaultConnection"), Region.US, PlayerStatus.class, "playerStatus"); - _euPlayerRepo = new RedisDataRepository<PlayerStatus>(_euConfig.getConnection(true, "DefaultConnection"), - _euConfig.getConnection(false, "DefaultConnection"), Region.EU, PlayerStatus.class, "playerStatus"); - - _usWritePool = Utility.generatePool(_usConfig.getConnection(true, "DefaultConnection")); - _euWritePool = Utility.generatePool(_euConfig.getConnection(true, "DefaultConnection")); - } - - @EventHandler - public void handleVote(VotifierEvent event) - { - final Vote vote = event.getVote(); - final String playerName = vote.getUsername(); - - System.out.println("New Vote: " + playerName); - - runAsync(new Runnable() - { - @Override - public void run() - { - UUID uuid = UUIDFetcher.getUUIDOf(playerName); - if (uuid == null) - { - System.out.println("Failed to load UUID of " + playerName + " from UUIDFetcher. Trying with database"); - uuid = _clientManager.loadUUIDFromDB(playerName); - - if (uuid == null) - { - System.out.println("Failed to load UUID from database. Giving up on " + playerName); - } - } - - String lowerPlayerName = playerName.toLowerCase(); - final PlayerStatus usStatus = _usPlayerRepo.getElement(lowerPlayerName); - final PlayerStatus euStatus = _euPlayerRepo.getElement(lowerPlayerName); - - System.out.println("Loaded " + playerName + " with uuid " + uuid); - System.out.println("Attempting to award bonus"); - final UUID finalUuid = uuid; - awardBonus(playerName, finalUuid, new Callback<Integer>() - { - @Override - public void run(final Integer shards) - { - runSync(new Runnable() - { - @Override - public void run() - { - if (usStatus != null) - { - System.out.println("Found " + playerName + " on US " + usStatus.getServer()); - notifyServer(playerName, shards, Region.US, usStatus.getServer()); - } - - if (euStatus != null) - { - System.out.println("Found " + playerName + " on EU " + euStatus.getServer()); - notifyServer(playerName, shards, Region.EU, euStatus.getServer()); - } - } - }); - } - }); - } - }); - System.out.println(); - System.out.println(); - -// UUID uuid = _clientManager.loadUUIDFromDB(playerName); -// if (uuid != null) -// { -// System.out.println("Found UUID:" + uuid.toString()); -// if (playerName.equalsIgnoreCase("Phinary")) -// { -// System.out.println("award bonus"); -// awardBonus(uuid); -// } -// } -// else -// { -// System.out.println("Failed to load UUID for player: " + playerName); -// } - -// PlayerStatus usStatus = _usPlayerRepo.getElement(playerName); -// if (usStatus != null) -// { -// System.out.println("Found on US Server: " + usStatus.getServer()); -// writePool = _usWritePool; -// serverName = usStatus.getServer(); -// } -// -// PlayerStatus euStatus = _euPlayerRepo.getElement(playerName); -// if (euStatus != null) -// { -// System.out.println("Found on EU Server: " + euStatus.getServer()); -// writePool = _euWritePool; -// serverName = euStatus.getServer(); -// } - - // Currently we just notify all servers, and the server with the player on it can deal with it -// notifyServer(playerName, true); - } - - private void notifyServer(String playerName, int shards, Region region, String targetServer) - { - JedisPool writePool = region == Region.EU ? _euWritePool : _usWritePool; - - VotifierCommand command = new VotifierCommand(playerName, shards, targetServer); - publishCommand(command, writePool); - } - - private void awardBonus(final String playerName, final UUID uuid, final Callback<Integer> onComplete) - { - DSLContext create = DSL.using(DBPool.getAccount(), SQLDialect.MYSQL); - - Record1<Integer> idRecord = create.select(Tables.accounts.id).from(Tables.accounts).where(Tables.accounts.uuid.eq(uuid.toString())).fetchOne(); - if (idRecord != null) - { - final int accountId = idRecord.value1(); - final BonusRecord client = _bonusManager.getRepository().loadRecord(playerName, accountId); - - final BonusAmount amount = _bonusManager.getVoteBonusAmount(client.getVoteStreak()); - - _bonusManager.getRepository().attemptVoteBonus(accountId, new Callback<Pair<Boolean, Date>>() - { - @Override - public void run(Pair<Boolean, Date> pair) - { - if (pair.getLeft()) - { - // Reward Amount - if (amount.getTickets() > 0) - client.setTickets(client.getTickets() + amount.getTickets()); - - if (amount.getTotalGems() > 0) - { - _donationManager.RewardGems(new Callback<Boolean>() - { - @Override - public void run(Boolean data) - { - if (data) - System.out.println("Gave " + amount.getGems() + " gems to " + playerName); - else - System.out.println("Failed to give " + amount.getGems() + " gems to " + playerName); - } - }, "Votifier", playerName, uuid, amount.getTotalGems()); - } - - if (amount.getTotalCoins() > 0) - { - _donationManager.RewardCoins(new Callback<Boolean>() - { - @Override - public void run(Boolean data) - { - if (data) - System.out.println("Gave " + amount.getCoins() + " coins to " + playerName); - else - System.out.println("Failed to give " + amount.getCoins() + " coins to " + playerName); - } - }, "Votifier", playerName, accountId, amount.getTotalCoins()); - } - - // Check if we need to reset vote streak - _bonusManager.updateVoteStreak(client); - client.setVotetime(pair.getRight()); - - // Update Streak - _bonusManager.incrementVoteStreak(client); - - client.store(); - System.out.println("Awarded carl ticket to " + playerName); - onComplete.run(amount.getTotalCoins()); - } - else - { - System.out.println(playerName + " attempted to vote, vote bonus returned false!"); - } - } - }); - } - } - - private void publishCommand(final ServerCommand serverCommand, final JedisPool writePool) - { - new Thread(new Runnable() - { - public void run() - { - try (Jedis jedis = writePool.getResource()) - { - String commandType = serverCommand.getClass().getSimpleName(); - String serializedCommand = Utility.serialize(serverCommand); - jedis.publish("commands.server" + ":" + commandType, serializedCommand); - } - } - }).start(); - } -} \ No newline at end of file diff --git a/Plugins/pom.xml b/Plugins/pom.xml index 3f9f3fbba..905d6e24b 100644 --- a/Plugins/pom.xml +++ b/Plugins/pom.xml @@ -34,7 +34,6 @@ <module>Mineplex.ServerData</module> <module>Mineplex.ServerMonitor</module> <module>Mineplex.StaffServer</module> - <module>Mineplex.Votifier</module> <module>Nautilus.Game.Arcade</module> <module>mavericks-review-hub</module> @@ -61,12 +60,6 @@ <version>2.2.1</version> <scope>compile</scope> </dependency> - <dependency> - <groupId>com.vexsoftware</groupId> - <artifactId>votifier</artifactId> - <version>1.9</version> - <scope>provided</scope> - </dependency> <dependency> <groupId>javax.mail</groupId> <artifactId>mail</artifactId> From 7ec530a8c72d76d14ad623b8963ee9514c5f5327 Mon Sep 17 00:00:00 2001 From: AlexTheCoder <alexjmeech@gmail.com> Date: Sat, 8 Oct 2016 19:22:29 -0400 Subject: [PATCH 038/147] Fix lobby protection on build server, make map locks persistent, implement larger parsing size, make map lock command require op, prevent raining on build server, and make block hunt actually work with any map with required information regardless of order --- .../src/mineplex/mapparser/MapData.java | 4 +- .../src/mineplex/mapparser/MapParser.java | 36 +++++----- .../mapparser/command/AdminCommand.java | 2 +- .../mapparser/command/AuthorCommand.java | 2 +- .../command/CurrentlyLiveCommand.java | 5 ++ .../mapparser/command/GameTypeCommand.java | 2 +- .../mapparser/command/LockCommand.java | 15 +++- .../mapparser/command/NameCommand.java | 2 +- .../mineplex/mapparser/command/PMCommand.java | 13 ++-- .../mapparser/command/ParseCommand1000.java | 70 +++++++++++++++++++ .../mapparser/command/ParseCommand200.java | 6 ++ .../mapparser/command/ParseCommand400.java | 6 ++ .../mapparser/command/ParseCommand600.java | 6 ++ .../mapparser/command/RenameCommand.java | 7 ++ .../mapparser/command/WarpCommand.java | 5 ++ .../mapparser/module/modules/EventModule.java | 66 +++++++++-------- .../arcade/game/games/hideseek/HideSeek.java | 4 +- 17 files changed, 192 insertions(+), 59 deletions(-) create mode 100644 Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ParseCommand1000.java diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapData.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapData.java index a87e4e8b9..978d282e6 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapData.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapData.java @@ -72,7 +72,7 @@ public class MapData continue; } - if(tokens[0].equalsIgnoreCase("locked")) + if(tokens[0].equalsIgnoreCase("LOCKED")) { _locked = tokens[1].equalsIgnoreCase("true"); continue; @@ -159,6 +159,8 @@ public class MapData out.write("currentlyLive:" + _currentlyLive); out.write("\n"); out.write("warps:" + warpsToString()); + out.write("\n"); + out.write("LOCKED:" + _locked); out.close(); } catch (Exception e) diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java index 9105e8ea6..6fa838da5 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java @@ -1,8 +1,26 @@ package mineplex.mapparser; +import java.io.File; +import java.io.IOException; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; + import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilBlock; @@ -30,6 +48,7 @@ import mineplex.mapparser.command.PMCommand; import mineplex.mapparser.command.ParseCommand200; import mineplex.mapparser.command.ParseCommand400; import mineplex.mapparser.command.ParseCommand600; +import mineplex.mapparser.command.ParseCommand1000; import mineplex.mapparser.command.PlayerHeadCommand; import mineplex.mapparser.command.RefreshWorldEditCommand; import mineplex.mapparser.command.RenameCommand; @@ -44,22 +63,6 @@ import mineplex.mapparser.module.modules.EventModule; import mineplex.mapparser.module.modules.MMMazeModule; import mineplex.mapparser.module.modules.SignModule; import mineplex.mapparser.module.modules.TreeToolModule; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.World; -import org.bukkit.block.Block; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.entity.Player; -import org.bukkit.plugin.java.JavaPlugin; - -import java.io.File; -import java.io.IOException; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; public class MapParser extends JavaPlugin { @@ -104,6 +107,7 @@ public class MapParser extends JavaPlugin commandModule.add(new ParseCommand200(this)); commandModule.add(new ParseCommand400(this)); commandModule.add(new ParseCommand600(this)); + commandModule.add(new ParseCommand1000(this)); commandModule.add(new RenameCommand(this)); commandModule.add(new SaveCommand(this)); commandModule.add(new WorldsCommand(this)); diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/AdminCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/AdminCommand.java index ad52b7f98..962a5813a 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/AdminCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/AdminCommand.java @@ -29,7 +29,7 @@ public class AdminCommand extends BaseCommand World world = player.getWorld(); - if (world.getName().equals("world")) + if (world.getName().equals("world_lobby")) { message(player, "Cannot change Admin-List for Lobby."); return true; diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/AuthorCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/AuthorCommand.java index c267e7d4d..48a23c693 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/AuthorCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/AuthorCommand.java @@ -33,7 +33,7 @@ public class AuthorCommand extends BaseCommand authorName += arg + " "; authorName = authorName.trim(); - if (world.getName().equals("world")) + if (world.getName().equals("world_lobby")) { message(player, "Cannot set author for Lobby."); return true; diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/CurrentlyLiveCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/CurrentlyLiveCommand.java index 7244346b9..746945b23 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/CurrentlyLiveCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/CurrentlyLiveCommand.java @@ -19,6 +19,11 @@ public class CurrentlyLiveCommand extends BaseCommand @Override public boolean execute(Player player, String alias, String[] args) { + if (player.getWorld().getName().equals("world_lobby")) + { + message(player, "Cannot set live status for Lobby."); + return true; + } MapData data = getPlugin().getData(player.getWorld().getName()); if(data == null) diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/GameTypeCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/GameTypeCommand.java index edf2482a9..4b01a03c9 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/GameTypeCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/GameTypeCommand.java @@ -32,7 +32,7 @@ public class GameTypeCommand extends BaseCommand return true; } - if (world.getName().equals("world")) + if (world.getName().equals("world_lobby")) { message(player, "Cannot set GameType for Lobby."); return true; diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/LockCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/LockCommand.java index a8dd0082d..9af13bbea 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/LockCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/LockCommand.java @@ -20,16 +20,27 @@ public class LockCommand extends BaseCommand @Override public boolean execute(Player player, String alias, String[] args) { + if (!player.isOp()) + { + message(player, "Only OPs can toggle map locks!"); + return true; + } + if (player.getWorld().getName().equals("world_lobby")) + { + message(player, "Cannot toggle lock for Lobby."); + return true; + } MapData data = getPlugin().getData(player.getWorld().getName()); - if(data == null) + if (data == null) { player.sendMessage(C.cRed + "There was an error with your map."); return true; } data._locked = !data._locked; - player.sendMessage(F.tf(data._locked) + " lock for world " + player.getWorld().getName()); + data.Write(); + message(player, "Lock for world " + F.elem(player.getWorld().getName()) + ": " + F.tf(data._locked)); return true; } } diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/NameCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/NameCommand.java index a7988c3ff..5e63f92a5 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/NameCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/NameCommand.java @@ -29,7 +29,7 @@ public class NameCommand extends BaseCommand return true; } - if (world.equals("world")) + if (world.getName().equals("world_lobby")) { message(player, "Cannot set name for Lobby."); return true; diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/PMCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/PMCommand.java index 82a72b071..86c4db4f2 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/PMCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/PMCommand.java @@ -20,26 +20,27 @@ public class PMCommand extends BaseCommand @Override public boolean execute(Player player, String alias, String[] args) { - if(!player.isOp()) + if (!player.isOp()) { player.sendMessage(C.cRed + "You are not allowed to do that!"); return true; } - if(args.length == 0) + if (args.length == 0) { player.sendMessage(C.cRed + "Please put a message in!"); return true; } StringBuilder builder = new StringBuilder(); - for(String s : args) + builder.append(player.getName() + ": "); + for (String s : args) { builder.append(s).append(" "); } - for(Player ops : UtilServer.getPlayers()) + for (Player ops : UtilServer.getPlayers()) { - if(!ops.isOp()) + if (!ops.isOp()) { continue; } @@ -49,4 +50,4 @@ public class PMCommand extends BaseCommand return true; } -} +} \ No newline at end of file diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ParseCommand1000.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ParseCommand1000.java new file mode 100644 index 000000000..8cfb3d5f3 --- /dev/null +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ParseCommand1000.java @@ -0,0 +1,70 @@ +package mineplex.mapparser.command; + +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.F; +import mineplex.mapparser.MapData; +import mineplex.mapparser.MapParser; +import mineplex.mapparser.Parse; + +/** + * Larger parse command + */ +public class ParseCommand1000 extends BaseCommand +{ + public ParseCommand1000(MapParser plugin) + { + super(plugin, "parse1000"); + } + + @Override + public boolean execute(Player player, String alias, String[] args) + { + if (!player.isOp()) + { + message(player, "Only OPs can parse maps!"); + return true; + } + + Location parseLoc = player.getLocation(); + + World world = parseLoc.getWorld(); + + if (world.getName().equals("world_lobby")) + { + message(player, "Cannot parse Lobby."); + return true; + } + + MapData data = getPlugin().getData(world.getName()); + + if (data.MapName.equals("null") || data.MapCreator.equals("null") || data.MapGameType.equals("null")) + { + message(player, "Map Name/Author/GameType are not set!"); + return true; + } + + //Teleport Players Out + for (Player worldPlayer : world.getPlayers()) + { + worldPlayer.teleport(getPlugin().getSpawnLocation()); + message(player, "World " + F.elem(world.getName()) + " is preparing to be parsed."); + } + + //Unload World > Copy + World parseableWorld = getPlugin().getWorldManager().prepMapParse(world); + + if (parseableWorld == null) + { + message(player, "Could not prepare world for parsing!"); + return true; + } + + //Parse the World + getPlugin().setCurrentParse(new Parse(getPlugin(), parseableWorld, args, parseLoc, getPlugin().getData(parseLoc.getWorld().getName()), 1000)); + + return true; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ParseCommand200.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ParseCommand200.java index 9cd58144b..7ac10132c 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ParseCommand200.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ParseCommand200.java @@ -31,6 +31,12 @@ public class ParseCommand200 extends BaseCommand Location parseLoc = player.getLocation(); World world = parseLoc.getWorld(); + + if (world.getName().equals("world_lobby")) + { + message(player, "Cannot parse Lobby."); + return true; + } MapData data = getPlugin().getData(world.getName()); diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ParseCommand400.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ParseCommand400.java index d08d60103..efb416dc5 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ParseCommand400.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ParseCommand400.java @@ -31,6 +31,12 @@ public class ParseCommand400 extends BaseCommand Location parseLoc = player.getLocation(); World world = parseLoc.getWorld(); + + if (world.getName().equals("world_lobby")) + { + message(player, "Cannot parse Lobby."); + return true; + } MapData data = getPlugin().getData(world.getName()); diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ParseCommand600.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ParseCommand600.java index daa28b4fa..07dd1deb2 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ParseCommand600.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ParseCommand600.java @@ -31,6 +31,12 @@ public class ParseCommand600 extends BaseCommand Location parseLoc = player.getLocation(); World world = parseLoc.getWorld(); + + if (world.getName().equals("world_lobby")) + { + message(player, "Cannot parse Lobby."); + return true; + } MapData data = getPlugin().getData(world.getName()); diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/RenameCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/RenameCommand.java index b2e539bb4..2f66500c2 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/RenameCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/RenameCommand.java @@ -24,6 +24,13 @@ public class RenameCommand extends BaseCommand public boolean execute(Player player, String alias, String[] args) { World world = player.getWorld(); + + if (world.getName().equals("world_lobby")) + { + message(player, "Cannot rename Lobby."); + return true; + } + MapData data = getPlugin().getData(world.getName()); if (data == null) diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/WarpCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/WarpCommand.java index dd533e4d8..ca99aa881 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/WarpCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/WarpCommand.java @@ -25,6 +25,11 @@ public class WarpCommand extends BaseCommand @Override public boolean execute(Player player, String alias, String[] args) { + if (player.getWorld().getName().equals("world_lobby")) + { + message(player, "Cannot use warps in Lobby."); + return true; + } MapData data = getPlugin().getData(player.getWorld().getName()); if(data == null) diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/module/modules/EventModule.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/module/modules/EventModule.java index 3f62f9337..1595b9886 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/module/modules/EventModule.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/module/modules/EventModule.java @@ -1,19 +1,8 @@ package mineplex.mapparser.module.modules; -import com.google.common.collect.Lists; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.MapUtil; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.mapparser.BackupTask; -import mineplex.mapparser.MapData; -import mineplex.mapparser.MapParser; -import mineplex.mapparser.Parse; -import mineplex.mapparser.TickEvent; -import mineplex.mapparser.module.Module; +import java.util.List; + import org.bukkit.ChatColor; -import org.bukkit.Sound; import org.bukkit.World; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; @@ -32,8 +21,21 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.weather.WeatherChangeEvent; -import java.util.List; +import com.google.common.collect.Lists; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.MapUtil; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.mapparser.BackupTask; +import mineplex.mapparser.MapData; +import mineplex.mapparser.MapParser; +import mineplex.mapparser.Parse; +import mineplex.mapparser.TickEvent; +import mineplex.mapparser.module.Module; /** * @@ -70,13 +72,14 @@ public class EventModule extends Module if (world.getName().toLowerCase().contains("halloween")) { world.setTime(16000); - } else + } + else { world.setTime(8000); } - _updated.add(world); world.setStorm(false); world.setGameRuleValue("doDaylightCycle", "false"); + _updated.add(world); } } @@ -114,7 +117,7 @@ public class EventModule extends Module { for (World world : getPlugin().getServer().getWorlds()) { - if (world.getName().equalsIgnoreCase("world")) + if (world.getName().equalsIgnoreCase("world_lobby")) { continue; } @@ -212,11 +215,14 @@ public class EventModule extends Module Player target = UtilPlayer.searchOnline(player, tokens[1], true); if (target != null) { - MapData data = getPlugin().getData(target.getWorld().getName()); - if(!data.CanJoin(player)) + if (!target.getWorld().getName().equals("world")) { - player.sendMessage(C.cRed + "That server is currently locked, and you don't have access to it."); - return; + MapData data = getPlugin().getData(target.getWorld().getName()); + if(!data.CanJoin(player)) + { + player.sendMessage(C.cRed + "That world is currently locked, and you don't have access to it."); + return; + } } UtilPlayer.message(player, F.main("Game", "You teleported to " + F.name(target.getName()) + ".")); player.teleport(target); @@ -287,13 +293,6 @@ public class EventModule extends Module @EventHandler public void Join(PlayerJoinEvent event) { - Player player = event.getPlayer(); - if (player.getName().equalsIgnoreCase("TadahTech")) - { - event.setJoinMessage(C.cGreenB + "Your build server Saviour, TIMOTHY! has arrived, please take a moment to thank him."); - getPlugin().getServer().getOnlinePlayers().forEach(o -> o.playSound(o.getLocation(), Sound.AMBIENCE_THUNDER, 1.0F, 1.0F)); - return; - } event.setJoinMessage(F.sys("Player Join", event.getPlayer().getName())); } @@ -351,4 +350,15 @@ public class EventModule extends Module { event.setCancelled(true); } + + @EventHandler + public void DisableWeather(WeatherChangeEvent event) + { + if (!_updated.contains(event.getWorld())) + { + return; + } + + event.setCancelled(true); + } } 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 ec646d75c..df9de39bb 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 @@ -413,11 +413,11 @@ public class HideSeek extends TeamGame if (event.GetState() != GameState.Recruit) return; - _hiders = GetTeamList().get(0); + _hiders = GetTeamList().stream().filter(team -> team.GetName().toUpperCase().contains("BLUE")).toArray(size -> new GameTeam[size])[0]; _hiders.SetColor(ChatColor.AQUA); _hiders.SetName("Hiders"); - _seekers = GetTeamList().get(1); + _seekers = GetTeamList().stream().filter(team -> team.GetName().toUpperCase().contains("RED")).toArray(size -> new GameTeam[size])[0]; _seekers.SetColor(ChatColor.RED); _seekers.SetName("Hunters"); From bb32a06caf1320b43f730c16fc9f7b601db7eb1d Mon Sep 17 00:00:00 2001 From: Shaun Bennett <me@phinary.ca> Date: Wed, 12 Oct 2016 23:30:52 -0400 Subject: [PATCH 039/147] Add Halloween Words --- .../game/arcade/game/games/build/Build.java | 52 ++++++++++++------- .../game/games/build/modes/TeamBuild.java | 5 +- .../game/arcade/game/games/draw/Draw.java | 31 ++++++++--- 3 files changed, 60 insertions(+), 28 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java index bcdf30b4a..4ef07344b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java @@ -127,8 +127,10 @@ public class Build extends Game private int _countdownTimerState = 0; protected String[] _words; - protected String[] _holidayWords; - protected boolean _useHolidayWords = false; + protected String[] _christmasWords; + protected String[] _halloweenWords; + protected boolean _useChristmasWords = false; + protected boolean _useHalloweenWords = true; protected String _word = "?"; @@ -231,7 +233,7 @@ public class Build extends Game "Water Gun", "Astronaut", "Wither", "Meteor" }; - _holidayWords = new String[] + _christmasWords = new String[] { "Santa", "Reindeer", "Ornament", "Elf", "North Pole", "Candy Cane", "Xmas Lights", "Christmas Tree", "Fireplace", "Hot Chocolate", "Snowflake", "Snowman", "Sleigh", "Toys", "Milk", "Eggnog", "Coal", @@ -241,6 +243,16 @@ public class Build extends Game "Boots", "Gingerbread Man", "Glacier", "Ice Hockey", "Scarf", "Snowboard" }; + _halloweenWords = new String[] + { + "Bat", "Cauldron", "Broomstick", "Witch", "Witch Hat", "Haunted House", "Ghost", "Spider", + "Werewolf", "Full Moon", "Vampire", "Dracula", "Zombie", "Grim Reaper", "Graveyard", + "Gravestone", "Pumpkin", "Pumpkin Patch", "Jack-O-Lantern", "Scarecrow", "Haunted", + "Monster", "Halloween", "Skeleton", "Skull", "Coffin", "Tomb", "Cobweb", "Spider Web", + "Costume", "Frankenstein", "Black Cat", "Bone", "Candy", "Trick or Treat", "Eyeball", "Fangs", + "Goblin", "Potion", "Treat", "Trick" + }; + _mobShop = new MobShop(getArcadeManager(), getArcadeManager().GetClients(), getArcadeManager().GetDonation()); _optionsShop = new OptionsShop(this, getArcadeManager(), getArcadeManager().GetClients(), getArcadeManager().GetDonation()); _shopItem = ItemStackFactory.Instance.CreateStack(Material.DIAMOND, (byte) 0, 1, C.cGreen + "Options"); @@ -289,10 +301,7 @@ public class Build extends Game player.setFlySpeed(0.1f); } - if (!_useHolidayWords || Math.random() >= 0.5) - _word = _words[UtilMath.r(_words.length)]; - else - _word = _holidayWords[UtilMath.r(_holidayWords.length)]; + _word = getNextWord(); UtilTextMiddle.display(null, C.cYellow + "Build " + C.cWhite + _word, 0, 80, 5); @@ -1664,7 +1673,24 @@ public class Build extends Game return Arrays.asList(player); } - + + protected String getNextWord() + { + // TODO: These should be even no matter what word packs are enabled + if (_useHalloweenWords && Math.random() <= 0.5) + { + return _halloweenWords[UtilMath.r(_halloweenWords.length)]; + } + else if (_useChristmasWords && Math.random() <= 0.5) + { + return _christmasWords[UtilMath.r(_christmasWords.length)]; + } + else + { + return _words[UtilMath.r(_words.length)]; + } + } + public Map<Player, BuildData> getData() { return _data; @@ -1680,16 +1706,6 @@ public class Build extends Game return _word; } - public boolean useHolidayWords() - { - return _useHolidayWords; - } - - public String[] getHolidayWords() - { - return _holidayWords; - } - public String[] getWords() { return _words; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/modes/TeamBuild.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/modes/TeamBuild.java index 3b2d98bb5..ef5e41c08 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/modes/TeamBuild.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/modes/TeamBuild.java @@ -69,10 +69,7 @@ public class TeamBuild extends Build } } - if (!useHolidayWords() || Math.random() >= 0.5) - setWord(getWords()[UtilMath.r(getWords().length)]); - else - setWord(getHolidayWords()[UtilMath.r(getHolidayWords().length)]); + setWord(getNextWord()); UtilTextMiddle.display(null, C.cYellow + "Build " + C.cWhite + getWord(), 0, 80, 5); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java index b6bad607f..3171f1920 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java @@ -91,8 +91,10 @@ public class Draw extends SoloGame private HashSet<Tool> _tools; private String[] _words; - private String[] _holidayWords; - private boolean _useHolidayWords = false; + private String[] _christmasWords; + private String[] _halloweenWords; + private boolean _useChristmasWords = false; + private boolean _useHalloweenWords = true; private HashSet<String> _usedWords = new HashSet<String>(); public Draw(ArcadeManager manager) @@ -187,7 +189,7 @@ public class Draw extends SoloGame "Strawberry", "Jam", "Sandwich", "Owl", "Watermelon", "Australia", "Canada", "United States", "Diary" }; - _holidayWords = new String[] + _christmasWords = new String[] { "Santa", "Reindeer", "Ornament", "Elf", "North Pole", "Candy Cane", "Christmas Tree", "Fireplace", "Hot Chocolate", "Snowflake", "Snowman", "Sleigh", "Toys", "Milk", "Eggnog", "Coal", @@ -197,6 +199,16 @@ public class Draw extends SoloGame "Boots", "Gingerbread Man", "Glacier", "Ice Hockey", "Scarf", "Snowboard" }; + _halloweenWords = new String[] + { + "Bat", "Cauldron", "Broomstick", "Witch", "Witch Hat", "Haunted House", "Ghost", "Spider", + "Werewolf", "Full Moon", "Vampire", "Dracula", "Zombie", "Grim Reaper", "Graveyard", + "Gravestone", "Pumpkin", "Pumpkin Patch", "Jack-O-Lantern", "Scarecrow", "Haunted", + "Monster", "Halloween", "Skeleton", "Skull", "Coffin", "Tomb", "Cobweb", "Spider Web", + "Costume", "Frankenstein", "Black Cat", "Bone", "Candy", "Trick or Treat", "Eyeball", "Fangs", + "Goblin", "Potion", "Treat", "Trick" + }; + _tools = new HashSet<Tool>(); _tools.add(new ToolLine(this)); _tools.add(new ToolSquare(this)); @@ -416,12 +428,19 @@ public class Draw extends SoloGame private String getRandomWord() { - if (!_useHolidayWords || Math.random() >= 0.30) + // TODO: These should be even no matter what word packs are enabled + if (_useHalloweenWords && Math.random() <= 0.3) + { + return _halloweenWords[UtilMath.r(_halloweenWords.length)]; + } + else if (_useChristmasWords && Math.random() <= 0.3) + { + return _christmasWords[UtilMath.r(_christmasWords.length)]; + } + else { return _words[UtilMath.r(_words.length)]; } - - return _holidayWords[UtilMath.r(_holidayWords.length)]; } @EventHandler(priority = EventPriority.LOWEST) From 8974b2b39590834288cf585e7d9ad646b0ffd107 Mon Sep 17 00:00:00 2001 From: Shaun Bennett <me@phinary.ca> Date: Thu, 13 Oct 2016 04:07:05 -0400 Subject: [PATCH 040/147] Fix Carl Error --- .../src/mineplex/core/bonuses/BonusManager.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java index d6ab5acb9..d609f656b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java @@ -89,6 +89,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I private ArrayList<Player> _pendingExplosionsPlayers = new ArrayList<>(); private HashMap<String, Boolean> _showCarl = new HashMap<>(); private long _explode; + private boolean _animationRunning; public static long getSqlTime() { @@ -225,10 +226,14 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I if(_pendingExplosions.isEmpty()) return; + + if (_animationRunning) + return; if (!_enabled) return; - + + _animationRunning = true; _explode = System.currentTimeMillis(); _animation.setTicks(0); } @@ -243,6 +248,9 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I if (!_enabled) return; + + if (!_animationRunning) + return; Entity creeper = _carlNpc.getEntity(); @@ -271,6 +279,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I if(!_animation.isDone()) return; + _animationRunning = false; DecreaseSize(creeper); _pendingExplosions.remove(0); _pendingExplosionsPlayers.remove(0); From a5d52d9e2f104e4d62a6310f178100ec6d69a4da Mon Sep 17 00:00:00 2001 From: Sam <huzzahpinkyoshi@gmail.com> Date: Thu, 13 Oct 2016 16:11:01 +0100 Subject: [PATCH 041/147] MERGE PLEASE! --- .../unrelated/BabyFireworkEffect.java | 2 + .../core/treasure/TreasureLocation.java | 1 + .../src/mineplex/hub/HubManager.java | 2 + .../game/games/smash/SoloSuperSmash.java | 8 +- .../arcade/game/games/smash/SuperSmash.java | 220 +++++++++--------- .../game/games/smash/TeamSuperSmash.java | 26 ++- .../game/games/smash/kits/KitMagmaCube.java | 5 +- .../game/games/smash/kits/KitSkeleton.java | 2 +- .../games/smash/perks/blaze/PerkFirefly.java | 6 + .../smash/perks/enderman/PerkBlockToss.java | 10 +- .../games/smash/perks/golem/SmashGolem.java | 3 +- .../smash/perks/guardian/TargetLazerData.java | 5 + .../smash/perks/magmacube/PerkFlameDash.java | 3 +- .../smash/perks/magmacube/PerkMagmaBoost.java | 7 +- .../smash/perks/sheep/PerkWoolCloud.java | 4 +- .../smash/perks/slime/PerkSlimeRocket.java | 36 +-- .../smash/perks/slime/PerkSlimeSlam.java | 18 +- .../games/smash/perks/slime/SmashSlime.java | 1 - .../smash/perks/witch/PerkWitchPotion.java | 41 +--- .../game/games/smash/perks/wolf/PerkWolf.java | 11 +- .../lobby/legacy/LegacyGameLobbyManager.java | 2 +- 21 files changed, 196 insertions(+), 217 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/BabyFireworkEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/BabyFireworkEffect.java index 61f5c5c79..69714b83d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/BabyFireworkEffect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/BabyFireworkEffect.java @@ -31,6 +31,8 @@ public class BabyFireworkEffect extends Effect _multipleColors = true; _fireworkColor = Color.RED; } + + _colors = new Color[0]; } public BabyFireworkEffect(Location location, JavaPlugin javaPlugin, Color... colors) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java index 40f68c2ee..af260b310 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java @@ -314,6 +314,7 @@ public class TreasureLocation implements Listener { Location fromLocation = event.getFrom(); Location toLocation = event.getTo(); + if (fromLocation.getWorld().equals(toLocation.getWorld())) return; Location centerLocation = _currentTreasure.getCenterBlock().getLocation().add(0.5, 1.5, 0.5); double toDistanceFromCenter = centerLocation.distanceSquared(toLocation); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 09120e45a..ccbaa8acd 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -1,6 +1,7 @@ package mineplex.hub; import mineplex.core.Managers; import mineplex.core.MiniClientPlugin; +import mineplex.core.TimingsFix; import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; @@ -237,6 +238,7 @@ public class HubManager extends MiniClientPlugin<HubClient> implements IChatMess // new HolidayGiftManager(plugin, clientManager, donationManager, inventoryManager, taskManager); require(PlayerDisguiseManager.class); + require(TimingsFix.class); // NotificationManager notificationManager = new NotificationManager(plugin, clientManager, donationManager); // new MailManager(_plugin, notificationManager); new ValentinesGiftManager(plugin, clientManager, _bonusManager.getRewardManager(), inventoryManager, _gadgetManager, statsManager); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java index d9d81048f..47b5c038e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java @@ -95,8 +95,12 @@ public class SoloSuperSmash extends SuperSmash //Wipe Last Scoreboard.reset(); - if (GetPlayers(true).size() > 14) + boolean minimise = false; + + if (GetPlayers(false).size() > 14) { + minimise = true; + Scoreboard.writeNewLine(); Scoreboard.write(C.cGreenB + "Players Alive"); Scoreboard.write(GetPlayers(true).size() + " "); @@ -109,7 +113,7 @@ public class SoloSuperSmash extends SuperSmash { Scoreboard.writeNewLine(); - Scoreboard.writeGroup(GetPlayers(false), player -> + Scoreboard.writeGroup(GetPlayers(minimise), player -> { int lives = getLives(player); 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 62269d1a0..b43ba4903 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 @@ -84,50 +84,33 @@ import nautilus.game.arcade.kit.Perk; public abstract class SuperSmash extends Game { - - private static final int MAX_LIVES = 4; - private static final int POWERUP_SPAWN_Y_INCREASE = 120; + + private static final int MAX_LIVES = 4; + private static final int POWERUP_SPAWN_Y_INCREASE = 120; private static final int HUNGER_DELAY = 250; - + private static final String DATA_POINT_POWERUP = "RED"; - + private Map<Player, Integer> _lives = new HashMap<>(); - + private Location _powerupCurrent = null; private Location _powerupTarget = null; private EnderCrystal _powerup = null; private Hologram _powerupHologram = null; private boolean _powerupHologramColour; private long _nextPowerup = 0; - + private static final Set<Material> REMOVE_ON_ITEM_SPAWN = Sets.newHashSet(Material.CACTUS, Material.BROWN_MUSHROOM, Material.RED_MUSHROOM, Material.YELLOW_FLOWER, Material.RED_ROSE); - + public SuperSmash(ArcadeManager manager, GameType type, String[] description) { this(manager, new Kit[] { - new KitSkeleton(manager), - new KitGolem(manager), - new KitSpider(manager), - new KitSlime(manager), - new KitCreeper(manager), - new KitEnderman(manager), - new KitSnowman(manager), - new KitWolf(manager), - new KitBlaze(manager), - new KitWitch(manager), - new KitChicken(manager), - new KitSkeletalHorse(manager), - new KitPig(manager), - new KitSkySquid(manager), - new KitWitherSkeleton(manager), - new KitMagmaCube(manager), - new KitZombie(manager), - new KitCow(manager), - new KitSheep(manager), - new KitGuardian(manager) + new KitSkeleton(manager), new KitGolem(manager), new KitSpider(manager), new KitSlime(manager), new KitCreeper(manager), new KitEnderman(manager), new KitSnowman(manager), + new KitWolf(manager), new KitBlaze(manager), new KitWitch(manager), new KitChicken(manager), new KitSkeletalHorse(manager), new KitPig(manager), new KitSkySquid(manager), + new KitWitherSkeleton(manager), new KitMagmaCube(manager), new KitZombie(manager), new KitCow(manager), new KitSheep(manager), new KitGuardian(manager) }, type, description); } @@ -136,12 +119,12 @@ public abstract class SuperSmash extends Game { super(manager, type, kits, description); - this.DeathOut = false; - this.CompassEnabled = true; - this.DeathSpectateSecs = 4; - this.WorldWaterDamage = 1000; - this.HideTeamSheep = true; - this.ReplaceTeamsWithKits = true; + DeathOut = false; + CompassEnabled = true; + DeathSpectateSecs = 4; + WorldWaterDamage = 1000; + HideTeamSheep = true; + ReplaceTeamsWithKits = true; } @EventHandler(priority = EventPriority.HIGH) @@ -168,18 +151,19 @@ public abstract class SuperSmash extends Game SetPlayerState(event.getEntity(), PlayerState.OUT); } - //I think this causes players to sometimes be invisible -// DisguiseManager disguiseManager = Manager.GetDisguise(); -// DisguiseBase disguise = disguiseManager.getActiveDisguise(event.getEntity()); -// -// if (disguise == null) -// { -// return; -// } -// -// disguiseManager.undisguise(disguise); + // I think this causes players to sometimes be invisible + // DisguiseManager disguiseManager = Manager.GetDisguise(); + // DisguiseBase disguise = + // disguiseManager.getActiveDisguise(event.getEntity()); + // + // if (disguise == null) + // { + // return; + // } + // + // disguiseManager.undisguise(disguise); } - + @EventHandler public void playerQuit(PlayerQuitEvent event) { @@ -208,7 +192,7 @@ public abstract class SuperSmash extends Game if (lives > 0) { String livesString = (lives == 1 ? "life" : "lives"); - + UtilPlayer.message(player, C.cRedB + "You have died!"); UtilPlayer.message(player, C.cRedB + "You have " + lives + " " + livesString + " left!"); player.playSound(player.getLocation(), Sound.NOTE_BASS_GUITAR, 2f, 0.5f); @@ -227,13 +211,13 @@ public abstract class SuperSmash extends Game return true; } - + String gameOver = "You ran out of lives!"; - + UtilTextMiddle.display(C.cRedB + "GAME OVER", gameOver, 10, 50, 10, player); UtilPlayer.message(player, C.cRedB + gameOver); player.playSound(player.getLocation(), Sound.EXPLODE, 2f, 1f); - + return false; } @@ -263,9 +247,9 @@ public abstract class SuperSmash extends Game { continue; } - + UtilInv.remove(player, Material.NETHER_STAR, (byte) 0, 1); - + player.setHealth(player.getMaxHealth()); player.playSound(player.getLocation(), ultimate.getSound(), 10, 1); @@ -285,39 +269,40 @@ public abstract class SuperSmash extends Game { return; } - + if (!IsLive()) { return; } - + if (_powerupHologram != null) { _powerupHologram.setText((_powerupHologramColour ? C.cGreenB : C.cWhiteB) + "SMASH CRYSTAL"); _powerupHologramColour = !_powerupHologramColour; } - + if (_powerup == null) { if (System.currentTimeMillis() < _nextPowerup) { return; } - + if (WorldData.GetDataLocs(DATA_POINT_POWERUP).isEmpty()) { return; } - + if (_powerupTarget == null) { BlockRestore blockRestore = Manager.GetBlockRestore(); Location newTarget = UtilAlg.Random(WorldData.GetDataLocs(DATA_POINT_POWERUP)); Block targetBlock = newTarget.getBlock(); - - // This relies on this method being called 4 times a second (5 ticks, UpdateType.FASTER). + + // This relies on this method being called 4 times a second (5 + // ticks, UpdateType.FASTER). long restoreTime = (POWERUP_SPAWN_Y_INCREASE / 4 / 2) * 1000 + 500; - + _powerupTarget = newTarget.clone(); _powerupCurrent = newTarget.clone().add(0, POWERUP_SPAWN_Y_INCREASE, 0); @@ -327,20 +312,20 @@ public abstract class SuperSmash extends Game for (int z = -1; z <= 1; z++) { blockRestore.add(targetBlock.getRelative(x, -3, z), Material.IRON_BLOCK.getId(), (byte) 0, restoreTime); - + if (x == 0 && z == 0) { continue; } - + blockRestore.add(targetBlock.getRelative(x, -1, z), Material.QUARTZ_BLOCK.getId(), (byte) 0, restoreTime); } } - + blockRestore.add(targetBlock.getRelative(0, -2, 0), Material.BEACON.getId(), (byte) 0, restoreTime); blockRestore.add(targetBlock.getRelative(0, -1, 0), Material.STAINED_GLASS.getId(), (byte) 5, restoreTime); } - + if (_powerupTarget.getY() < _powerupCurrent.getY()) { _powerupCurrent.subtract(0, 2, 0); @@ -352,9 +337,9 @@ public abstract class SuperSmash extends Game _powerup = _powerupTarget.getWorld().spawn(_powerupTarget, EnderCrystal.class); _powerupHologram = new Hologram(Manager.getHologramManager(), _powerupTarget.add(0, 2, 0), true, "SMASH CRYSTAL").start(); CreatureAllowOverride = false; - + UtilFirework.playFirework(_powerupTarget, Type.BURST, Color.YELLOW, false, true); - + _powerupTarget = null; _powerupCurrent = null; } @@ -368,17 +353,17 @@ public abstract class SuperSmash extends Game { return; } - + if (!IsLive()) { return; } - + if (_powerup == null) { return; } - + Player best = null; double bestDist = 0; @@ -388,14 +373,14 @@ public abstract class SuperSmash extends Game { continue; } - + double dist = UtilMath.offset(player, _powerup); if (dist > 2) { continue; } - + if (best == null || dist < bestDist) { best = player; @@ -407,15 +392,15 @@ public abstract class SuperSmash extends Game { _powerupHologram.stop(); _powerupHologram = null; - + _powerup.remove(); _powerup = null; - + giveSmashItem(best); _nextPowerup = getNewSmashTime(); } } - + private void giveSmashItem(Player player) { player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 1, C.cYellowB + "Click" + C.cWhiteB + " - " + C.cGreenB + "Smash")); @@ -438,7 +423,7 @@ public abstract class SuperSmash extends Game { return; } - + if (event.GetCause() == DamageCause.FALL) { event.SetCancelled("No Fall Damage"); @@ -452,11 +437,11 @@ public abstract class SuperSmash extends Game { return; } - + if (event.GetDamageePlayer() != null) { Player player = event.GetDamageePlayer(); - + event.AddKnockback("Smash Knockback", 1 + 0.1 * (player.getMaxHealth() - player.getHealth())); } } @@ -468,11 +453,11 @@ public abstract class SuperSmash extends Game { return; } - + if (event.GetCause() == DamageCause.VOID || event.GetCause() == DamageCause.LAVA) { LivingEntity entity = event.GetDamageeEntity(); - + entity.eject(); entity.leaveVehicle(); @@ -480,7 +465,7 @@ public abstract class SuperSmash extends Game { entity.getWorld().strikeLightningEffect(entity.getLocation()); } - + event.AddMod("Smash", "Super Smash Mobs", 5000, false); } } @@ -491,7 +476,7 @@ public abstract class SuperSmash extends Game if (event.getRegainReason() == RegainReason.SATIATED) { event.setCancelled(true); - } + } } @EventHandler(priority = EventPriority.MONITOR) @@ -533,42 +518,42 @@ public abstract class SuperSmash extends Game { return; } - + Player player = event.getPlayer(); ItemStack itemStack = player.getItemInHand(); - + if (itemStack == null) { return; } - + if (itemStack.getItemMeta() == null) { return; } - + ItemMeta itemMeta = itemStack.getItemMeta(); - + if (itemMeta.getDisplayName() == null) { return; } - + if (itemMeta.getLore() == null) { return; } - + if (GetState() != GameState.Recruit) - { + { return; } - + for (int i = player.getItemInHand().getItemMeta().getLore().size(); i <= 7; i++) { UtilPlayer.message(player, ""); } - + UtilPlayer.message(player, ArcadeFormat.Line); UtilPlayer.message(player, "§aAbility - §f§l" + player.getItemInHand().getItemMeta().getDisplayName()); @@ -607,12 +592,12 @@ public abstract class SuperSmash extends Game { return; } - + if (!IsLive()) { return; } - + hungerTick = (hungerTick + 1) % 10; for (Player player : GetPlayers(true)) @@ -641,33 +626,33 @@ public abstract class SuperSmash extends Game { return; } - + Player damager = event.GetDamagerPlayer(true); if (damager == null) { return; } - + if (damager.equals(event.GetDamageeEntity())) { return; } - + if (!(event.GetDamageeEntity() instanceof Player)) { return; } - + if (!Recharge.Instance.use(damager, "Hunger Restore", HUNGER_DELAY, false, false)) { return; } - + int amount = Math.max(1, (int) (event.GetDamage() / 2)); UtilPlayer.hunger(damager, amount); } - + @EventHandler public void itemSpawn(ItemSpawnEvent event) { @@ -676,7 +661,7 @@ public abstract class SuperSmash extends Game event.setCancelled(true); } } - + public long getNewSmashTime() { return (long) (System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(3) + TimeUnit.MINUTES.toMillis(5) * Math.random()); @@ -698,12 +683,12 @@ public abstract class SuperSmash extends Game return C.cGreen; } } - + public Map<Player, Integer> getLiveMap() { return _lives; } - + @EventHandler public void debugCommands(PlayerCommandPreprocessEvent event) { @@ -711,62 +696,71 @@ public abstract class SuperSmash extends Game { return; } - + String message = event.getMessage(); Player player = event.getPlayer(); - + if (message.startsWith("/cooldown")) { event.setCancelled(true); - + for (Player other : UtilServer.getPlayers()) { Recharge.Instance.Reset(other); } - + Announce(C.cWhiteB + player.getName() + C.cAquaB + " reset cooldowns!"); } else if (message.startsWith("/nextsmash")) { event.setCancelled(true); - + _nextPowerup = System.currentTimeMillis() + 1000; Announce(C.cWhiteB + player.getName() + C.cAquaB + " spawned a smash crystal!"); } else if (message.startsWith("/smash")) { event.setCancelled(true); - + giveSmashItem(player); } else if (message.startsWith("/kit")) { event.setCancelled(true); - + String[] args = message.split(" "); String kit = ""; - + for (int i = 1; i < args.length; i++) { kit += args[i] + " "; } - + kit = kit.trim(); - + for (Kit kits : GetKits()) { if (kit.equalsIgnoreCase(kits.GetName())) { SetKit(player, kits, true); + return; } } + + player.sendMessage(F.main("Kit", "Sorry that is not a kit!")); } else if (message.startsWith("/lives")) { event.setCancelled(true); - - _lives.put(player, MAX_LIVES); + Announce(C.cWhiteB + player.getName() + C.cAquaB + " reset their lives!"); + + if (!IsAlive(player)) + SetPlayerState(player, PlayerState.IN); + RespawnPlayer(player); + player.sendMessage(F.main("Revive", "You are back in the game!")); } + + _lives.put(player, MAX_LIVES); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java index d86ad4429..8ec0506dd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java @@ -10,12 +10,11 @@ import org.bukkit.scheduler.BukkitRunnable; import mineplex.core.common.Pair; import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; @@ -89,11 +88,11 @@ public class TeamSuperSmash extends SuperSmash for (GameTeam team : GetTeamList()) { - Scoreboard.writeGroup(team.GetPlayers(true), player -> + Scoreboard.writeGroup(team.GetPlayers(false), player -> { int lives = getLives(player); - return Pair.create(team.GetColor() + player.getName(), lives); + return Pair.create(team.GetColor() + (IsAlive(player) ? "" : C.Strike) + player.getName(), lives); }, true); } } @@ -101,6 +100,7 @@ public class TeamSuperSmash extends SuperSmash Scoreboard.draw(); } + @Override @EventHandler public void gameStart(GameStateChangeEvent event) { @@ -109,6 +109,8 @@ public class TeamSuperSmash extends SuperSmash return; } + super.gameStart(event); + new BukkitRunnable() { @@ -116,12 +118,7 @@ public class TeamSuperSmash extends SuperSmash public void run() { for (Player player : GetPlayers(true)) - { - if (UtilPlayer.isSpectator(player)) - { - continue; - } - + { GameTeam team = GetTeam(player); Player bestTeamMember = null; @@ -142,11 +139,11 @@ public class TeamSuperSmash extends SuperSmash if (bestTeamMember == null) { - UtilTextMiddle.display(C.cRedB + "No one", "You don\'t have a teamamte :(", 10, 50, 10); + UtilTextMiddle.display(C.cRedB + "No one", "You don\'t have a teammate :(", 10, 50, 10, player); return; } - UtilTextMiddle.display(team.GetColor() + bestTeamMember.getName(), "Is your teammate", 10, 50, 10); + UtilTextMiddle.display(team.GetColor() + bestTeamMember.getName(), "Is your teammate", 10, 50, 10, player); } } }.runTaskLater(Manager.getPlugin(), 40); @@ -163,6 +160,11 @@ public class TeamSuperSmash extends SuperSmash Player damager = event.GetDamagerPlayer(true); Player damagee = event.GetDamageePlayer(); + if (GetTeam(damager) == null || GetTeam(damagee) == null) + { + return; + } + if (GetTeam(damager).equals(GetTeam(damagee))) { if (event.GetCause() == DamageCause.FIRE) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java index 3836b1640..e252a2e64 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java @@ -105,7 +105,7 @@ public class KitMagmaCube extends SmashKit } @EventHandler - public void FireItemResist(UpdateEvent event) + public void fireResistance(UpdateEvent event) { if (event.getType() != UpdateType.FAST) { @@ -124,8 +124,7 @@ public class KitMagmaCube extends SmashKit continue; } - Manager.GetCondition().Factory().FireItemImmunity(GetName(), player, player, 1.9, false); + player.setFireTicks(0); } } - } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java index 978224567..5729bb8ac 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java @@ -128,6 +128,6 @@ public class KitSkeleton extends SmashKit return; } - event.AddMod("Arrow Nerf", -2); + event.AddMod("Arrow Nerf", -1.5); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkFirefly.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkFirefly.java index 76a22df83..29cd6d704 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkFirefly.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/PerkFirefly.java @@ -135,6 +135,12 @@ public class PerkFirefly extends SmashPerk boolean superActive = isSuperActive(data.Player); String skillName = superActive ? "Phoenix" : GetName(); + if (UtilPlayer.isSpectator(player)) + { + dataIterator.remove(); + continue; + } + // Warmup if (!UtilTime.elapsed(data.Time, WARMUP_TIME) && !superActive) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java index 50ccb7630..afa59acd8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkBlockToss.java @@ -44,7 +44,7 @@ public class PerkBlockToss extends SmashPerk implements IThrown private static final int COOLDOWN = 2000; private static final int CHARGE_TIME = 1200; - private static final int DAMAGE = 11; + private static final int DAMAGE = 9; private static final float KNOCKBACK_MAGNITUDE = 2.5F; private Map<UUID, BlockTossData> _hold = new HashMap<>(); @@ -133,7 +133,7 @@ public class PerkBlockToss extends SmashPerk implements IThrown { return; } - + Set<Player> throwSet = new HashSet<>(); for (UUID key : _hold.keySet()) @@ -165,7 +165,7 @@ public class PerkBlockToss extends SmashPerk implements IThrown for (Player cur : throwSet) { UUID key = cur.getUniqueId(); - + Recharge.Instance.recharge(cur, GetName()); Recharge.Instance.use(cur, GetName(), COOLDOWN, false, true); @@ -181,7 +181,7 @@ public class PerkBlockToss extends SmashPerk implements IThrown // Throw double mult = Math.min(1.4, 1.4 * ((double) charge / CHARGE_TIME)); - + // Action UtilAction.velocity(block, cur.getLocation().getDirection(), mult, false, 0.2, 0, 1, true); Manager.GetProjectile().AddThrow(block, cur, this, -1, true, true, true, true, null, 0, 0, null, 0, UpdateType.FASTEST, 1f); @@ -241,7 +241,7 @@ public class PerkBlockToss extends SmashPerk implements IThrown { return; } - + FallingBlock falling = (FallingBlock) event.getEntity(); falling.getWorld().playEffect(event.getBlock().getLocation(), Effect.STEP_SOUND, falling.getBlockId()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashGolem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashGolem.java index e28bc8aea..973837961 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashGolem.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashGolem.java @@ -1,7 +1,6 @@ package nautilus.game.arcade.game.games.smash.perks.golem; import java.util.List; -import java.util.Map; import org.bukkit.Effect; import org.bukkit.Material; @@ -60,7 +59,7 @@ public class SmashGolem extends SmashUltimate for (Player other : alivePlayers) { - if (player.equals(other) || UtilPlayer.isSpectator(player)) + if (player.equals(other) || UtilPlayer.isSpectator(other)) { continue; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/TargetLazerData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/TargetLazerData.java index 04f5c8500..4c07e7537 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/TargetLazerData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/TargetLazerData.java @@ -3,6 +3,8 @@ package nautilus.game.arcade.game.games.smash.perks.guardian; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Player; +import mineplex.core.common.util.UtilEnt; + import nautilus.game.arcade.ArcadeManager; public class TargetLazerData @@ -35,6 +37,9 @@ public class TargetLazerData _targetPlaceholder.setBasePlate(false); _targetPlaceholder.setGravity(false); _targetPlaceholder.setVisible(false); + + UtilEnt.ghost(_targetPlaceholder, true, false); + manager.GetGame().CreatureAllowOverride = false; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkFlameDash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkFlameDash.java index 4477c5692..f8030aaeb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkFlameDash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkFlameDash.java @@ -102,7 +102,8 @@ public class PerkFlameDash extends Perk return; } - Recharge.Instance.useForce(player, GetName(), COOLDOWN); + Recharge.Instance.recharge(player, GetName()); + Recharge.Instance.use(player, GetName(), COOLDOWN, true, true); _data.add(new FireflyData(player)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBoost.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBoost.java index c3508a4d3..136200d15 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBoost.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBoost.java @@ -4,6 +4,7 @@ import java.util.HashMap; import java.util.Map; import java.util.UUID; +import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -39,7 +40,7 @@ public class PerkMagmaBoost extends Perk { Player killed = (Player) event.GetEvent().getEntity(); - _kills.remove(killed); + _kills.remove(killed.getUniqueId()); if (event.GetLog().GetKiller() == null) { @@ -74,7 +75,9 @@ public class PerkMagmaBoost extends Perk slime.SetSize(size + 1); Manager.GetDisguise().updateDisguise(slime); - + + Bukkit.broadcastMessage("Exp: " + 0.99f * (size / MAX_STACKS)); + killer.setExp(0.99f * (size / MAX_STACKS)); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolCloud.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolCloud.java index 186ba1acf..999c1ac52 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolCloud.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolCloud.java @@ -131,7 +131,7 @@ public class PerkWoolCloud extends Perk UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation(), 0.2f, 0.2f, 0.2f, 0, 4, ViewDist.LONGER, UtilServer.getPlayers()); - if (!UtilTime.elapsed(_active.get(player), MIN_VELOCITY_TIME)) + if (!UtilTime.elapsed(_active.get(key), MIN_VELOCITY_TIME)) { continue; } @@ -153,7 +153,7 @@ public class PerkWoolCloud extends Perk } } - if (UtilEnt.isGrounded(player) || UtilTime.elapsed(_active.get(player), MAX_VELOCITY_TIME)) + if (UtilEnt.isGrounded(player) || UtilTime.elapsed(_active.get(key), MAX_VELOCITY_TIME)) { playerIterator.remove(); setWoolColor(player, DyeColor.WHITE); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeRocket.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeRocket.java index 9a2db18a1..a9994d4a1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeRocket.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeRocket.java @@ -37,15 +37,18 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkSlimeRocket extends SmashPerk implements IThrown { - + private static final int COOLDOWN = 6000; private static final float ENERGY_PER_TICK = 0.004F; private static final int KNOCKBACK_MAGNITUDE = 3; - + private static final int MAX_ENERGY_TIME = 3000; + private static final int MAX_HOLD_TIME = 5000; + private Map<UUID, Long> _charge = new HashMap<>(); private Map<Slime, UUID> _owner = new HashMap<>(); private Map<Slime, Long> _lastAttack = new HashMap<>(); @@ -69,12 +72,12 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown { continue; } - + if (isSuperActive(player)) { continue; } - + int size = 1; if (player.getExp() > 0.8) { @@ -93,7 +96,7 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown Manager.GetDisguise().updateDisguise(slime); } - if (player.isBlocking()) + if (player.isBlocking() && !Recharge.Instance.usable(player, GetName())) { continue; } @@ -141,7 +144,7 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown { return; } - + UtilPlayer.message(player, F.main("Skill", "You are charging " + F.skill(GetName()) + ".")); _charge.put(player.getUniqueId(), System.currentTimeMillis()); @@ -154,7 +157,7 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown { return; } - + Iterator<UUID> chargeIterator = _charge.keySet().iterator(); while (chargeIterator.hasNext()) @@ -173,7 +176,7 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown // Charge if (player.isBlocking()) { - // Energy Depleted + // Energy Depleted if (player.getExp() < 0.1) { FireRocket(player); @@ -184,22 +187,23 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown double elapsed = Math.min(3, (double) (System.currentTimeMillis() - time) / 1000d); // Use Energy - if (!UtilTime.elapsed(time, 3000)) + if (!UtilTime.elapsed(time, MAX_ENERGY_TIME)) { player.setExp((float) Math.max(0, player.getExp() - 0.01f)); } // AutoFire - if (UtilTime.elapsed(time, 5000)) + if (UtilTime.elapsed(time, MAX_HOLD_TIME)) { FireRocket(player); chargeIterator.remove(); } + float offset = (float) (elapsed / 6d); + // Effect player.getWorld().playSound(player.getLocation(), Sound.SLIME_WALK, 0.5f, (float) (0.5 + 1.5 * (elapsed / 3d))); - UtilParticle.PlayParticle(ParticleType.SLIME, player.getLocation().add(0, 1, 0), (float) (elapsed / 6d), (float) (elapsed / 6d), (float) (elapsed / 6d), 0, (int) (elapsed * 5), - ViewDist.LONGER, UtilServer.getPlayers()); + UtilParticle.PlayParticle(ParticleType.SLIME, player.getLocation().add(0, 1, 0), offset, offset, offset, 0, (int) (elapsed * 5), ViewDist.LONGER, UtilServer.getPlayers()); } } // Release @@ -247,15 +251,15 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown { return; } - + if (!_owner.containsKey(event.getEntity())) { return; } - + if (event.getTarget() instanceof Player) { - if (isTeamDamage((Player) event.getTarget(), UtilPlayer.searchExact(_owner.get(event.getEntity().getUniqueId())))) + if (isTeamDamage((Player) event.getTarget(), UtilPlayer.searchExact(_owner.get(event.getEntity())))) { event.setCancelled(true); return; @@ -328,7 +332,7 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown { return; } - + Slime slime = (Slime) event.GetDamagerEntity(false); // Attack Rate diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeSlam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeSlam.java index b51206e02..6d27af729 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeSlam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/PerkSlimeSlam.java @@ -75,11 +75,6 @@ public class PerkSlimeSlam extends SmashPerk return; } - if (isSuperActive(player)) - { - return; - } - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) { return; @@ -114,12 +109,7 @@ public class PerkSlimeSlam extends SmashPerk for (Player other : alivePlayers) { - if (UtilPlayer.isSpectator(other)) - { - continue; - } - - if (other.equals(player)) + if (player.equals(other) || UtilPlayer.isSpectator(other) || isTeamDamage(player, other)) { continue; } @@ -171,10 +161,10 @@ public class PerkSlimeSlam extends SmashPerk if (!isSuperActive(damager)) { Manager.GetDamage().NewDamageEvent(damager, damagee, null, DamageCause.CUSTOM, DAMAGE / 4, true, true, false, damager.getName(), GetName() + " Recoil"); - } - // Damage Event - Manager.GetDamage().NewDamageEvent(damagee, damager, null, DamageCause.CUSTOM, DAMAGE, true, true, false, damager.getName(), GetName()); + // Damage Event + Manager.GetDamage().NewDamageEvent(damagee, damager, null, DamageCause.CUSTOM, DAMAGE, true, true, false, damager.getName(), GetName()); + } // Inform UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName()) + ".")); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/SmashSlime.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/SmashSlime.java index 31d5b98e0..4a9e2894b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/SmashSlime.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/SmashSlime.java @@ -41,7 +41,6 @@ public class SmashSlime extends SmashUltimate super.activate(player); player.getInventory().remove(Material.IRON_SWORD); - player.getInventory().remove(Material.IRON_AXE); DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); if (disguise != null && disguise instanceof DisguiseSlime) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java index 57ebb1a7f..b3ab83c74 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Set; import org.bukkit.block.Block; @@ -42,8 +43,7 @@ public class PerkWitchPotion extends SmashPerk implements IThrown private static final int COOLDOWN = 2000; private static final int RANGE_NOMRAL = 3; - private static final int RANGE_SMASH = 4; - private static final int DAMAGE_NORMAL = 6; + private static final int DAMAGE_NORMAL = 7; private static final int KNOCKBACK_MAGNITUDE = 2; private List<Projectile> _proj = new ArrayList<>(); @@ -99,7 +99,7 @@ public class PerkWitchPotion extends SmashPerk implements IThrown _proj.add(potion); - Manager.GetProjectile().AddThrow(potion, player, this, 10000, true, true, true, false, false, 0.5F); + Manager.GetProjectile().AddThrow(potion, player, this, 10000, true, true, true, false, false, 0); // Inform UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); @@ -143,39 +143,12 @@ public class PerkWitchPotion extends SmashPerk implements IThrown @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { - Set<LivingEntity> players = new HashSet<>(); - Player thrower = (Player) data.getThrower(); + Map<Player, Double> nearby = UtilPlayer.getInRadius(data.getThrown().getLocation(), RANGE_NOMRAL); + LivingEntity entity = data.getThrower(); - if (target != null) + for (Player player : nearby.keySet()) { - players.add(target); - } - - for (Player player : Manager.GetGame().GetPlayers(true)) - { - if (player.equals(data.getThrower())) - { - continue; - } - - double d = UtilMath.offset(player.getLocation().add(0, 1, 0), data.getThrown().getLocation()); - - if (d > (isSuperActive(thrower) ? RANGE_SMASH : RANGE_NOMRAL)) - { - continue; - } - - players.add(player); - } - - int i = 0; - - for (LivingEntity entity : players) - { - // Damage Event - Manager.GetDamage().NewDamageEvent(entity, thrower, null, DamageCause.CUSTOM, (i++ == 0 ? DAMAGE_NORMAL + 1 : DAMAGE_NORMAL), true, true, false, thrower.getName(), GetName()); - - Manager.GetCondition().Factory().Slow(GetName(), entity, null, 3, 1, true, false, false, false); + Manager.GetDamage().NewDamageEvent(player, entity, null, DamageCause.CUSTOM, DAMAGE_NORMAL * nearby.get(player), true, true, false, entity.getName(), GetName()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/PerkWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/PerkWolf.java index eeab53826..00fee85c3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/PerkWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/PerkWolf.java @@ -357,12 +357,7 @@ public class PerkWolf extends SmashPerk for (Player other : Manager.GetGame().GetPlayers(true)) { - if (player.equals(other)) - { - continue; - } - - if (Manager.isSpectator(other)) + if (player.equals(other) || UtilPlayer.isSpectator(other) || isTeamDamage(player, other)) { continue; } @@ -490,7 +485,7 @@ public class PerkWolf extends SmashPerk _repeat.get(damager.getUniqueId()).add(System.currentTimeMillis()); // Exp - damager.setExp(Math.min(0.9999f, _repeat.get(damager.getUniqueId()).size() / 9f)); + damager.setExp(Math.min(0.999f, _repeat.get(damager.getUniqueId()).size() / 9f)); } @EventHandler @@ -521,7 +516,7 @@ public class PerkWolf extends SmashPerk } // Exp - player.setExp(Math.min(0.9999f, _repeat.get(player).size() / 9f)); + player.setExp(Math.min(0.999f, _repeat.get(uuid).size() / 9f)); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/legacy/LegacyGameLobbyManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/legacy/LegacyGameLobbyManager.java index 5dda2cc42..3ecc7b3a1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/legacy/LegacyGameLobbyManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/legacy/LegacyGameLobbyManager.java @@ -271,7 +271,7 @@ public class LegacyGameLobbyManager extends LobbyManager double space = 4; double offset = (divide - 1) * space / 2d; - for (int i = 0; i < kits.size() - divide; i++) + for (int i = 1; i < kits.size() - divide; i++) { Kit kit = kits.get(i + divide); From f72f6e8aaa96e785d4d34398caa65c66af1ea12a Mon Sep 17 00:00:00 2001 From: Sam <huzzahpinkyoshi@gmail.com> Date: Thu, 13 Oct 2016 20:20:00 +0100 Subject: [PATCH 042/147] Tweaks --- .../nautilus/game/arcade/game/games/smash/SoloSuperSmash.java | 2 +- .../arcade/game/games/smash/perks/guardian/PerkThorns.java | 4 ++-- .../arcade/game/games/smash/perks/witch/PerkWitchPotion.java | 3 --- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java index 47b5c038e..1cb424597 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java @@ -82,7 +82,7 @@ public class SoloSuperSmash extends SuperSmash _players = GetTeamList().get(0); _players.SetColor(ChatColor.YELLOW); _players.SetName("Players"); - _players.setDisplayName(C.cYellow + C.Bold + "Players"); + _players.setDisplayName(C.cYellowB + "Players"); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkThorns.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkThorns.java index 5420f86dc..22fa5b671 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkThorns.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkThorns.java @@ -18,7 +18,7 @@ public class PerkThorns extends Perk public PerkThorns() { - super("Thorns", new String[] { C.cGray + "When below 6 health you take reduced damage and knockback."}); + super("Thorns", new String[] { C.cGray + "When below 6 health you take reduced damage and knockback from projectiles."}); } @EventHandler(priority = EventPriority.HIGHEST) @@ -38,7 +38,7 @@ public class PerkThorns extends Perk if (player.getHealth() < MAX_HEALTH) { - event.AddMod(GetName(), DAMAGE_DECREASE * event.GetDamage()); + event.AddMod(GetName(), -DAMAGE_DECREASE * event.GetDamage()); event.AddKnockback(GetName(), -KNOCKBACK_DECREASE); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java index b3ab83c74..42375fd88 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java @@ -1,11 +1,9 @@ package nautilus.game.arcade.game.games.smash.perks.witch; import java.util.ArrayList; -import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Set; import org.bukkit.block.Block; import org.bukkit.entity.LivingEntity; @@ -23,7 +21,6 @@ import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilItem; -import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; From ca0da15b8c0033fb017e6465a5384b5008e861e3 Mon Sep 17 00:00:00 2001 From: Sam <huzzahpinkyoshi@gmail.com> Date: Thu, 13 Oct 2016 22:43:04 +0100 Subject: [PATCH 043/147] Fix magma cube --- .../smash/perks/magmacube/PerkMagmaBoost.java | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBoost.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBoost.java index 136200d15..18f3c4443 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBoost.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBoost.java @@ -28,7 +28,7 @@ public class PerkMagmaBoost extends Perk private static final int MAX_STACKS = 3; - private Map<UUID, Integer> _kills = new HashMap<UUID, Integer>(); + private Map<UUID, Integer> _kills = new HashMap<>(); public PerkMagmaBoost() { @@ -36,10 +36,10 @@ public class PerkMagmaBoost extends Perk } @EventHandler - public void Kill(CombatDeathEvent event) + public void kill(CombatDeathEvent event) { Player killed = (Player) event.GetEvent().getEntity(); - + _kills.remove(killed.getUniqueId()); if (event.GetLog().GetKiller() == null) @@ -55,7 +55,7 @@ public class PerkMagmaBoost extends Perk } DisguiseMagmaCube slime = (DisguiseMagmaCube) Manager.GetDisguise().getActiveDisguise(killer); - UUID key = killed.getUniqueId(); + UUID key = killer.getUniqueId(); if (slime == null) { @@ -75,14 +75,12 @@ public class PerkMagmaBoost extends Perk slime.SetSize(size + 1); Manager.GetDisguise().updateDisguise(slime); - - Bukkit.broadcastMessage("Exp: " + 0.99f * (size / MAX_STACKS)); - - killer.setExp(0.99f * (size / MAX_STACKS)); + + killer.setExp(0.99F * (size / (float) MAX_STACKS)); } @EventHandler(priority = EventPriority.HIGHEST) - public void SizeDamage(CustomDamageEvent event) + public void sizeDamage(CustomDamageEvent event) { if (event.IsCancelled()) { @@ -95,7 +93,7 @@ public class PerkMagmaBoost extends Perk } Player damager = event.GetDamagerPlayer(false); - + if (damager == null) { return; @@ -106,25 +104,29 @@ public class PerkMagmaBoost extends Perk return; } - if (!_kills.containsKey(damager.getUniqueId())) + UUID key = damager.getUniqueId(); + + if (!_kills.containsKey(key)) { return; } - - int bonus = _kills.get(damager.getUniqueId()); - - event.AddMod(damager.getName(), GetName(), bonus, false); + + event.AddMod(damager.getName(), GetName(), _kills.get(key), false); } @EventHandler(priority = EventPriority.HIGHEST) - public void SizeKnockback(CustomDamageEvent event) + public void sizeKnockback(CustomDamageEvent event) { if (event.IsCancelled()) + { return; - + } + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + { return; - + } + Player damagee = event.GetDamageePlayer(); if (damagee == null) @@ -147,9 +149,9 @@ public class PerkMagmaBoost extends Perk } @EventHandler - public void EnergyUpdate(UpdateEvent event) + public void energyUpdate(UpdateEvent event) { - if (event.getType() != UpdateType.SEC && event.getType() != UpdateType.FAST && event.getType() != UpdateType.FASTER && event.getType() != UpdateType.FASTEST) + if (event.getType() != UpdateType.FASTER) { return; } From e698037a739058801feba3aeb493e70b1b5bf135 Mon Sep 17 00:00:00 2001 From: Sam <huzzahpinkyoshi@gmail.com> Date: Thu, 13 Oct 2016 22:44:48 +0100 Subject: [PATCH 044/147] Remove unused import --- .../arcade/game/games/smash/perks/magmacube/PerkMagmaBoost.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBoost.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBoost.java index 18f3c4443..3e817de76 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBoost.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBoost.java @@ -4,7 +4,6 @@ import java.util.HashMap; import java.util.Map; import java.util.UUID; -import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -21,6 +20,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.kit.Perk; public class PerkMagmaBoost extends Perk From 99c72a3b31160cb7af6e5fa784612fc6b7422cfa Mon Sep 17 00:00:00 2001 From: Sam <huzzahpinkyoshi@gmail.com> Date: Thu, 13 Oct 2016 23:10:59 +0100 Subject: [PATCH 045/147] Fix debug command --- .../nautilus/game/arcade/game/games/smash/SuperSmash.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 b43ba4903..15abad40d 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 @@ -756,9 +756,11 @@ public abstract class SuperSmash extends Game Announce(C.cWhiteB + player.getName() + C.cAquaB + " reset their lives!"); if (!IsAlive(player)) + { SetPlayerState(player, PlayerState.IN); - RespawnPlayer(player); - player.sendMessage(F.main("Revive", "You are back in the game!")); + RespawnPlayer(player); + player.sendMessage(F.main("Revive", "You are back in the game!")); + } } _lives.put(player, MAX_LIVES); From 4810960d825bb00e2c5d5a4468a99cd784e2dd6d Mon Sep 17 00:00:00 2001 From: Sam <huzzahpinkyoshi@gmail.com> Date: Thu, 13 Oct 2016 23:19:11 +0100 Subject: [PATCH 046/147] Stop visible armorstands --- .../game/games/smash/perks/guardian/TargetLazerData.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/TargetLazerData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/TargetLazerData.java index 4c07e7537..1f02a2f65 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/TargetLazerData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/TargetLazerData.java @@ -37,9 +37,7 @@ public class TargetLazerData _targetPlaceholder.setBasePlate(false); _targetPlaceholder.setGravity(false); _targetPlaceholder.setVisible(false); - - UtilEnt.ghost(_targetPlaceholder, true, false); - + manager.GetGame().CreatureAllowOverride = false; } From 76a413548b2444eab9965ef2563f6b8381eb41ba Mon Sep 17 00:00:00 2001 From: Sam <huzzahpinkyoshi@gmail.com> Date: Thu, 13 Oct 2016 23:31:32 +0100 Subject: [PATCH 047/147] More unused imports --- .../arcade/game/games/smash/perks/guardian/TargetLazerData.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/TargetLazerData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/TargetLazerData.java index 1f02a2f65..0d2d1066b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/TargetLazerData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/TargetLazerData.java @@ -3,8 +3,6 @@ package nautilus.game.arcade.game.games.smash.perks.guardian; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Player; -import mineplex.core.common.util.UtilEnt; - import nautilus.game.arcade.ArcadeManager; public class TargetLazerData From 3b7169ad3d949df29bbf0c04d0fb4dcfd83c5351 Mon Sep 17 00:00:00 2001 From: Keir Nellyer <keir@nellyer.co.uk> Date: Fri, 14 Oct 2016 01:14:51 +0100 Subject: [PATCH 048/147] PC-1000 Implement token generating method --- .../core/chatsnap/SnapshotRepository.java | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotRepository.java index e353d8bba..7bacc39f4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotRepository.java @@ -1,10 +1,12 @@ package mineplex.core.chatsnap; +import java.security.SecureRandom; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Types; +import java.util.Base64; import java.util.Collection; import java.util.Optional; import java.util.concurrent.CompletableFuture; @@ -22,6 +24,9 @@ public class SnapshotRepository { private static final String URL_PREFIX = "http://report.mineplex.com/chatsnap/view.php?id="; + private static final int TOKEN_CHARS = 8; + private static final SecureRandom SECURE_RANDOM = new SecureRandom(); + public static String getURL(long reportId) { return URL_PREFIX + reportId; @@ -29,8 +34,35 @@ public class SnapshotRepository public static String generateToken() { - // TODO: implement - return null; + // 6 bits per character, round to nearest byte + int byteAmount = (int) Math.ceil((TOKEN_CHARS * 6) / 8.0); + byte[] bytes = new byte[byteAmount]; + SECURE_RANDOM.nextBytes(bytes); + + String token = Base64.getUrlEncoder().encodeToString(bytes); + token = replaceDashes(token); + + return token; + } + + private static String replaceDashes(String token) + { + for (int i = 0; i < token.length(); i++) + { + char originalChar = token.charAt(i); + char newChar = originalChar; + + while (newChar == '-') + { + byte[] replacementBytes = new byte[1]; + SECURE_RANDOM.nextBytes(replacementBytes); + newChar = Base64.getUrlEncoder().encodeToString(replacementBytes).charAt(0); + } + + token = token.replaceFirst(String.valueOf(originalChar), String.valueOf(newChar)); + } + + return token; } private static final String INSERT_SNAPSHOT = "INSERT INTO snapshots (token, creator) VALUES (?, ?);"; From 0e5d8cc7856f866512cec729e95f0ef42e4bf76a Mon Sep 17 00:00:00 2001 From: cnr <ConnorNJames@gmail.com> Date: Fri, 14 Oct 2016 00:24:54 -0500 Subject: [PATCH 049/147] Replace pumpling spawn flicker with short glow --- .../games/halloween2016/PumpkinPlant.java | 38 ++++++------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/PumpkinPlant.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/PumpkinPlant.java index 0b2a18ad9..73e9e6165 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/PumpkinPlant.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/PumpkinPlant.java @@ -11,17 +11,11 @@ import nautilus.game.arcade.game.games.halloween2016.creatures.MobPumpling; public class PumpkinPlant { - - /** - * Defines how fast the pumpkin is going to blink. the closer to 1, the faster the blinking. - */ - private static final double BLINK_SPEED = 0.95; + private static final int GROWING_TICKS = 30 * 20; // 30 seconds + private static final int GLOW_TRANSITION_TIME = (int)Math.floor(GROWING_TICKS * .75); private Halloween2016 _game; - - private int _growTicksTotal = 30 * 20; - private int _growTick; - private int _sleep; + private int _age; private Block _growing = null; private int _health; @@ -37,8 +31,6 @@ public class PumpkinPlant _growing.setType(Material.PUMPKIN); - _growTick = _growTicksTotal; - _sleep = _growTick; _health = 3; } @@ -50,16 +42,15 @@ public class PumpkinPlant public void tick() { if(!isGrowing()) return; - - if(_sleep > _growTick) + + _age++; + + if (_age == GLOW_TRANSITION_TIME) { - _sleep *= BLINK_SPEED; - Material old = _growing.getType(); - _growing.setType(old == Material.PUMPKIN ? Material.JACK_O_LANTERN : Material.PUMPKIN); + _growing.setType(Material.JACK_O_LANTERN); } - _growTick--; - - if(_growTick == 0) + + if (_age == GROWING_TICKS) { spawn(); } @@ -68,9 +59,7 @@ public class PumpkinPlant public void spawn() { _growing.setType(Material.AIR); - _growTick = 0; - _sleep = 0; - + Location loc = _growing.getLocation().add(0.5, 0, 0.5); _game.AddCreature(new MobPumpling(_game, loc)); @@ -89,10 +78,7 @@ public class PumpkinPlant if(_health <= 0) { _growing.setType(Material.AIR); - _growTick = 0; - _sleep = 0; - - + loc.getWorld().playEffect(loc, Effect.TILE_BREAK, new MaterialData(Material.PUMPKIN)); _growing = null; From 8ebad90f52a87323e491526f560985659dc02729 Mon Sep 17 00:00:00 2001 From: cnr <ConnorNJames@gmail.com> Date: Thu, 13 Oct 2016 14:46:27 -0500 Subject: [PATCH 050/147] Don't lock current month's cosmetic on resub day This fixes an issue where a player might lose the current month's cosmetic on the date of resubscription until his/her payment method was charged --- .../mineplex/core/powerplayclub/PowerPlayData.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayData.java b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayData.java index 09b4b30f2..178916f39 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayData.java @@ -36,6 +36,9 @@ public class PowerPlayData return new PowerPlayData(Optional.empty(), Collections.emptySet(), Collections.emptySet()); } + final LocalDate today = LocalDate.now(); + final YearMonth thisMonth = YearMonth.now(); + // Build the list of potential claim dates from subscriptions // Note that it's a LinkedList with dates in ascending order List<LocalDate> claimDates = subscriptions.stream() @@ -49,7 +52,7 @@ public class PowerPlayData // In the case of a yearly subscription, they're likely to have a claim date scheduled // (this is not the case for the last month) - Optional<LocalDate> nextSubClaim = claimDates.stream().filter(date -> date.isAfter(LocalDate.now())).findFirst(); + Optional<LocalDate> nextSubClaim = claimDates.stream().filter(date -> date.isAfter(today)).findFirst(); if (nextSubClaim.isPresent()) { nextClaimDate = nextSubClaim; @@ -59,14 +62,14 @@ public class PowerPlayData // In the case of a monthly subscription, we need to extrapolate the next claim date nextClaimDate = Optional.of(claimDates.get(claimDates.size() - 1)) .map(date -> date.plusMonths(1)) - .filter(date -> date.isAfter(LocalDate.now())); // and make sure it's after today + .filter(date -> date.equals(today) || date.isAfter(today)); // and make sure it's today or later nextClaimDate.ifPresent(claimDates::add); } // Determine the months whose cosmetics can be used by this player Set<YearMonth> cosmeticMonths = claimDates.stream() .map(YearMonth::from) - .filter(yearMonth -> yearMonth.isBefore(YearMonth.now()) || yearMonth.equals(YearMonth.now())) + .filter(yearMonth -> yearMonth.isBefore(thisMonth) || yearMonth.equals(thisMonth)) .collect(Collectors.toSet()); // Remove already-claimed months @@ -89,7 +92,7 @@ public class PowerPlayData }); Set<YearMonth> unclaimedMonths = claimDates.stream() - .filter(date -> date.isBefore(LocalDate.now()) || date.equals(LocalDate.now())) // Filter dates yet to come + .filter(date -> date.isBefore(today) || date.equals(today)) // Filter dates yet to come .map(YearMonth::from) .collect(Collectors.toSet()); From 8e7ae7f55f16c17e89e3957a50166554059caa84 Mon Sep 17 00:00:00 2001 From: cnr <ConnorNJames@gmail.com> Date: Thu, 13 Oct 2016 14:53:40 -0500 Subject: [PATCH 051/147] Make Power Play status clearer on support server --- .../customerSupport/CustomerSupport.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index df73cbcfc..57e4603c7 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -2,7 +2,9 @@ package mineplex.staffServer.customerSupport; import java.sql.ResultSet; import java.sql.SQLException; +import java.time.LocalDate; import java.time.YearMonth; +import java.time.format.TextStyle; import java.util.ArrayList; import java.util.Calendar; import java.util.HashSet; @@ -124,9 +126,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable _repository.loadBonusLogForAccountId(client.getAccountId(), instance); PowerPlayData powerPlayData = _powerPlayRepo.loadData(client.getAccountId()).join(); - boolean powerPlaySub = powerPlayData.isSubscribed(); - boolean powerPlayClaim = powerPlaySub && !powerPlayData.getUnclaimedMonths().contains(YearMonth.now()); - + runSync(new Runnable() { public void run() @@ -338,8 +338,14 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable caller.sendMessage(C.cBlue + "Clan Banner Usage: " + getLockedFreedomStr(client.getUniqueId(), "Clan Banner Usage")); caller.sendMessage(C.cBlue + "Clan Banner Editor: " + getLockedFreedomStr(client.getUniqueId(), "Clan Banner Editor")); caller.sendMessage(C.cDGreen + C.Strike + "============================================="); - caller.sendMessage(C.cBlue + "Power Play Subscription (" + Calendar.getInstance().getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.getDefault()) + "): " + (powerPlaySub ? C.cGreen + "Active" : C.cRed + "Inactive")); - caller.sendMessage(C.cBlue + "Power Play Monthly Reward (" + Calendar.getInstance().getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.getDefault()) + "): " + (powerPlayClaim ? C.cRed + "Unavailable" : C.cGreen + "Available")); + YearMonth yearMonth = YearMonth.now(); + caller.sendMessage(C.cBlue + "Power Play Subscription (" + yearMonth.getMonth().getDisplayName(TextStyle.FULL, Locale.US) + ") " + (powerPlayData.isSubscribed() ? C.cGreen + "Active" : C.cRed + "Inactive")); + if (powerPlayData.isSubscribed()) + { + caller.sendMessage(C.cBlue + "Power Play Chest/Amplifiers (" + yearMonth.getMonth().getDisplayName(TextStyle.FULL, Locale.US) + ") " + (powerPlayData.getUnclaimedMonths().contains(YearMonth.now()) ? C.cGreen + "Unclaimed" : C.cRed + "Claimed")); + LocalDate nextClaimDate = powerPlayData.getNextClaimDate().get(); // Guaranteed by isSubscribed() + caller.sendMessage(C.cBlue + "Power Play Next Claim Date " + C.cYellow + nextClaimDate.getMonth().getDisplayName(TextStyle.FULL, Locale.US) + " " + nextClaimDate.getDayOfMonth()); + } _accountBonusLog.remove(client.getAccountId()); } From b6bda9418d14713434a32de74174eac68dc4a6ce Mon Sep 17 00:00:00 2001 From: Keir Nellyer <keir@nellyer.co.uk> Date: Fri, 14 Oct 2016 16:28:42 +0100 Subject: [PATCH 052/147] PC-1000 Make all token related things work together --- .../core/chatsnap/SnapshotManager.java | 6 +- .../core/chatsnap/SnapshotRepository.java | 63 ++++++++++++++++--- .../core/report/ReportHandlerTask.java | 23 +++++-- .../mineplex/core/report/ReportManager.java | 2 +- .../src/mineplex/core/report/data/Report.java | 11 ++-- .../core/report/data/ReportRepository.java | 8 ++- 6 files changed, 86 insertions(+), 27 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotManager.java b/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotManager.java index ab1824174..7f063cf6a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotManager.java @@ -132,15 +132,15 @@ public class SnapshotManager .collect(Collectors.toCollection(TreeSet::new)); } - public CompletableFuture<Integer> saveReportSnapshot(Report report, Collection<SnapshotMessage> messages) + public CompletableFuture<SnapshotMetadata> saveReportSnapshot(Report report, Collection<SnapshotMessage> messages) { return _snapshotRepository .saveReportSnapshot(report, messages) - .whenComplete((snapshotId, throwable) -> + .whenComplete((snapshotMetadata, throwable) -> { if (throwable == null) { - report.setSnapshotId(snapshotId); + report.setSnapshotMetadata(snapshotMetadata); } else { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotRepository.java index 7bacc39f4..af4951d7f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotRepository.java @@ -22,14 +22,14 @@ import mineplex.serverdata.database.DBPool; */ public class SnapshotRepository { - private static final String URL_PREFIX = "http://report.mineplex.com/chatsnap/view.php?id="; + private static final String URL_PREFIX = "http://report.mineplex.com/chatsnap/view.php?token="; private static final int TOKEN_CHARS = 8; private static final SecureRandom SECURE_RANDOM = new SecureRandom(); - public static String getURL(long reportId) + public static String getURL(String token) { - return URL_PREFIX + reportId; + return URL_PREFIX + token; } public static String generateToken() @@ -70,6 +70,7 @@ public class SnapshotRepository private static final String INSERT_MESSAGE_RECIPIENT = "INSERT INTO snapshotRecipients (messageId, recipientId) VALUES (?, ?);"; private static final String INSERT_MESSAGE_MAPPING = "INSERT INTO snapshotMessageMap (snapshotId, messageId) VALUES (?, ?);"; private static final String GET_ID_FROM_TOKEN = "SELECT snapshots.id FROM snapshots WHERE snapshots.token = ?;"; + private static final String GET_METADATA = "SELECT token, creator FROM snapshots WHERE id = ?;"; private final String _serverName; private final Logger _logger; @@ -80,17 +81,17 @@ public class SnapshotRepository _logger = logger; } - public CompletableFuture<Integer> saveReportSnapshot(Report report, Collection<SnapshotMessage> messages) + public CompletableFuture<SnapshotMetadata> saveReportSnapshot(Report report, Collection<SnapshotMessage> messages) { return CompletableFuture.supplyAsync(() -> { try (Connection connection = DBPool.getAccount().getConnection()) { - int snapshotId = report.getSnapshotId().orElseThrow(() -> - new IllegalStateException("Report does not have associated snapshot id.")); + SnapshotMetadata snapshotMetadata = report.getSnapshotMetadata().orElseThrow(() -> + new IllegalStateException("Report does not have associated snapshot.")); - insertMessages(snapshotId, messages, connection); - return snapshotId; + insertMessages(snapshotMetadata.getId(), messages, connection); + return snapshotMetadata; } catch (SQLException e) { @@ -133,7 +134,7 @@ public class SnapshotRepository private SnapshotMetadata createSnapshot(Connection connection, Integer creatorAccount) throws SQLException { - String token = getToken(connection); + String token = getUnusedToken(connection); PreparedStatement insertSnapshotStatement = connection.prepareStatement(INSERT_SNAPSHOT, new String[]{"id"}); insertSnapshotStatement.setString(1, token); // TODO: correct data type @@ -161,7 +162,7 @@ public class SnapshotRepository } } - private String getToken(Connection connection) throws SQLException + private String getUnusedToken(Connection connection) throws SQLException { String token; @@ -195,6 +196,48 @@ public class SnapshotRepository } } + public CompletableFuture<SnapshotMetadata> getSnapshotMetadata(int snapshotId) + { + CompletableFuture<SnapshotMetadata> future = CompletableFuture.supplyAsync(() -> + { + try (Connection connection = DBPool.getAccount().getConnection()) + { + try (PreparedStatement statement = connection.prepareStatement(GET_METADATA)) + { + statement.setInt(1, snapshotId); + + ResultSet resultSet = statement.executeQuery(); + if (resultSet.next()) + { + String token = resultSet.getString("token"); + if (resultSet.wasNull()) token = null; + + Integer creatorId = resultSet.getInt("creator"); + if (resultSet.wasNull()) creatorId = null; + + return new SnapshotMetadata(snapshotId, token, creatorId); + } + else + { + return null; + } + } + } + catch (SQLException e) + { + throw new RuntimeException(e); + } + }); + + future.exceptionally(throwable -> + { + _logger.log(Level.SEVERE, "Error whilst getting snapshot metadata for id: " + snapshotId, throwable); + return null; + }); + + return future; + } + private void insertMessages(int snapshotId, Collection<SnapshotMessage> messages, Connection connection) throws SQLException { try (PreparedStatement insertSnapshotStatement = connection.prepareStatement(INSERT_MESSAGE, new String[]{"id"})) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportHandlerTask.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportHandlerTask.java index 9b06529e5..f8d4974ba 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportHandlerTask.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportHandlerTask.java @@ -11,6 +11,7 @@ import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitRunnable; +import mineplex.core.chatsnap.SnapshotMetadata; import mineplex.core.chatsnap.SnapshotRepository; import mineplex.core.common.jsonchat.ChildJsonMessage; import mineplex.core.common.jsonchat.ClickEvent; @@ -88,13 +89,23 @@ public class ReportHandlerTask extends BukkitRunnable .add(Arrays.stream(getReportReasons(report)).map(s -> prefix + s).collect(Collectors.joining("\n"))) .add("\n" + prefix + "\n"); - if (report.getCategory() == ReportCategory.CHAT_ABUSE) + Optional<SnapshotMetadata> snapshotMetadataOptional = report.getSnapshotMetadata(); + + if (snapshotMetadataOptional.isPresent()) { - jsonMessage = jsonMessage - .add(prefix + C.cAqua + "View chat log") - .hover(HoverEvent.SHOW_TEXT, C.cGray + "Opens the chat log in your default browser") - .click(ClickEvent.OPEN_URL, SnapshotRepository.getURL(reportId)) - .add("\n"); + SnapshotMetadata snapshotMetadata = snapshotMetadataOptional.get(); + Optional<String> tokenOptional = snapshotMetadata.getToken(); + + if (tokenOptional.isPresent()) + { + String token = tokenOptional.get(); + + jsonMessage = jsonMessage + .add(prefix + C.cAqua + "View chat log") + .hover(HoverEvent.SHOW_TEXT, C.cGray + "Opens the chat log in your default browser") + .click(ClickEvent.OPEN_URL, SnapshotRepository.getURL(token)) + .add("\n"); + } } jsonMessage = jsonMessage diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java index 03320afc5..69002af2b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java @@ -150,7 +150,7 @@ public class ReportManager if (category == ReportCategory.CHAT_ABUSE) { SnapshotMetadata snapshotMetadata = _snapshotManager.getSnapshotRepository().createSnapshot(null).join(); - report.setSnapshotId(snapshotMetadata.getId()); + report.setSnapshotMetadata(snapshotMetadata); } saveReport(report).join(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/data/Report.java b/Plugins/Mineplex.Core/src/mineplex/core/report/data/Report.java index 4a8d8e969..6fd4af9f6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/data/Report.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/data/Report.java @@ -5,6 +5,7 @@ import java.util.Map; import java.util.Optional; import java.util.Set; +import mineplex.core.chatsnap.SnapshotMetadata; import mineplex.core.report.ReportCategory; import mineplex.core.report.ReportHandlerTask; import mineplex.core.report.ReportResult; @@ -21,7 +22,7 @@ public class Report // set of player account ids and the reason they reported this player private final Map<Integer, ReportMessage> _reportMessages = new HashMap<>(); private Integer _handlerId = null; - private Integer _snapshotId = null; + private SnapshotMetadata _snapshotMetadata = null; private ReportResult _reportResult = null; private ReportTeam _assignedTeam = null; @@ -89,14 +90,14 @@ public class Report _handlerId = handlerId; } - public Optional<Integer> getSnapshotId() + public Optional<SnapshotMetadata> getSnapshotMetadata() { - return Optional.ofNullable(_snapshotId); + return Optional.ofNullable(_snapshotMetadata); } - public void setSnapshotId(Integer snapshotId) + public void setSnapshotMetadata(SnapshotMetadata snapshotMetadata) { - _snapshotId = snapshotId; + _snapshotMetadata = snapshotMetadata; } public Optional<ReportResult> getResult() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java index 6e8507925..263f8e7d6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java @@ -30,6 +30,7 @@ import com.google.common.cache.CacheBuilder; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; import com.mysql.jdbc.Statement; +import mineplex.core.chatsnap.SnapshotMetadata; import mineplex.core.common.util.UtilTime; import mineplex.core.report.ReportCategory; import mineplex.core.report.ReportManager; @@ -338,7 +339,10 @@ public class ReportRepository int snapshotId = resultSet.getInt("snapshotId"); if (!resultSet.wasNull()) { - report.setSnapshotId(snapshotId); + SnapshotMetadata snapshotMetadata = _reportManager.getSnapshotManager().getSnapshotRepository() + .getSnapshotMetadata(snapshotId).join(); + + report.setSnapshotMetadata(snapshotMetadata); } int handlerId = resultSet.getInt("handlerId"); @@ -542,7 +546,7 @@ public class ReportRepository try (Connection connection = DBPool.getAccount().getConnection()) { Optional<Long> reportIdOptional = report.getId(); - Optional<Integer> snapshotIdOptional = report.getSnapshotId(); + Optional<Integer> snapshotIdOptional = report.getSnapshotMetadata().map(SnapshotMetadata::getId); Optional<ReportTeam> teamOptional = report.getAssignedTeam(); long reportId; From 4b4dc74cbfd59454d16bb9da913be1ac7cc810c4 Mon Sep 17 00:00:00 2001 From: Keir Nellyer <keir@nellyer.co.uk> Date: Fri, 14 Oct 2016 16:29:04 +0100 Subject: [PATCH 053/147] PC-1000 Token column is now 8 characters --- Plugins/Mineplex.ReportSite/sql/snapshot-tokens.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.ReportSite/sql/snapshot-tokens.sql b/Plugins/Mineplex.ReportSite/sql/snapshot-tokens.sql index 3dcb33f5d..d0522a91c 100644 --- a/Plugins/Mineplex.ReportSite/sql/snapshot-tokens.sql +++ b/Plugins/Mineplex.ReportSite/sql/snapshot-tokens.sql @@ -1,4 +1,4 @@ -ALTER TABLE Account.snapshots ADD token CHAR(6); +ALTER TABLE Account.snapshots ADD token CHAR(8); CREATE UNIQUE INDEX snapshots_token_uindex ON snapshots (token); ALTER TABLE Account.snapshots MODIFY COLUMN creator INT(11) AFTER token; \ No newline at end of file From 28603ec8c584f3f9b4eb66d564f2a9b8d0bbc88d Mon Sep 17 00:00:00 2001 From: Keir Nellyer <keir@nellyer.co.uk> Date: Fri, 14 Oct 2016 18:47:25 +0100 Subject: [PATCH 054/147] Remove resolved TODOs --- .../src/mineplex/core/chatsnap/SnapshotRepository.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotRepository.java index af4951d7f..f05939322 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotRepository.java @@ -136,7 +136,7 @@ public class SnapshotRepository { String token = getUnusedToken(connection); PreparedStatement insertSnapshotStatement = connection.prepareStatement(INSERT_SNAPSHOT, new String[]{"id"}); - insertSnapshotStatement.setString(1, token); // TODO: correct data type + insertSnapshotStatement.setString(1, token); if (creatorAccount != null) { @@ -179,7 +179,7 @@ public class SnapshotRepository { try (PreparedStatement statement = connection.prepareStatement(GET_ID_FROM_TOKEN)) { - statement.setString(1, token); // TODO: correct data type + statement.setString(1, token); try (ResultSet resultSet = statement.executeQuery()) { From 64bb01c92fbc11a234f729308440c3f10ada45c2 Mon Sep 17 00:00:00 2001 From: Keir Nellyer <keir@nellyer.co.uk> Date: Fri, 14 Oct 2016 19:14:35 +0100 Subject: [PATCH 055/147] Move /reportabort functionality over to the /reportclose gui --- .../mineplex/core/report/ReportPlugin.java | 2 - .../report/command/ReportAbortCommand.java | 64 ------------------- .../core/report/ui/ReportAbortButton.java | 34 ++++++++++ .../core/report/ui/ReportResultPage.java | 55 ++++++++++++---- 4 files changed, 75 insertions(+), 80 deletions(-) delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportAbortCommand.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportAbortButton.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportPlugin.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportPlugin.java index 0a0e1ff18..7f960f1a7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportPlugin.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportPlugin.java @@ -6,7 +6,6 @@ import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.MiniPlugin; -import mineplex.core.report.command.ReportAbortCommand; import mineplex.core.report.command.ReportCloseCommand; import mineplex.core.report.command.ReportCommand; import mineplex.core.report.command.ReportHandleCommand; @@ -38,7 +37,6 @@ public class ReportPlugin extends MiniPlugin addCommand(new ReportHandleCommand(this)); addCommand(new ReportCloseCommand(this)); addCommand(new ReportStatsCommand(this)); - addCommand(new ReportAbortCommand(this)); addCommand(new ReportInfoCommand(this)); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportAbortCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportAbortCommand.java deleted file mode 100644 index 67450ea61..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportAbortCommand.java +++ /dev/null @@ -1,64 +0,0 @@ -package mineplex.core.report.command; - -import java.util.logging.Level; - -import org.bukkit.entity.Player; - -import mineplex.core.command.CommandBase; -import mineplex.core.common.Rank; -import mineplex.core.common.util.BukkitFuture; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.report.ReportManager; -import mineplex.core.report.ReportPlugin; -import mineplex.core.report.data.Report; - -/** - * A command which allows a staff member to abort the report which they are currently handling. - * Another staff member may be given this report when executing {@link ReportHandleCommand}. - */ -public class ReportAbortCommand extends CommandBase<ReportPlugin> -{ - public ReportAbortCommand(ReportPlugin plugin) - { - super(plugin, Rank.MODERATOR, "reportabort"); - } - - @Override - public void Execute(Player player, String[] args) - { - if (args == null || args.length == 0) - { - ReportManager reportManager = Plugin.getReportManager(); - - reportManager.getReportHandling(player).whenComplete(BukkitFuture.complete((reportOptional, throwable) -> - { - if (throwable == null) - { - if (reportOptional.isPresent()) - { - Report report = reportOptional.get(); - - reportManager.abortReport(report).thenApply(BukkitFuture.accept(voidValue -> - UtilPlayer.message(player, F.main(ReportManager.getReportPrefix(report), - "Report has been aborted and may be handled by another staff member.")))); - } - else - { - UtilPlayer.message(player, F.main(Plugin.getName(), "You aren't currently handling a report.")); - } - } - else - { - UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "An error occurred, please try again later.")); - Plugin.getPlugin().getLogger().log(Level.SEVERE, "Error whilst aborting report for player " + player.getName(), throwable); - } - })); - } - else - { - UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "Invalid Usage: " + F.elem("/" + _aliasUsed))); - } - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportAbortButton.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportAbortButton.java new file mode 100644 index 000000000..ccecffbe1 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportAbortButton.java @@ -0,0 +1,34 @@ +package mineplex.core.report.ui; + +import org.bukkit.Material; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.gui.SimpleGuiItem; +import mineplex.core.itemstack.ItemBuilder; + +/** + * A gui button which when clicked aborts the report the user is currently handling + */ +public class ReportAbortButton extends SimpleGuiItem +{ + private static final ItemStack ITEM = new ItemBuilder(Material.BEDROCK) + .setTitle(C.cRed + "Abort") + .addLore("Another member of staff may handle this report instead.") + .build(); + + private final ReportResultPage _page; + + public ReportAbortButton(ReportResultPage page) + { + super(ITEM); + _page = page; + } + + @Override + public void click(ClickType clickType) + { + _page.abortReport(); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportResultPage.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportResultPage.java index 127f78114..113e4b728 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportResultPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportResultPage.java @@ -1,8 +1,11 @@ package mineplex.core.report.ui; -import org.bukkit.entity.Player; -import org.bukkit.event.HandlerList; +import java.util.logging.Level; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.BukkitFuture; +import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.gui.SimpleGui; @@ -18,15 +21,17 @@ import mineplex.core.report.data.Report; */ public class ReportResultPage extends SimpleGui { - private ReportManager _reportManager; - private Report _report; - private String _suspectName; - private String _reason; + private final ReportPlugin _plugin; + private final ReportManager _reportManager; + private final Report _report; + private final String _suspectName; + private final String _reason; - public ReportResultPage(ReportPlugin reportPlugin, Report report, Player reportCloser, String suspectName, String reason) + public ReportResultPage(ReportPlugin plugin, Report report, Player reportCloser, String suspectName, String reason) { - super(reportPlugin.getPlugin(), reportCloser, "Close Report", 9 * 4); - _reportManager = reportPlugin.getReportManager(); + super(plugin.getPlugin(), reportCloser, "Close Report", 9 * 4); + _plugin = plugin; + _reportManager = plugin.getReportManager(); _report = report; _suspectName = suspectName; _reason = reason; @@ -44,14 +49,13 @@ public class ReportResultPage extends SimpleGui setItem(11, new ReportResultButton(this, ReportResultType.ACCEPTED)); setItem(13, new ReportResultButton(this, ReportResultType.DENIED)); setItem(15, new ReportResultButton(this, ReportResultType.ABUSIVE)); - //setItem(34, ); + setItem(27, new ReportAbortButton(this)); setItem(35, new ReportAssignTeamButton(this, ReportTeam.RC)); } public void closeReport(ReportResultType result) { getPlayer().closeInventory(); - unregisterListener(); ReportResult reportResult = new ReportResult(result, _reason); _reportManager.closeReport(_report, getPlayer(), reportResult); @@ -60,7 +64,6 @@ public class ReportResultPage extends SimpleGui public void assignTeam(ReportTeam team) { getPlayer().closeInventory(); - unregisterListener(); _reportManager.assignTeam(_report, team).thenAccept(aVoid -> UtilPlayer.message(getPlayer(), @@ -68,8 +71,32 @@ public class ReportResultPage extends SimpleGui "Report forwarded to " + F.elem(team.name()) + " team"))); } - public void unregisterListener() + public void abortReport() { - HandlerList.unregisterAll(this); + getPlayer().closeInventory(); + + _reportManager.getReportHandling(getPlayer()).whenComplete(BukkitFuture.complete((reportOptional, throwable) -> + { + if (throwable == null) + { + if (reportOptional.isPresent()) + { + Report report = reportOptional.get(); + + _reportManager.abortReport(report).thenApply(BukkitFuture.accept(voidValue -> + UtilPlayer.message(getPlayer(), F.main(ReportManager.getReportPrefix(report), + "Report has been aborted and may be handled by another staff member.")))); + } + else + { + UtilPlayer.message(getPlayer(), F.main(_plugin.getName(), "You aren't currently handling a report.")); + } + } + else + { + UtilPlayer.message(getPlayer(), F.main(_plugin.getName(), C.cRed + "An error occurred, please try again later.")); + _plugin.getPlugin().getLogger().log(Level.SEVERE, "Error whilst aborting report for player " + getPlayer().getName(), throwable); + } + })); } } From 1ab646bbdaa6d4208a1e0e9c8836188f4a57dbf8 Mon Sep 17 00:00:00 2001 From: Keir Nellyer <keir@nellyer.co.uk> Date: Fri, 14 Oct 2016 19:14:50 +0100 Subject: [PATCH 056/147] Fix error message colouring when there are no reports to handle --- .../src/mineplex/core/report/ui/ReportHandlePage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportHandlePage.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportHandlePage.java index 05e355caf..830085fa5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportHandlePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportHandlePage.java @@ -108,7 +108,7 @@ public class ReportHandlePage extends SimpleGui implements ReportCategoryCallbac } else { - UtilPlayer.message(_handler, F.main(_plugin.getName(), C.cRed + "No open " + F.elem(category.getName()) + " report(s) found.")); + UtilPlayer.message(_handler, F.main(_plugin.getName(), "No open " + F.elem(category.getName()) + " report(s) found.")); } })); } From 35c9d2ecb182f695367d972828f43d2ce17db238 Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Sat, 15 Oct 2016 14:56:38 +0200 Subject: [PATCH 057/147] Tweaked damage/KB values and fixed text issues --- .../game/arcade/game/games/smash/kits/KitGuardian.java | 8 ++++---- .../game/games/smash/perks/guardian/PerkTargetLazer.java | 2 +- .../game/games/smash/perks/guardian/PerkThorns.java | 8 ++++---- .../game/games/smash/perks/guardian/PerkWaterSplash.java | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java index e21263ed3..822d73294 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java @@ -51,8 +51,8 @@ public class KitGuardian extends SmashKit C.Reset + "You bounce into the air and pull all nearby players", C.Reset + "towards you.", C.Reset + "Blocking with the sword while bouncing increases the height.", - C.Reset + "Landing causes a water splash dealing damage and knockback to", - C.Reset + "nearby players." + C.Reset + "Landing causes a water splash dealing damage and knockback", + C.Reset + "to nearby players." }), ItemStackFactory.Instance.CreateStack(Material.IRON_PICKAXE, (byte) 0, 1, C.cYellowB + "Right-Click" + C.cWhiteB + " - " + C.cGreenB + "Target Laser", @@ -64,8 +64,8 @@ public class KitGuardian extends SmashKit ItemStackFactory.Instance.CreateStack(Material.PRISMARINE_SHARD, (byte) 0, 1, C.cYellowB + "Passive" + C.cWhiteB + " - " + C.cGreenB + "Thorns", new String[] { - C.Reset + "When your health drops below 6 all ranged attacks", - C.Reset + "deal reduced damage and knockback.", + C.Reset + "Takes 66% less damage and knockback from projectiles", + C.Reset + "when uder 10 health.", }), ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 1, C.cYellowB + "Smash Crystal" + C.cWhiteB + " - " + C.cGreenB + "Rise of the Guardian", diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java index bcd0362d4..bc847a9b1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java @@ -38,7 +38,7 @@ public class PerkTargetLazer extends SmashPerk { private static final int COOLDOWN = 15000; - private static final int MAX_RANGE = 7; + private static final int MAX_RANGE = 11; private static final int MAX_TIME = 8000; private static final int DAMAGE_INCREASE = 3; private static final int KNOCKBACK_INCREASE = 1; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkThorns.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkThorns.java index 22fa5b671..ffe3c7842 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkThorns.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkThorns.java @@ -12,13 +12,13 @@ import nautilus.game.arcade.kit.Perk; public class PerkThorns extends Perk { - private static final int MAX_HEALTH = 6; - private static final float DAMAGE_DECREASE = 0.5F; - private static final float KNOCKBACK_DECREASE = 0.75F; + private static final int MAX_HEALTH = 10; + private static final float DAMAGE_DECREASE = 0.66F; + private static final float KNOCKBACK_DECREASE = 0.66F; public PerkThorns() { - super("Thorns", new String[] { C.cGray + "When below 6 health you take reduced damage and knockback from projectiles."}); + super("Thorns", new String[] { C.cGray + "Takes 66% less damage and knockback from projectiles", C.cGray + "when under 10 health."}); } @EventHandler(priority = EventPriority.HIGHEST) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java index 5f182f534..ad5729e53 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java @@ -43,7 +43,7 @@ public class PerkWaterSplash extends Perk private static final int RADIUS = 5; private static final int MIN_AIR_TIME = 750; private static final int SECOND_BOOST_TIME = 800; - private static final int DAMAGE = 10; + private static final int DAMAGE = 12; private Map<UUID, Long> _active = new HashMap<>(); private Set<UUID> _usedSecondBoost = new HashSet<>(); From db0bfece235972b1b77635d6163a2fa5bdc388c3 Mon Sep 17 00:00:00 2001 From: Keir Nellyer <keir@nellyer.co.uk> Date: Sun, 16 Oct 2016 23:23:55 +0100 Subject: [PATCH 058/147] Prevent re-saves from un-aborting user reports --- .../src/mineplex/core/report/data/ReportRepository.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java index 263f8e7d6..57f553921 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java @@ -54,7 +54,7 @@ public class ReportRepository private static final String SET_REPORT_MESSAGE = "REPLACE INTO reportReasons (reportId, reporterId, reason, `server`, weight, `time`)" + " VALUES (?, ?, ?, ?, ?, ?);"; - private static final String SET_REPORT_HANDLER = "REPLACE INTO reportHandlers (reportId, handlerId)" + + private static final String INSERT_REPORT_HANDLER = "INSERT IGNORE INTO reportHandlers (reportId, handlerId)" + " VALUES (?, ?);"; private static final String SET_REPORT_RESULT = "REPLACE INTO reportResults (reportId, resultId, reason, closedTime)" + @@ -637,7 +637,7 @@ public class ReportRepository Optional<Integer> handlerIdOptional = report.getHandlerId(); if (handlerIdOptional.isPresent()) { - PreparedStatement setReportHandlerStatement = connection.prepareStatement(SET_REPORT_HANDLER); + PreparedStatement setReportHandlerStatement = connection.prepareStatement(INSERT_REPORT_HANDLER); setReportHandlerStatement.setLong(1, reportId); // report id setReportHandlerStatement.setInt(2, handlerIdOptional.get()); // handler id setReportHandlerStatement.execute(); From 9e3cf58ff565b70b5feb7eaf904dd45f528c200e Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Tue, 18 Oct 2016 19:39:06 +0200 Subject: [PATCH 059/147] Type in blaze smash --- .../game/arcade/game/games/smash/perks/blaze/SmashBlaze.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/SmashBlaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/SmashBlaze.java index 9bbf07151..6fba264a3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/SmashBlaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/blaze/SmashBlaze.java @@ -14,7 +14,7 @@ public class SmashBlaze extends SmashUltimate public SmashBlaze() { - super("Phoneix", new String[] {}, Sound.BLAZE_DEATH, DURATION); + super("Phoenix", new String[] {}, Sound.BLAZE_DEATH, DURATION); } @Override From 0b02bc9e2d759fe25bbe5414e7cf18022f58ab26 Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Wed, 19 Oct 2016 16:35:49 +0200 Subject: [PATCH 060/147] Fixed with daze potion self damage and only randomly working --- .../arcade/game/games/smash/perks/witch/PerkWitchPotion.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java index 42375fd88..9d6f6ce42 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java @@ -5,6 +5,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import org.bukkit.Bukkit; import org.bukkit.block.Block; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -145,6 +146,8 @@ public class PerkWitchPotion extends SmashPerk implements IThrown for (Player player : nearby.keySet()) { + if(player.equals(data.getThrower())) continue; + Manager.GetDamage().NewDamageEvent(player, entity, null, DamageCause.CUSTOM, DAMAGE_NORMAL * nearby.get(player), true, true, false, entity.getName(), GetName()); } } @@ -152,10 +155,12 @@ public class PerkWitchPotion extends SmashPerk implements IThrown @Override public void Idle(ProjectileUser data) { + Collide(null, null, data); } @Override public void Expire(ProjectileUser data) { + Collide(null, null, data); } } From 8de69d2573bbea89353e9cff4b5c17108f0b493f Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Wed, 19 Oct 2016 17:49:59 +0200 Subject: [PATCH 061/147] Fixed guardian passive to acctually work --- .../game/games/smash/perks/guardian/PerkThorns.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkThorns.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkThorns.java index ffe3c7842..4e1e99010 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkThorns.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkThorns.java @@ -7,6 +7,7 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import mineplex.core.common.util.C; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.kit.Perk; public class PerkThorns extends Perk @@ -29,17 +30,18 @@ public class PerkThorns extends Perk return; } - Player player = event.GetDamagerPlayer(true); + Player player = event.GetDamageePlayer(); + if (!hasPerk(player)) { return; } - + if (player.getHealth() < MAX_HEALTH) { - event.AddMod(GetName(), -DAMAGE_DECREASE * event.GetDamage()); - event.AddKnockback(GetName(), -KNOCKBACK_DECREASE); + event.AddMult(GetName(), null, DAMAGE_DECREASE, false); + event.AddKnockback(GetName(), KNOCKBACK_DECREASE); } } } From 225f5c6b7c7362f6cafdffb9f1c976448fe50ef7 Mon Sep 17 00:00:00 2001 From: LCastr0 <castr0mmbr@gmail.com> Date: Wed, 19 Oct 2016 18:44:57 -0200 Subject: [PATCH 062/147] Internal: - Removed Win room test command - Fixed spelling error in MountSpider - Changed MountChicken so it can now jump - Still working on the Sleigh morph - Added Wind Up Suit for testing - Removed unused code from MountSpider External: - Added Sleigh Morph (Still need some work on it) --- .../common/block/schematic/Schematic.java | 15 +- .../core/cosmetic/ui/page/GadgetPage.java | 18 +- .../core/cosmetic/ui/page/MountPage.java | 15 +- .../core/cosmetic/ui/page/PetPage.java | 26 ++- .../mineplex/core/gadget/GadgetManager.java | 19 +- .../gadget/commands/ReindeerTestCommand.java | 85 +++++++ .../gadget/commands/WinRoomTestCommand.java | 72 ------ .../gadget/gadgets/morph/MorphMetalMan.java | 9 +- .../gadget/gadgets/morph/MorphSleigh.java | 218 ++++++++++++++++++ .../core/gadget/gadgets/morph/MorphSquid.java | 2 +- .../core/gadget/gadgets/morph/MorphWitch.java | 5 +- .../gadgets/morph/managers/sleigh/Sleigh.java | 161 +++++++++++++ .../morph/managers/sleigh/SleighBlock.java | 53 +++++ .../morph/managers/sleigh/SleighPosition.java | 73 ++++++ .../morph/managers/sleigh/SleighReindeer.java | 170 ++++++++++++++ .../src/mineplex/core/mount/MountManager.java | 18 +- .../core/mount/types/MountChicken.java | 133 ++++++++--- .../core/mount/types/MountSpider.java | 44 +--- 18 files changed, 957 insertions(+), 179 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/ReindeerTestCommand.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/WinRoomTestCommand.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSleigh.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/Sleigh.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighBlock.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighPosition.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighReindeer.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/schematic/Schematic.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/schematic/Schematic.java index e08a70c0d..0ab1c909f 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/schematic/Schematic.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/schematic/Schematic.java @@ -5,12 +5,17 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.bukkit.Bukkit; +import net.minecraft.server.v1_8_R3.Entity; +import net.minecraft.server.v1_8_R3.EntityTypes; +import net.minecraft.server.v1_8_R3.NBTTagCompound; +import net.minecraft.server.v1_8_R3.NBTTagInt; +import net.minecraft.server.v1_8_R3.TileEntity; +import net.minecraft.server.v1_8_R3.WorldServer; + import org.bukkit.DyeColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; -import org.bukkit.entity.Player; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; import org.bukkit.util.BlockVector; import org.bukkit.util.Vector; @@ -23,12 +28,6 @@ import com.java.sk89q.jnbt.Tag; import mineplex.core.common.block.DataLocationMap; import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.UtilBlock; -import net.minecraft.server.v1_8_R3.Entity; -import net.minecraft.server.v1_8_R3.EntityTypes; -import net.minecraft.server.v1_8_R3.NBTTagCompound; -import net.minecraft.server.v1_8_R3.NBTTagInt; -import net.minecraft.server.v1_8_R3.TileEntity; -import net.minecraft.server.v1_8_R3.WorldServer; public class Schematic { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java index 9a7030ed7..5ea66bd15 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java @@ -4,6 +4,13 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.BannerMeta; +import org.bukkit.inventory.meta.ItemMeta; + import mineplex.core.account.CoreClientManager; import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; @@ -28,12 +35,6 @@ import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.SalesPackageProcessor; import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.page.ShopPageBase; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.BannerMeta; -import org.bukkit.inventory.meta.ItemMeta; public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop> { @@ -145,6 +146,11 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop> itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Haunted Chests"); } + else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -14) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Power Play Club"); + } //Rank Unlocks else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -10) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java index 9f39b1322..821a325aa 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java @@ -4,6 +4,10 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + import mineplex.core.account.CoreClientManager; import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; @@ -17,9 +21,6 @@ import mineplex.core.mount.Mount; import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.page.ShopPageBase; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop> { @@ -99,8 +100,14 @@ public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop> else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -9) { itemLore.add(C.cBlack); - itemLore.add(C.cBlue + "Found in Halloween Chests"); + itemLore.add(C.cBlue + "Found in Haunted Chests"); } + else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -14) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Power Play Club"); + } + //Rank Unlocks else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -10) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java index 57cc96538..30bd7bf8c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java @@ -4,6 +4,19 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import net.minecraft.server.v1_8_R3.Blocks; +import net.minecraft.server.v1_8_R3.ChatMessage; +import net.minecraft.server.v1_8_R3.EntityPlayer; +import net.minecraft.server.v1_8_R3.Items; +import net.minecraft.server.v1_8_R3.PacketPlayOutOpenWindow; +import net.minecraft.server.v1_8_R3.PacketPlayOutSetSlot; + +import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + import mineplex.core.account.CoreClientManager; import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; @@ -24,12 +37,6 @@ import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.page.AnvilContainer; import mineplex.core.shop.page.ShopPageBase; -import net.minecraft.server.v1_8_R3.*; -import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop> { @@ -98,7 +105,12 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop> else if (pet.getCost(GlobalCurrency.TREASURE_SHARD) == -9) { itemLore.add(C.cBlack); - itemLore.add(C.cBlue + "Found in Halloween Chests"); + itemLore.add(C.cBlue + "Found in Haunted Chests"); + } + else if (pet.getCost(GlobalCurrency.TREASURE_SHARD) == -14) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Power Play Club"); } //Rank Unlocks diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index 1958205ae..e0c1d4bcc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -37,8 +37,8 @@ import mineplex.core.disguise.DisguiseManager; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.commands.AmmoCommand; import mineplex.core.gadget.commands.LockCosmeticsCommand; +import mineplex.core.gadget.commands.ReindeerTestCommand; import mineplex.core.gadget.commands.UnlockCosmeticsCommand; -import mineplex.core.gadget.commands.WinRoomTestCommand; import mineplex.core.gadget.event.GadgetChangeEvent; import mineplex.core.gadget.event.GadgetCollideEntityEvent; import mineplex.core.gadget.event.GadgetEnableEvent; @@ -117,10 +117,12 @@ import mineplex.core.gadget.gadgets.morph.MorphEnderman; import mineplex.core.gadget.gadgets.morph.MorphGrimReaper; import mineplex.core.gadget.gadgets.morph.MorphPig; import mineplex.core.gadget.gadgets.morph.MorphPumpkinKing; +import mineplex.core.gadget.gadgets.morph.MorphSleigh; import mineplex.core.gadget.gadgets.morph.MorphSlime; import mineplex.core.gadget.gadgets.morph.MorphSnowman; import mineplex.core.gadget.gadgets.morph.MorphSquid; import mineplex.core.gadget.gadgets.morph.MorphTitan; +import mineplex.core.gadget.gadgets.morph.MorphTurkey; import mineplex.core.gadget.gadgets.morph.MorphUncleSam; import mineplex.core.gadget.gadgets.morph.MorphVillager; import mineplex.core.gadget.gadgets.morph.MorphWitch; @@ -137,6 +139,10 @@ import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitChestplate; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitHelmet; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitLeggings; import mineplex.core.gadget.gadgets.outfit.windupsuit.OutfitWindUpSuitBoosterManager; +import mineplex.core.gadget.gadgets.outfit.windupsuit.OutfitWindUpSuitBoots; +import mineplex.core.gadget.gadgets.outfit.windupsuit.OutfitWindUpSuitChestplate; +import mineplex.core.gadget.gadgets.outfit.windupsuit.OutfitWindUpSuitHelmet; +import mineplex.core.gadget.gadgets.outfit.windupsuit.OutfitWindUpSuitLeggings; import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes; import mineplex.core.gadget.gadgets.particle.ParticleFairy; import mineplex.core.gadget.gadgets.particle.ParticleFireRings; @@ -182,6 +188,7 @@ import mineplex.core.gadget.set.SetVampire; import mineplex.core.gadget.set.SetWisdom; import mineplex.core.gadget.set.suits.SetRaveSuit; import mineplex.core.gadget.set.suits.SetSpaceSuit; +import mineplex.core.gadget.set.suits.SetWindUpSuit; import mineplex.core.gadget.types.ArrowEffectGadget; import mineplex.core.gadget.types.DeathEffectGadget; import mineplex.core.gadget.types.DoubleJumpEffectGadget; @@ -276,7 +283,7 @@ public class GadgetManager extends MiniPlugin addCommand(new UnlockCosmeticsCommand(this)); addCommand(new LockCosmeticsCommand(this)); addCommand(new AmmoCommand(this)); - addCommand(new WinRoomTestCommand(this)); + addCommand(new ReindeerTestCommand(this)); } private void createSets() @@ -289,7 +296,7 @@ public class GadgetManager extends MiniPlugin //Costumes addSet(new SetRaveSuit(this)); addSet(new SetSpaceSuit(this)); - //addSet(new SetWindUpSuit(this)); + addSet(new SetWindUpSuit(this)); addSet(new SetParty(this)); addSet(new SetCupidsLove(this)); addSet(new SetEmerald(this)); @@ -335,10 +342,10 @@ public class GadgetManager extends MiniPlugin addGadget(new OutfitSpaceSuitLeggings(this)); addGadget(new OutfitSpaceSuitBoots(this)); - /*addGadget(new OutfitWindUpSuitHelmet(this)); + addGadget(new OutfitWindUpSuitHelmet(this)); addGadget(new OutfitWindUpSuitChestplate(this)); addGadget(new OutfitWindUpSuitLeggings(this)); - addGadget(new OutfitWindUpSuitBoots(this));*/ + addGadget(new OutfitWindUpSuitBoots(this)); addGadget(new OutfitTeam(this, "Team Helmet", -1, ArmorSlot.Helmet, Material.LEATHER_HELMET, (byte)0)); addGadget(new OutfitTeam(this, "Team Shirt", -1, ArmorSlot.Chest, Material.LEATHER_CHESTPLATE, (byte)0)); @@ -367,6 +374,8 @@ public class GadgetManager extends MiniPlugin addGadget(new MorphGrimReaper(this)); // Not being added in this update! //addGadget(new MorphMetalMan(this)); + addGadget(new MorphTurkey(this)); + addGadget(new MorphSleigh(this)); // Particles addGadget(new ParticleFoot(this)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/ReindeerTestCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/ReindeerTestCommand.java new file mode 100644 index 000000000..b8af63074 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/ReindeerTestCommand.java @@ -0,0 +1,85 @@ +package mineplex.core.gadget.commands; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Horse; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.EulerAngle; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilServer; +import mineplex.core.gadget.GadgetManager; + +public class ReindeerTestCommand extends CommandBase<GadgetManager> +{ + + private GadgetManager _plugin; + private Horse _horse; + private ArmorStand _armorStand; + + public ReindeerTestCommand(GadgetManager plugin) + { + super(plugin, Rank.JNR_DEV, "reindeer"); + _plugin = plugin; + } + + @Override + public void Execute(Player caller, String[] args) + { + if (_horse == null) + { + Location testHorse = new Location(caller.getWorld(), 8.5, 71, 0.5, 0, 0); + testHorse.setYaw(180); + Horse horse = testHorse.getWorld().spawn(testHorse, Horse.class); + horse.setVariant(Horse.Variant.HORSE); + horse.setColor(Horse.Color.BROWN); + horse.setStyle(Horse.Style.NONE); + + UtilEnt.Vegetate(horse, true); + UtilEnt.ghost(horse, true, false); + + /** + * South + * .4 1 .6 + * .2 1 .7 + * 0 4 0 + * 0 2 0 + * + * North + */ + + Location hornALoc = horse.getLocation().clone().add(-.3, 1, -.5); + Location hornBLoc = horse.getLocation().clone().add(-.25, 1, -.6); + + ArmorStand hornA = hornALoc.getWorld().spawn(hornALoc, ArmorStand.class); + hornA.setVisible(false); + hornA.setGravity(false); + hornA.getEquipment().setItemInHand(new ItemStack(Material.DEAD_BUSH)); + hornA.setRightArmPose(new EulerAngle(0, 4, 0)); + + ArmorStand hornB = hornBLoc.getWorld().spawn(hornBLoc, ArmorStand.class); + hornB.setVisible(false); + hornB.setGravity(false); + hornB.getEquipment().setItemInHand(new ItemStack(Material.DEAD_BUSH)); + hornB.setRightArmPose(new EulerAngle(0, 2, 0)); + + _horse = horse; + + Bukkit.getScheduler().scheduleSyncRepeatingTask(UtilServer.getPlugin(), new Runnable() + { + @Override + public void run() + { + Location location = _horse.getLocation(); + location.setYaw(180); + _horse.teleport(location); + } + }, 1l, 1l); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/WinRoomTestCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/WinRoomTestCommand.java deleted file mode 100644 index a6a029bc5..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/WinRoomTestCommand.java +++ /dev/null @@ -1,72 +0,0 @@ -package mineplex.core.gadget.commands; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import mineplex.core.command.CommandBase; -import mineplex.core.common.Rank; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.wineffect.*; -import mineplex.core.gadget.types.WinEffectGadget; -import org.bukkit.entity.Player; - -public class WinRoomTestCommand extends CommandBase<GadgetManager> -{ - - private GadgetManager _manager; - - public WinRoomTestCommand(GadgetManager manager) - { - super(manager, Rank.JNR_DEV, "winroomtest"); - _manager = manager; - } - - @Override - public void Execute(Player player, String[] args) - { - if (args.length < 1 || args.length > 2) - { - UtilPlayer.message(player, F.main("Win Rooms", "Usage: /winroomtest <room name> [play]")); - return; - } - boolean play = false; - if (args.length == 2) - { - if (args[1].equalsIgnoreCase("true")) - { - play = true; - } - } - loadWinRoom(args[0], player, play); - } - - private void loadWinRoom(String roomName, Player player, boolean play) - { - List<String> names = Arrays.asList("BabyChicken", "DragonRider", "Fireworks", "Flames", "Halloween", "LavaTrap", - "LightningStrike", "MrPunchMan", "Podium", "RiseOfTheElderGuardian", "SnowTrails"); - List<Class> winClasses = Arrays.asList(WinEffectBabyChicken.class, WinEffectDragonRider.class, - WinEffectFireworks.class, WinEffectFlames.class, WinEffectHalloween.class, WinEffectLavaTrap.class, - WinEffectLightningStrike.class, WinEffectMrPunchMan.class, WinEffectPodium.class, - WinEffectRiseOfTheElderGuardian.class, WinEffectSnowTrails.class); - if (names.contains(roomName)) - { - int index = names.indexOf(roomName); - WinEffectGadget gadget = (WinEffectGadget) _manager.getGadget(winClasses.get(index)); - gadget.setup(player, new ArrayList<>(), new ArrayList<>(), player.getLocation().clone().add(100, 0, 100)); - gadget.buildWinnerRoom(); - gadget.teleport(); - if (play) - { - gadget.runPlay(); - } - } - else - { - UtilPlayer.message(player, F.main("Win Rooms", "Wrong room name!")); - } - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphMetalMan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphMetalMan.java index d130b1c04..fbed219e4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphMetalMan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphMetalMan.java @@ -37,9 +37,12 @@ public class MorphMetalMan extends MorphGadget public MorphMetalMan(GadgetManager manager) { - super(manager, "Metal Man Morph", UtilText.splitLinesToArray(new String[]{C.cGray + "This powerful suit forged of metal makes the wearer strong enough to even battle the gods", - "", C.cWhite + "Left-click to shoot laser beam"}, LineFormat.LORE), - 0, Material.IRON_INGOT, (byte) 0); + super(manager, "Metal Man Morph", UtilText.splitLinesToArray(new String[]{ + C.cGray + "This powerful suit forged of metal makes the wearer strong enough to even battle the gods", + "", + C.cWhite + "Left-click to shoot laser beam" + }, LineFormat.LORE), + -14, Material.IRON_INGOT, (byte) 0); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSleigh.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSleigh.java new file mode 100644 index 000000000..dcc94efa8 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSleigh.java @@ -0,0 +1,218 @@ +package mineplex.core.gadget.gadgets.morph; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.vehicle.VehicleExitEvent; + +import mineplex.core.common.block.schematic.Schematic; +import mineplex.core.common.block.schematic.UtilSchematic; +import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.sleigh.Sleigh; +import mineplex.core.gadget.gadgets.morph.managers.sleigh.SleighPosition; +import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class MorphSleigh extends MorphGadget +{ + + // TODO JAVADOCS + LIMIT AMOUNT OF SLEIGHS + + public enum SleighDirection + { + NORTH("SleighMorphNorth.schematic", 0.5, 4.5), + SOUTH("SleighMorphSouth.schematic", 0.5, 1.5), + EAST("SleighMorphEast.schematic", 1.5, 1.5), + WEST("SleighMorphWest.schematic", 4.5, 1.5); + + private String _schematic; + private double _fixedX; + private double _fixedZ; + + SleighDirection(String schematic, double fixedX, double fixedZ) + { + _schematic = schematic; + _fixedX = fixedX; + _fixedZ = fixedZ; + } + + public String getSchematic() + { + return _schematic; + } + + public double getFixedX() + { + return _fixedX; + } + + public double getFixedZ() + { + return _fixedZ; + } + + } + + private Map<Player, Sleigh> _sleighs = new HashMap<>(); + private Map<SleighDirection, Schematic> _schematics = new HashMap<>(); + + private List<SleighPosition> _positions = new ArrayList<>(); + + private Long _rightClickStart = null; + + public MorphSleigh(GadgetManager manager) + { + super(manager, "Sleigh Morph", UtilText.splitLinesToArray(new String[]{"Placeholder"}, LineFormat.LORE), -14, Material.STAINED_CLAY, (byte) 14); + // Loads sleigh schematics + for (SleighDirection sleighDirection : SleighDirection.values()) + { + try + { + Schematic schematic = UtilSchematic.loadSchematic(new File("../../update/schematic/" + sleighDirection.getSchematic())); + _schematics.put(sleighDirection, schematic); + } catch (IOException e) + { + e.printStackTrace(); + } + } + buildPositions(); + } + + @Override + public void enableCustom(Player player, boolean message) + { + applyArmor(player, message); + + // TODO DISGUISE + } + + @Override + public void disableCustom(Player player, boolean message) + { + removeArmor(player); + + // TODO UNDISGUISE + if (_sleighs.containsKey(player)) + { + _sleighs.get(player).stopEffect(); + _sleighs.remove(player); + } + } + + @EventHandler + public void activateSleigh(PlayerInteractEvent event) + { + if (!isActive(event.getPlayer())) + return; + + if (!UtilEvent.isAction(event, UtilEvent.ActionType.L)) + return; + + Player player = event.getPlayer(); + + if (player.getItemInHand().getType() != Material.AIR) + return; + + //if (!Recharge.Instance.use(player, getName(), 150000, true, false, "Cosmetics")) + //return; + + List<SleighPosition> freePositions = _positions.stream().filter(position -> !position.isUsed()).collect(Collectors.toList()); + + if (freePositions.size() == 0) + { + UtilPlayer.message(player, F.main("Sleigh Ride", "There are too many sleighs in the sky right now! Please wait a minute and try again!")); + return; + } + + int randomPosition = UtilMath.random.nextInt(freePositions.size()); + SleighPosition position = freePositions.get(randomPosition); + position.setUsed(true); + SleighDirection direction = position.getDirection(); + Schematic schematic = _schematics.get(direction); + if (schematic == null) + { + try + { + schematic = UtilSchematic.loadSchematic(new File("../../update/schematic/SleighMorph.schematic")); + Location fixYaw = player.getLocation().clone(); + fixYaw.setYaw(90); + player.teleport(fixYaw); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + Sleigh sleigh = new Sleigh(player, schematic, position); + sleigh.startEffect(); + _sleighs.put(player, sleigh); + } + + @EventHandler + public void onLeaveVehicle(VehicleExitEvent event) + { + if (event.getExited() instanceof Player) + { + Player player = (Player) event.getExited(); + if (isActive(player)) + { + event.setCancelled(true); + } + } + } + + private void buildPositions() + { + _positions.add(new SleighPosition(-11, 143, -30, SleighDirection.SOUTH, -9.5, 145.5, -28.5)); + _positions.add(new SleighPosition(57, 109, -150, SleighDirection.SOUTH, 58.5, 111.5, -148.5)); + _positions.add(new SleighPosition(141, 101, 80, SleighDirection.NORTH, 142.5, 103.5, 84.5)); + _positions.add(new SleighPosition(-12, 88, 85, SleighDirection.NORTH, -10.5, 90.5, 89.5)); + _positions.add(new SleighPosition(-95, 90, 70, SleighDirection.NORTH, -93.5, 92.5, 74.5)); + _positions.add(new SleighPosition(-105, 115, -80, SleighDirection.EAST, -103.5, 117.5, -78.5)); + _positions.add(new SleighPosition(-135, 97, -8, SleighDirection.EAST, -133.5, 99.5, -6.5)); + _positions.add(new SleighPosition(-45, 97, 15, SleighDirection.EAST, -43.5, 99.5, 16.5)); + _positions.add(new SleighPosition(136, 116, 85, SleighDirection.WEST, 140.5, 118.5, 86.5)); + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() == UpdateType.FASTER) + { + _sleighs.values().forEach(Sleigh::playSound); + } + + if (event.getType() != UpdateType.TICK) + return; + + Iterator<Map.Entry<Player, Sleigh>> iterator = _sleighs.entrySet().iterator(); + while (iterator.hasNext()) + { + Map.Entry<Player, Sleigh> entry = iterator.next(); + Sleigh sleigh = entry.getValue(); + if (!sleigh.update()) + { + iterator.remove(); + } + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java index 0098be412..487ee3db1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java @@ -43,7 +43,7 @@ public class MorphSquid extends MorphGadget implements IThrown C.cWhite + "Swim to enable Fast Swimming", C.cWhite + "Sneak to shoot a fish above you" }, LineFormat.LORE), - 0, Material.INK_SACK, (byte) 0); + -14, Material.INK_SACK, (byte) 0); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWitch.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWitch.java index cda2d17c1..e35a4b7e5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWitch.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWitch.java @@ -28,7 +28,10 @@ public class MorphWitch extends MorphGadget public MorphWitch(GadgetManager manager) { - super(manager, "Witch Morph", UtilText.splitLinesToArray(new String[]{C.cWhite + "Press sneak to summon your trusty bat and start brewing"}, LineFormat.LORE), 0, Material.SKULL_ITEM, (byte) 3); + super(manager, "Witch Morph", UtilText.splitLinesToArray(new String[]{ + C.cWhite + "Press sneak to summon your trusty bat and start brewing" + }, LineFormat.LORE), + -14, Material.SKULL_ITEM, (byte) 3); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/Sleigh.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/Sleigh.java new file mode 100644 index 000000000..95b0c1092 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/Sleigh.java @@ -0,0 +1,161 @@ +package mineplex.core.gadget.gadgets.morph.managers.sleigh; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Player; + +import mineplex.core.common.block.schematic.Schematic; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilServer; +import mineplex.core.gadget.gadgets.morph.MorphSleigh; + +public class Sleigh +{ + + private Map<Location, Material> _oldBlockMaterials = new HashMap<>(); + private Map<Location, Byte> _oldBlockDatas = new HashMap<>(); + + private Player _player; + private Location _originalLocation; + private Schematic _schematic; + private SleighPosition _sleighPosition; + private Arrow _arrow; + private float _yaw; + + private int _moves = 0; + + public Sleigh(Player player, Schematic schematic, SleighPosition sleighPosition) + { + _player = player; + _schematic = schematic; + _sleighPosition = sleighPosition; + _yaw = (sleighPosition.getDirection() == MorphSleigh.SleighDirection.SOUTH) ? 0f : + (sleighPosition.getDirection() == MorphSleigh.SleighDirection.NORTH) ? 180f : + (sleighPosition.getDirection() == MorphSleigh.SleighDirection.WEST) ? 90f : -90f; + } + + public void startEffect() + { + _originalLocation = _player.getLocation().clone(); + Location origin = new Location(_originalLocation.getWorld(), _sleighPosition.getX(), + _sleighPosition.getY(), _sleighPosition.getZ()); + try + { + pasteSchematic(origin, 0, 0); + } catch (IOException e) + { + e.printStackTrace(); + } + } + + public void stopEffect() + { + restoreBlocks(); + _arrow.remove(); + _player.teleport(_originalLocation.clone().add(0, 5, 0)); + _sleighPosition.setUsed(false); + } + + private void pasteSchematic(Location origin, int playerX, int playerZ) throws IOException + { + restoreBlocks(); + short width = _schematic.getWidth(); + short height = _schematic.getHeight(); + short length = _schematic.getLength(); + for (short x = 0; x < width; x++) + { + for (short y = 0; y < height; y++) + { + for (short z = 0; z < length; z++) + { + Location location = origin.clone().add(x, y, z); + _oldBlockMaterials.put(location, location.getBlock().getType()); + _oldBlockDatas.put(location, location.getBlock().getData()); + } + } + } + _schematic.paste(origin); + Location playerLoc = new Location(_originalLocation.getWorld(), _sleighPosition.getPlayerX() + playerX, + _sleighPosition.getPlayerY(), _sleighPosition.getPlayerZ() + playerZ); + // Spawns arrow so it looks like player is sitting on the sleigh + if (_arrow != null) + { + _arrow.remove(); + } + _arrow = playerLoc.getWorld().spawn(playerLoc, Arrow.class); + UtilEnt.ghost(_arrow, true, true); + playerLoc.setYaw(_yaw); + playerLoc.setPitch(0.0f); + _player.teleport(playerLoc); + _arrow.setPassenger(_player); + } + + public boolean update() + { + _moves++; + int x = 0, z = 0; + switch (_sleighPosition.getDirection()) + { + case NORTH: + z = -1 * _moves; + break; + case SOUTH: + z = _moves; + break; + case WEST: + x = -1 * _moves; + break; + case EAST: + x = _moves; + } + Location newOrigin = new Location(_originalLocation.getWorld(), _sleighPosition.getX() + x, + _sleighPosition.getY(), _sleighPosition.getZ() + z); + restoreBlocks(); + UtilParticle.PlayParticle(UtilParticle.ParticleType.SNOW_SHOVEL, _player.getLocation(), 0f, 0f, 0f, 0.6f, 100, + UtilParticle.ViewDist.LONGER, UtilServer.getPlayers()); + try + { + pasteSchematic(newOrigin, x, z); + } catch (IOException e) + { + e.printStackTrace(); + } + if (_moves >= 20 * 3) + { + stopEffect(); + return false; + } + return true; + } + + public void playSound() + { + _player.playSound(_player.getLocation(), Sound.ORB_PICKUP, 1f, 1f); + } + + private void restoreBlocks() + { + for (Map.Entry<Location, Material> entry : _oldBlockMaterials.entrySet()) + { + Location location = entry.getKey(); + Material material = entry.getValue(); + byte data = 0; + if (_oldBlockDatas.containsKey(location)) + { + data = _oldBlockDatas.get(location); + } + location.getBlock().setType(material); + location.getBlock().setData(data); + } + _oldBlockMaterials.clear(); + _oldBlockDatas.clear(); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighBlock.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighBlock.java new file mode 100644 index 000000000..c7ac99a3f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighBlock.java @@ -0,0 +1,53 @@ +package mineplex.core.gadget.gadgets.morph.managers.sleigh; + +import org.bukkit.Material; + +public class SleighBlock +{ + + private int _x, _y, _z; + private Material _material; + private byte _data; + private boolean _middle; + + public SleighBlock(int x, int y, int z, Material material, int data, boolean middle) + { + _x = x; + _y = y; + _z = z; + _material = material; + _data = (byte) data; + _middle = middle; + } + + public int getX() + { + return _x; + } + + public int getY() + { + return _y; + } + + public int getZ() + { + return _z; + } + + public Material getMaterial() + { + return _material; + } + + public byte getData() + { + return _data; + } + + public boolean isMiddle() + { + return _middle; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighPosition.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighPosition.java new file mode 100644 index 000000000..bc44ea9c7 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighPosition.java @@ -0,0 +1,73 @@ +package mineplex.core.gadget.gadgets.morph.managers.sleigh; + +import mineplex.core.gadget.gadgets.morph.MorphSleigh; + +public class SleighPosition +{ + + private int _x; + private int _y; + private int _z; + private MorphSleigh.SleighDirection _direction; + private double _playerX; + private double _playerY; + private double _playerZ; + private boolean _used; + + public SleighPosition(int x, int y, int z, MorphSleigh.SleighDirection direction, double playerX, double playerY, double playerZ) + { + _x = x; + _y = y; + _z = z; + _direction = direction; + _playerX = playerX; + _playerY = playerY; + _playerZ = playerZ; + _used = false; + } + + public int getX() + { + return _x; + } + + public int getY() + { + return _y; + } + + public int getZ() + { + return _z; + } + + public MorphSleigh.SleighDirection getDirection() + { + return _direction; + } + + public double getPlayerX() + { + return _playerX; + } + + public double getPlayerY() + { + return _playerY; + } + + public double getPlayerZ() + { + return _playerZ; + } + + public void setUsed(boolean used) + { + _used = used; + } + + public boolean isUsed() + { + return _used; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighReindeer.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighReindeer.java new file mode 100644 index 000000000..413a5ad53 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighReindeer.java @@ -0,0 +1,170 @@ +package mineplex.core.gadget.gadgets.morph.managers.sleigh; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Horse; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.EulerAngle; + +import mineplex.core.common.util.UtilEnt; + +public class SleighReindeer +{ + + private enum AntlerPosition + { + SOUTH(0.4, 0.2, 0.6, 0.7, 4.0, 2.0), + NORTH(-0.3, -0.25, -0.5, -0.6, 4.0, 2.0); + + private double _xA, _xB, _zA, _zB, _angleA, _angleB; + + AntlerPosition(double xA, double xB, double zA, double zB, double angleA, double angleB) + { + _xA = xA; + _xB = xB; + _zA = zA; + _zB = zB; + _angleA = angleA; + _angleB = angleB; + } + + public double getxA() + { + return _xA; + } + + public double getxB() + { + return _xB; + } + + public double getzA() + { + return _zA; + } + + public double getzB() + { + return _zB; + } + + public double getAngleA() + { + return _angleA; + } + + public double getAngleB() + { + return _angleB; + } + } + + private Location _location; + private int _yaw; + private Horse _horse; + private Arrow _base; + private ArmorStand _hornA; + private ArmorStand _hornB; + + public SleighReindeer(Location location, int yaw) + { + _location = location; + _yaw = yaw; + } + + public void spawn() + { + _location.setYaw(_yaw); + _base = _location.getWorld().spawn(_location.clone().subtract(0, 1.5, 0), Arrow.class); + UtilEnt.Vegetate(_base, true); + UtilEnt.ghost(_base, true, true); + + _horse = _location.getWorld().spawn(_location, Horse.class); + _horse.setStyle(Horse.Style.NONE); + _horse.setColor(Horse.Color.CREAMY); + _horse.setVariant(Horse.Variant.HORSE); + _horse.setCustomName("Rudolph"); + _horse.setCustomNameVisible(true); + + //_base.setPassenger(_horse); + + createAntlers(); + } + + public void remove() + { + _horse.remove(); + _base.remove(); + } + + public void move(int x, int z) + { + _horse.eject(); + _base.remove(); + _base = _location.getWorld().spawn(_location.clone().subtract(0, 1.5, 0).add(x, 0, z), Arrow.class); + UtilEnt.Vegetate(_base, true); + UtilEnt.ghost(_base, true, true); + Location horseLocation = _location.clone().subtract(0, 0.5, 0).add(x, 0, z); + horseLocation.setYaw(_yaw); + _horse.teleport(horseLocation); + //_base.setPassenger(_horse); + UtilEnt.Vegetate(_horse, true); + UtilEnt.ghost(_horse, true, false); + _hornA.remove(); + _hornB.remove(); + createAntlers(); + } + + private void createAntlers() + { + AntlerPosition antlerPosition = AntlerPosition.SOUTH; + + switch (_yaw) + { + case 0: + antlerPosition = AntlerPosition.SOUTH; + break; + case 180: + antlerPosition = AntlerPosition.NORTH; + } + + /*Location hornALoc = _horse.getLocation().clone().add(.4, 1, .6); + Location hornBLoc = _horse.getLocation().clone().add(.2, 1, .7); + + ArmorStand hornA = hornALoc.getWorld().spawn(hornALoc, ArmorStand.class); + hornA.setVisible(false); + hornA.setGravity(false); + hornA.getEquipment().setItemInHand(new ItemStack(Material.DEAD_BUSH)); + hornA.setRightArmPose(new EulerAngle(0, 4, 0)); + + ArmorStand hornB = hornBLoc.getWorld().spawn(hornBLoc, ArmorStand.class); + hornB.setVisible(false); + hornB.setGravity(false); + hornB.getEquipment().setItemInHand(new ItemStack(Material.DEAD_BUSH)); + hornB.setRightArmPose(new EulerAngle(0, 2, 0)); + + _hornA = hornA; + _hornB = hornB;*/ + + Location hornALoc = _horse.getLocation().clone().add(antlerPosition.getxA(), 1, antlerPosition.getzA()); + Location hornBLoc = _horse.getLocation().clone().add(antlerPosition.getxB(), 1, antlerPosition.getzB()); + + ArmorStand hornA = hornALoc.getWorld().spawn(hornALoc, ArmorStand.class); + hornA.setVisible(false); + hornA.setGravity(false); + hornA.getEquipment().setItemInHand(new ItemStack(Material.DEAD_BUSH)); + hornA.setRightArmPose(new EulerAngle(0, antlerPosition.getAngleA(), 0)); + + ArmorStand hornB = hornBLoc.getWorld().spawn(hornBLoc, ArmorStand.class); + hornB.setVisible(false); + hornB.setGravity(false); + hornB.getEquipment().setItemInHand(new ItemStack(Material.DEAD_BUSH)); + hornB.setRightArmPose(new EulerAngle(0, antlerPosition.getAngleB(), 0)); + + _hornA = hornA; + _hornB = hornB; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java index 399bbd25c..238082e40 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java @@ -3,7 +3,6 @@ package mineplex.core.mount; import java.util.ArrayList; import java.util.List; -import mineplex.core.mount.types.*; import org.bukkit.Material; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; @@ -24,6 +23,20 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.DisguiseManager; import mineplex.core.donation.DonationManager; +import mineplex.core.mount.types.MountBabyReindeer; +import mineplex.core.mount.types.MountCart; +import mineplex.core.mount.types.MountChicken; +import mineplex.core.mount.types.MountDragon; +import mineplex.core.mount.types.MountFreedomHorse; +import mineplex.core.mount.types.MountFrost; +import mineplex.core.mount.types.MountMule; +import mineplex.core.mount.types.MountNightmareSteed; +import mineplex.core.mount.types.MountSlime; +import mineplex.core.mount.types.MountSpider; +import mineplex.core.mount.types.MountTitan; +import mineplex.core.mount.types.MountUndead; +import mineplex.core.mount.types.MountValentinesSheep; +import mineplex.core.mount.types.MountZombie; public class MountManager extends MiniPlugin { @@ -49,7 +62,7 @@ public class MountManager extends MiniPlugin private void CreateGadgets() { - _types = new ArrayList<Mount<?>>(); + _types = new ArrayList<>(); _types.add(new MountUndead(this)); _types.add(new MountFrost(this)); @@ -64,6 +77,7 @@ public class MountManager extends MiniPlugin _types.add(new MountValentinesSheep(this)); _types.add(new MountFreedomHorse(this)); _types.add(new MountNightmareSteed(this)); + _types.add(new MountChicken(this)); //_types.add(new MountSheep(this)); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountChicken.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountChicken.java index dbcad568f..b5d1a2df2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountChicken.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountChicken.java @@ -1,32 +1,47 @@ package mineplex.core.mount.types; +import java.lang.reflect.Field; +import java.util.Map; + +import net.minecraft.server.v1_8_R3.EntityLiving; + import org.bukkit.Material; -import org.bukkit.entity.Chicken; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.entity.Horse; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.inventory.ItemStack; -import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilText; -import mineplex.core.mount.Mount; +import mineplex.core.disguise.disguises.DisguiseChicken; +import mineplex.core.mount.HorseMount; import mineplex.core.mount.MountManager; import mineplex.core.mount.SingleEntityMountData; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; -public class MountChicken extends Mount<SingleEntityMountData<Chicken>> +public class MountChicken extends HorseMount { public MountChicken(MountManager manager) { - super(manager, "Chicken Mount", Material.SLIME_BALL, (byte)0, - UtilText.splitLineToArray(C.cGray + "Placeholder", LineFormat.LORE), - 15000); - - KnownPackage = false; + super(manager, "Chicken Mount", + UtilText.splitLinesToArray(new String[] + { + "Placeholder" + }, LineFormat.LORE), + Material.GLASS, (byte) 0, -1, Horse.Color.BLACK, Horse.Style.NONE, Horse.Variant.HORSE, 2.0, Material.AIR); } + @Override public void enableCustom(Player player) { player.leaveVehicle(); @@ -35,50 +50,108 @@ public class MountChicken extends Mount<SingleEntityMountData<Chicken>> //Remove other mounts Manager.DeregisterAll(player); - SingleEntityMountData<Chicken> mount = new SingleEntityMountData<>(player, player.getWorld().spawn(player.getLocation(), Chicken.class)); - mount.getEntity().setBaby(); + Horse horse = player.getWorld().spawn(player.getLocation(), Horse.class); + horse.setAdult(); + horse.setAgeLock(true); + horse.setColor(_color); + horse.setStyle(_style); + horse.setVariant(_variant); + horse.setOwner(player); + horse.setMaxDomestication(1); + horse.setJumpStrength(_jump); + horse.setMaxHealth(20); + horse.setHealth(horse.getMaxHealth()); + horse.getInventory().setSaddle(new ItemStack(Material.SADDLE)); - mount.getEntity().setCustomName(player.getName() + "'s " + getName()); + if (horse.getVariant() == Horse.Variant.MULE) + horse.setCarryingChest(true); + + if (_armor != null) + horse.getInventory().setArmor(new ItemStack(_armor)); + + horse.setCustomName(player.getName() + "'s " + getName()); //Inform UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(getName()) + ".")); //Store + SingleEntityMountData<Horse> mount = new SingleEntityMountData<>(player, horse); _active.put(player, mount); + + DisguiseChicken chicken = new DisguiseChicken(horse); + chicken.setName(player.getName() + "'s Chicken Mount"); + Manager.getDisguiseManager().disguise(chicken); + + UtilEnt.silence(horse, true); } - public void disable(Player player) + // Detects player falling and slows down, like it happens with a chicken falling + @EventHandler + public void onPlayerFall(PlayerMoveEvent event) { - SingleEntityMountData<Chicken> mount = _active.remove(player); - if (mount != null) + Player player = event.getPlayer(); + + for (Map.Entry<Player, SingleEntityMountData<Horse>> entry : getActive().entrySet()) { - mount.remove(); + Horse horse = entry.getValue().getEntity(); - //Inform - UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(getName()) + ".")); - - Manager.removeActive(player); + if (horse.getPassenger() == player) + { + if (event.getFrom().getY() > event.getTo().getY()) + { + // Slows down horse + horse.setVelocity(horse.getVelocity().setY(horse.getVelocity().getY() * .75)); + } + } } } @EventHandler - public void interactMount(PlayerInteractEntityEvent event) + public void jump(UpdateEvent event) { - if (event.getRightClicked() == null) + if (event.getType() != UpdateType.TICK) return; - SingleEntityMountData<Chicken> data = getActive().get(event.getPlayer()); + for (Player player : getActive().keySet()) + { + final Horse horse = getActive().get(player).getEntity(); - if(data == null) return; + if (horse.getPassenger() != player) + continue; - if(!data.ownsMount(event.getPlayer())) return; + if (!UtilEnt.isGrounded(horse)) + continue; - if(!data.isPartOfMount(event.getRightClicked())) return; + if (!Recharge.Instance.use(player, "Chicken Mount Jump", 100, false, false)) + continue; - event.getPlayer().leaveVehicle(); - event.getPlayer().eject(); + try + { + Field jump = EntityLiving.class.getDeclaredField("aY"); + final boolean accessible = jump.isAccessible(); - event.getRightClicked().setPassenger(event.getPlayer()); + jump.setAccessible(true); + boolean isJumping = jump.getBoolean(((CraftPlayer) player).getHandle()); + + jump.setAccessible(accessible); + + if (!isJumping) + continue; + + //Not jumping anymore + ((CraftPlayer) player).getHandle().i(false); + + //Velocity + UtilAction.velocity(horse, 1.4, 0.38, .8, true); + + //Sound + player.playSound(horse.getLocation(), Sound.CHICKEN_IDLE, .4F, 1.0F); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java index 4ee91ff52..68486bd4c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java @@ -4,6 +4,8 @@ import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Map.Entry; +import net.minecraft.server.v1_8_R3.EntityLiving; + import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; @@ -33,7 +35,6 @@ import mineplex.core.mount.SingleEntityMountData; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import net.minecraft.server.v1_8_R3.EntityLiving; public class MountSpider extends HorseMount { @@ -152,43 +153,6 @@ public class MountSpider extends HorseMount } } } - -// @EventHandler(priority = EventPriority.LOW) -// public void doubleJump(PlayerToggleFlightEvent event) -// { -// Player player = event.getPlayer(); -// -// if (player.getGameMode() == GameMode.CREATIVE) -// return; -// -// if (!getActive().containsKey(player)) -// return; -// -// if (getActive().get(player).getPassenger() != event.getPlayer()) -// return; -// -// //Chicken Cancel -// DisguiseBase disguise = Manager.getDisguiseManager().getDisguise(player); -// if (disguise != null && ((disguise instanceof DisguiseChicken && !((DisguiseChicken)disguise).isBaby()) || disguise instanceof DisguiseBat || disguise instanceof DisguiseEnderman || disguise instanceof DisguiseWither)) -// return; -// -// Horse horse = getActive().get(event.getPlayer()); -// -// if (!UtilEnt.isGrounded(horse)) -// return; -// -// event.setCancelled(true); -// player.setFlying(false); -// -// //Disable Flight -// player.setAllowFlight(false); -// -// //Velocity -// UtilAction.velocity(horse, 1.4, 0.38, 1, true); -// -// //Sound -// player.playSound(horse.getLocation(), Sound.SPIDER_IDLE, .4F, 1.0F); -// } @EventHandler public void jump(UpdateEvent event) @@ -212,12 +176,12 @@ public class MountSpider extends HorseMount try { Field jump = EntityLiving.class.getDeclaredField("aY"); - final boolean accessable = jump.isAccessible(); + final boolean accessible = jump.isAccessible(); jump.setAccessible(true); boolean isJumping = jump.getBoolean(((CraftPlayer) player).getHandle()); - jump.setAccessible(accessable); + jump.setAccessible(accessible); if (!isJumping) continue; From 2306dbc9097cd69cb37de2167474d7ea0e1a5287 Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Thu, 20 Oct 2016 01:01:31 +0200 Subject: [PATCH 063/147] Fixed creeper XP --- .../game/games/smash/perks/creeper/PerkCreeperExplode.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperExplode.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperExplode.java index 048b614b0..e07b996fa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperExplode.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperExplode.java @@ -138,13 +138,15 @@ public class PerkCreeperExplode extends SmashPerk IncreaseSize(player); - player.setExp(Math.min(0.99f, (float) (elapsed / (WARMUP / 1000)))); + player.setExp(Math.min(0.999f, elapsed / (float) WARMUP)); // Not Detonated if (!UtilTime.elapsed(_active.get(key), WARMUP)) { continue; } + + player.setExp(0); chargeIterator.remove(); From 82f1ec1ac623a2b9200f732b4712968a8af52160 Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Thu, 20 Oct 2016 01:01:46 +0200 Subject: [PATCH 064/147] Tweaked spider smash --- .../games/smash/perks/spider/SmashSpider.java | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java index 71833fcb6..9a52fd00f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java @@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.smash.perks.spider; import java.util.HashMap; import java.util.Map; +import org.bukkit.Bukkit; import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.entity.LivingEntity; @@ -10,6 +11,9 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityRegainHealthEvent; + +import com.sun.xml.internal.fastinfoset.algorithm.HexadecimalEncodingAlgorithm; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilParticle; @@ -64,7 +68,7 @@ public class SmashSpider extends SmashUltimate } // Regen - Manager.GetCondition().Factory().Regen(GetName(), player, player, DURATION / 1000, 0, false, false, false); + Manager.GetCondition().Factory().Regen(GetName(), player, player, DURATION / 1000, 2, false, false, false); } @EventHandler(priority = EventPriority.HIGH) @@ -140,7 +144,6 @@ public class SmashSpider extends SmashUltimate } damager.setMaxHealth(Math.min(30, damager.getMaxHealth() + diff)); - damager.setHealth(Math.min(damagee.getMaxHealth(), damager.getHealth() + diff)); UtilParticle.PlayParticle(ParticleType.HEART, damager.getLocation().add(0, 1, 0), 0, 0, 0, 0, 1, ViewDist.LONG, UtilServer.getPlayers()); @@ -151,4 +154,19 @@ public class SmashSpider extends SmashUltimate damager.getWorld().playSound(damager.getLocation(), Sound.SPIDER_IDLE, 1.5f, 1f); } } + + @EventHandler(priority = EventPriority.HIGHEST) + public void onRegen(EntityRegainHealthEvent event) + { + if(!(event.getEntity() instanceof Player)) return; + + Player p = (Player) event.getEntity(); + + if(!hasPerk(p)) + { + return; + } + + Bukkit.broadcastMessage("Regen: " + p.getName() + " - " + event.getRegainReason().name() + " - " + event.getAmount() + " " + event.isCancelled()); + } } From 74d6c599b5a1ea9417327567cc8671b88783fd32 Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Thu, 20 Oct 2016 01:27:22 +0200 Subject: [PATCH 065/147] Fixed snowman turret targeting team mates --- .../game/games/smash/perks/snowman/SmashSnowman.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java index 613aa5bf4..c5dc0a692 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java @@ -106,7 +106,7 @@ public class SmashSnowman extends SmashUltimate { Snowman snowman = turretIter.next(); Player player = _turret.get(snowman); - Player target = UtilPlayer.getClosest(snowman.getLocation(), player); + Player target = UtilPlayer.getClosest(snowman.getLocation(), Manager.GetGame().GetTeam(player).GetPlayers(true)); if (target == null) { @@ -150,8 +150,10 @@ public class SmashSnowman extends SmashUltimate { return; } + + Player damager = _snowball.get(proj); - if (!_snowball.containsKey(proj)) + if (damager == null) { return; } @@ -165,7 +167,7 @@ public class SmashSnowman extends SmashUltimate event.SetCancelled("Turret"); - if (damagee.equals(_snowball.get(proj))) + if(Manager.GetGame().GetTeam(damager).GetPlayers(true).contains(damagee)) { return; } @@ -183,7 +185,7 @@ public class SmashSnowman extends SmashUltimate return; } - Manager.GetDamage().NewDamageEvent(damagee, _snowball.get(proj), null, DamageCause.PROJECTILE, 2, false, true, false, UtilEnt.getName(_snowball.get(proj)), GetName()); + Manager.GetDamage().NewDamageEvent(damagee, damager, null, DamageCause.PROJECTILE, 2, false, true, false, UtilEnt.getName(_snowball.get(proj)), GetName()); } @EventHandler From 33a7deed585c342212c0c6b94545a70205765ed5 Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Thu, 20 Oct 2016 01:27:43 +0200 Subject: [PATCH 066/147] Tweaked witch daze potion damage --- .../game/games/smash/perks/witch/PerkWitchPotion.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java index 9d6f6ce42..168f2ca47 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java @@ -148,7 +148,11 @@ public class PerkWitchPotion extends SmashPerk implements IThrown { if(player.equals(data.getThrower())) continue; - Manager.GetDamage().NewDamageEvent(player, entity, null, DamageCause.CUSTOM, DAMAGE_NORMAL * nearby.get(player), true, true, false, entity.getName(), GetName()); + double damage = DAMAGE_NORMAL * nearby.get(player); + + if(player.equals(target)) damage = DAMAGE_NORMAL; + + Manager.GetDamage().NewDamageEvent(player, entity, null, DamageCause.CUSTOM, damage, true, true, false, entity.getName(), GetName()); } } From 0d688534b15caecf7396729b8d22d4f3d3ebe9f8 Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Thu, 20 Oct 2016 01:28:25 +0200 Subject: [PATCH 067/147] Reduce slime smash durration --- .../game/arcade/game/games/smash/perks/slime/SmashSlime.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/SmashSlime.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/SmashSlime.java index 4a9e2894b..16bfccd4e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/SmashSlime.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/slime/SmashSlime.java @@ -26,7 +26,7 @@ import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashSlime extends SmashUltimate { - private static final int DURATION = 24000; + private static final int DURATION = 19000; private static final int HIT_BOX = 5; private static final int DAMAGE = 8; From 6851a20e924d5753080de1c4e5016ef9fb2e820b Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Thu, 20 Oct 2016 02:00:01 +0200 Subject: [PATCH 068/147] Fix /lives debug command --- .../src/nautilus/game/arcade/game/games/smash/SuperSmash.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 15abad40d..62d79d198 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 @@ -761,8 +761,8 @@ public abstract class SuperSmash extends Game RespawnPlayer(player); player.sendMessage(F.main("Revive", "You are back in the game!")); } + + _lives.put(player, MAX_LIVES); } - - _lives.put(player, MAX_LIVES); } } From 21d004b3f2d330b56ef3130fbb64c49cb0d42a75 Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Thu, 20 Oct 2016 02:00:30 +0200 Subject: [PATCH 069/147] Make the skelleton kit deal static 6 damage for arrows --- .../game/arcade/game/games/smash/kits/KitSkeleton.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java index 5729bb8ac..07f123e5b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java @@ -7,6 +7,7 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.C; @@ -30,6 +31,8 @@ import nautilus.game.arcade.kit.perks.PerkRopedArrow; public class KitSkeleton extends SmashKit { + + private static double ARROW_DAMAGE = 6; private static final Perk[] PERKS = { new PerkSmashStats(5, 1.25, 0.2, 6), @@ -107,7 +110,7 @@ public class KitSkeleton extends SmashKit player.getInventory().setArmorContents(PLAYER_ARMOR); } - @EventHandler + @EventHandler(priority = EventPriority.HIGHEST) public void arrowDamage(CustomDamageEvent event) { Player player = event.GetDamagerPlayer(true); @@ -128,6 +131,9 @@ public class KitSkeleton extends SmashKit return; } - event.AddMod("Arrow Nerf", -1.5); + //Try making arrows deal static damage + double diff = ARROW_DAMAGE - event.GetDamage(); + + event.AddMod("Arrow Nerf", diff); } } From 59712b40899b31fadceb92d6be400194fac60ed5 Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Thu, 20 Oct 2016 02:01:23 +0200 Subject: [PATCH 070/147] Prevent multiple abilities from dealing damage and knockback on teammate --- .../games/smash/perks/chicken/PerkChickenRocket.java | 4 ++++ .../games/smash/perks/magmacube/PerkMagmaBlast.java | 9 +++++++++ .../game/games/smash/perks/sheep/PerkWoolBomb.java | 12 ++++++++++++ 3 files changed, 25 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java index 3f88daa93..e7d19bfab 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java @@ -195,6 +195,10 @@ public class PerkChickenRocket extends SmashPerk { continue; } + if (Manager.GetGame().GetTeam(data.Player).GetPlayers(true).contains(ent)) + { + continue; + } } // Damage Event diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBlast.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBlast.java index 060e72fc3..f347ae2cc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBlast.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBlast.java @@ -168,6 +168,15 @@ public class PerkMagmaBlast extends Perk for (Player cur : hitMap.keySet()) { + if(Manager.GetGame().GetTeam(shooter).GetPlayers(true).contains(cur)) + { + // Do not deal damage to team mates, but do deal damage to player him/her self + if(!cur.equals(shooter)) + { + continue; + } + } + double range = hitMap.get(cur); Manager.GetDamage().NewDamageEvent(cur, shooter, proj, DamageCause.PROJECTILE, range * DAMAGE, false, true, false, shooter.getName(), GetName()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolBomb.java index beb6cc23f..f07a3212d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolBomb.java @@ -244,6 +244,18 @@ public class PerkWoolBomb extends Perk implements IThrown for (LivingEntity cur : targets.keySet()) { + if(cur instanceof Player) + { + if(Manager.GetGame().GetTeam(player).GetPlayers(true).contains(cur)) + { + // Do not deal damage to team mates, but do deal damage to player him/her self + if(!cur.equals(player)) + { + continue; + } + } + } + // Damage Event Manager.GetDamage().NewDamageEvent(cur, player, null, DamageCause.CUSTOM, DAMAGE_EXPLODE * targets.get(cur) + 0.5, false, true, false, player.getName(), GetName()); From db9f3587189e3c91fd5074df6aac68e889e63715 Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Thu, 20 Oct 2016 02:01:40 +0200 Subject: [PATCH 071/147] Increase Angry Heard durration --- .../arcade/game/games/smash/perks/cow/PerkCowAngryHerd.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowAngryHerd.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowAngryHerd.java index 445f6a006..18ea1df4e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowAngryHerd.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/cow/PerkCowAngryHerd.java @@ -39,7 +39,7 @@ public class PerkCowAngryHerd extends SmashPerk private static final int COOLDOWN_NORMAL = 13000; private static final int COOLDOWN_SMASH = 6000; - private static final int MAX_TIME = 1000; + private static final int MAX_TIME = 2500; private static final int STUCK_TIME = 300; private static final int FORCE_MOVE = 350; private static final float HIT_BOX_RADIUS = 2.2F; From 55b37e02611ad63bab0ece05321e0f8b5b3bac16 Mon Sep 17 00:00:00 2001 From: AlexTheCoder <alexjmeech@gmail.com> Date: Sun, 16 Oct 2016 02:23:53 -0400 Subject: [PATCH 072/147] Fix players being able to log in multiple times via different bungees --- .../playerTracker/PlayerJoinHandler.java | 2 - .../bungee/playerTracker/PlayerTracker.java | 54 +++++++++---------- 2 files changed, 25 insertions(+), 31 deletions(-) diff --git a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerTracker/PlayerJoinHandler.java b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerTracker/PlayerJoinHandler.java index 36c4f37c8..19c52c0a0 100644 --- a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerTracker/PlayerJoinHandler.java +++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerTracker/PlayerJoinHandler.java @@ -14,14 +14,12 @@ public class PlayerJoinHandler implements CommandCallback _playerTracker = playerTracker; } - @SuppressWarnings("deprecation") @Override public void run(ServerCommand command) { if (command instanceof PlayerJoinCommand) { PlayerJoinCommand joinCommand = (PlayerJoinCommand)command; - _playerTracker.kickPlayerIfOnline(UUID.fromString(joinCommand.getUuid())); } } diff --git a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerTracker/PlayerTracker.java b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerTracker/PlayerTracker.java index a7b2d004e..09c11dfff 100644 --- a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerTracker/PlayerTracker.java +++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerTracker/PlayerTracker.java @@ -1,17 +1,18 @@ package mineplex.bungee.playerTracker; -import java.io.File; -import java.util.HashSet; -import java.util.Set; +import java.util.List; import java.util.UUID; -import java.util.concurrent.TimeUnit; + +import com.google.common.collect.Lists; import mineplex.serverdata.Region; +import mineplex.serverdata.commands.PlayerJoinCommand; import mineplex.serverdata.commands.ServerCommandManager; import mineplex.serverdata.data.DataRepository; import mineplex.serverdata.data.PlayerStatus; import mineplex.serverdata.redis.RedisDataRepository; import mineplex.serverdata.servers.ServerManager; +import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.event.PlayerDisconnectEvent; import net.md_5.bungee.api.event.PostLoginEvent; @@ -20,7 +21,7 @@ import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.api.plugin.Plugin; import net.md_5.bungee.event.EventHandler; -public class PlayerTracker implements Listener, Runnable +public class PlayerTracker implements Listener { // Default period before status expiry (8 hours) private static final int DEFAULT_STATUS_TIMEOUT = 60 * 60 * 8; @@ -28,24 +29,29 @@ public class PlayerTracker implements Listener, Runnable // Repository storing player status' across network. private DataRepository<PlayerStatus> _repository; - private Set<UUID> _onlineUUIDs = new HashSet<>(); - private Plugin _plugin; + private final List<UUID> _ignoreKick = Lists.newArrayList(); + public PlayerTracker(Plugin plugin) { _plugin = plugin; _plugin.getProxy().getPluginManager().registerListener(_plugin, this); - _plugin.getProxy().getScheduler().schedule(_plugin, this, 1L, 1L, TimeUnit.MINUTES); _repository = new RedisDataRepository<PlayerStatus>(ServerManager.getMasterConnection(), ServerManager.getSlaveConnection(), Region.currentRegion(), PlayerStatus.class, "playerStatus"); - ServerCommandManager.getInstance().registerCommandType("PlayerJoinCommand", mineplex.serverdata.commands.PlayerJoinCommand.class, new PlayerJoinHandler(this)); + ServerCommandManager.getInstance().initializeServer("BUNGEE ENABLE - " + System.currentTimeMillis()); + ServerCommandManager.getInstance().registerCommandType(mineplex.serverdata.commands.PlayerJoinCommand.class, new PlayerJoinHandler(this)); System.out.println("Initialized PlayerTracker."); } + + public Plugin getPlugin() + { + return _plugin; + } @EventHandler public void playerConnect(final ServerConnectedEvent event) @@ -70,42 +76,32 @@ public class PlayerTracker implements Listener, Runnable _repository.removeElement(event.getPlayer().getName().toLowerCase()); } }); - - _onlineUUIDs.remove(event.getPlayer().getUniqueId()); } @EventHandler public void playerConnect(final PostLoginEvent event) { - _onlineUUIDs.add(event.getPlayer().getUniqueId()); - } - - @Override - public void run() - { - Set<UUID> onlineUUIDs = new HashSet<>(); - - for (ProxiedPlayer player : _plugin.getProxy().getPlayers()) - { - onlineUUIDs.add(player.getUniqueId()); - } - - _onlineUUIDs = onlineUUIDs; + _ignoreKick.add(event.getPlayer().getUniqueId()); + PlayerJoinCommand command = new PlayerJoinCommand(event.getPlayer().getUniqueId()); + command.publish(); } public boolean isPlayerOnline(UUID uuid) { - return _onlineUUIDs.contains(uuid); + return _plugin.getProxy().getPlayer(uuid) != null; } public void kickPlayerIfOnline(UUID uuid) { - if (_onlineUUIDs.contains(uuid)) + if (_ignoreKick.remove(uuid)) + { + return; + } + if (isPlayerOnline(uuid)) { ProxiedPlayer player = _plugin.getProxy().getPlayer(uuid); - if (player != null) - player.disconnect("You have logged in from another location."); + player.disconnect(new TextComponent("You have logged in from another location.")); } } } From 26baf6aa67866c0182c2b6529fd4b254becd41f4 Mon Sep 17 00:00:00 2001 From: AlexTheCoder <alexjmeech@gmail.com> Date: Sat, 15 Oct 2016 20:18:00 -0400 Subject: [PATCH 073/147] Make Halloween pumpkins actually drop gems and shards in Block Hunt and Minestrike --- .../src/nautilus/game/arcade/ArcadeManager.java | 5 +++++ .../nautilus/game/arcade/game/games/hideseek/HideSeek.java | 4 ++-- .../game/arcade/game/games/minestrike/GunModule.java | 2 +- .../src/nautilus/game/arcade/managers/HolidayManager.java | 3 ++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index 58c49294b..bb9ca2417 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -255,6 +255,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation //Game commands public static final String GAME_CMD_MODE_FILE = "GAME_CMD_MODE.dat"; private boolean _gameCommandMode; + + public final boolean IsHolidayEnabled; public ArcadeManager(Arcade plugin, ServerStatusManager serverStatusManager, GameServerConfig serverConfig, CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager, @@ -344,7 +346,10 @@ public class ArcadeManager extends MiniPlugin implements IRelation _hologramManager = hologramManager; _idleManager = new IdleManager(this); TitanGiveawayManager titanGiveaway = new TitanGiveawayManager(getPlugin(), clientManager, serverStatusManager); + new HolidayManager(this, titanGiveaway); + IsHolidayEnabled = true; + new ValentinesGiftManager(plugin, clientManager, _bonusManager.getRewardManager(), inventoryManager, _cosmeticManager.getGadgetManager(), statsManager); new GameTestingManager(this); require(PlayerDisguiseManager.class); 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 df9de39bb..b8161cbb7 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 @@ -639,9 +639,9 @@ public class HideSeek extends TeamGame @EventHandler public void FallingBlockBreak(ItemSpawnEvent event) { - if (event.getEntity().getItemStack().getType() == Material.getMaterial(175)) + if (event.getEntity().getItemStack().getType() == Material.getMaterial(175) || (Manager.IsHolidayEnabled && (event.getEntity().getItemStack().getType() == Material.PRISMARINE_SHARD || event.getEntity().getItemStack().getType() == Material.EMERALD))) return; - + event.setCancelled(true); for (Form form : _forms.values()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/GunModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/GunModule.java index e4dbe64ba..5cb098b4e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/GunModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/GunModule.java @@ -1546,7 +1546,7 @@ public class GunModule implements Listener if (_bombItem != null && _bombItem.equals(ent)) continue; - if (ent instanceof Item && ((Item)ent).getItemStack().getTypeId() == 175) + if (ent instanceof Item && (((Item)ent).getItemStack().getTypeId() == 175 || (Manager.IsHolidayEnabled && (((Item)ent).getItemStack().getType() == Material.PRISMARINE_SHARD || ((Item)ent).getItemStack().getType() == Material.EMERALD)))) continue; ent.remove(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java index 89e04c909..bd2bbb545 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java @@ -484,9 +484,10 @@ public class HolidayManager implements Listener @EventHandler public void spawnDebug(PlayerCommandPreprocessEvent event) { - if (event.getPlayer().isOp() && event.getPlayer().getName().equals("Chiss") && event.getMessage().contains("pumpkin")) + if (event.getPlayer().isOp() && event.getMessage().toLowerCase().contains("pumpkin")) { spawnSpecialBlock(event.getPlayer().getLocation().getBlock()); + event.setCancelled(true); } } From 60fad6316bc8e1300edd07cfa8de171c8a6a9d44 Mon Sep 17 00:00:00 2001 From: Alexander Meech <Alex-The-Coder@users.noreply.github.com> Date: Sat, 15 Oct 2016 20:32:11 -0400 Subject: [PATCH 074/147] Ensure command used is actually /pumpkin --- .../src/nautilus/game/arcade/managers/HolidayManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java index bd2bbb545..c7b572244 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java @@ -484,7 +484,7 @@ public class HolidayManager implements Listener @EventHandler public void spawnDebug(PlayerCommandPreprocessEvent event) { - if (event.getPlayer().isOp() && event.getMessage().toLowerCase().contains("pumpkin")) + if (event.getPlayer().isOp() && event.getMessage().toLowerCase().startsWith("/pumpkin")) { spawnSpecialBlock(event.getPlayer().getLocation().getBlock()); event.setCancelled(true); From 6d9d42cfdd157afa16656898c9dce5b72e910ab5 Mon Sep 17 00:00:00 2001 From: AlexTheCoder <alexjmeech@gmail.com> Date: Sat, 15 Oct 2016 19:37:56 -0400 Subject: [PATCH 075/147] Allow pets to be given from the support server --- .../salespackage/SalesPackageManager.java | 50 ++++++++- .../salespackage/command/PetCommand.java | 102 ++++++++++++++++++ .../salespackage/command/Sales.java | 1 + .../salespackage/salespackages/Pet.java | 26 +++++ 4 files changed, 178 insertions(+), 1 deletion(-) create mode 100644 Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/PetCommand.java create mode 100644 Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/Pet.java diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java index 897af4562..7996621e1 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java @@ -1,6 +1,5 @@ package mineplex.staffServer.salespackage; -import mineplex.staffServer.salespackage.salespackages.*; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; @@ -10,10 +9,32 @@ import mineplex.core.common.jsonchat.JsonMessage; import mineplex.core.common.util.NautHashMap; import mineplex.core.donation.DonationManager; import mineplex.core.inventory.InventoryManager; +import mineplex.core.pet.PetFactory; +import mineplex.core.pet.repository.PetRepository; import mineplex.core.powerplayclub.PowerPlayClubRepository; import mineplex.core.stats.StatsManager; import mineplex.staffServer.salespackage.command.DisplayPackageCommand; import mineplex.staffServer.salespackage.command.Sales; +import mineplex.staffServer.salespackage.salespackages.AncientChest; +import mineplex.staffServer.salespackage.salespackages.ApplyKits; +import mineplex.staffServer.salespackage.salespackages.ClanBannerEditor; +import mineplex.staffServer.salespackage.salespackages.ClanBannerUsage; +import mineplex.staffServer.salespackage.salespackages.Coins; +import mineplex.staffServer.salespackage.salespackages.DefaultRank; +import mineplex.staffServer.salespackage.salespackages.FreedomChest; +import mineplex.staffServer.salespackage.salespackages.HauntedChest; +import mineplex.staffServer.salespackage.salespackages.IlluminatedChest; +import mineplex.staffServer.salespackage.salespackages.LifetimeHero; +import mineplex.staffServer.salespackage.salespackages.LifetimeLegend; +import mineplex.staffServer.salespackage.salespackages.LifetimeTitan; +import mineplex.staffServer.salespackage.salespackages.LifetimeUltra; +import mineplex.staffServer.salespackage.salespackages.MythicalChest; +import mineplex.staffServer.salespackage.salespackages.OldChest; +import mineplex.staffServer.salespackage.salespackages.OmegaChest; +import mineplex.staffServer.salespackage.salespackages.Pet; +import mineplex.staffServer.salespackage.salespackages.PowerPlayClub; +import mineplex.staffServer.salespackage.salespackages.RuneAmplifier; +import mineplex.staffServer.salespackage.salespackages.SalesPackageBase; public class SalesPackageManager extends MiniPlugin { @@ -22,6 +43,8 @@ public class SalesPackageManager extends MiniPlugin private InventoryManager _inventoryManager; private StatsManager _statsManager; private PowerPlayClubRepository _powerPlayRepo; + private PetRepository _petRepo; + private PetFactory _petFactory; private NautHashMap<String, SalesPackageBase> _salesPackages = new NautHashMap<String, SalesPackageBase>(); @@ -34,6 +57,10 @@ public class SalesPackageManager extends MiniPlugin _inventoryManager = inventoryManager; _statsManager = statsManager; _powerPlayRepo = powerPlayRepo; + + _petRepo = new PetRepository(plugin, plugin.getConfig().getString("webServer")); + _petFactory = new PetFactory(_petRepo); + //Strutt20 asked me to remove some of the stuff from the menu AddSalesPackage(new Coins(this, 5000)); @@ -65,6 +92,11 @@ public class SalesPackageManager extends MiniPlugin AddSalesPackage(new PowerPlayClub(this, true)); AddSalesPackage(new OmegaChest(this)); AddSalesPackage(new HauntedChest(this)); + + for (mineplex.core.pet.Pet pet : _petFactory.GetPets()) + { + AddSalesPackage(new Pet(this, pet.getName(), pet.getPetType())); + } } private void AddSalesPackage(SalesPackageBase salesPackage) @@ -98,6 +130,16 @@ public class SalesPackageManager extends MiniPlugin { return _powerPlayRepo; } + + public PetRepository getPetRepo() + { + return _petRepo; + } + + public PetFactory getPetFactory() + { + return _petFactory; + } public void help(Player player) { @@ -115,6 +157,7 @@ public class SalesPackageManager extends MiniPlugin JsonMessage chestBuilder = new JsonMessage("Chest Packages : ").color("blue"); JsonMessage clanBuilder = new JsonMessage("Clan Packages : ").color("blue"); JsonMessage powerPlayBuilder = new JsonMessage("Power Play Club Packages : ").color("blue"); + JsonMessage petBuilder = new JsonMessage("Pet Packages : ").color("blue"); for (SalesPackageBase salesPackage : _salesPackages.values()) { @@ -134,6 +177,10 @@ public class SalesPackageManager extends MiniPlugin { powerPlayBuilder = powerPlayBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray"); } + else if (salesPackage instanceof Pet) + { + petBuilder = petBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray"); + } else { packageBuilder = packageBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray"); @@ -145,6 +192,7 @@ public class SalesPackageManager extends MiniPlugin packageBuilder.sendToPlayer(caller); clanBuilder.sendToPlayer(caller); powerPlayBuilder.sendToPlayer(caller); + petBuilder.sendToPlayer(caller); } public StatsManager getStatsManager() diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/PetCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/PetCommand.java new file mode 100644 index 000000000..69c5d6aac --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/PetCommand.java @@ -0,0 +1,102 @@ +package mineplex.staffServer.salespackage.command; + +import java.util.UUID; + +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +import com.google.gson.Gson; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; +import mineplex.core.pet.Pet; +import mineplex.core.pet.PetClient; +import mineplex.core.pet.repository.token.ClientPetTokenWrapper; +import mineplex.core.pet.repository.token.PetChangeToken; +import mineplex.staffServer.salespackage.SalesPackageManager; + +public class PetCommand extends CommandBase<SalesPackageManager> +{ + public PetCommand(SalesPackageManager plugin) + { + super(plugin, Rank.MODERATOR, "pet"); + } + + @Override + public void Execute(final Player caller, String[] args) + { + if (args.length < 2) + return; + + final String playerName = args[0]; + int petId = Integer.parseInt(args[1]); + + if ((petId < 0 || petId >= EntityType.values().length) || Plugin.getPetFactory().getPet(EntityType.values()[petId]) == null) + { + caller.sendMessage(F.main(Plugin.getName(), "You have entered an invalid Pet Type.")); + return; + } + + final EntityType petType = EntityType.values()[petId]; + + Plugin.getClientManager().loadClientByName(playerName, client -> + { + final UUID uuid = Plugin.getClientManager().loadUUIDFromDB(playerName); + + if (uuid != null) + { + final Callback<PetClient> clientCallback = new Callback<PetClient>() + { + public void run(PetClient petClient) + { + if (petClient.getPets().containsKey(petType)) + { + caller.sendMessage(F.main(Plugin.getName(), F.elem(playerName) + " already has that Pet!")); + } + else + { + Pet pet = Plugin.getPetFactory().getPet(petType); + PetChangeToken token = new PetChangeToken(); + token.AccountId = client.getAccountId(); + token.Name = playerName; + token.PetType = petType.toString(); + token.PetName = pet.getName(); + + Plugin.getPetRepo().AddPet(token); + Plugin.getInventoryManager().addItemToInventoryForOffline(success -> + { + if (success) + { + caller.sendMessage(F.main(Plugin.getName(), F.elem(playerName) + " has been given their Pet!")); + } + else + { + caller.sendMessage(F.main(Plugin.getName(), "Attempt to give Pet has failed!")); + } + }, client.getAccountId(), petType.toString(), 1); + } + } + }; + + Plugin.runAsync(() -> + { + Gson gson = new Gson(); + ClientPetTokenWrapper token = null; + String response = Plugin.getClientManager().getRepository().getClientByUUID(uuid); + token = gson.fromJson(response, ClientPetTokenWrapper.class); + + PetClient petClient = new PetClient(); + petClient.load(token.DonorToken); + + clientCallback.run(petClient); + }); + } + else + { + caller.sendMessage(F.main(Plugin.getName(), "Couldn't find " + playerName + "'s account!")); + } + }); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/Sales.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/Sales.java index 4a1bfc4c7..40040e1d0 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/Sales.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/Sales.java @@ -24,6 +24,7 @@ public class Sales extends MultiCommandBase<SalesPackageManager> AddCommand(new LifetimeTitanCommand(plugin)); AddCommand(new KitsCommand(plugin)); AddCommand(new PowerPlayCommand(plugin)); + AddCommand(new PetCommand(plugin)); } @Override diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/Pet.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/Pet.java new file mode 100644 index 000000000..add8d52ae --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/Pet.java @@ -0,0 +1,26 @@ +package mineplex.staffServer.salespackage.salespackages; + +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +import mineplex.staffServer.salespackage.SalesPackageManager; + +public class Pet extends SalesPackageBase +{ + private String _petName; + private EntityType _petType; + + public Pet(SalesPackageManager manager, String petName, EntityType petType) + { + super(manager, "1 " + petName + " Pet"); + _petName = petName; + _petType = petType; + } + + public void displayToAgent(Player agent, String playerName) + { + addButton(agent, "/sales pet " + playerName + " " + _petType.ordinal(), "Give 1 " + _petName + " Pet."); + agent.sendMessage(" "); + addBackButton(agent, playerName); + } +} \ No newline at end of file From 2e280d62de438b7187db1d07b6587866eb6f2999 Mon Sep 17 00:00:00 2001 From: AlexTheCoder <alexjmeech@gmail.com> Date: Sat, 15 Oct 2016 19:48:17 -0400 Subject: [PATCH 076/147] Block rain on the support server --- .../customerSupport/CustomerSupport.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index 57e4603c7..b81e2ae90 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -6,12 +6,12 @@ import java.time.LocalDate; import java.time.YearMonth; import java.time.format.TextStyle; import java.util.ArrayList; -import java.util.Calendar; import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.UUID; +import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -22,6 +22,7 @@ import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.weather.WeatherChangeEvent; import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.Managers; @@ -54,6 +55,8 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable private NautHashMap<Player, HashSet<String>> _agentCacheMap = new NautHashMap<Player, HashSet<String>>(); private NautHashMap<Integer, List<String>> _accountBonusLog = new NautHashMap<>(); + + private boolean _allowWeatherChange = false; public CustomerSupport(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, SalesPackageManager salesPackageManager, PowerPlayClubRepository powerPlayRepo) { @@ -64,6 +67,10 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable _salesPackageManager = salesPackageManager; _repository = new CustomerSupportRepository(getPlugin()); _powerPlayRepo = powerPlayRepo; + + _allowWeatherChange = true; + Bukkit.getWorlds().get(0).setStorm(false); + _allowWeatherChange = false; } @EventHandler @@ -402,6 +409,15 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable event.setCancelled(true); } + + @EventHandler + public void stopRain(WeatherChangeEvent event) + { + if (!_allowWeatherChange) + { + event.setCancelled(true); + } + } @Override public void processResultSet(ResultSet resultSet) throws SQLException From 16b195d2ab6f17912fb45fcf165dffe9b03960f0 Mon Sep 17 00:00:00 2001 From: AlexTheCoder <alexjmeech@gmail.com> Date: Fri, 14 Oct 2016 20:09:55 -0400 Subject: [PATCH 077/147] Make playwire-given carl spin tickets update while the player is logged in --- .../core/playwire/PlayWireManager.java | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java b/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java index 047fd66ed..b61784b6d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java @@ -19,8 +19,10 @@ import org.bukkit.plugin.java.JavaPlugin; import org.jooq.SQLDialect; import org.jooq.impl.DSL; +import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; +import java.sql.Statement; import java.util.UUID; /** @@ -85,15 +87,25 @@ public class PlayWireManager extends MiniDbClientPlugin<PlayWireClientData> final int accountId = _clientManager.Get(player).getAccountId(); runAsync(() -> { - try + try (Connection c = DBPool.getAccount().getConnection(); Statement statement = c.createStatement()) { - final int newTickets = DSL.using(DBPool.getAccount(), SQLDialect.MYSQL).update(Tables.bonus).set(Tables.bonus.tickets, Tables.bonus.tickets.add(1)). - where(Tables.bonus.accountId.eq(accountId)).returning(Tables.bonus.tickets).fetchOne().getTickets(); - runSync(() -> + final String query = "UPDATE bonus SET tickets = tickets + 1 WHERE accountId = " + accountId + ";SELECT tickets FROM bonus WHERE accountId = " + accountId; + + statement.execute(query); + statement.getUpdateCount(); + statement.getMoreResults(); + + ResultSet rs = statement.getResultSet(); + if (rs.next()) { - Managers.get(BonusManager.class).Get(player).setTickets(newTickets); - Managers.get(BonusManager.class).updateCreeperVisual(player, true, C.cAqua); - }); + final int newTickets = rs.getInt(1); + + runSync(() -> + { + Managers.get(BonusManager.class).Get(player).setTickets(newTickets); + Managers.get(BonusManager.class).updateCreeperVisual(player, true, C.cAqua); + }); + } } catch (Exception e) { @@ -101,7 +113,7 @@ public class PlayWireManager extends MiniDbClientPlugin<PlayWireClientData> e.printStackTrace(); } }); - Managers.get(BonusManager.class).addPendingExplosion(player, player.getName()); + //Managers.get(BonusManager.class).addPendingExplosion(player, player.getName()); Bukkit.getScheduler().runTaskLater(getClientManager().getPlugin(), () -> UtilPlayer.message(player, ResponseType.COUNTED.getMessage()), REWARD_MESSAGE_DELAY_SECONDS * 20L); }); } From 13220e267ced1aa031d70c1c0077987b6a27a1dd Mon Sep 17 00:00:00 2001 From: AlexTheCoder <alexjmeech@gmail.com> Date: Fri, 14 Oct 2016 20:29:23 -0400 Subject: [PATCH 078/147] Re-enable animation --- .../src/mineplex/core/playwire/PlayWireManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java b/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java index b61784b6d..87c0ca9af 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java @@ -113,7 +113,7 @@ public class PlayWireManager extends MiniDbClientPlugin<PlayWireClientData> e.printStackTrace(); } }); - //Managers.get(BonusManager.class).addPendingExplosion(player, player.getName()); + Managers.get(BonusManager.class).addPendingExplosion(player, player.getName()); Bukkit.getScheduler().runTaskLater(getClientManager().getPlugin(), () -> UtilPlayer.message(player, ResponseType.COUNTED.getMessage()), REWARD_MESSAGE_DELAY_SECONDS * 20L); }); } From 6719f11358a27bad9da43f7dca46de7c65577975 Mon Sep 17 00:00:00 2001 From: AlexTheCoder <alexjmeech@gmail.com> Date: Fri, 14 Oct 2016 20:50:22 -0400 Subject: [PATCH 079/147] Fix playwire command not requiring console to use it --- .../core/playwire/PlayWireCommand.java | 10 +++++++- .../core/playwire/PlayWireManager.java | 23 ++++++++----------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireCommand.java index 5a2a56d10..709804c93 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireCommand.java @@ -3,6 +3,7 @@ package mineplex.core.playwire; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; /** * @@ -20,7 +21,14 @@ public class PlayWireCommand implements CommandExecutor @Override public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) { - _manager.onCommand(args); + if (commandSender instanceof Player) + { + commandSender.sendMessage("Unknown command. Type \"/help\" for help."); + } + else + { + _manager.onCommand(args); + } return true; } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java b/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java index 87c0ca9af..3e7995add 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java @@ -1,5 +1,15 @@ package mineplex.core.playwire; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + import mineplex.core.Managers; import mineplex.core.MiniDbClientPlugin; import mineplex.core.account.CoreClientManager; @@ -10,21 +20,8 @@ import mineplex.core.common.util.UtilTime.TimeUnit; import mineplex.core.donation.DonationManager; import mineplex.core.inventory.InventoryManager; import mineplex.core.treasure.TreasureType; -import mineplex.database.Tables; import mineplex.serverdata.database.DBPool; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.plugin.java.JavaPlugin; -import org.jooq.SQLDialect; -import org.jooq.impl.DSL; - -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.UUID; - /** * */ From dbd5203e9dfedf40fbd07dfdb5ae31a04f0c0594 Mon Sep 17 00:00:00 2001 From: samczsun <github@samczsun.com> Date: Fri, 30 Sep 2016 19:25:53 -0400 Subject: [PATCH 080/147] Fix memory leak in ParticleFreedom --- .../core/gadget/gadgets/particle/freedom/ParticleFreedom.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/freedom/ParticleFreedom.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/freedom/ParticleFreedom.java index 68c253c4a..65b2525cf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/freedom/ParticleFreedom.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/freedom/ParticleFreedom.java @@ -43,7 +43,7 @@ public class ParticleFreedom extends ParticleGadget public void stopEffect(Player player) { if (_effects.containsKey(player.getUniqueId())) - _effects.get(player.getUniqueId()).stop(); + _effects.remove(player.getUniqueId()).stop(); } } From 0cbd4a9de2b6725ca2052b8b81442ad56b5f3707 Mon Sep 17 00:00:00 2001 From: samczsun <github@samczsun.com> Date: Fri, 30 Sep 2016 19:28:21 -0400 Subject: [PATCH 081/147] Fix memory leak in Teleport --- .../Mineplex.Core/src/mineplex/core/teleport/Teleport.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/teleport/Teleport.java b/Plugins/Mineplex.Core/src/mineplex/core/teleport/Teleport.java index 0b7ba2cfa..d93abe6e9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/teleport/Teleport.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/teleport/Teleport.java @@ -25,6 +25,7 @@ import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.world.WorldUnloadEvent; import org.bukkit.plugin.java.JavaPlugin; import java.util.HashMap; @@ -117,6 +118,12 @@ public class Teleport extends MiniPlugin _tpHistory.remove(event.GetName()); } + @EventHandler + public void on(WorldUnloadEvent event) + { + _tpHistory.values().forEach(list -> list.removeIf(location -> location.getWorld() == event.getWorld())); + } + @EventHandler public void update(UpdateEvent event) { From 894e6b4a8921659c6ccd9c46789f5b4b8878fc3b Mon Sep 17 00:00:00 2001 From: samczsun <github@samczsun.com> Date: Fri, 30 Sep 2016 19:34:04 -0400 Subject: [PATCH 082/147] Fix memory leak in CombatLogNPC --- .../core/disguise/DisguiseManager.java | 6 ++++- .../modules/combatlog/CombatLogModule.java | 9 +++---- .../game/modules/combatlog/CombatLogNPC.java | 27 ++++++++++++++----- 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java index 57bf4a047..421ccbcba 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java @@ -261,7 +261,11 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler entityPlayer.playerConnection.networkManager.handle(((DisguisePlayer) originalDisguise).getUndisguiseInfoPackets(true)); if (reason != UndisguiseReason.QUIT) { - entityPlayer.playerConnection.networkManager.handle(((DisguisePlayer) originalDisguise).getUndisguiseInfoPackets(false)); + Packet add = ((DisguisePlayer) originalDisguise).getUndisguiseInfoPackets(false); + if (add != null) + { + entityPlayer.playerConnection.networkManager.handle(add); + } } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/combatlog/CombatLogModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/combatlog/CombatLogModule.java index 6e23a2ad6..9fd3f2f81 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/combatlog/CombatLogModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/combatlog/CombatLogModule.java @@ -228,6 +228,8 @@ public class CombatLogModule extends Module teamGame.RejoinTeam.remove(logoutNpc.getPlayerInfo().getName()); teamGame.RejoinHealth.remove(logoutNpc.getPlayerInfo().getName()); } + + _logoutNpcs.remove(logoutNpc.getPlayerInfo().getUniqueId()); } @EventHandler(ignoreCancelled = true) @@ -274,10 +276,7 @@ public class CombatLogModule extends Module { if (event.getType() == UpdateType.FASTER) { - for (CombatLogNPC npc : _logoutNpcs.values()) - { - npc.update(); - } + _logoutNpcs.values().forEach(CombatLogNPC::update); } if (event.getType() == UpdateType.SEC) @@ -297,7 +296,7 @@ public class CombatLogModule extends Module else if (!npc.isAlive()) { System.out.println("Removing NPC " + npc.getPlayerInfo().getName() + " for 2"); - npc.remove(); + npc.despawn(); iterator.remove(); } else if (npc.getAliveDuation() > this._spawnTime) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/combatlog/CombatLogNPC.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/combatlog/CombatLogNPC.java index 66c7eac4c..65e59f64b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/combatlog/CombatLogNPC.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/combatlog/CombatLogNPC.java @@ -3,6 +3,7 @@ package nautilus.game.arcade.game.modules.combatlog; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilTime; import mineplex.core.disguise.DisguiseManager; +import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.hologram.Hologram; import nautilus.game.arcade.ArcadeManager; @@ -33,6 +34,7 @@ public class CombatLogNPC private double _maxHealth; private LivingEntity _npc; + private DisguiseBase _disguise; private EntityDamageEvent.DamageCause _lastDamageCause; private Entity _lastDamager; @@ -59,7 +61,7 @@ public class CombatLogNPC */ public void onDeath() { - _disguiseManager.undisguise(_npc); + despawn(); } public void update() @@ -99,21 +101,30 @@ public class CombatLogNPC public void despawn() { + if (_disguise != null) + { + try + { + _disguiseManager.undisguise(_disguise); + _disguise = null; + } + catch (Exception e) + { + e.printStackTrace(); + } + } if (_npc != null) { _npc.remove(); _npc = null; + } + if (_hologram != null) + { _hologram.stop(); _hologram = null; } } - public void remove() - { - _hologram.stop(); - _hologram = null; - } - public PlayerInfo getPlayerInfo() { return _playerInfo; @@ -149,6 +160,8 @@ public class CombatLogNPC DisguisePlayer disguise = new DisguisePlayer(skel, ((CraftPlayer) player).getHandle().getProfile()); _disguiseManager.disguise(disguise); + _disguise = disguise; + return skel; } From c00502d91ff4244a25e3cc710d8f9951e64d4b09 Mon Sep 17 00:00:00 2001 From: samczsun <github@samczsun.com> Date: Fri, 30 Sep 2016 19:35:23 -0400 Subject: [PATCH 083/147] Fix memory leak in WinEffectPodium --- .../mineplex/core/gadget/gadgets/wineffect/WinEffectPodium.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectPodium.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectPodium.java index 34b7077e4..3dc52ff95 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectPodium.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectPodium.java @@ -78,6 +78,7 @@ public class WinEffectPodium extends WinEffectGadget @Override public void finish() { + Manager.getDisguiseManager().undisguise(_npc); _npc = null; } From b3ed9db2c7c0a9cd8062286ea22ab060ea526944 Mon Sep 17 00:00:00 2001 From: samczsun <github@samczsun.com> Date: Fri, 30 Sep 2016 20:41:35 -0400 Subject: [PATCH 084/147] Fix memory leak in ProgressingKitManager --- .../nautilus/game/arcade/managers/ProgressingKitManager.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ProgressingKitManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ProgressingKitManager.java index b132cf5b5..325b54462 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ProgressingKitManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ProgressingKitManager.java @@ -162,6 +162,8 @@ public class ProgressingKitManager implements Listener } } _manager.getKitProgressionManager().getDataManager().remove(playerKit); + + _data.remove(event.getPlayer().getUniqueId()); } @EventHandler From a338fb27d3d699a482820d094ebc6ec07c530aa8 Mon Sep 17 00:00:00 2001 From: samczsun <github@samczsun.com> Date: Sat, 1 Oct 2016 18:24:48 -0400 Subject: [PATCH 085/147] Various memory leak fixes --- .../src/mineplex/core/memory/MemoryFix.java | 181 ++++++++++++++++-- 1 file changed, 169 insertions(+), 12 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/memory/MemoryFix.java b/Plugins/Mineplex.Core/src/mineplex/core/memory/MemoryFix.java index b801e7759..90eab086c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/memory/MemoryFix.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/memory/MemoryFix.java @@ -1,52 +1,209 @@ package mineplex.core.memory; import java.lang.reflect.Field; +import java.util.HashSet; import java.util.Iterator; +import java.util.List; +import java.util.Set; import mineplex.core.MiniPlugin; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import net.minecraft.server.v1_8_R3.CraftingManager; +import net.minecraft.server.v1_8_R3.Enchantment; +import net.minecraft.server.v1_8_R3.EnchantmentManager; import net.minecraft.server.v1_8_R3.IInventory; +import net.minecraft.server.v1_8_R3.WorldServer; import org.bukkit.Bukkit; import org.bukkit.World; +import org.bukkit.block.Block; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.entity.Entity; import org.bukkit.entity.HumanEntity; +import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageByBlockEvent; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.plugin.java.JavaPlugin; public class MemoryFix extends MiniPlugin { private static Field _intHashMap; - + public MemoryFix(JavaPlugin plugin) { super("Memory Fix", plugin); - + //_intHashMap = IntHashMap.class. } - + + @EventHandler + public void fixLastDamageEventLeaks(UpdateEvent event) + { + if (event.getType() != UpdateType.SLOW) + return; + + List<World> worldList = Bukkit.getWorlds(); + Set<World> worlds = new HashSet<>(worldList); + + // Sanity check + if (worlds.size() != worldList.size()) + throw new RuntimeException("Error: Duplicated worlds?!?!"); + + + for (World world : worlds) + { + WorldServer worldServer = ((CraftWorld) world).getHandle(); + + for (net.minecraft.server.v1_8_R3.Entity nmsentity : worldServer.entityList) + { + Entity entity = nmsentity.getBukkitEntity(); + EntityDamageEvent lastDamageCause = entity.getLastDamageCause(); + if (lastDamageCause != null) + { + Entity damaged = lastDamageCause.getEntity(); + Entity damagerEntity = null; + Block damagerBlock = null; + if (lastDamageCause instanceof EntityDamageByEntityEvent) + damagerEntity = ((EntityDamageByEntityEvent) lastDamageCause).getDamager(); + if (lastDamageCause instanceof EntityDamageByBlockEvent) + damagerBlock = ((EntityDamageByBlockEvent) lastDamageCause).getDamager(); + + boolean shouldRemove = false; + + if (!damaged.isValid()) + shouldRemove = true; + else if (damagerEntity != null) + { + if (!damagerEntity.isValid()) + shouldRemove = true; + else if (!worlds.contains(damagerEntity.getWorld())) + shouldRemove = true; + } + else if (damagerBlock != null) + { + if (!worlds.contains(damagerBlock.getWorld())) + shouldRemove = true; + } + + if (shouldRemove) + entity.setLastDamageCause(null); + } + } + } + } + + private static Object ENCHANTMENTMANAGER_D; + private static Field ENCHANTMENT_MODIFIER_THORNS_A; + private static Field ENCHANTMENT_MODIFIER_THORNS_B; + private static boolean ENCHANTMENTMANAGER_D_SUCCESFUL; + + private static Object ENCHANTMENTMANAGER_E; + private static Field ENCHANTMENT_MODIFIER_ARTHROPODS_A; + private static Field ENCHANTMENT_MODIFIER_ARTHROPODS_B; + private static boolean ENCHANTMENTMANAGER_E_SUCCESFUL; + + static + { + try + { + Field field = EnchantmentManager.class.getDeclaredField("d"); + field.setAccessible(true); + ENCHANTMENTMANAGER_D = field.get(null); + ENCHANTMENT_MODIFIER_THORNS_A = ENCHANTMENTMANAGER_D.getClass().getDeclaredField("a"); + ENCHANTMENT_MODIFIER_THORNS_A.setAccessible(true); + ENCHANTMENT_MODIFIER_THORNS_B = ENCHANTMENTMANAGER_D.getClass().getDeclaredField("b"); + ENCHANTMENT_MODIFIER_THORNS_B.setAccessible(true); + ENCHANTMENTMANAGER_D_SUCCESFUL = true; + } + catch (ReflectiveOperationException e) + { + e.printStackTrace(); + } + try + { + Field field = EnchantmentManager.class.getDeclaredField("e"); + field.setAccessible(true); + ENCHANTMENTMANAGER_E = field.get(null); + ENCHANTMENT_MODIFIER_ARTHROPODS_A = ENCHANTMENTMANAGER_E.getClass().getDeclaredField("a"); + ENCHANTMENT_MODIFIER_ARTHROPODS_A.setAccessible(true); + ENCHANTMENT_MODIFIER_ARTHROPODS_B = ENCHANTMENTMANAGER_E.getClass().getDeclaredField("b"); + ENCHANTMENT_MODIFIER_ARTHROPODS_B.setAccessible(true); + ENCHANTMENTMANAGER_E_SUCCESFUL = true; + } + catch (ReflectiveOperationException e) + { + e.printStackTrace(); + } + } + + @EventHandler + public void fixEnchantmentManager(UpdateEvent event) + { + if (event.getType() != UpdateType.SLOW) + return; + + if (ENCHANTMENTMANAGER_D_SUCCESFUL) + { + try + { + net.minecraft.server.v1_8_R3.Entity a = (net.minecraft.server.v1_8_R3.Entity) ENCHANTMENT_MODIFIER_THORNS_A.get(ENCHANTMENTMANAGER_D); + net.minecraft.server.v1_8_R3.Entity b = (net.minecraft.server.v1_8_R3.Entity) ENCHANTMENT_MODIFIER_THORNS_B.get(ENCHANTMENTMANAGER_D); + + if ((a != null && !a.valid) || (b != null && !b.valid)) + { + ENCHANTMENT_MODIFIER_THORNS_A.set(ENCHANTMENTMANAGER_D, null); + ENCHANTMENT_MODIFIER_THORNS_B.set(ENCHANTMENTMANAGER_D, null); + } + } + catch (ReflectiveOperationException e) + { + e.printStackTrace(); + } + } + + if (ENCHANTMENTMANAGER_E_SUCCESFUL) + { + try + { + net.minecraft.server.v1_8_R3.Entity a = (net.minecraft.server.v1_8_R3.Entity) ENCHANTMENT_MODIFIER_ARTHROPODS_A.get(ENCHANTMENTMANAGER_E); + net.minecraft.server.v1_8_R3.Entity b = (net.minecraft.server.v1_8_R3.Entity) ENCHANTMENT_MODIFIER_ARTHROPODS_B.get(ENCHANTMENTMANAGER_E); + + if ((a != null && !a.valid) || (b != null && !b.valid)) + { + ENCHANTMENT_MODIFIER_ARTHROPODS_A.set(ENCHANTMENTMANAGER_E, null); + ENCHANTMENT_MODIFIER_ARTHROPODS_B.set(ENCHANTMENTMANAGER_E, null); + } + } + catch (ReflectiveOperationException e) + { + e.printStackTrace(); + } + } + } + @EventHandler public void fixInventoryLeaks(UpdateEvent event) { if (event.getType() != UpdateType.SLOW) return; - + for (World world : Bukkit.getWorlds()) { - for (Object tileEntity : ((CraftWorld)world).getHandle().tileEntityList) + for (Object tileEntity : ((CraftWorld) world).getHandle().tileEntityList) { if (tileEntity instanceof IInventory) { - Iterator<HumanEntity> entityIterator = ((IInventory)tileEntity).getViewers().iterator(); - + Iterator<HumanEntity> entityIterator = ((IInventory) tileEntity).getViewers().iterator(); + while (entityIterator.hasNext()) { HumanEntity entity = entityIterator.next(); - - if (entity instanceof CraftPlayer && !((CraftPlayer)entity).isOnline()) + + if (entity instanceof CraftPlayer && !((CraftPlayer) entity).isOnline()) { entityIterator.remove(); } @@ -54,17 +211,17 @@ public class MemoryFix extends MiniPlugin } } } - + CraftingManager.getInstance().lastCraftView = null; CraftingManager.getInstance().lastRecipe = null; } - + @EventHandler public void fixEntityTrackerLeak(UpdateEvent event) { if (event.getType() != UpdateType.SLOW) return; - + // NEED TO FIX STUCK NETWORKMANAGERS..... /* for (World world : Bukkit.getWorlds()) From bd9aa38afa44fba1c390412f1c99c624a8bbbe36 Mon Sep 17 00:00:00 2001 From: samczsun <github@samczsun.com> Date: Sat, 1 Oct 2016 18:30:42 -0400 Subject: [PATCH 086/147] Make DisguiseManager clean up after lazy callers --- .../core/disguise/DisguiseManager.java | 13 ++++++ .../disguises/DisguiseArmorStand.java | 16 +++---- .../core/disguise/disguises/DisguiseBase.java | 42 +++++++++++-------- .../disguise/disguises/DisguiseBlock.java | 20 ++++----- .../disguise/disguises/DisguiseCreature.java | 16 +++---- .../disguise/disguises/DisguiseEnderman.java | 2 +- .../disguise/disguises/DisguiseLiving.java | 16 +++---- .../disguise/disguises/DisguiseMagmaCube.java | 16 +++---- .../disguise/disguises/DisguisePlayer.java | 38 ++++++++--------- .../disguise/disguises/DisguiseRabbit.java | 16 +++---- .../disguise/disguises/DisguiseSlime.java | 16 +++---- 11 files changed, 116 insertions(+), 95 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java index 421ccbcba..6e1e32169 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java @@ -109,6 +109,19 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler createBedChunk(); } + @EventHandler + public void cleanupLazyCallers(UpdateEvent event) + { + if (event.getType() != UpdateType.SLOW) + return; + + _spawnPacketMap.values().forEach(list -> list.removeIf(base -> base.getEntity() == null)); + _spawnPacketMap.values().removeIf(list -> list.size() == 0); + _entityDisguiseMap.values().forEach(list -> list.removeIf(base -> base.getEntity() == null)); + _entityDisguiseMap.values().removeIf(list -> list.size() == 0); + _disguisePlayerMap.keySet().removeIf(base -> base.getEntity() == null); + } + // We want to re-register entities that were reloaded by chunk loading @EventHandler public void onEntityAdd(ChunkAddEntityEvent event) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseArmorStand.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseArmorStand.java index ed3cade7d..79695ec61 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseArmorStand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseArmorStand.java @@ -51,15 +51,15 @@ public class DisguiseArmorStand extends DisguiseInsentient public Packet getSpawnPacket() { PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(); - packet.a = Entity.getId(); + packet.a = getEntity().getId(); packet.b = (byte) 30; - packet.c = (int) MathHelper.floor(Entity.locX * 32.0D); - packet.d = (int) MathHelper.floor(Entity.locY * 32.0D); - packet.e = (int) MathHelper.floor(Entity.locZ * 32.0D); - packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F)); - packet.j = (byte) ((int) (Entity.pitch * 256.0F / 360.0F)); - packet.k = (byte) ((int) (Entity.yaw * 256.0F / 360.0F)); - packet.uuid = Entity.getUniqueID(); + packet.c = (int) MathHelper.floor(getEntity().locX * 32.0D); + packet.d = (int) MathHelper.floor(getEntity().locY * 32.0D); + packet.e = (int) MathHelper.floor(getEntity().locZ * 32.0D); + packet.i = (byte) ((int) (getEntity().yaw * 256.0F / 360.0F)); + packet.j = (byte) ((int) (getEntity().pitch * 256.0F / 360.0F)); + packet.k = (byte) ((int) (getEntity().yaw * 256.0F / 360.0F)); + packet.uuid = getEntity().getUniqueID(); double var2 = 3.9D; double var4 = 0; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBase.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBase.java index 7c742b3c4..2d0334abc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBase.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBase.java @@ -17,13 +17,15 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.entity.CreatureSpawnEvent; +import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Collections; import java.util.List; public abstract class DisguiseBase { - protected Entity Entity; + private WeakReference<Entity> _entity = new WeakReference<>(null); + protected DataWatcher DataWatcher; private DisguiseBase _soundDisguise; @@ -56,18 +58,18 @@ public abstract class DisguiseBase public void attemptToSpawn() { - this.Entity.world.addEntity(this.Entity, CreatureSpawnEvent.SpawnReason.CUSTOM); + this.getEntity().world.addEntity(this.getEntity(), CreatureSpawnEvent.SpawnReason.CUSTOM); } public void setEntity(org.bukkit.entity.Entity entity) { - Entity = ((CraftEntity) entity).getHandle(); + setEntity(((CraftEntity) entity).getHandle()); } public void UpdateDataWatcher() { - DataWatcher.watch(0, Entity.getDataWatcher().getByte(0), net.minecraft.server.v1_8_R3.Entity.META_ENTITYDATA, Entity.getDataWatcher().getByte(0)); - DataWatcher.watch(1, Entity.getDataWatcher().getShort(1), net.minecraft.server.v1_8_R3.Entity.META_AIR, (int) Entity.getDataWatcher().getShort(1)); + DataWatcher.watch(0, getEntity().getDataWatcher().getByte(0), net.minecraft.server.v1_8_R3.Entity.META_ENTITYDATA, getEntity().getDataWatcher().getByte(0)); + DataWatcher.watch(1, getEntity().getDataWatcher().getShort(1), net.minecraft.server.v1_8_R3.Entity.META_AIR, (int) getEntity().getDataWatcher().getShort(1)); } public abstract Packet getSpawnPacket(); @@ -75,22 +77,22 @@ public abstract class DisguiseBase public Packet getMetadataPacket() { UpdateDataWatcher(); - return new PacketPlayOutEntityMetadata(Entity.getId(), DataWatcher, true); + return new PacketPlayOutEntityMetadata(getEntity().getId(), DataWatcher, true); } public void resendMetadata() { - if (Entity == null || !Entity.getBukkitEntity().isValid() || !(Entity.world instanceof WorldServer)) + if (getEntity() == null || !getEntity().getBukkitEntity().isValid() || !(getEntity().world instanceof WorldServer)) return; - IntHashMap<EntityTrackerEntry> tracker = ((WorldServer) Entity.world).tracker.trackedEntities; + IntHashMap<EntityTrackerEntry> tracker = ((WorldServer) getEntity().world).tracker.trackedEntities; - if (tracker.get(Entity.getId()) == null) + if (tracker.get(getEntity().getId()) == null) return; Packet packet = getMetadataPacket(); - for (EntityPlayer player : tracker.get(Entity.getId()).trackedPlayers) + for (EntityPlayer player : tracker.get(getEntity().getId()).trackedPlayers) { UtilPlayer.sendPacket(player.getBukkitEntity(), packet); } @@ -106,17 +108,17 @@ public abstract class DisguiseBase public void playHurtSound() { - Entity.world.makeSound(Entity, _soundDisguise.getHurtSound(), _soundDisguise.getVolume(), _soundDisguise.getPitch()); + getEntity().world.makeSound(getEntity(), _soundDisguise.getHurtSound(), _soundDisguise.getVolume(), _soundDisguise.getPitch()); } public Entity getEntity() { - return Entity; + return _entity.get(); } public int getEntityId() { - return Entity.getId(); + return getEntity().getId(); } protected abstract String getHurtSound(); @@ -128,13 +130,13 @@ public abstract class DisguiseBase public List<Player> getTrackedPlayers() { List<Player> players = new ArrayList<>(); - IntHashMap<EntityTrackerEntry> tracker = ((WorldServer) Entity.world).tracker.trackedEntities; - if (tracker.get(Entity.getId()) == null) + IntHashMap<EntityTrackerEntry> tracker = ((WorldServer) getEntity().world).tracker.trackedEntities; + if (tracker.get(getEntity().getId()) == null) { - System.out.println("Tracker did not contain " + Entity.getId() + " " + Entity.getCustomName() + " " + Entity.dead + " " + Entity.locX + " " + Entity.locY + " " + Entity.locZ); + System.out.println("Tracker did not contain " + getEntity().getId() + " " + getEntity().getCustomName() + " " + getEntity().dead + " " + getEntity().locX + " " + getEntity().locY + " " + getEntity().locZ); return Collections.emptyList(); } - for (EntityPlayer ep : tracker.get(Entity.getId()).trackedPlayers) + for (EntityPlayer ep : tracker.get(getEntity().getId()).trackedPlayers) { players.add(ep.getBukkitEntity()); } @@ -194,4 +196,10 @@ public abstract class DisguiseBase { return this._disguiseType; } + + public void setEntity(net.minecraft.server.v1_8_R3.Entity entity) + { + _entity.clear(); + _entity = new WeakReference<>(entity); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBlock.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBlock.java index 735ae8914..387208c51 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBlock.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBlock.java @@ -36,19 +36,19 @@ public class DisguiseBlock extends DisguiseBase public Packet getSpawnPacket() { PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(); - packet.a = Entity.getId(); - packet.b = MathHelper.floor(Entity.locX * 32.0D); - packet.c = MathHelper.floor(Entity.locY * 32.0D); - packet.d = MathHelper.floor(Entity.locZ * 32.0D); - packet.h = MathHelper.d(Entity.pitch * 256.0F / 360.0F); - packet.i = MathHelper.d(Entity.yaw * 256.0F / 360.0F); + packet.a = getEntity().getId(); + packet.b = MathHelper.floor(getEntity().locX * 32.0D); + packet.c = MathHelper.floor(getEntity().locY * 32.0D); + packet.d = MathHelper.floor(getEntity().locZ * 32.0D); + packet.h = MathHelper.d(getEntity().pitch * 256.0F / 360.0F); + packet.i = MathHelper.d(getEntity().yaw * 256.0F / 360.0F); packet.j = 70; packet.k = _blockId | _blockData << 12; - packet.uuid = Entity.getUniqueID(); + packet.uuid = getEntity().getUniqueID(); - double d1 = Entity.motX; - double d2 = Entity.motY; - double d3 = Entity.motZ; + double d1 = getEntity().motX; + double d2 = getEntity().motY; + double d3 = getEntity().motZ; double d4 = 3.9D; if (d1 < -d4) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseCreature.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseCreature.java index 2e00319f0..d477ab3bc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseCreature.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseCreature.java @@ -16,15 +16,15 @@ public abstract class DisguiseCreature extends DisguiseInsentient public Packet getSpawnPacket() { PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(); - packet.a = Entity.getId(); + packet.a = getEntity().getId(); packet.b = (byte) getDisguiseType().getTypeId(); - packet.c = (int) MathHelper.floor(Entity.locX*32D); - packet.d = (int) MathHelper.floor(Entity.locY * 32.0D); - packet.e = (int) MathHelper.floor(Entity.locZ*32D); - packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F)); - packet.j = (byte) ((int) (Entity.pitch * 256.0F / 360.0F)); - packet.k = (byte) ((int) (Entity.yaw * 256.0F / 360.0F)); - packet.uuid = Entity.getUniqueID(); + packet.c = (int) MathHelper.floor(getEntity().locX*32D); + packet.d = (int) MathHelper.floor(getEntity().locY * 32.0D); + packet.e = (int) MathHelper.floor(getEntity().locZ*32D); + packet.i = (byte) ((int) (getEntity().yaw * 256.0F / 360.0F)); + packet.j = (byte) ((int) (getEntity().pitch * 256.0F / 360.0F)); + packet.k = (byte) ((int) (getEntity().yaw * 256.0F / 360.0F)); + packet.uuid = getEntity().getUniqueID(); double var2 = 3.9D; double var4 = 0; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseEnderman.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseEnderman.java index 55964abc2..d8d9703c4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseEnderman.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseEnderman.java @@ -36,7 +36,7 @@ public class DisguiseEnderman extends DisguiseMonster { super.UpdateDataWatcher(); - DataWatcher.watch(0, Byte.valueOf((byte) (DataWatcher.getByte(0) & ~(1 << 0))), Entity.META_ENTITYDATA, + DataWatcher.watch(0, Byte.valueOf((byte) (DataWatcher.getByte(0) & ~(1 << 0))), getEntity().META_ENTITYDATA, (byte) (DataWatcher.getByte(0) & ~(1 << 0))); DataWatcher.watch(16, DataWatcher.getShort(16), EntityEnderman.META_BLOCK, getBlock(DataWatcher.getShort(16))); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseLiving.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseLiving.java index 2a1dd6ea2..dc3608873 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseLiving.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseLiving.java @@ -80,9 +80,9 @@ public abstract class DisguiseLiving extends DisguiseBase { ItemStack item = null; - if (Entity instanceof EntityLiving) + if (getEntity() instanceof EntityLiving) { - item = CraftItemStack.asBukkitCopy(((EntityLiving) Entity).getEquipment()[nmsSlot]); + item = CraftItemStack.asBukkitCopy(((EntityLiving) getEntity()).getEquipment()[nmsSlot]); } if (item == null || item.getType() == Material.AIR) @@ -111,15 +111,15 @@ public abstract class DisguiseLiving extends DisguiseBase else DataWatcher.watch(0, Byte.valueOf((byte) (b0 & ~(1 << 5))), EntityLiving.META_ENTITYDATA, (byte) (b0 & ~(1 << 5))); - if (Entity instanceof EntityLiving) + if (getEntity() instanceof EntityLiving) { - DataWatcher.watch(6, Entity.getDataWatcher().getFloat(6), EntityLiving.META_HEALTH, - Entity.getDataWatcher().getFloat(6)); - DataWatcher.watch(7, Entity.getDataWatcher().getInt(7), EntityLiving.META_POTION_COLOR, Entity.getDataWatcher() + DataWatcher.watch(6, getEntity().getDataWatcher().getFloat(6), EntityLiving.META_HEALTH, + getEntity().getDataWatcher().getFloat(6)); + DataWatcher.watch(7, getEntity().getDataWatcher().getInt(7), EntityLiving.META_POTION_COLOR, getEntity().getDataWatcher() .getInt(7)); - DataWatcher.watch(8, Entity.getDataWatcher().getByte(8), EntityLiving.META_AMBIENT_POTION, Entity.getDataWatcher() + DataWatcher.watch(8, getEntity().getDataWatcher().getByte(8), EntityLiving.META_AMBIENT_POTION, getEntity().getDataWatcher() .getByte(8) == 1); - DataWatcher.watch(9, Entity.getDataWatcher().getByte(9), EntityLiving.META_ARROWS, (int) Entity.getDataWatcher() + DataWatcher.watch(9, getEntity().getDataWatcher().getByte(9), EntityLiving.META_ARROWS, (int) getEntity().getDataWatcher() .getByte(9)); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseMagmaCube.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseMagmaCube.java index e39715d04..904835bba 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseMagmaCube.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseMagmaCube.java @@ -28,15 +28,15 @@ public class DisguiseMagmaCube extends DisguiseInsentient public Packet getSpawnPacket() { PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(); - packet.a = Entity.getId(); + packet.a = getEntity().getId(); packet.b = (byte) 62; - packet.c = (int) MathHelper.floor(Entity.locX * 32D); - packet.d = (int) MathHelper.floor(Entity.locY * 32.0D); - packet.e = (int) MathHelper.floor(Entity.locZ * 32D); - packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F)); - packet.j = (byte) ((int) (Entity.pitch * 256.0F / 360.0F)); - packet.k = (byte) ((int) (Entity.yaw * 256.0F / 360.0F)); - packet.uuid = Entity.getUniqueID(); + packet.c = (int) MathHelper.floor(getEntity().locX * 32D); + packet.d = (int) MathHelper.floor(getEntity().locY * 32.0D); + packet.e = (int) MathHelper.floor(getEntity().locZ * 32D); + packet.i = (byte) ((int) (getEntity().yaw * 256.0F / 360.0F)); + packet.j = (byte) ((int) (getEntity().pitch * 256.0F / 360.0F)); + packet.k = (byte) ((int) (getEntity().yaw * 256.0F / 360.0F)); + packet.uuid = getEntity().getUniqueID(); double var2 = 3.9D; double var4 = 0; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java index 7b45bada6..abfced0a4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java @@ -202,7 +202,7 @@ public class DisguisePlayer extends DisguiseHuman byte b0 = DataWatcher.getByte(0); - if (Entity.isSneaking()) + if (getEntity().isSneaking()) { DataWatcher.watch(0, Byte.valueOf((byte) (b0 | 1 << 1)), EntityHuman.META_ENTITYDATA, (byte) (b0 | 1 << 1)); } @@ -211,9 +211,9 @@ public class DisguisePlayer extends DisguiseHuman DataWatcher.watch(0, Byte.valueOf((byte) (b0 & ~(1 << 1))), EntityHuman.META_ENTITYDATA, (byte) (b0 & ~(1 << 1))); } - if (Entity instanceof EntityPlayer) + if (getEntity() instanceof EntityPlayer) { - EntityPlayer entityPlayer = (EntityPlayer) Entity; + EntityPlayer entityPlayer = (EntityPlayer) getEntity(); DataWatcher.watch(10, entityPlayer.getDataWatcher().getByte(10), EntityPlayer.META_SKIN, entityPlayer.getDataWatcher().getByte(10)); DataWatcher.watch(16, (byte) 0, EntityPlayer.META_CAPE, (byte) 1); @@ -224,13 +224,13 @@ public class DisguisePlayer extends DisguiseHuman public PacketPlayOutNamedEntitySpawn getSpawnPacket() { PacketPlayOutNamedEntitySpawn packet = new PacketPlayOutNamedEntitySpawn(); - packet.a = Entity.getId(); + packet.a = getEntity().getId(); packet.b = _profile.getId(); - packet.c = MathHelper.floor(Entity.locX * 32.0D); - packet.d = MathHelper.floor(Entity.locY * 32.0D); - packet.e = MathHelper.floor(Entity.locZ * 32.0D); - packet.f = (byte) ((int) ((Entity.isFakeHead() ? Entity.fakePitch : Entity.pitch) * 256.0F / 360.0F)); - packet.g = (byte) ((int) ((Entity.isFakeHead() ? Entity.fakePitch : Entity.pitch) * 256.0F / 360.0F)); + packet.c = MathHelper.floor(getEntity().locX * 32.0D); + packet.d = MathHelper.floor(getEntity().locY * 32.0D); + packet.e = MathHelper.floor(getEntity().locZ * 32.0D); + packet.f = (byte) ((int) ((getEntity().isFakeHead() ? getEntity().fakePitch : getEntity().pitch) * 256.0F / 360.0F)); + packet.g = (byte) ((int) ((getEntity().isFakeHead() ? getEntity().fakePitch : getEntity().pitch) * 256.0F / 360.0F)); packet.i = DataWatcher; return packet; @@ -253,11 +253,11 @@ public class DisguisePlayer extends DisguiseHuman @Override public void onDisguise(boolean isActive) { - if (this.Entity instanceof EntityPlayer) + if (this.getEntity() instanceof EntityPlayer) { if (_sendSkinToSelf) { - EntityPlayer entityPlayer = ((EntityPlayer) this.Entity); + EntityPlayer entityPlayer = ((EntityPlayer) this.getEntity()); // First construct the packet which will remove the previous disguise from the tab list PacketPlayOutPlayerInfo playerInfoPacketRemove = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER); @@ -285,11 +285,11 @@ public class DisguisePlayer extends DisguiseHuman @Override public void onUndisguise(boolean wasActive) { - if (this.Entity instanceof EntityPlayer) + if (this.getEntity() instanceof EntityPlayer) { if (_sendSkinToSelf) { - EntityPlayer entityPlayer = ((EntityPlayer) this.Entity); + EntityPlayer entityPlayer = ((EntityPlayer) this.getEntity()); // First construct the packet which will remove the previous disguise from the tab list PacketPlayOutPlayerInfo playerInfoPacketRemove = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER); @@ -320,9 +320,9 @@ public class DisguisePlayer extends DisguiseHuman { if (disguise instanceof DisguisePlayer) { - if (((DisguisePlayer) disguise).getSendSkinDataToSelf() && _sendSkinToSelf && this.Entity instanceof EntityPlayer) + if (((DisguisePlayer) disguise).getSendSkinDataToSelf() && _sendSkinToSelf && this.getEntity() instanceof EntityPlayer) { - EntityPlayer entityPlayer = ((EntityPlayer) this.Entity); + EntityPlayer entityPlayer = ((EntityPlayer) this.getEntity()); PacketPlayOutPlayerInfo playerInfoRemove = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER); PacketPlayOutPlayerInfo.PlayerInfoData data = playerInfoRemove.new PlayerInfoData(getSelfProfile(), entityPlayer.ping, getAppropriateGamemode(), null); @@ -338,9 +338,9 @@ public class DisguisePlayer extends DisguiseHuman { if (disguise instanceof DisguisePlayer) { - if (((DisguisePlayer) disguise).getSendSkinDataToSelf() && _sendSkinToSelf && this.Entity instanceof EntityPlayer) + if (((DisguisePlayer) disguise).getSendSkinDataToSelf() && _sendSkinToSelf && this.getEntity() instanceof EntityPlayer) { - EntityPlayer entityPlayer = ((EntityPlayer) this.Entity); + EntityPlayer entityPlayer = ((EntityPlayer) this.getEntity()); PacketPlayOutPlayerInfo playerInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER); PacketPlayOutPlayerInfo.PlayerInfoData data = playerInfoPacket.new PlayerInfoData(((DisguisePlayer) disguise)._originalProfile, entityPlayer.ping, entityPlayer.playerInteractManager.getGameMode(), null); @@ -421,9 +421,9 @@ public class DisguisePlayer extends DisguiseHuman private WorldSettings.EnumGamemode getAppropriateGamemode() { - if (Entity instanceof EntityPlayer) + if (getEntity() instanceof EntityPlayer) { - return ((EntityPlayer) Entity).playerInteractManager.getGameMode(); + return ((EntityPlayer) getEntity()).playerInteractManager.getGameMode(); } return WorldSettings.EnumGamemode.SURVIVAL; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseRabbit.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseRabbit.java index 1ebe31ae6..3facd4fe2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseRabbit.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseRabbit.java @@ -21,15 +21,15 @@ public class DisguiseRabbit extends DisguiseAnimal public Packet getSpawnPacket() { PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(); - packet.a = Entity.getId(); + packet.a = getEntity().getId(); packet.b = (byte) 101; - packet.c = (int) MathHelper.floor(Entity.locX * 32D); - packet.d = (int) MathHelper.floor(Entity.locY * 32.0D); - packet.e = (int) MathHelper.floor(Entity.locZ * 32D); - packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F)); - packet.j = (byte) ((int) (Entity.pitch * 256.0F / 360.0F)); - packet.k = (byte) ((int) (Entity.yaw * 256.0F / 360.0F)); - packet.uuid = Entity.getUniqueID(); + packet.c = (int) MathHelper.floor(getEntity().locX * 32D); + packet.d = (int) MathHelper.floor(getEntity().locY * 32.0D); + packet.e = (int) MathHelper.floor(getEntity().locZ * 32D); + packet.i = (byte) ((int) (getEntity().yaw * 256.0F / 360.0F)); + packet.j = (byte) ((int) (getEntity().pitch * 256.0F / 360.0F)); + packet.k = (byte) ((int) (getEntity().yaw * 256.0F / 360.0F)); + packet.uuid = getEntity().getUniqueID(); double var2 = 3.9D; double var4 = 0; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSlime.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSlime.java index a9f0b44f5..96bb78cd9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSlime.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSlime.java @@ -28,15 +28,15 @@ public class DisguiseSlime extends DisguiseInsentient public Packet getSpawnPacket() { PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(); - packet.a = Entity.getId(); + packet.a = getEntity().getId(); packet.b = (byte) 55; - packet.c = (int) MathHelper.floor(Entity.locX * 32D); - packet.d = (int) MathHelper.floor(Entity.locY * 32.0D); - packet.e = (int) MathHelper.floor(Entity.locZ * 32D); - packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F)); - packet.j = (byte) ((int) (Entity.pitch * 256.0F / 360.0F)); - packet.k = (byte) ((int) (Entity.yaw * 256.0F / 360.0F)); - packet.uuid = Entity.getUniqueID(); + packet.c = (int) MathHelper.floor(getEntity().locX * 32D); + packet.d = (int) MathHelper.floor(getEntity().locY * 32.0D); + packet.e = (int) MathHelper.floor(getEntity().locZ * 32D); + packet.i = (byte) ((int) (getEntity().yaw * 256.0F / 360.0F)); + packet.j = (byte) ((int) (getEntity().pitch * 256.0F / 360.0F)); + packet.k = (byte) ((int) (getEntity().yaw * 256.0F / 360.0F)); + packet.uuid = getEntity().getUniqueID(); double var2 = 3.9D; double var4 = 0; From 6f80e2137218842faef631b841d55ba7903c037f Mon Sep 17 00:00:00 2001 From: samczsun <github@samczsun.com> Date: Sat, 1 Oct 2016 21:51:09 -0400 Subject: [PATCH 087/147] Fix memory leak in carl, server --- .../bonuses/animations/AnimationCarl.java | 1 + .../src/mineplex/core/memory/MemoryFix.java | 145 ++++++++++++++++-- 2 files changed, 136 insertions(+), 10 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/animations/AnimationCarl.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/animations/AnimationCarl.java index 6c966aedf..5e2fb892a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/animations/AnimationCarl.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/animations/AnimationCarl.java @@ -158,6 +158,7 @@ public class AnimationCarl extends Animation @Override protected void onFinish() { _isDone = true; + _player = null; setTicks(0); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/memory/MemoryFix.java b/Plugins/Mineplex.Core/src/mineplex/core/memory/MemoryFix.java index 90eab086c..5ac6c423f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/memory/MemoryFix.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/memory/MemoryFix.java @@ -10,10 +10,13 @@ import mineplex.core.MiniPlugin; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import net.minecraft.server.v1_8_R3.CraftingManager; -import net.minecraft.server.v1_8_R3.Enchantment; import net.minecraft.server.v1_8_R3.EnchantmentManager; +import net.minecraft.server.v1_8_R3.EntityInsentient; import net.minecraft.server.v1_8_R3.IInventory; +import net.minecraft.server.v1_8_R3.PathfinderGoal; +import net.minecraft.server.v1_8_R3.PathfinderGoalNearestAttackableTarget; +import net.minecraft.server.v1_8_R3.PathfinderGoalSelector; import net.minecraft.server.v1_8_R3.WorldServer; import org.bukkit.Bukkit; import org.bukkit.World; @@ -22,7 +25,6 @@ import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Entity; import org.bukkit.entity.HumanEntity; -import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageByBlockEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; @@ -52,8 +54,7 @@ public class MemoryFix extends MiniPlugin // Sanity check if (worlds.size() != worldList.size()) throw new RuntimeException("Error: Duplicated worlds?!?!"); - - + for (World world : worlds) { WorldServer worldServer = ((CraftWorld) world).getHandle(); @@ -96,15 +97,139 @@ public class MemoryFix extends MiniPlugin } } + private static Field PATHFINDER_GOAL_SELECTOR_B; + private static boolean PATHFINDER_GOAL_SELECTOR_B_SUCCESSFUL; + + private static Field PATHFINDER_GOAL_SELECTOR_C; + private static boolean PATHFINDER_GOAL_SELECTOR_C_SUCCESSFUL; + + private static Field PATHFINDER_GOAL_SELECTOR_ITEM_A; + private static boolean PATHFINDER_GOAL_SELECTOR_ITEM_A_SUCCESSFUL; + + private static Field PATHFINDER_GOAL_NEAREST_ATTACKABLE_TARGET_D; + private static boolean PATHFINDER_GOAL_NEAREST_ATTACKABLE_TARGET_D_SUCCESSFUL; + + static + { + try + { + PATHFINDER_GOAL_SELECTOR_ITEM_A = Class.forName(PathfinderGoalSelector.class.getName() + "$PathfinderGoalSelectorItem").getDeclaredField("a"); + PATHFINDER_GOAL_SELECTOR_ITEM_A.setAccessible(true); + PATHFINDER_GOAL_SELECTOR_ITEM_A_SUCCESSFUL = true; + } + catch (ReflectiveOperationException e) + { + e.printStackTrace(); + } + try + { + PATHFINDER_GOAL_SELECTOR_B = PathfinderGoalSelector.class.getDeclaredField("b"); + PATHFINDER_GOAL_SELECTOR_B.setAccessible(true); + PATHFINDER_GOAL_SELECTOR_B_SUCCESSFUL = true; + } + catch (ReflectiveOperationException e) + { + e.printStackTrace(); + } + try + { + PATHFINDER_GOAL_SELECTOR_C = PathfinderGoalSelector.class.getDeclaredField("c"); + PATHFINDER_GOAL_SELECTOR_C.setAccessible(true); + PATHFINDER_GOAL_SELECTOR_C_SUCCESSFUL = true; + } + catch (ReflectiveOperationException e) + { + e.printStackTrace(); + } + try + { + PATHFINDER_GOAL_NEAREST_ATTACKABLE_TARGET_D = PathfinderGoalNearestAttackableTarget.class.getDeclaredField("d"); + PATHFINDER_GOAL_NEAREST_ATTACKABLE_TARGET_D.setAccessible(true); + PATHFINDER_GOAL_NEAREST_ATTACKABLE_TARGET_D_SUCCESSFUL = true; + } + catch (ReflectiveOperationException e) + { + e.printStackTrace(); + } + } + + @SuppressWarnings("unchecked") + @EventHandler + public void fixPathfinderGoalLeaks(UpdateEvent event) + { + if (event.getType() != UpdateType.SLOW) + return; + + List<World> worldList = Bukkit.getWorlds(); + Set<World> worlds = new HashSet<>(worldList); + + // Sanity check + if (worlds.size() != worldList.size()) + throw new RuntimeException("Error: Duplicated worlds?!?!"); + + for (World world : worlds) + { + WorldServer worldServer = ((CraftWorld) world).getHandle(); + + for (net.minecraft.server.v1_8_R3.Entity nmsentity : worldServer.entityList) + { + if (nmsentity instanceof EntityInsentient) + { + EntityInsentient ei = (EntityInsentient) nmsentity; + if (PATHFINDER_GOAL_SELECTOR_ITEM_A_SUCCESSFUL) + { + if (PATHFINDER_GOAL_SELECTOR_B_SUCCESSFUL) + { + try + { + PathfinderGoalSelector targetSelector = ei.targetSelector; + List<Object> list = (List<Object>) PATHFINDER_GOAL_SELECTOR_B.get(targetSelector); + for (Object object : list) + { + try + { + PathfinderGoal goal = (PathfinderGoal) PATHFINDER_GOAL_SELECTOR_ITEM_A.get(object); + if (goal instanceof PathfinderGoalNearestAttackableTarget && PATHFINDER_GOAL_NEAREST_ATTACKABLE_TARGET_D_SUCCESSFUL) + { + net.minecraft.server.v1_8_R3.Entity original = (net.minecraft.server.v1_8_R3.Entity) PATHFINDER_GOAL_NEAREST_ATTACKABLE_TARGET_D.get(goal); + boolean shouldClear = false; + + if (original != null) + { + if (!original.valid) + shouldClear = true; + } + + if (shouldClear) + PATHFINDER_GOAL_NEAREST_ATTACKABLE_TARGET_D.set(goal, null); + } + } + catch (ReflectiveOperationException ex) + { + ex.printStackTrace(); + } + } + } + catch (ReflectiveOperationException e) + { + e.printStackTrace(); + } + } + } + } + } + } + } + private static Object ENCHANTMENTMANAGER_D; private static Field ENCHANTMENT_MODIFIER_THORNS_A; private static Field ENCHANTMENT_MODIFIER_THORNS_B; - private static boolean ENCHANTMENTMANAGER_D_SUCCESFUL; + private static boolean ENCHANTMENTMANAGER_D_SUCCESSFUL; private static Object ENCHANTMENTMANAGER_E; private static Field ENCHANTMENT_MODIFIER_ARTHROPODS_A; private static Field ENCHANTMENT_MODIFIER_ARTHROPODS_B; - private static boolean ENCHANTMENTMANAGER_E_SUCCESFUL; + private static boolean ENCHANTMENTMANAGER_E_SUCCESSFUL; static { @@ -117,7 +242,7 @@ public class MemoryFix extends MiniPlugin ENCHANTMENT_MODIFIER_THORNS_A.setAccessible(true); ENCHANTMENT_MODIFIER_THORNS_B = ENCHANTMENTMANAGER_D.getClass().getDeclaredField("b"); ENCHANTMENT_MODIFIER_THORNS_B.setAccessible(true); - ENCHANTMENTMANAGER_D_SUCCESFUL = true; + ENCHANTMENTMANAGER_D_SUCCESSFUL = true; } catch (ReflectiveOperationException e) { @@ -132,7 +257,7 @@ public class MemoryFix extends MiniPlugin ENCHANTMENT_MODIFIER_ARTHROPODS_A.setAccessible(true); ENCHANTMENT_MODIFIER_ARTHROPODS_B = ENCHANTMENTMANAGER_E.getClass().getDeclaredField("b"); ENCHANTMENT_MODIFIER_ARTHROPODS_B.setAccessible(true); - ENCHANTMENTMANAGER_E_SUCCESFUL = true; + ENCHANTMENTMANAGER_E_SUCCESSFUL = true; } catch (ReflectiveOperationException e) { @@ -146,7 +271,7 @@ public class MemoryFix extends MiniPlugin if (event.getType() != UpdateType.SLOW) return; - if (ENCHANTMENTMANAGER_D_SUCCESFUL) + if (ENCHANTMENTMANAGER_D_SUCCESSFUL) { try { @@ -165,7 +290,7 @@ public class MemoryFix extends MiniPlugin } } - if (ENCHANTMENTMANAGER_E_SUCCESFUL) + if (ENCHANTMENTMANAGER_E_SUCCESSFUL) { try { From 19eeae7f7f7ead02e60e587ad22d66e00673e8f1 Mon Sep 17 00:00:00 2001 From: samczsun <github@samczsun.com> Date: Sun, 2 Oct 2016 12:14:21 -0400 Subject: [PATCH 088/147] Fix memory leak in ParticleFoot --- .../gadget/gadgets/particle/shadow/ParticleFoot.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/shadow/ParticleFoot.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/shadow/ParticleFoot.java index e44905184..9c3b8be54 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/shadow/ParticleFoot.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/shadow/ParticleFoot.java @@ -50,8 +50,6 @@ public class ParticleFoot extends ParticleGadget _foot = !_foot; - cleanSteps(); - if (!Manager.isMoving(player)) return; if (!UtilEnt.isGrounded(player)) return; @@ -85,6 +83,15 @@ public class ParticleFoot extends ParticleGadget UtilServer.getPlayers()); } + @EventHandler + public void cleanup(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTEST) + return; + + cleanSteps(); + } + public void cleanSteps() { if (_steps.isEmpty()) return; From a59dde44c62d92660061736361c8fd15202010ca Mon Sep 17 00:00:00 2001 From: samczsun <github@samczsun.com> Date: Sun, 2 Oct 2016 14:26:48 -0400 Subject: [PATCH 089/147] Remove recharge data on quit instead of later --- .../src/mineplex/core/recharge/Recharge.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/recharge/Recharge.java b/Plugins/Mineplex.Core/src/mineplex/core/recharge/Recharge.java index e9d4e2e63..6422651d6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/recharge/Recharge.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/recharge/Recharge.java @@ -243,13 +243,7 @@ public class Recharge extends MiniPlugin @EventHandler public void clearPlayer(final ClientUnloadEvent event) { - UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable() { - public void run() - { - _recharge.remove(event.GetName()); - } - } - , 20 * 60 * 2); // Retain info for 2 minutes + _recharge.remove(event.GetName()); } public void setDisplayForce(Player player, String ability, boolean displayForce) From 2b6d7a4d7ab051a371e676b3434079e3c16b10d2 Mon Sep 17 00:00:00 2001 From: samczsun <github@samczsun.com> Date: Sun, 2 Oct 2016 14:54:36 -0400 Subject: [PATCH 090/147] Fix memory leak in ParticleFairy --- .../core/gadget/gadgets/particle/ParticleFairy.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFairy.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFairy.java index 2116e7604..452410209 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFairy.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFairy.java @@ -32,7 +32,18 @@ public class ParticleFairy extends ParticleGadget // Create if (!_fairy.containsKey(player)) _fairy.put(player, new ParticleFairyData(player)); - _fairy.get(player).Update(); + ParticleFairyData data = _fairy.get(player); + + if (!data.Fairy.getWorld().equals(player.getWorld())) + { + data.Fairy = null; + data.Player = null; + data.Target = null; + data = new ParticleFairyData(player); + _fairy.put(player, data); + } + + data.Update(); } @Override From 25d6a4239ecb1ed3083c8eb7e2fb3781cd5f9871 Mon Sep 17 00:00:00 2001 From: samczsun <github@samczsun.com> Date: Sun, 2 Oct 2016 17:43:37 -0400 Subject: [PATCH 091/147] Fix memory leak in StatsManager, CombatManager --- .../src/mineplex/core/stats/StatsManager.java | 58 ++++++++++--------- .../game/core/combat/CombatManager.java | 50 ++++++---------- 2 files changed, 47 insertions(+), 61 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java index 6d6094c31..8b52886cb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java @@ -5,6 +5,8 @@ import java.sql.SQLException; import java.util.Iterator; import java.util.UUID; +import mineplex.cache.player.PlayerInfo; +import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerJoinEvent; @@ -22,13 +24,13 @@ import mineplex.core.stats.event.StatChangeEvent; public class StatsManager extends MiniDbClientPlugin<PlayerStats> { - private static Object _statSync = new Object(); + private static final Object _statSync = new Object(); private StatsRepository _repository; private NautHashMap<String, Integer> _stats = new NautHashMap<String, Integer>(); - private NautHashMap<Player, NautHashMap<String, Long>> _statUploadQueue = new NautHashMap<Player, NautHashMap<String, Long>>(); - private NautHashMap<Player, NautHashMap<String, Long>> _statUploadQueueOverRidable = new NautHashMap<Player, NautHashMap<String, Long>>(); + private NautHashMap<UUID, NautHashMap<String, Long>> _statUploadQueue = new NautHashMap<>(); + private NautHashMap<UUID, NautHashMap<String, Long>> _statUploadQueueOverRidable = new NautHashMap<>(); private Runnable _saveRunnable; @@ -122,13 +124,13 @@ public class StatsManager extends MiniDbClientPlugin<PlayerStats> { synchronized (_statSync) { - if (!_statUploadQueueOverRidable.containsKey(player)) - _statUploadQueueOverRidable.put(player, new NautHashMap<String, Long>()); + if (!_statUploadQueueOverRidable.containsKey(player.getUniqueId())) + _statUploadQueueOverRidable.put(player.getUniqueId(), new NautHashMap<String, Long>()); - if (!_statUploadQueueOverRidable.get(player).containsKey(statName)) - _statUploadQueueOverRidable.get(player).put(statName, 0L); + if (!_statUploadQueueOverRidable.get(player.getUniqueId()).containsKey(statName)) + _statUploadQueueOverRidable.get(player.getUniqueId()).put(statName, 0L); - _statUploadQueueOverRidable.get(player).put(statName, _statUploadQueueOverRidable.get(player).get(statName) + value); + _statUploadQueueOverRidable.get(player.getUniqueId()).put(statName, _statUploadQueueOverRidable.get(player.getUniqueId()).get(statName) + value); } } @@ -143,24 +145,24 @@ public class StatsManager extends MiniDbClientPlugin<PlayerStats> synchronized (_statSync) { - for (Iterator<Player> statIterator = _statUploadQueueOverRidable.keySet().iterator(); statIterator.hasNext();) + for (Iterator<UUID> statIterator = _statUploadQueueOverRidable.keySet().iterator(); statIterator.hasNext();) { - Player player = statIterator.next(); + UUID player = statIterator.next(); - if (player.isOnline()) + if (Bukkit.getPlayer(player) != null) continue; try { - int uploadKey = PlayerCache.getInstance().getPlayer(player.getUniqueId()).getAccountId(); + PlayerInfo info = PlayerCache.getInstance().getPlayer(player); - uploadQueue.put(uploadKey, new NautHashMap<Integer, Long>()); + uploadQueue.put(info.getAccountId(), new NautHashMap<>()); for (String statName : _statUploadQueueOverRidable.get(player).keySet()) { int statId = _stats.get(statName); - uploadQueue.get(uploadKey).put(statId, _statUploadQueueOverRidable.get(player).get(statName)); - System.out.println(player.getName() + " saving stat : " + statName + " overriding " + _statUploadQueueOverRidable.get(player).get(statName)); + uploadQueue.get(info.getAccountId()).put(statId, _statUploadQueueOverRidable.get(player).get(statName)); + System.out.println(info.getName() + " saving stat : " + statName + " overriding " + _statUploadQueueOverRidable.get(player).get(statName)); } statIterator.remove(); @@ -184,13 +186,13 @@ public class StatsManager extends MiniDbClientPlugin<PlayerStats> { synchronized (_statSync) { - if (!_statUploadQueue.containsKey(player)) - _statUploadQueue.put(player, new NautHashMap<String, Long>()); + if (!_statUploadQueue.containsKey(player.getUniqueId())) + _statUploadQueue.put(player.getUniqueId(), new NautHashMap<String, Long>()); - if (!_statUploadQueue.get(player).containsKey(statName)) - _statUploadQueue.get(player).put(statName, 0L); + if (!_statUploadQueue.get(player.getUniqueId()).containsKey(statName)) + _statUploadQueue.get(player.getUniqueId()).put(statName, 0L); - _statUploadQueue.get(player).put(statName, _statUploadQueue.get(player).get(statName) + value); + _statUploadQueue.get(player.getUniqueId()).put(statName, _statUploadQueue.get(player.getUniqueId()).get(statName) + value); } } @@ -205,24 +207,24 @@ public class StatsManager extends MiniDbClientPlugin<PlayerStats> synchronized (_statSync) { - for (Iterator<Player> statIterator = _statUploadQueue.keySet().iterator(); statIterator.hasNext();) + for (Iterator<UUID> statIterator = _statUploadQueue.keySet().iterator(); statIterator.hasNext();) { - Player player = statIterator.next(); - - if (player.isOnline()) + UUID player = statIterator.next(); + + if (Bukkit.getPlayer(player) != null) continue; try { - int uploadKey = PlayerCache.getInstance().getPlayer(player.getUniqueId()).getAccountId(); + PlayerInfo info = PlayerCache.getInstance().getPlayer(player); - uploadQueue.put(uploadKey, new NautHashMap<Integer, Long>()); + uploadQueue.put(info.getAccountId(), new NautHashMap<Integer, Long>()); for (String statName : _statUploadQueue.get(player).keySet()) { int statId = _stats.get(statName); - uploadQueue.get(uploadKey).put(statId, _statUploadQueue.get(player).get(statName)); - System.out.println(player.getName() + " saving stat : " + statName + " adding " + _statUploadQueue.get(player).get(statName)); + uploadQueue.get(info.getAccountId()).put(statId, _statUploadQueue.get(player).get(statName)); + System.out.println(info.getName() + " saving stat : " + statName + " adding " + _statUploadQueue.get(player).get(statName)); } statIterator.remove(); diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java index 24a848c3e..b6591802f 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java @@ -6,6 +6,7 @@ import java.util.Iterator; import java.util.Map; import java.util.UUID; +import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; import org.bukkit.entity.Arrow; @@ -46,10 +47,10 @@ public class CombatManager extends MiniPlugin DefaultWeaponName } - private NautHashMap<Player, CombatLog> _active = new NautHashMap<Player, CombatLog>(); + private NautHashMap<UUID, CombatLog> _active = new NautHashMap<>(); private Map<UUID, ClientCombat> _combatClients = new HashMap<>(); - private HashSet<Player> _removeList = new HashSet<Player>(); + private HashSet<UUID> _removeList = new HashSet<>(); protected long ExpireTime = 15000; @@ -63,7 +64,7 @@ public class CombatManager extends MiniPlugin @EventHandler public void UnloadDonor(ClientUnloadEvent event) { - _combatClients.remove(event.GetName()); + _combatClients.remove(event.getUniqueId()); } public ClientCombat Get(UUID uuid) @@ -419,10 +420,10 @@ public class CombatManager extends MiniPlugin { event.setDeathMessage(null); - if (!_active.containsKey(event.getEntity())) + if (!_active.containsKey(event.getEntity().getUniqueId())) return; - CombatLog log = _active.remove(event.getEntity()); + CombatLog log = _active.remove(event.getEntity().getUniqueId()); log.SetDeathTime(System.currentTimeMillis()); // Save Death @@ -592,24 +593,24 @@ public class CombatManager extends MiniPlugin public void Add(Player player) { - _active.put(player, new CombatLog(player, 15000)); + _active.put(player.getUniqueId(), new CombatLog(player, 15000)); } @EventHandler(priority = EventPriority.HIGHEST) public void Clear(ClearCombatEvent event) { - _active.remove(event.GetPlayer()); + _active.remove(event.GetPlayer().getUniqueId()); } public CombatLog Get(Player player) { - if (!_active.containsKey(player)) + if (!_active.containsKey(player.getUniqueId())) { Add(player); } - return _active.get(player); + return _active.get(player.getUniqueId()); } public long GetExpireTime() @@ -623,44 +624,27 @@ public class CombatManager extends MiniPlugin if (event.getType() == UpdateType.MIN_02) { // Remove already marked inactives if still offline - Iterator<Player> removeIterator = _removeList.iterator(); + Iterator<UUID> removeIterator = _removeList.iterator(); while (removeIterator.hasNext()) { - Player player = removeIterator.next(); + UUID uuid = removeIterator.next(); + Player player = Bukkit.getPlayer(uuid); - if (!player.isOnline()) - _active.remove(player); + if (player == null) + _active.remove(uuid); removeIterator.remove(); } // Mark inactives for cleanup next go around - for (Player player : _active.keySet()) + for (UUID player : _active.keySet()) { - if (!player.isOnline()) + if (Bukkit.getPlayer(player) == null) _removeList.add(player); } } } - - public void DebugInfo(Player player) - { - StringBuilder nameBuilder = new StringBuilder(); - - for (Player combats : _active.keySet()) - { - if (!combats.isOnline()) - { - if (nameBuilder.length() != 0) - nameBuilder.append(", "); - - nameBuilder.append(combats.getName()); - } - } - - player.sendMessage(F.main(getName(), nameBuilder.toString())); - } public void setUseWeaponName(AttackReason var) { From bcb56c50f5d98275fb871885f7131eedb5858f8d Mon Sep 17 00:00:00 2001 From: samczsun <github@samczsun.com> Date: Mon, 3 Oct 2016 22:03:22 -0400 Subject: [PATCH 092/147] Fix memory leak in AntiHackGuardian --- .../src/mineplex/core/antihack/AntiHackGuardian.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHackGuardian.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHackGuardian.java index 8535483a9..9cff0ce43 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHackGuardian.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHackGuardian.java @@ -376,9 +376,13 @@ public class AntiHackGuardian implements Listener public void remove() { - this._armorStand.remove(); this._target = null; + UtilServer.Unregister(this); Managers.get(DisguiseManager.class).undisguise(this._disguise); + this._armorStand.remove(); + this._nmsEntity = null; + this._armorStand = null; + this._center = null; } public ArmorStand getEntity() From 09fe7b736a53bf90994903d04b5a6d7dc5c66376 Mon Sep 17 00:00:00 2001 From: samczsun <github@samczsun.com> Date: Mon, 3 Oct 2016 22:06:36 -0400 Subject: [PATCH 093/147] Don't enable debugging --- .../Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java | 4 +++- .../src/mineplex/staffServer/StaffServer.java | 4 +++- .../src/nautilus/game/arcade/Arcade.java | 6 ++++-- .../src/mineplex/mavericks/review/Hub.java | 4 +++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java index 7956c676a..5ff84a246 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java @@ -65,6 +65,7 @@ import org.bukkit.Material; import org.bukkit.World; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.plugin.java.JavaPlugin; +import org.spigotmc.SpigotConfig; import static mineplex.core.Managers.require; @@ -265,7 +266,8 @@ public class Clans extends JavaPlugin //Updates new Updater(this); - MinecraftServer.getServer().getPropertyManager().setProperty("debug", true); + MinecraftServer.getServer().getPropertyManager().setProperty("debug", false); + SpigotConfig.debug = false; } public static String prettifyName(Material material) diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java index 44251149e..5d84a00fd 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java @@ -31,6 +31,7 @@ import net.minecraft.server.v1_8_R3.MinecraftServer; import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.plugin.java.JavaPlugin; +import org.spigotmc.SpigotConfig; import java.util.UUID; @@ -80,7 +81,8 @@ public class StaffServer extends JavaPlugin //Updates getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1); - MinecraftServer.getServer().getPropertyManager().setProperty("debug", true); + MinecraftServer.getServer().getPropertyManager().setProperty("debug", false); + SpigotConfig.debug = false; Bukkit.getWorlds().get(0).setSpawnLocation(0, 102, 0); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java index a47fc844e..2a9f9b518 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java @@ -71,6 +71,7 @@ import net.minecraft.server.v1_8_R3.MinecraftServer; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; +import org.spigotmc.SpigotConfig; import java.io.File; import java.util.HashMap; @@ -197,8 +198,9 @@ public class Arcade extends JavaPlugin //Updates getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1); - - MinecraftServer.getServer().getPropertyManager().setProperty("debug", true); + + MinecraftServer.getServer().getPropertyManager().setProperty("debug", false); + SpigotConfig.debug = false; // Remove nasty biomes from natural terrain generation, used for UHC BiomeBase.getBiomes()[BiomeBase.OCEAN.id] = BiomeBase.PLAINS; diff --git a/Plugins/mavericks-review-hub/src/mineplex/mavericks/review/Hub.java b/Plugins/mavericks-review-hub/src/mineplex/mavericks/review/Hub.java index e9ab99136..632be718e 100644 --- a/Plugins/mavericks-review-hub/src/mineplex/mavericks/review/Hub.java +++ b/Plugins/mavericks-review-hub/src/mineplex/mavericks/review/Hub.java @@ -51,6 +51,7 @@ import mineplex.core.updater.Updater; import mineplex.core.velocity.VelocityFix; import mineplex.core.visibility.VisibilityManager; import net.minecraft.server.v1_8_R3.MinecraftServer; +import org.spigotmc.SpigotConfig; import static mineplex.core.Managers.require; @@ -156,7 +157,8 @@ public class Hub extends JavaPlugin // Updates getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1); - MinecraftServer.getServer().getPropertyManager().setProperty("debug", true); + MinecraftServer.getServer().getPropertyManager().setProperty("debug", false); + SpigotConfig.debug = false; } } From d2c0b34459a4cdb919e850a49594f32441b5a1d6 Mon Sep 17 00:00:00 2001 From: samczsun <github@samczsun.com> Date: Tue, 4 Oct 2016 19:43:14 -0400 Subject: [PATCH 094/147] PlayerMap --- .../mineplex/core/common/util/PlayerMap.java | 233 ++++++++++++++++++ 1 file changed, 233 insertions(+) create mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/PlayerMap.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/PlayerMap.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/PlayerMap.java new file mode 100644 index 000000000..426d2fd20 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/PlayerMap.java @@ -0,0 +1,233 @@ +package mineplex.core.common.util; + +import com.google.common.collect.Sets; +import org.apache.commons.lang3.Validate; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerQuitEvent; + +import javax.annotation.Nonnull; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.WeakHashMap; +import java.util.concurrent.ConcurrentHashMap; + +public class PlayerMap<V> implements Map<UUID, V> +{ + private static final Object LOCK = new Object(); + + private static final RemovalListener REMOVAL_LISTENER = new RemovalListener(); + private static final Set<PlayerMap<?>> ALL_PLAYER_MAPS = Sets.newSetFromMap(new WeakHashMap<>()); + + static + { + UtilServer.RegisterEvents(REMOVAL_LISTENER); + } + + private final Map<UUID, V> _backingMap; + + private PlayerMap(Map<UUID, V> backingMap) + { + this._backingMap = backingMap; + + synchronized (LOCK) + { + ALL_PLAYER_MAPS.add(this); + } + } + + public static <V> PlayerMap<V> newMap() + { + return new PlayerMap<>(new HashMap<>()); + } + + public static <V> PlayerMap<V> newConcurrentMap() + { + return new PlayerMap<>(new ConcurrentHashMap<>()); + } + + @Override + public int size() + { + return _backingMap.size(); + } + + @Override + public boolean isEmpty() + { + return _backingMap.isEmpty(); + } + + @Override + @Deprecated + public boolean containsKey(Object key) + { + Validate.notNull(key, "Key cannot be null"); + if (key instanceof Player) + { + return containsKey((Player) key); + } + else if (key instanceof UUID) + { + return containsKey((UUID) key); + } + throw new UnsupportedOperationException("Unknown key type: " + key.getClass().getName()); + } + + public boolean containsKey(Player key) + { + Validate.notNull(key, "Player cannot be null"); + return _backingMap.containsKey(key.getUniqueId()); + } + + public boolean containsKey(UUID key) + { + return _backingMap.containsKey(key); + } + + @Override + public boolean containsValue(Object value) + { + return _backingMap.containsValue(value); + } + + @Override + @Deprecated + public V get(Object key) + { + Validate.notNull(key, "Key cannot be null"); + if (key instanceof Player) + { + return get((Player) key); + } + else if (key instanceof UUID) + { + return get((UUID) key); + } + throw new UnsupportedOperationException("Unknown key type: " + key.getClass().getName()); + } + + public V get(Player key) + { + return _backingMap.get(key.getUniqueId()); + } + + public V get(UUID key) + { + return _backingMap.get(key); + } + + @Override + public V put(UUID key, V value) + { + return _backingMap.put(key, value); + } + + public V put(Player key, V value) + { + Validate.notNull(key, "Player cannot be null"); + return put(key.getUniqueId(), value); + } + + @Override + @Deprecated + public V remove(Object key) + { + Validate.notNull(key, "Key cannot be null"); + if (key instanceof Player) + { + return remove((Player) key); + } + else if (key instanceof UUID) + { + return remove((UUID) key); + } + throw new UnsupportedOperationException("Unknown key type: " + key.getClass().getName()); + } + + public V remove(Player key) + { + return _backingMap.remove(key.getUniqueId()); + } + + public V remove(UUID key) + { + return _backingMap.remove(key); + } + + @Override + public void putAll(@Nonnull Map<? extends UUID, ? extends V> m) + { + _backingMap.putAll(m); + } + + @Override + public void clear() + { + _backingMap.clear(); + } + + @Override + @Nonnull + public Set<UUID> keySet() + { + return _backingMap.keySet(); + } + + @Override + @Nonnull + public Collection<V> values() + { + return _backingMap.values(); + } + + @Override + @Nonnull + public Set<Entry<UUID, V>> entrySet() + { + return _backingMap.entrySet(); + } + + @Override + public String toString() + { + return _backingMap.toString(); + } + + @Override + public boolean equals(Object o) + { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + PlayerMap<?> playerMap = (PlayerMap<?>) o; + + return _backingMap.equals(playerMap._backingMap); + + } + + @Override + public int hashCode() + { + return _backingMap.hashCode(); + } + + private static class RemovalListener implements Listener + { + @EventHandler + public void onQuit(PlayerQuitEvent event) + { + synchronized (LOCK) + { + for (PlayerMap<?> map : ALL_PLAYER_MAPS) + { + map.remove(event.getPlayer()); + } + } + } + } +} From 5168044be50d1a622a52d0a9fc0f84d11aa21bbe Mon Sep 17 00:00:00 2001 From: samczsun <github@samczsun.com> Date: Mon, 10 Oct 2016 00:14:30 -0400 Subject: [PATCH 095/147] Fix memory leak in WinEffectHalloween --- .../core/gadget/gadgets/wineffect/WinEffectHalloween.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectHalloween.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectHalloween.java index 038495d65..ffd1e29be 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectHalloween.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectHalloween.java @@ -26,7 +26,6 @@ public class WinEffectHalloween extends WinEffectGadget { private DisguisePlayer _npc; - private Skeleton _skeleton; private List<DisguisePlayer> _disguisePlayers = new ArrayList<>(); private int _tick; @@ -68,8 +67,6 @@ public class WinEffectHalloween extends WinEffectGadget _nonTeam.forEach(p -> UtilPlayer.showForAll(p)); _disguisePlayers.forEach(d -> d.getEntity().getBukkitEntity().remove()); _disguisePlayers.clear(); - _skeleton.remove(); - _skeleton = null; } @EventHandler From 2ed03147b056bf029c69299adf4426f199828275 Mon Sep 17 00:00:00 2001 From: samczsun <github@samczsun.com> Date: Mon, 10 Oct 2016 00:15:01 -0400 Subject: [PATCH 096/147] Make WinEffectGadget clean up even if exceptions occur --- .../core/gadget/types/WinEffectGadget.java | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java index e2857ec77..0ab922d9d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java @@ -94,21 +94,27 @@ public abstract class WinEffectGadget extends Gadget public void runFinish() { - finish(); - _player = null; - _baseLocation = null; - _team.clear(); - _team = null; - _nonTeam.clear(); - _nonTeam = null; - _other.clear(); - _other = null; - _allPlayers.clear(); - _allPlayers = null; - // Loads gadgets back when players are teleported to the arcade hub, after the win effect - for (Player player : UtilServer.getPlayers()) + try { - Manager.getUserGadgetPersistence().load(player); + finish(); + } + finally + { + _player = null; + _baseLocation = null; + _team.clear(); + _team = null; + _nonTeam.clear(); + _nonTeam = null; + _other.clear(); + _other = null; + _allPlayers.clear(); + _allPlayers = null; + // Loads gadgets back when players are teleported to the arcade hub, after the win effect + for (Player player : UtilServer.getPlayers()) + { + Manager.getUserGadgetPersistence().load(player); + } } } From 38ef65c32eee2323bb29a358a1bda6e6765f406f Mon Sep 17 00:00:00 2001 From: samczsun <github@samczsun.com> Date: Mon, 10 Oct 2016 00:21:43 -0400 Subject: [PATCH 097/147] Fix memory leak in ItemSnowball --- .../core/gadget/gadgets/item/ItemSnowball.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemSnowball.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemSnowball.java index eeaf89b60..fd6e988e8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemSnowball.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemSnowball.java @@ -16,6 +16,8 @@ import mineplex.core.common.util.UtilText; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.gadgets.Ammo; import mineplex.core.gadget.types.ItemGadget; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; public class ItemSnowball extends ItemGadget { @@ -59,4 +61,12 @@ public class ItemSnowball extends ItemGadget event.getDamager().getWorld().playSound(event.getDamager().getLocation(), Sound.STEP_SNOW, 1, 0.5f); } + @EventHandler + public void cleanup(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + _snowballs.entrySet().removeIf(ent -> !ent.getKey().isValid()); + } } From bafad1189b31f2501973f6acb581c1ba9c3379dc Mon Sep 17 00:00:00 2001 From: samczsun <github@samczsun.com> Date: Thu, 13 Oct 2016 20:35:45 -0400 Subject: [PATCH 098/147] ProgressingKitManager: Temporarily add finally --- .../managers/ProgressingKitManager.java | 33 ++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ProgressingKitManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ProgressingKitManager.java index 325b54462..db0a72789 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ProgressingKitManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ProgressingKitManager.java @@ -149,21 +149,32 @@ public class ProgressingKitManager implements Listener @EventHandler public void onQuit(PlayerQuitEvent event) { - //Fail safe updating in case a player leaves the game before we do data - Player player = event.getPlayer(); - - PlayerKit playerKit = _manager.getKitProgressionManager().getDataManager().get(player.getUniqueId()); - for (Kit kit : _manager.GetGame().GetKits()) + try { - if (kit instanceof ProgressingKit) + //Fail safe updating in case a player leaves the game before we do data + Player player = event.getPlayer(); + + PlayerKit playerKit = _manager.getKitProgressionManager().getDataManager().get(player.getUniqueId()); + try { - ProgressingKit progressingKit = (ProgressingKit) kit; - _manager.getKitProgressionManager().getRepository().insertOrUpdate(playerKit, progressingKit.getInternalName()); + for (Kit kit : _manager.GetGame().GetKits()) + { + if (kit instanceof ProgressingKit) + { + ProgressingKit progressingKit = (ProgressingKit) kit; + _manager.getKitProgressionManager().getRepository().insertOrUpdate(playerKit, progressingKit.getInternalName()); + } + } + } + finally + { + _manager.getKitProgressionManager().getDataManager().remove(playerKit); } } - _manager.getKitProgressionManager().getDataManager().remove(playerKit); - - _data.remove(event.getPlayer().getUniqueId()); + finally + { + _data.remove(event.getPlayer().getUniqueId()); + } } @EventHandler From 0705e38b3ec31e5af122984364c41a092d4673f2 Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Thu, 20 Oct 2016 22:43:51 +0200 Subject: [PATCH 099/147] Fixed NPE --- .../src/nautilus/game/arcade/kit/perks/PerkWoolCloud.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolCloud.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolCloud.java index 93ca2537d..77a9a7740 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolCloud.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolCloud.java @@ -153,7 +153,7 @@ public class PerkWoolCloud extends Perk } } - if (UtilEnt.isGrounded(player) || UtilTime.elapsed(_active.get(player), MAX_VELOCITY_TIME)) + if (UtilEnt.isGrounded(player) || UtilTime.elapsed(_active.get(key), MAX_VELOCITY_TIME)) { playerIterator.remove(); setWoolColor(player, DyeColor.WHITE); From 4e4fd2a8e9f0c28a14724062f8035403800b8d9f Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Thu, 20 Oct 2016 22:44:13 +0200 Subject: [PATCH 100/147] Changed respawn title text --- .../src/nautilus/game/arcade/game/games/smash/SuperSmash.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 62d79d198..bd40fd96f 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 @@ -205,7 +205,7 @@ public abstract class SuperSmash extends Game @Override public void run() { - UtilTextMiddle.display(getLiveColour(lives) + lives, livesString + " left!", 10, 30, 10, player); + UtilTextMiddle.display(null, getLiveColour(lives) + lives + " " + livesString + " left!", 10, 30, 10, player); } }.runTaskLater(Manager.getPlugin(), (long) DeathSpectateSecs * 20 + 2); From d119a94d5325b9d2ecd8c53073ffd7b45b986687 Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Thu, 20 Oct 2016 22:44:43 +0200 Subject: [PATCH 101/147] Fixed concurrency issue --- .../game/arcade/game/games/smash/perks/SmashUltimate.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashUltimate.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashUltimate.java index 6bd2aa444..8bddb995c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashUltimate.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/SmashUltimate.java @@ -1,6 +1,8 @@ package nautilus.game.arcade.game.games.smash.perks; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.UUID; @@ -15,6 +17,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; + import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.kit.Perk; @@ -79,7 +82,10 @@ public class SmashUltimate extends Perk return; } - for (UUID uuid : _lastUltimate.keySet()) + List<UUID> list = new ArrayList<>(); + list.addAll(_lastUltimate.keySet()); + + for (UUID uuid : list) { Player player = UtilPlayer.searchExact(uuid); From 875bdc1fca622374be82df7ddd35f18b0c02dbb8 Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Thu, 20 Oct 2016 22:50:12 +0200 Subject: [PATCH 102/147] Removed unused code --- .../game/games/smash/perks/pig/PerkPigBaconBounce.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBounce.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBounce.java index 14eb68ebe..87e993d45 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBounce.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBounce.java @@ -125,11 +125,8 @@ public class PerkPigBaconBounce extends SmashPerk implements IThrown Rebound(data.getThrower(), data.getThrown()); if (target == null) - return; - - if (isTeamDamage((Player) target, (Player) data.getThrower())) { - + return; } // Damage Event From be2bc098967e3580d8f8a2ee1a33711c532a2b6f Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Thu, 20 Oct 2016 22:56:12 +0200 Subject: [PATCH 103/147] Added comma to laser text --- .../arcade/game/games/smash/perks/guardian/PerkTargetLazer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java index bc847a9b1..b90cdfd24 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkTargetLazer.java @@ -189,7 +189,7 @@ public class PerkTargetLazer extends SmashPerk targetPlaceholder.remove(); setLazerTarget(data.getAttacker(), null); - data.getAttacker().sendMessage(F.main("Game", "Your laser broke dealing damage to " + F.name(data.getTarget().getName())) + "."); + data.getAttacker().sendMessage(F.main("Game", "Your laser broke, dealing damage to " + F.name(data.getTarget().getName())) + "."); Manager.GetDamage().NewDamageEvent(data.getTarget(), data.getAttacker(), null, DamageCause.CUSTOM, damage, false, true, false, data.getAttacker().getName(), GetName()); Recharge.Instance.use(data.getAttacker(), GetName(), COOLDOWN, true, true); From 7ad0b214a5d8e477faf5741c2a57c6375b09d81e Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Thu, 20 Oct 2016 23:08:40 +0200 Subject: [PATCH 104/147] Change team display text --- .../nautilus/game/arcade/game/games/smash/TeamSuperSmash.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java index 8ec0506dd..8970c916d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java @@ -143,7 +143,7 @@ public class TeamSuperSmash extends SuperSmash return; } - UtilTextMiddle.display(team.GetColor() + bestTeamMember.getName(), "Is your teammate", 10, 50, 10, player); + UtilTextMiddle.display(null, team.GetColor() + bestTeamMember.getName() + " is your teammate", 10, 50, 10, player); } } }.runTaskLater(Manager.getPlugin(), 40); From 08b7b7cb486d717eb9e8c1441d4b915e4ebb0ccd Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Thu, 20 Oct 2016 23:11:55 +0200 Subject: [PATCH 105/147] Removed unused files. Move wool bomb patch to correct file --- .../games/smash/perks/sheep/PerkLazer.java | 245 ------------ .../games/smash/perks/sheep/PerkWoolBomb.java | 376 ------------------ .../smash/perks/sheep/PerkWoolCloud.java | 189 --------- .../game/arcade/kit/perks/PerkWoolBomb.java | 12 + 4 files changed, 12 insertions(+), 810 deletions(-) delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkLazer.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolBomb.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolCloud.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkLazer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkLazer.java deleted file mode 100644 index afec5a96c..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkLazer.java +++ /dev/null @@ -1,245 +0,0 @@ -package nautilus.game.arcade.game.games.smash.perks.sheep; - -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; -import java.util.UUID; - -import org.bukkit.Color; -import org.bukkit.DyeColor; -import org.bukkit.FireworkEffect.Type; -import org.bukkit.Location; -import org.bukkit.Sound; -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 mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilFirework; -import mineplex.core.common.util.UtilItem; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.particles.effects.LineParticle; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.disguise.disguises.DisguiseBase; -import mineplex.core.disguise.disguises.DisguiseSheep; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.Perk; - -public class PerkLazer extends Perk -{ - - private static final float MAX_CHARGE = 0.99F; - private static final float CHARGE_PER_TICK = 0.035F; - private static final float INCREMENTATION = 0.2F; - private static final float HIT_BOX_RADIUS = 2.5F; - private static final int DAMAGE_RADIUS = 3; - private static final int DAMAGE = 7; - private static final int KNOCKBACK_MAGNITUDE = 3; - - private double _range; - private int _recharge; - - private Set<UUID> _active = new HashSet<>(); - - public PerkLazer(double range, int recharge) - { - super("Static Lazer", new String[] { C.cYellow + "Hold Block" + C.cGray + " with Sword to use " + C.cGreen + "Static Lazer" }); - - _range = range; - _recharge = recharge; - } - - @EventHandler - public void skill(PlayerInteractEvent event) - { - if (event.isCancelled()) - { - return; - } - - if (!UtilEvent.isAction(event, ActionType.R)) - { - return; - } - - if (UtilBlock.usable(event.getClickedBlock())) - { - return; - } - - Player player = event.getPlayer(); - - if (!UtilItem.isSword(player.getItemInHand())) - { - return; - } - - if (!hasPerk(player)) - { - return; - } - - if (!Recharge.Instance.use(player, GetName(), _recharge, true, true)) - { - return; - } - - _active.add(player.getUniqueId()); - } - - @EventHandler - public void chargeFire(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - { - return; - } - - Iterator<UUID> playerIterator = _active.iterator(); - - while (playerIterator.hasNext()) - { - UUID uuid = playerIterator.next(); - Player player = UtilPlayer.searchExact(uuid); - - if (player == null) - { - playerIterator.remove(); - continue; - } - - if (player.isBlocking()) - { - player.setExp(Math.min(MAX_CHARGE, player.getExp() + CHARGE_PER_TICK)); - - player.getWorld().playSound(player.getLocation(), Sound.FIZZ, 0.25f + player.getExp(), 0.75f + player.getExp()); - - // Wool - DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); - if (disguise != null && disguise instanceof DisguiseSheep) - { - DisguiseSheep sheep = (DisguiseSheep) disguise; - - if (Math.random() > 0.5) - { - sheep.setColor(DyeColor.YELLOW); - } - else - { - sheep.setColor(DyeColor.BLACK); - } - - sheep.setSheared(false); - - sheep.UpdateDataWatcher(); - Manager.GetDisguise().updateDisguise(disguise); - } - - if (player.getExp() >= MAX_CHARGE) - { - playerIterator.remove(); - fire(player); - } - } - else - { - playerIterator.remove(); - fire(player); - } - } - } - - public void fire(Player player) - { - if (player.getExp() <= 0.2) - { - setWoolColor(player, DyeColor.WHITE); - player.setExp(0f); - return; - } - - LineParticle lineParticle = new LineParticle(player.getEyeLocation(), player.getLocation().getDirection(), INCREMENTATION, _range * player.getExp(), null, ParticleType.FIREWORKS_SPARK, - UtilServer.getPlayers()); - - particleLoop: while (lineParticle.update()) - { - for (Player other : UtilPlayer.getNearby(lineParticle.getLastLocation(), HIT_BOX_RADIUS)) - { - if (player.equals(other)) - { - continue; - } - - break particleLoop; - } - } - - Location target = lineParticle.getDestination(); - - UtilParticle.PlayParticle(ParticleType.EXPLODE, target, 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); - - // Firework - UtilFirework.playFirework(target, Type.BURST, Color.YELLOW, false, false); - - for (LivingEntity other : UtilEnt.getInRadius(target, DAMAGE_RADIUS).keySet()) - { - if (other.equals(player)) - { - continue; - } - - // Damage Event - Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, player.getExp() * DAMAGE, true, true, false, player.getName(), GetName()); - } - - // Inform - UtilPlayer.message(player, F.main("Game", "You fired " + F.skill(GetName()) + ".")); - - // Sound - player.getWorld().playSound(player.getEyeLocation(), Sound.ZOMBIE_REMEDY, 0.5f + player.getExp(), 1.75f - player.getExp()); - player.getWorld().playSound(player.getLocation(), Sound.SHEEP_IDLE, 2f, 1.5f); - - // Wool - setWoolColor(player, DyeColor.WHITE); - player.setExp(0f); - } - - @EventHandler - public void knockback(CustomDamageEvent event) - { - if (event.GetReason() == null || !event.GetReason().contains(GetName())) - { - return; - } - - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); - } - - public void setWoolColor(Player player, DyeColor color) - { - DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); - - if (disguise != null && disguise instanceof DisguiseSheep) - { - DisguiseSheep sheep = (DisguiseSheep) disguise; - sheep.setSheared(false); - sheep.setColor(color); - - sheep.UpdateDataWatcher(); - Manager.GetDisguise().updateDisguise(disguise); - } - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolBomb.java deleted file mode 100644 index f07a3212d..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolBomb.java +++ /dev/null @@ -1,376 +0,0 @@ -package nautilus.game.arcade.game.games.smash.perks.sheep; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; -import java.util.UUID; - -import org.bukkit.Effect; -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 mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilItem; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.disguise.disguises.DisguiseBase; -import mineplex.core.disguise.disguises.DisguiseSheep; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.projectile.IThrown; -import mineplex.core.projectile.ProjectileUser; -import mineplex.core.recharge.Recharge; -import mineplex.core.recharge.RechargedEvent; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.data.WoolBombData; - -public class PerkWoolBomb extends Perk implements IThrown -{ - - private static final int RATE = 800; - private static final int COOLDOWN = 8000; - private static final int DAMAGE_RADIUS = 9; - private static final int DAMAGE_EXPLODE = 14; - private static final int DAMAGE_COLLIDE = 4; - private static final int KNOCKBACK_MAGNITUDE = 2; - - private Map<UUID, Item> _thrown = new HashMap<>(); - private Map<UUID, WoolBombData> _active = new HashMap<>(); - - public PerkWoolBomb() - { - super("Wool Mine", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Wool Mine" }); - } - - @EventHandler - public void skill(PlayerInteractEvent event) - { - if (event.isCancelled()) - { - return; - } - - if (!UtilEvent.isAction(event, ActionType.R)) - { - return; - } - - if (UtilBlock.usable(event.getClickedBlock())) - { - return; - } - - Player player = event.getPlayer(); - - if (!UtilItem.isAxe(player.getItemInHand())) - { - return; - } - - if (!hasPerk(player)) - { - return; - } - - if (!Recharge.Instance.usable(player, GetName() + " Rate")) - { - return; - } - - if (_active.containsKey(player)) - { - if (detonate(player, true)) - { - return; - } - } - - if (_thrown.containsKey(player)) - { - if (solidify(player, true)) - { - return; - } - } - - launch(player); - - event.setCancelled(true); - } - - private void launch(Player player) - { - if (!Recharge.Instance.usable(player, GetName(), true)) - { - return; - } - - Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.WOOL, (byte) 0)); - - UtilAction.velocity(ent, player.getLocation().getDirection(), 1, false, 0, 0.2, 10, false); - - Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true, null, 1f, 1f, null, 1, UpdateType.SLOW, 0.5f); - - _thrown.put(player.getUniqueId(), ent); - - // Inform - UtilPlayer.message(player, F.main("Game", "You launched " + F.skill(GetName()) + ".")); - - // Effect - player.getWorld().playSound(player.getLocation(), Sound.SHEEP_IDLE, 2f, 1.5f); - - // Rate - Recharge.Instance.useForce(player, GetName() + " Rate", RATE); - - // Disguise - DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); - - if (disguise != null && disguise instanceof DisguiseSheep) - { - DisguiseSheep sheep = (DisguiseSheep) disguise; - sheep.setSheared(true); - - sheep.UpdateDataWatcher(); - Manager.GetDisguise().updateDisguise(disguise); - } - } - - @EventHandler - public void rechargeWool(RechargedEvent event) - { - if (event.GetAbility().equals(GetName())) - { - DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(event.GetPlayer()); - - if (disguise != null && disguise instanceof DisguiseSheep) - { - DisguiseSheep sheep = (DisguiseSheep) disguise; - sheep.setSheared(false); - - sheep.UpdateDataWatcher(); - Manager.GetDisguise().updateDisguise(disguise); - } - } - } - - private boolean solidify(LivingEntity ent, boolean inform) - { - if (!(ent instanceof Player)) - { - return false; - } - - Player player = (Player) ent; - - Item thrown = _thrown.remove(player.getUniqueId()); - - if (thrown == null) - { - return false; - } - - // Make Block - Block block = thrown.getLocation().getBlock(); - - Manager.GetBlockRestore().restore(block); - - _active.put(player.getUniqueId(), new WoolBombData(block)); - - block.setType(Material.WOOL); - block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType()); - - // Clean - thrown.remove(); - - // Rate - Recharge.Instance.useForce(player, GetName() + " Rate", RATE); - - // Inform - if (inform) - { - player.getWorld().playSound(player.getLocation(), Sound.SHEEP_IDLE, 2f, 1.5f); - - UtilPlayer.message(player, F.main("Game", "You armed " + F.skill(GetName()) + ".")); - } - - return true; - } - - private boolean detonate(Player player, boolean inform) - { - WoolBombData data = _active.remove(player); - - if (data == null) - { - return false; - } - - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) - { - return false; - } - - // Restore - data.restore(); - - // Explode - UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, data.Block.getLocation().add(0.5, 0.5, 0.5), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); - data.Block.getWorld().playSound(data.Block.getLocation(), Sound.EXPLODE, 3f, 0.8f); - - // Damage - Map<LivingEntity, Double> targets = UtilEnt.getInRadius(data.Block.getLocation().add(0.5, 0.5, 0.5), DAMAGE_RADIUS); - - for (LivingEntity cur : targets.keySet()) - { - if(cur instanceof Player) - { - if(Manager.GetGame().GetTeam(player).GetPlayers(true).contains(cur)) - { - // Do not deal damage to team mates, but do deal damage to player him/her self - if(!cur.equals(player)) - { - continue; - } - } - } - - // Damage Event - Manager.GetDamage().NewDamageEvent(cur, player, null, DamageCause.CUSTOM, DAMAGE_EXPLODE * targets.get(cur) + 0.5, false, true, false, player.getName(), GetName()); - - // Condition - Manager.GetCondition().Factory().Falling(GetName(), cur, player, 10, false, true); - - // Knockback - UtilAction.velocity(cur, UtilAlg.getTrajectory2d(data.Block.getLocation().add(0.5, 0.5, 0.5), cur.getEyeLocation()), 0.5 + 2.5 * targets.get(cur), true, 0.8, 0, 10, true); - - // Inform - if (cur instanceof Player && !player.equals(cur)) - { - UtilPlayer.message((Player) cur, F.main("Game", F.name(player.getName()) + " hit you with " + F.skill(GetName()) + ".")); - } - - } - - // Rate - Recharge.Instance.useForce(player, GetName() + " Rate", RATE); - - // Inform - if (inform) - { - player.getWorld().playSound(player.getLocation(), Sound.SHEEP_IDLE, 2f, 1.5f); - - UtilPlayer.message(player, F.main("Game", "You detonated " + F.skill(GetName()) + ".")); - } - - return true; - } - - @Override - public void Collide(LivingEntity target, Block block, ProjectileUser data) - { - solidify(data.getThrower(), false); - - if (target == null) - { - return; - } - - // Damage Event - Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, DAMAGE_COLLIDE, true, true, false, UtilEnt.getName(data.getThrower()), GetName()); - } - - @Override - public void Idle(ProjectileUser data) - { - solidify(data.getThrower(), false); - } - - @Override - public void Expire(ProjectileUser data) - { - solidify(data.getThrower(), false); - } - - @EventHandler - public void colorExpireUpdate(UpdateEvent event) - { - if (event.getType() != UpdateType.FASTER) - { - return; - } - - Set<Player> detonate = new HashSet<Player>(); - Iterator<UUID> playerIterator = _active.keySet().iterator(); - - while (playerIterator.hasNext()) - { - UUID key = playerIterator.next(); - - Player player = UtilPlayer.searchExact(key); - - if (player == null) - { - playerIterator.remove(); - continue; - } - - WoolBombData data = _active.get(key); - - if (UtilTime.elapsed(data.Time, COOLDOWN)) - { - detonate.add(player); - continue; - } - - if (Recharge.Instance.usable(player, GetName() + " Rate")) - { - if (data.Block.getData() == 14) - { - data.Block.setData((byte) 0); - } - else - { - data.Block.setData((byte) 14); - } - } - } - - for (Player player : detonate) - { - detonate(player, false); - } - } - - @EventHandler - public void knockback(CustomDamageEvent event) - { - if (event.GetReason() == null || !event.GetReason().contains(GetName())) - { - return; - } - - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolCloud.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolCloud.java deleted file mode 100644 index 999c1ac52..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/sheep/PerkWoolCloud.java +++ /dev/null @@ -1,189 +0,0 @@ -package nautilus.game.arcade.game.games.smash.perks.sheep; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.UUID; - -import org.bukkit.DyeColor; -import org.bukkit.Effect; -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.util.Vector; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilItem; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.disguise.disguises.DisguiseBase; -import mineplex.core.disguise.disguises.DisguiseSheep; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.Perk; - -public class PerkWoolCloud extends Perk -{ - - private static final int COOLDOWN = 10000; - private static final int MIN_VELOCITY_TIME = 200; - private static final int MAX_VELOCITY_TIME = 1200; - private static final int DAMAGE_RADIUS = 2; - private static final int DAMAGE = 8; - private static final float KNOCKBACK_MAGNITUDE = 2.5F; - - private Map<UUID, Long> _active = new HashMap<>(); - - public PerkWoolCloud() - { - super("Wooly Rocket", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Spade to " + C.cGreen + "Wooly Rocket" }); - } - - @EventHandler - public void Leap(PlayerInteractEvent event) - { - if (event.isCancelled()) - { - return; - } - - if (!UtilEvent.isAction(event, ActionType.R)) - { - return; - } - - if (UtilBlock.usable(event.getClickedBlock())) - { - return; - } - - Player player = event.getPlayer(); - - if (!UtilItem.isSpade(player.getItemInHand())) - { - return; - } - - if (!hasPerk(player)) - { - return; - } - - // Recharge - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) - { - return; - } - - UtilAction.velocity(player, new Vector(0, 1, 0), 1, false, 0, 0, 2, true); - - UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); - - player.getWorld().playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0); - - // Allow double jump - player.setAllowFlight(true); - - setWoolColor(player, DyeColor.RED); - - _active.put(player.getUniqueId(), System.currentTimeMillis()); - } - - @EventHandler - public void update(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - { - return; - } - - if (!Manager.GetGame().IsLive()) - { - return; - } - - Iterator<UUID> playerIterator = _active.keySet().iterator(); - - while (playerIterator.hasNext()) - { - UUID key = playerIterator.next(); - Player player = UtilPlayer.searchExact(key); - - if (player == null) - { - playerIterator.remove(); - continue; - } - - UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation(), 0.2f, 0.2f, 0.2f, 0, 4, ViewDist.LONGER, UtilServer.getPlayers()); - - if (!UtilTime.elapsed(_active.get(key), MIN_VELOCITY_TIME)) - { - continue; - } - - for (Player other : Manager.GetGame().GetPlayers(true)) - { - if (player.equals(other)) - { - continue; - } - - if (UtilMath.offset(player, other) < DAMAGE_RADIUS) - { - // Damage Event - Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, DAMAGE, true, false, false, player.getName(), GetName()); - - UtilParticle.PlayParticle(ParticleType.EXPLODE, other.getLocation(), 0f, 0f, 0f, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); - UtilParticle.PlayParticle(ParticleType.LAVA, player.getLocation(), 0.2f, 0.2f, 0.2f, 0, 10, ViewDist.MAX, UtilServer.getPlayers()); - } - } - - if (UtilEnt.isGrounded(player) || UtilTime.elapsed(_active.get(key), MAX_VELOCITY_TIME)) - { - playerIterator.remove(); - setWoolColor(player, DyeColor.WHITE); - } - } - } - - public void setWoolColor(Player player, DyeColor color) - { - DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); - - if (disguise != null && disguise instanceof DisguiseSheep) - { - DisguiseSheep sheep = (DisguiseSheep) disguise; - sheep.setSheared(false); - sheep.setColor(color); - - sheep.UpdateDataWatcher(); - Manager.GetDisguise().updateDisguise(disguise); - } - } - - @EventHandler - public void knockback(CustomDamageEvent event) - { - if (event.GetReason() == null || !event.GetReason().contains(GetName())) - { - return; - } - - event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java index 110a2acda..27efa4a4c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java @@ -246,6 +246,18 @@ public class PerkWoolBomb extends Perk implements IThrown for (LivingEntity cur : targets.keySet()) { + if(cur instanceof Player) + { + if(Manager.GetGame().GetTeam(player).GetPlayers(true).contains(cur)) + { + // Do not deal damage to team mates, but do deal damage to player him/her self + if(!cur.equals(player)) + { + continue; + } + } + } + // Damage Event Manager.GetDamage().NewDamageEvent(cur, player, null, DamageCause.CUSTOM, DAMAGE_EXPLODE * targets.get(cur) + 0.5, false, true, false, player.getName(), GetName()); From d42a5f189767ab109dfe4df56e3650038e99d1bf Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Thu, 20 Oct 2016 23:13:32 +0200 Subject: [PATCH 106/147] Prevent Chicken Rocket from resetting cooldown when hitting team mates --- .../game/games/smash/perks/chicken/PerkChickenRocket.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java index e7d19bfab..2625bf466 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java @@ -163,6 +163,11 @@ public class PerkChickenRocket extends SmashPerk { continue; } + + if(Manager.GetGame().GetTeam(data.Player).GetPlayers(true).contains(ent)) + { + continue; + } } // Recharge From d26103d321ec7e6951bc41e09ebcc2da8458c6aa Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Thu, 20 Oct 2016 23:20:02 +0200 Subject: [PATCH 107/147] Increase Whirlpool damage --- .../game/games/smash/perks/guardian/PerkWhirlpoolBlade.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java index 96a03a2e9..a40a2c735 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java @@ -39,7 +39,7 @@ public class PerkWhirlpoolBlade extends Perk implements IThrown private static final int EXPIRE_TIME = 3000; private static final float VELOCITY = 1.6F; private static final float HIT_BOX = 0.5F; - private static final int DAMAGE = 2; + private static final int DAMAGE = 5; private Set<Item> _items = new HashSet<>(); From db3106d8a4438141bda11997a080792fd9162037 Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Thu, 20 Oct 2016 23:20:26 +0200 Subject: [PATCH 108/147] Prevent golem fissure from effecting team mates --- .../src/nautilus/game/arcade/kit/perks/data/FissureData.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/FissureData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/FissureData.java index 2d66b8e93..93e2e2754 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/FissureData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/FissureData.java @@ -154,6 +154,11 @@ public class FissureData } + + if(Host.Manager.GetGame().GetTeam(_player).GetPlayers(true).contains(cur)) + { + continue; + } //Damage if (!_hit.contains(cur)) From 6a6a589cb7b09bfe6b3dc538c46d4e82441673d1 Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Fri, 21 Oct 2016 00:25:37 +0200 Subject: [PATCH 109/147] Fixed wolf cub sometimes not being removed --- .../arcade/game/games/smash/perks/wolf/PerkWolf.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/PerkWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/PerkWolf.java index 00fee85c3..bc060b790 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/PerkWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/PerkWolf.java @@ -164,12 +164,12 @@ public class PerkWolf extends SmashPerk wolfIterator.remove(); return; } - - if (!wolf.isValid() || (UtilEnt.isGrounded(wolf) && wolf.getTicksLived() > WOLF_MAX_TICKS)) - { - wolf.remove(); - wolfIterator.remove(); - } + } + + if (!wolf.isValid() || (UtilEnt.isGrounded(wolf) && wolf.getTicksLived() > WOLF_MAX_TICKS)) + { + wolf.remove(); + wolfIterator.remove(); } } } From c8edc2d01e16f578a2df3453af1e9467cd4a6406 Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Fri, 21 Oct 2016 00:54:04 +0200 Subject: [PATCH 110/147] Rewrote daze potion damage calculations --- .../mineplex/core/common/util/UtilEnt.java | 11 +++++++ .../smash/perks/witch/PerkWitchPotion.java | 32 +++++++++++++------ 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java index 712eacdf4..ee6eed0df 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java @@ -180,6 +180,17 @@ public class UtilEnt return list; } + /** + * @return Returns true if the entities boundinbox collides or is inside the given bounding box + */ + public static boolean isInsideBoundingBox(Entity ent, Vector a, Vector b) + { + AxisAlignedBB box = ((CraftEntity)ent).getHandle().getBoundingBox(); + AxisAlignedBB box2 = new AxisAlignedBB(a.getX(), a.getY(), a.getZ(), b.getX(), b.getY(), b.getZ()); + + return box.b(box2); + } + public static void Vegetate(Entity entity) { Vegetate(entity, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java index 168f2ca47..be159abdd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java @@ -5,7 +5,6 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import org.bukkit.Bukkit; import org.bukkit.block.Block; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -14,11 +13,13 @@ import org.bukkit.entity.ThrownPotion; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilItem; @@ -41,7 +42,8 @@ public class PerkWitchPotion extends SmashPerk implements IThrown private static final int COOLDOWN = 2000; private static final int RANGE_NOMRAL = 3; - private static final int DAMAGE_NORMAL = 7; + private static final int DAMAGE_DIRECT = 7; + private static final int DAMAGE_DISTANCE = 6; private static final int KNOCKBACK_MAGNITUDE = 2; private List<Projectile> _proj = new ArrayList<>(); @@ -141,18 +143,28 @@ public class PerkWitchPotion extends SmashPerk implements IThrown @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { - Map<Player, Double> nearby = UtilPlayer.getInRadius(data.getThrown().getLocation(), RANGE_NOMRAL); LivingEntity entity = data.getThrower(); - for (Player player : nearby.keySet()) + List<Player> players = new ArrayList<>(); + players.addAll(Manager.GetGame().GetPlayers(true)); + players.removeAll(Manager.GetGame().GetTeam((Player) data.getThrower()).GetPlayers(true)); + + List<Player> directHit = UtilEnt.getPlayersInsideEntity(target, players); + + for (Player player : directHit) { - if(player.equals(data.getThrower())) continue; + Manager.GetDamage().NewDamageEvent(player, entity, null, DamageCause.CUSTOM, DAMAGE_DIRECT, true, true, false, entity.getName(), GetName()); + } + + players.removeAll(directHit); + + Vector a = data.getThrown().getLocation().subtract(RANGE_NOMRAL, RANGE_NOMRAL, RANGE_NOMRAL).toVector(); + Vector b = data.getThrown().getLocation().add(RANGE_NOMRAL, RANGE_NOMRAL, RANGE_NOMRAL).toVector(); + for (Player player : players) + { + if(!UtilEnt.isInsideBoundingBox(player, a, b)) continue; - double damage = DAMAGE_NORMAL * nearby.get(player); - - if(player.equals(target)) damage = DAMAGE_NORMAL; - - Manager.GetDamage().NewDamageEvent(player, entity, null, DamageCause.CUSTOM, damage, true, true, false, entity.getName(), GetName()); + Manager.GetDamage().NewDamageEvent(player, entity, null, DamageCause.CUSTOM, DAMAGE_DISTANCE, true, true, false, entity.getName(), GetName()); } } From 45c5ba66bdf257edeaa2f1c2ab1aa50cdb312d28 Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Fri, 21 Oct 2016 00:55:18 +0200 Subject: [PATCH 111/147] Prevent multiple perks from affect team mates and cleaned up some code --- .../games/smash/perks/spider/SmashSpider.java | 3 +- .../game/arcade/kit/perks/PerkBlizzard.java | 34 +++++-- .../arcade/kit/perks/PerkDeathsGrasp.java | 95 ++++++++++--------- .../game/arcade/kit/perks/PerkIronHook.java | 5 + 4 files changed, 84 insertions(+), 53 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java index 9a52fd00f..305e4cabd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java @@ -13,14 +13,13 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityRegainHealthEvent; -import com.sun.xml.internal.fastinfoset.algorithm.HexadecimalEncodingAlgorithm; - import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilServer; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashSpider extends SmashUltimate diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlizzard.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlizzard.java index fb8b77d58..ac801a55a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlizzard.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlizzard.java @@ -9,18 +9,18 @@ import org.bukkit.entity.Projectile; import org.bukkit.entity.Snowball; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.util.Vector; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.kit.Perk; public class PerkBlizzard extends Perk @@ -93,32 +93,50 @@ public class PerkBlizzard extends Perk public void Snowball(CustomDamageEvent event) { if (event.GetCause() != DamageCause.PROJECTILE) + { return; + } Projectile proj = event.GetProjectile(); - if (proj == null) return; + if (proj == null) + { + return; + } if (!(proj instanceof Snowball)) + { return; + } - if (!_snowball.containsKey(proj)) + Player shooter = _snowball.get(proj); + if (shooter == null) + { return; + } LivingEntity damagee = event.GetDamageeEntity(); - if (damagee == null) return; + if (damagee == null) + { + return; + } event.SetCancelled("Blizzard"); + + if(Manager.GetGame().GetTeam(shooter).GetPlayers(true).contains(damagee)) + { + return; + } UtilAction.velocity(damagee, proj.getVelocity().multiply(0.15).add(new Vector(0, 0.15, 0))); //Damage Event if (damagee instanceof Player) + { if (Recharge.Instance.use((Player)damagee, GetName(), 200, false, false)) { - Manager.GetDamage().NewDamageEvent(damagee, event.GetDamagerEntity(true), null, - DamageCause.CUSTOM, 1, false, true, false, - UtilEnt.getName(event.GetDamagerEntity(true)), GetName()); + Manager.GetDamage().NewDamageEvent(damagee, shooter, null, DamageCause.CUSTOM, 1, false, true, false, shooter.getName(), GetName()); } + } } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeathsGrasp.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeathsGrasp.java index d2996ce62..66ac42e26 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeathsGrasp.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeathsGrasp.java @@ -1,10 +1,12 @@ package nautilus.game.arcade.kit.perks; -import java.time.temporal.WeekFields; import java.util.HashMap; import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.UUID; -import org.bukkit.GameMode; import org.bukkit.Sound; import org.bukkit.entity.Arrow; import org.bukkit.entity.LivingEntity; @@ -14,7 +16,6 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.util.Vector; import mineplex.core.common.util.C; import mineplex.core.common.util.F; @@ -25,21 +26,25 @@ import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.kit.Perk; public class PerkDeathsGrasp extends Perk { - private HashMap<LivingEntity, Long> _live = new HashMap<LivingEntity, Long>(); + private Map<UUID, Long> _live = new HashMap<>(); private HashMap<LivingEntity, Long> _weakness = new HashMap<LivingEntity, Long>(); + + private static final long LEAP_DURATION = 1000; + private static final long WEAKNESS_DURATION = 1000; public PerkDeathsGrasp() { @@ -76,7 +81,7 @@ public class PerkDeathsGrasp extends Perk UtilAction.velocity(player, player.getLocation().getDirection(), 1.4, false, 0, 0.2, 1.2, true); //Record - _live.put(player, System.currentTimeMillis()); + _live.put(player.getUniqueId(), System.currentTimeMillis()); //Inform UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); @@ -89,51 +94,57 @@ public class PerkDeathsGrasp extends Perk public void end(UpdateEvent event) { if (event.getType() != UpdateType.TICK) - return; - - //Collide - for (Player player : Manager.GetGame().GetPlayers(true)) - if (_live.containsKey(player)) - for (Player other : Manager.GetGame().GetPlayers(true)) - if (!Manager.isSpectator(other)) - if (!other.equals(player)) - if (UtilMath.offset(player, other) < 2) - { - collide(player, other); - _live.remove(player); - return; - } - - //Leap End - Iterator<LivingEntity> leapIter = _live.keySet().iterator(); - - while (leapIter.hasNext()) { - LivingEntity ent = leapIter.next(); + return; + } + + //Leap End & Collide + for(Iterator<Entry<UUID, Long>> it = _live.entrySet().iterator(); it.hasNext();) + { + Entry<UUID, Long> e = it.next(); + Player player = UtilPlayer.searchExact(e.getKey()); + if(player == null) + { + it.remove(); + } - if (!UtilEnt.isGrounded(ent)) - continue; + if (UtilEnt.isGrounded(player) || UtilTime.elapsed(e.getValue(), LEAP_DURATION)) + { + it.remove(); + } - if (!UtilTime.elapsed(_live.get(ent), 1000)) - continue; - - leapIter.remove(); + List<Player> team = Manager.GetGame().GetTeam(player).GetPlayers(true); + for (Player other : Manager.GetGame().GetPlayers(true)) + { + if(team.contains(other)) + { + continue; + } + if (UtilMath.offset(player, other) < 2) + { + collide(player, other); + it.remove(); + return; + } + } } //Weakness End - Iterator<LivingEntity> weaknessIter = _weakness.keySet().iterator(); - - while (weaknessIter.hasNext()) + for (Iterator<LivingEntity> it = _weakness.keySet().iterator(); it.hasNext();) { - LivingEntity ent = weaknessIter.next(); + LivingEntity ent = it.next(); if (!UtilEnt.isGrounded(ent)) + { continue; + } - if (!UtilTime.elapsed(_weakness.get(ent), 1000)) + if (!UtilTime.elapsed(_weakness.get(ent), WEAKNESS_DURATION)) + { continue; + } - weaknessIter.remove(); + it.remove(); } } @@ -183,10 +194,8 @@ public class PerkDeathsGrasp extends Perk event.AddMult(GetName(), GetName() + " Combo", 2, true); - UtilParticle.PlayParticle(ParticleType.RED_DUST, event.GetDamageeEntity().getLocation(), 0.5f, 0.5f, 0.5f, 0, 20, - ViewDist.MAX, UtilServer.getPlayers()); - UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, event.GetDamageeEntity().getLocation(), 0, 0, 0, 0, 1, - ViewDist.MAX, UtilServer.getPlayers()); + UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, event.GetDamageeEntity().getLocation(), 0.5f, 0.5f, 0.5f, 0, 20, ViewDist.MAX); + UtilParticle.PlayParticleToAll(ParticleType.LARGE_EXPLODE, event.GetDamageeEntity().getLocation(), 0, 0, 0, 0, 1, ViewDist.MAX); damager.getWorld().playSound(damager.getLocation(), Sound.ZOMBIE_HURT, 1f, 2f); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java index 62b1f5a9c..b2b0881c2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java @@ -104,6 +104,11 @@ public class PerkIronHook extends Perk implements IThrown return; } + if(Manager.GetGame().GetTeam(player).GetPlayers(true).contains(target)) + { + return; + } + // Pull UtilAction.velocity(target, UtilAlg.getTrajectory(target.getLocation(), player.getLocation()), 2, false, 0, 0.8, 1.5, true); From ca0f36d14229940898b68ad726647a7f9ff9c60c Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Fri, 21 Oct 2016 00:55:44 +0200 Subject: [PATCH 112/147] Prevent armorstand used by laze to block projectiles --- .../game/games/smash/perks/guardian/TargetLazerData.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/TargetLazerData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/TargetLazerData.java index 0d2d1066b..f81316ce8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/TargetLazerData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/TargetLazerData.java @@ -3,6 +3,8 @@ package nautilus.game.arcade.game.games.smash.perks.guardian; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Player; +import mineplex.core.common.util.UtilEnt; + import nautilus.game.arcade.ArcadeManager; public class TargetLazerData @@ -35,6 +37,8 @@ public class TargetLazerData _targetPlaceholder.setBasePlate(false); _targetPlaceholder.setGravity(false); _targetPlaceholder.setVisible(false); + + UtilEnt.ghost(_targetPlaceholder, true, true); manager.GetGame().CreatureAllowOverride = false; } From 70d554fa2dafbd8f6c4c64a09427fcdd3f48bb50 Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Fri, 21 Oct 2016 01:12:02 +0200 Subject: [PATCH 113/147] Fixed witch daze potion --- .../arcade/game/games/smash/perks/witch/PerkWitchPotion.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java index be159abdd..1fa54521b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java @@ -3,7 +3,6 @@ package nautilus.game.arcade.game.games.smash.perks.witch; import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import java.util.Map; import org.bukkit.block.Block; import org.bukkit.entity.LivingEntity; @@ -149,7 +148,7 @@ public class PerkWitchPotion extends SmashPerk implements IThrown players.addAll(Manager.GetGame().GetPlayers(true)); players.removeAll(Manager.GetGame().GetTeam((Player) data.getThrower()).GetPlayers(true)); - List<Player> directHit = UtilEnt.getPlayersInsideEntity(target, players); + List<Player> directHit = UtilEnt.getPlayersInsideEntity(entity, players); for (Player player : directHit) { From ff1d29bd2e631fc6992672153dad4b8abaf9a558 Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Fri, 21 Oct 2016 01:37:14 +0200 Subject: [PATCH 114/147] Apply wool bomb damage to self in team games --- .../game/arcade/kit/perks/PerkWoolBomb.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java index 27efa4a4c..73c7df885 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java @@ -15,6 +15,7 @@ import org.bukkit.entity.Item; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; @@ -43,6 +44,7 @@ import mineplex.core.recharge.RechargedEvent; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.data.WoolBombData; @@ -288,6 +290,32 @@ public class PerkWoolBomb extends Perk implements IThrown return true; } + + @EventHandler(priority = EventPriority.HIGH) + public void onDamageSelf(CustomDamageEvent event) + { + if(event.GetDamageePlayer() == null || event.GetDamagerPlayer(true) == null) + { + return; + } + + if(!event.GetDamageePlayer().equals(event.GetDamagerPlayer(true))) + { + return; + } + + if(event.GetCause() != DamageCause.CUSTOM) + { + return; + } + + if(!event.IsCancelled()) + { + return; + } + + event.GetCancellers().remove("Team Damage"); + } @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) From 63514029f22399914b4e599136c0d28234a48939 Mon Sep 17 00:00:00 2001 From: Keir Nellyer <keir@nellyer.co.uk> Date: Fri, 21 Oct 2016 14:09:12 +0100 Subject: [PATCH 115/147] Generate missing tokens for snapshots on report load --- .../core/chatsnap/SnapshotRepository.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotRepository.java index f05939322..e832cd8b6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotRepository.java @@ -71,6 +71,7 @@ public class SnapshotRepository private static final String INSERT_MESSAGE_MAPPING = "INSERT INTO snapshotMessageMap (snapshotId, messageId) VALUES (?, ?);"; private static final String GET_ID_FROM_TOKEN = "SELECT snapshots.id FROM snapshots WHERE snapshots.token = ?;"; private static final String GET_METADATA = "SELECT token, creator FROM snapshots WHERE id = ?;"; + private static final String SET_TOKEN = "UPDATE snapshots SET token = ? WHERE id = ?;"; private final String _serverName; private final Logger _logger; @@ -210,7 +211,12 @@ public class SnapshotRepository if (resultSet.next()) { String token = resultSet.getString("token"); - if (resultSet.wasNull()) token = null; + if (resultSet.wasNull()) + { + // assign token to snapshot if it doesn't have one + token = getUnusedToken(connection); + setToken(connection, snapshotId, token); + } Integer creatorId = resultSet.getInt("creator"); if (resultSet.wasNull()) creatorId = null; @@ -238,6 +244,16 @@ public class SnapshotRepository return future; } + private void setToken(Connection connection, int snapshotId, String token) throws SQLException + { + try (PreparedStatement setTokenStatement = connection.prepareStatement(SET_TOKEN)) + { + setTokenStatement.setString(1, token); + setTokenStatement.setInt(2, snapshotId); + setTokenStatement.execute(); + } + } + private void insertMessages(int snapshotId, Collection<SnapshotMessage> messages, Connection connection) throws SQLException { try (PreparedStatement insertSnapshotStatement = connection.prepareStatement(INSERT_MESSAGE, new String[]{"id"})) From b0ac3cac8c9b8b1d5de388608fff46601503bb79 Mon Sep 17 00:00:00 2001 From: Keir Nellyer <keir@nellyer.co.uk> Date: Fri, 21 Oct 2016 14:22:47 +0100 Subject: [PATCH 116/147] Show link to view chat log in /reportinfo --- .../report/command/ReportInfoCommand.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportInfoCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportInfoCommand.java index feb465dc5..4f5b92b46 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportInfoCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportInfoCommand.java @@ -6,8 +6,13 @@ import java.util.logging.Level; import org.bukkit.entity.Player; +import mineplex.core.chatsnap.SnapshotMetadata; +import mineplex.core.chatsnap.SnapshotRepository; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; +import mineplex.core.common.jsonchat.ClickEvent; +import mineplex.core.common.jsonchat.HoverEvent; +import mineplex.core.common.jsonchat.JsonMessage; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; @@ -48,6 +53,7 @@ public class ReportInfoCommand extends CommandBase<ReportPlugin> String prefix = ReportManager.getReportPrefix(report); String suspect = repository.getAccountName(report.getSuspectId()).join(); String handler = report.getHandlerId().map(handlerId -> repository.getAccountName(handlerId).join()).orElse("None"); + Optional<SnapshotMetadata> snapshotMetadataOptional = report.getSnapshotMetadata(); UtilPlayer.message(player, F.main(prefix, "Type: " + F.elem(report.getCategory().getName()))); UtilPlayer.message(player, F.main(prefix, "Suspect: " + F.elem(suspect))); @@ -76,6 +82,23 @@ public class ReportInfoCommand extends CommandBase<ReportPlugin> String handlerMessage = result.getReason().orElse("None specified."); UtilPlayer.message(player, F.main(prefix, "Handler Message: " + F.elem(handlerMessage))); } + + if (snapshotMetadataOptional.isPresent()) + { + SnapshotMetadata snapshotMetadata = snapshotMetadataOptional.get(); + Optional<String> tokenOptional = snapshotMetadata.getToken(); + + if (tokenOptional.isPresent()) + { + String token = tokenOptional.get(); + UtilPlayer.message(player, F.main(prefix, "")); + + new JsonMessage(F.main(prefix, F.elem("View chat log"))) + .hover(HoverEvent.SHOW_TEXT, C.cGray + "Opens the chat log in your default browser") + .click(ClickEvent.OPEN_URL, SnapshotRepository.getURL(token)) + .sendToPlayer(player); + } + } } else { From bcfdfd4619d27dd2de46349773b2ea69b4c2f809 Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Fri, 21 Oct 2016 16:51:16 +0200 Subject: [PATCH 117/147] Added better team mate detection for team super smash --- .../game/games/smash/TeamSuperSmash.java | 31 +++++++++++++++++++ .../smash/perks/magmacube/PerkMagmaBlast.java | 11 ++++--- .../smash/perks/snowman/SmashSnowman.java | 5 +-- .../game/arcade/kit/perks/PerkBlizzard.java | 3 +- .../game/arcade/kit/perks/PerkIronHook.java | 4 ++- .../game/arcade/kit/perks/PerkWoolBomb.java | 9 +++--- 6 files changed, 50 insertions(+), 13 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java index 8970c916d..c6414d5fd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java @@ -242,4 +242,35 @@ public class TeamSuperSmash extends SuperSmash { return "Team Mode"; } + + /** + * @param manager The arcade manager + * @param player The player to check + * @param includeSelf If true, then the list will contain the given player in addition to team mates. If false then it will + * not include the player. If the given player is a spectator then this will always return empty. + * @return Returns a list of players who the given player should not be able to damage as they are + * the player's team mates. If the given player is a spectator the list will return empty. If the game is Solo Super Smash Mobs + * or any other game than Team Super Smash Mob then the list will return only the player or empty depending on <code>includeSelf</code> + */ + public static List<Player> getTeam(ArcadeManager manager, Player player, boolean includeSelf) + { + List<Player> list = new ArrayList<>(); + if(!manager.IsAlive(player)) + { + return list; + } + else if(manager.GetGame() instanceof TeamSuperSmash) + { + list.addAll(manager.GetGame().GetTeam(player).GetPlayers(true)); + if(!includeSelf) list.remove(player); + } + else + { + if(includeSelf) + { + list.add(player); + } + } + return list; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBlast.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBlast.java index f347ae2cc..20d96917b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBlast.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBlast.java @@ -2,8 +2,11 @@ package nautilus.game.arcade.game.games.smash.perks.magmacube; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; +import net.minecraft.server.v1_8_R3.EntityLargeFireball; + import org.bukkit.Location; import org.bukkit.Sound; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLargeFireball; @@ -33,8 +36,9 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + +import nautilus.game.arcade.game.games.smash.TeamSuperSmash; import nautilus.game.arcade.kit.Perk; -import net.minecraft.server.v1_8_R3.EntityLargeFireball; public class PerkMagmaBlast extends Perk { @@ -166,12 +170,11 @@ public class PerkMagmaBlast extends Perk // Velocity Players Map<Player, Double> hitMap = UtilPlayer.getInRadius(proj.getLocation(), VELOCITY_RADIUS); + List<Player> team = TeamSuperSmash.getTeam(Manager, shooter, false); for (Player cur : hitMap.keySet()) { - if(Manager.GetGame().GetTeam(shooter).GetPlayers(true).contains(cur)) + if(team.contains(cur)) { - // Do not deal damage to team mates, but do deal damage to player him/her self - if(!cur.equals(shooter)) { continue; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java index c5dc0a692..b7d20c5f5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java @@ -30,6 +30,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.games.smash.TeamSuperSmash; import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashSnowman extends SmashUltimate @@ -106,7 +107,7 @@ public class SmashSnowman extends SmashUltimate { Snowman snowman = turretIter.next(); Player player = _turret.get(snowman); - Player target = UtilPlayer.getClosest(snowman.getLocation(), Manager.GetGame().GetTeam(player).GetPlayers(true)); + Player target = UtilPlayer.getClosest(snowman.getLocation(), TeamSuperSmash.getTeam(Manager, player, true)); if (target == null) { @@ -167,7 +168,7 @@ public class SmashSnowman extends SmashUltimate event.SetCancelled("Turret"); - if(Manager.GetGame().GetTeam(damager).GetPlayers(true).contains(damagee)) + if(TeamSuperSmash.getTeam(Manager, damager, false).contains(damagee)) { return; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlizzard.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlizzard.java index ac801a55a..68a30fba8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlizzard.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlizzard.java @@ -21,6 +21,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.TeamSuperSmash; import nautilus.game.arcade.kit.Perk; public class PerkBlizzard extends Perk @@ -122,7 +123,7 @@ public class PerkBlizzard extends Perk event.SetCancelled("Blizzard"); - if(Manager.GetGame().GetTeam(shooter).GetPlayers(true).contains(damagee)) + if(TeamSuperSmash.getTeam(Manager, shooter, true).contains(damagee)) { return; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java index b2b0881c2..1f9f786f4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java @@ -24,6 +24,8 @@ import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; + +import nautilus.game.arcade.game.games.smash.TeamSuperSmash; import nautilus.game.arcade.kit.Perk; public class PerkIronHook extends Perk implements IThrown @@ -104,7 +106,7 @@ public class PerkIronHook extends Perk implements IThrown return; } - if(Manager.GetGame().GetTeam(player).GetPlayers(true).contains(target)) + if(TeamSuperSmash.getTeam(Manager, player, true).contains(target)) { return; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java index 73c7df885..2a2ec4083 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java @@ -3,6 +3,7 @@ package nautilus.game.arcade.kit.perks; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.Set; import java.util.UUID; @@ -45,6 +46,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.TeamSuperSmash; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.data.WoolBombData; @@ -246,17 +248,14 @@ public class PerkWoolBomb extends Perk implements IThrown // Damage Map<LivingEntity, Double> targets = UtilEnt.getInRadius(data.Block.getLocation().add(0.5, 0.5, 0.5), DAMAGE_RADIUS); + List<Player> team = TeamSuperSmash.getTeam(Manager, player, false); for (LivingEntity cur : targets.keySet()) { if(cur instanceof Player) { - if(Manager.GetGame().GetTeam(player).GetPlayers(true).contains(cur)) + if(team.contains(cur)) { - // Do not deal damage to team mates, but do deal damage to player him/her self - if(!cur.equals(player)) - { continue; - } } } From b8c474a92d846045db4cccc39d5b3374ae2eb59e Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Fri, 21 Oct 2016 16:51:29 +0200 Subject: [PATCH 118/147] Fixed daze potion --- .../games/smash/perks/witch/PerkWitchPotion.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java index 1fa54521b..02dd04394 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witch/PerkWitchPotion.java @@ -34,6 +34,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.TeamSuperSmash; import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkWitchPotion extends SmashPerk implements IThrown @@ -142,17 +143,17 @@ public class PerkWitchPotion extends SmashPerk implements IThrown @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { - LivingEntity entity = data.getThrower(); + Player thrower = (Player) data.getThrower(); List<Player> players = new ArrayList<>(); players.addAll(Manager.GetGame().GetPlayers(true)); - players.removeAll(Manager.GetGame().GetTeam((Player) data.getThrower()).GetPlayers(true)); + players.removeAll(TeamSuperSmash.getTeam(Manager, thrower, true)); - List<Player> directHit = UtilEnt.getPlayersInsideEntity(entity, players); + List<Player> directHit = UtilEnt.getPlayersInsideEntity(data.getThrown(), players); for (Player player : directHit) { - Manager.GetDamage().NewDamageEvent(player, entity, null, DamageCause.CUSTOM, DAMAGE_DIRECT, true, true, false, entity.getName(), GetName()); + Manager.GetDamage().NewDamageEvent(player, thrower, null, DamageCause.CUSTOM, DAMAGE_DIRECT, true, true, false, thrower.getName(), GetName()); } players.removeAll(directHit); @@ -162,8 +163,8 @@ public class PerkWitchPotion extends SmashPerk implements IThrown for (Player player : players) { if(!UtilEnt.isInsideBoundingBox(player, a, b)) continue; - - Manager.GetDamage().NewDamageEvent(player, entity, null, DamageCause.CUSTOM, DAMAGE_DISTANCE, true, true, false, entity.getName(), GetName()); + + Manager.GetDamage().NewDamageEvent(player, thrower, null, DamageCause.CUSTOM, DAMAGE_DISTANCE, true, true, false, thrower.getName(), GetName()); } } From cfd2343f0e641202de2a9416e4b367b80b9770bf Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Fri, 21 Oct 2016 16:51:47 +0200 Subject: [PATCH 119/147] Fixed zombie perk Deaths Grasp --- .../game/arcade/kit/perks/PerkDeathsGrasp.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeathsGrasp.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeathsGrasp.java index 66ac42e26..3bcbf1db5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeathsGrasp.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeathsGrasp.java @@ -29,13 +29,13 @@ import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.TeamSuperSmash; import nautilus.game.arcade.kit.Perk; public class PerkDeathsGrasp extends Perk @@ -97,6 +97,7 @@ public class PerkDeathsGrasp extends Perk { return; } + //Leap End & Collide for(Iterator<Entry<UUID, Long>> it = _live.entrySet().iterator(); it.hasNext();) @@ -106,14 +107,16 @@ public class PerkDeathsGrasp extends Perk if(player == null) { it.remove(); + return; } - - if (UtilEnt.isGrounded(player) || UtilTime.elapsed(e.getValue(), LEAP_DURATION)) + + if (UtilEnt.isGrounded(player) && UtilTime.elapsed(e.getValue(), LEAP_DURATION)) { it.remove(); + return; } - List<Player> team = Manager.GetGame().GetTeam(player).GetPlayers(true); + List<Player> team = TeamSuperSmash.getTeam(Manager, player, true); for (Player other : Manager.GetGame().GetPlayers(true)) { if(team.contains(other)) From 0d6ff42a8df3f27f16575a94a9ac24d2649fbd91 Mon Sep 17 00:00:00 2001 From: LCastr0 <castr0mmbr@gmail.com> Date: Fri, 21 Oct 2016 18:06:13 -0200 Subject: [PATCH 120/147] - Fixed players not being kicked from treasure chest locations when they are being opened - Increased the time needed for the Wind Up suit to be charged - Added effect for the Wind Up suit to blink between yellow and red when the effect is active --- .../outfit/windupsuit/OutfitWindUpSuit.java | 63 +++++++++++++---- .../OutfitWindUpSuitBoosterManager.java | 70 +++++++++++++++---- .../core/treasure/TreasureLocation.java | 47 +++++++------ 3 files changed, 132 insertions(+), 48 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuit.java index 974ff360a..201eab634 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuit.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuit.java @@ -1,11 +1,12 @@ package mineplex.core.gadget.gadgets.outfit.windupsuit; -import mineplex.core.common.util.*; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.OutfitGadget; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import org.bukkit.*; +import java.util.HashMap; +import java.util.Iterator; + +import org.bukkit.ChatColor; +import org.bukkit.Color; +import org.bukkit.Material; +import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerMoveEvent; @@ -13,8 +14,17 @@ import org.bukkit.event.player.PlayerToggleSneakEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffectType; -import java.util.HashMap; -import java.util.Iterator; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilColor; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilTextBottom; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.OutfitGadget; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; public class OutfitWindUpSuit extends OutfitGadget { @@ -94,17 +104,17 @@ public class OutfitWindUpSuit extends OutfitGadget if (phase == 0) { updateNextColor(color, colors[phase], player, phase); - percentage += 5; + percentage += 1; } else if (phase == 1) { updateNextColor(color, colors[phase], player, phase); - percentage += 5; + percentage += 1; } else if (phase == 2) { updateNextColor(color, colors[phase], player, phase); - percentage += 5; + percentage += 1; } else if (phase == 3) { @@ -153,6 +163,10 @@ public class OutfitWindUpSuit extends OutfitGadget if (_boosterManager.getTicks(player) >= 1800) { _boosterManager.removeEffects(player); + for (ItemStack itemStack : player.getEquipment().getArmorContents()) + { + UtilColor.applyColor(itemStack, UtilColor.DEFAULT_LEATHER_COLOR); + } } else { @@ -204,9 +218,9 @@ public class OutfitWindUpSuit extends OutfitGadget private void updateNextColor(Color original, Color finalColor, Player player, int phase) { // Makes a really smooth transition between colors - Color nextColor = UtilColor.getNextColor(original, finalColor, 5); + Color nextColor = UtilColor.getNextColor(original, finalColor, 1); - if (nextColor.getRed() == finalColor.getRed() && nextColor.getGreen() == finalColor.getGreen() && nextColor.getBlue() == finalColor.getBlue()) + if (compareColors(finalColor, nextColor)) _colorPhase.put(player, phase + 1); updateColor(player, nextColor); @@ -247,4 +261,27 @@ public class OutfitWindUpSuit extends OutfitGadget double percent = ((_percentage.get(player) * 100d) / 888d) / 100d; UtilTextBottom.displayProgress(C.Bold + getSet().getName(), percent, "", player); } + + private boolean compareColors(Color colorA, Color colorB) + { + int rA = colorA.getRed(), rB = colorB.getRed(); + int gA = colorA.getGreen(), gB = colorB.getGreen(); + int bA = colorA.getBlue(), bB = colorB.getBlue(); + int minR = Math.min(rA, rB), maxR = Math.max(rA, rB); + int minG = Math.min(gA, gB), maxG = Math.max(gA, gB); + int minB = Math.min(bA, bB), maxB = Math.max(bA, bB); + if (maxR - minR > 2) + { + return false; + } + if (maxG - minG > 2) + { + return false; + } + if (maxB - minB > 2) + { + return false; + } + return true; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuitBoosterManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuitBoosterManager.java index 265cc7d3d..abf360737 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuitBoosterManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuitBoosterManager.java @@ -1,19 +1,5 @@ package mineplex.core.gadget.gadgets.outfit.windupsuit; -import mineplex.core.common.util.UtilFirework; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.OutfitGadget; -import mineplex.core.noteblock.INoteVerifier; -import mineplex.core.noteblock.NBSReader; -import mineplex.core.noteblock.NotePlayer; -import mineplex.core.noteblock.NoteSong; -import org.bukkit.Color; -import org.bukkit.FireworkEffect; -import org.bukkit.entity.Player; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; - import java.io.DataInputStream; import java.io.File; import java.io.FileInputStream; @@ -21,7 +7,28 @@ import java.io.FileNotFoundException; import java.util.HashMap; import java.util.Set; -public class OutfitWindUpSuitBoosterManager +import org.bukkit.Bukkit; +import org.bukkit.Color; +import org.bukkit.FireworkEffect; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.LeatherArmorMeta; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +import mineplex.core.common.util.UtilColor; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.noteblock.NBSReader; +import mineplex.core.noteblock.NotePlayer; +import mineplex.core.noteblock.NoteSong; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class OutfitWindUpSuitBoosterManager implements Listener { private GadgetManager _gadget; @@ -32,6 +39,7 @@ public class OutfitWindUpSuitBoosterManager public OutfitWindUpSuitBoosterManager(GadgetManager gadget) { _gadget = gadget; + Bukkit.getPluginManager().registerEvents(this, gadget.getPlugin()); } public void applyEffects(Player player) @@ -121,4 +129,36 @@ public class OutfitWindUpSuitBoosterManager } } + /** + * Flickers colors between yellow and red to mimic the invulnerability star from mario + */ + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + _notePlayers.keySet().forEach(player -> flickerColor(player)); + } + + private void flickerColor(Player player) + { + ItemStack[] playerArmor = player.getEquipment().getArmorContents(); + for (ItemStack item : playerArmor) + { + if (item != null) + { + LeatherArmorMeta leatherMeta = (LeatherArmorMeta) item.getItemMeta(); + if (leatherMeta.getColor().getRed() == 255 && leatherMeta.getColor().getGreen() == 255) + { + UtilColor.applyColor(item, Color.fromRGB(255, 0, 0)); + } + else + { + UtilColor.applyColor(item, Color.fromRGB(255, 255, 0)); + } + } + } + } + } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java index af260b310..cbb165169 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java @@ -2,22 +2,6 @@ package mineplex.core.treasure; import java.util.List; -import mineplex.core.account.CoreClientManager; -import mineplex.core.common.util.*; -import mineplex.core.donation.DonationManager; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.event.GadgetBlockEvent; -import mineplex.core.hologram.Hologram; -import mineplex.core.hologram.HologramInteraction; -import mineplex.core.hologram.HologramManager; -import mineplex.core.inventory.InventoryManager; -import mineplex.core.reward.Reward; -import mineplex.core.status.ServerStatusManager; -import mineplex.core.treasure.event.TreasureFinishEvent; -import mineplex.core.treasure.event.TreasureStartEvent; -import mineplex.core.treasure.gui.TreasureShop; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -35,6 +19,30 @@ import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerVelocityEvent; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.donation.DonationManager; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.event.GadgetBlockEvent; +import mineplex.core.hologram.Hologram; +import mineplex.core.hologram.HologramInteraction; +import mineplex.core.hologram.HologramManager; +import mineplex.core.inventory.InventoryManager; +import mineplex.core.reward.Reward; +import mineplex.core.status.ServerStatusManager; +import mineplex.core.treasure.event.TreasureFinishEvent; +import mineplex.core.treasure.event.TreasureStartEvent; +import mineplex.core.treasure.gui.TreasureShop; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + public class TreasureLocation implements Listener { private TreasureManager _treasureManager; @@ -162,6 +170,7 @@ public class TreasureLocation implements Listener Treasure treasure = new Treasure(player, rewards, treasureType.getRewardType(), _chestBlock, _chestSpawns, treasureType, _treasureManager.getBlockRestore(), _hologramManager, _statusManager); _currentTreasure = treasure; + Bukkit.broadcastMessage(_currentTreasure.toString()); UtilTextMiddle.display(treasureType.getName(), "Choose " + rewards.length + " " + UtilText.plural("Chest", rewards.length) + " To Open", 20, 180, 20, player); UtilPlayer.message(player, F.main("Treasure", "Choose " + rewards.length + " " + UtilText.plural("Chest", rewards.length) + " To Open")); @@ -296,7 +305,7 @@ public class TreasureLocation implements Listener public void cancelMove(PlayerMoveEvent event) { Player player = event.getPlayer(); - if (isTreasureInProgress()) + if (_currentTreasure != null) { if (_currentTreasure.getPlayer().equals(player)) { @@ -314,10 +323,9 @@ public class TreasureLocation implements Listener { Location fromLocation = event.getFrom(); Location toLocation = event.getTo(); - if (fromLocation.getWorld().equals(toLocation.getWorld())) return; + if (!fromLocation.getWorld().equals(toLocation.getWorld())) return; Location centerLocation = _currentTreasure.getCenterBlock().getLocation().add(0.5, 1.5, 0.5); double toDistanceFromCenter = centerLocation.distanceSquared(toLocation); - if (toDistanceFromCenter <= 16) { // Only cancel movement if they are moving towards the center @@ -326,7 +334,6 @@ public class TreasureLocation implements Listener { Location spawnLocation = new Location(player.getWorld(), 0, 64, 0); UtilAction.velocity(player, UtilAlg.getTrajectory(player.getLocation(), spawnLocation).multiply(-1), 1.5, true, 0.8, 0, 1.0, true); -// event.setTo(event.getFrom()); } } } From 83ba1cb26e07d72316e4a7c777364eb6b1a23717 Mon Sep 17 00:00:00 2001 From: LCastr0 <castr0mmbr@gmail.com> Date: Fri, 21 Oct 2016 18:48:47 -0200 Subject: [PATCH 121/147] - Removed debug message - Added check for player teleport when opening a chest - Added Turkey Morph and Chicken Mount to PowerPlayClubRewards --- .../powerplayclub/PowerPlayClubRewards.java | 16 ++++++++----- .../core/treasure/TreasureLocation.java | 24 +++++++++++++++++-- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java index 66a2d3d5c..1d7606146 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java @@ -2,22 +2,24 @@ package mineplex.core.powerplayclub; import java.time.Month; import java.time.YearMonth; -import java.util.*; +import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + import com.google.common.collect.ImmutableMap; -import mineplex.core.common.currency.GlobalCurrency; + import mineplex.core.common.skin.SkinData; import mineplex.core.common.util.BukkitFuture; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; -import mineplex.core.donation.DonationManager; import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.data.Item; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; public class PowerPlayClubRewards { @@ -27,6 +29,8 @@ public class PowerPlayClubRewards private static final Map<YearMonth, PowerPlayClubItem> rewards = ImmutableMap.<YearMonth, PowerPlayClubItem>builder() .put(YearMonth.of(2016, Month.SEPTEMBER), new PowerPlayClubItem("Squid Morph", new ItemStack(Material.INK_SACK))) .put(YearMonth.of(2016, Month.OCTOBER), new PowerPlayClubItem("Witch Morph", SkinData.WITCH.getSkull())) + .put(YearMonth.of(2016, Month.NOVEMBER), new PowerPlayClubItem("Turkey Morph", SkinData.TURKEY.getSkull())) + .put(YearMonth.of(2017, Month.JANUARY), new PowerPlayClubItem("Chicken Mount", new ItemStack(Material.GLASS))) .build(); public static class PowerPlayClubItem diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java index cbb165169..a21248956 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java @@ -17,6 +17,7 @@ import org.bukkit.event.inventory.InventoryOpenEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerVelocityEvent; import mineplex.core.account.CoreClientManager; @@ -170,7 +171,6 @@ public class TreasureLocation implements Listener Treasure treasure = new Treasure(player, rewards, treasureType.getRewardType(), _chestBlock, _chestSpawns, treasureType, _treasureManager.getBlockRestore(), _hologramManager, _statusManager); _currentTreasure = treasure; - Bukkit.broadcastMessage(_currentTreasure.toString()); UtilTextMiddle.display(treasureType.getName(), "Choose " + rewards.length + " " + UtilText.plural("Chest", rewards.length) + " To Open", 20, 180, 20, player); UtilPlayer.message(player, F.main("Treasure", "Choose " + rewards.length + " " + UtilText.plural("Chest", rewards.length) + " To Open")); @@ -305,7 +305,7 @@ public class TreasureLocation implements Listener public void cancelMove(PlayerMoveEvent event) { Player player = event.getPlayer(); - if (_currentTreasure != null) + if (isTreasureInProgress()) { if (_currentTreasure.getPlayer().equals(player)) { @@ -340,6 +340,26 @@ public class TreasureLocation implements Listener } } + @EventHandler + public void cancelTeleport(PlayerTeleportEvent event) + { + Player player = event.getPlayer(); + if (isTreasureInProgress()) + { + if (_currentTreasure.getPlayer().equals(player)) + { + event.setCancelled(true); + return; + } + double toDistanceFromCenter = _currentTreasure.getCenterBlock().getLocation().add(0.5, 1.5, 0.5).distanceSquared(event.getTo()); + if (toDistanceFromCenter <= 16) + { + Location spawnLocation = new Location(player.getWorld(), 0, 64, 0); + UtilAction.velocity(player, UtilAlg.getTrajectory(player.getLocation(), spawnLocation).multiply(-1), 1.5, true, 0.8, 0, 1.0, true); + } + } + } + @EventHandler public void cancelVelocity(PlayerVelocityEvent event) { From 6de2df5cc42e9231601b09d87549dd31a8e9223b Mon Sep 17 00:00:00 2001 From: LCastr0 <castr0mmbr@gmail.com> Date: Sat, 22 Oct 2016 02:27:44 -0200 Subject: [PATCH 122/147] Fixed lores Fixed icons Removed sleigh, chicken mount and wind up suit from menus Added javadocs to sleigh --- .../core/cosmetic/ui/page/GadgetPage.java | 19 +- .../core/cosmetic/ui/page/MountPage.java | 19 +- .../mineplex/core/gadget/GadgetManager.java | 24 +-- .../gadget/gadgets/morph/MorphSleigh.java | 26 ++- .../core/gadget/gadgets/morph/MorphSquid.java | 5 +- .../gadget/gadgets/morph/MorphTurkey.java | 13 +- .../core/gadget/gadgets/morph/MorphWitch.java | 5 +- .../gadgets/morph/managers/sleigh/Sleigh.java | 26 +++ .../morph/managers/sleigh/SleighBlock.java | 53 ------ .../morph/managers/sleigh/SleighPosition.java | 3 + .../morph/managers/sleigh/SleighReindeer.java | 170 ------------------ .../mineplex/core/gadget/types/Gadget.java | 32 +++- .../core/gadget/types/MorphGadget.java | 7 + .../src/mineplex/core/mount/HorseMount.java | 42 +++-- .../src/mineplex/core/mount/Mount.java | 34 +++- .../src/mineplex/core/mount/MountManager.java | 4 +- .../core/mount/types/MountChicken.java | 6 +- .../core/treasure/TreasureLocation.java | 1 - 18 files changed, 215 insertions(+), 274 deletions(-) delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighBlock.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighReindeer.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java index 5ea66bd15..bd55b33f0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java @@ -1,8 +1,12 @@ package mineplex.core.cosmetic.ui.page; +import java.time.Month; +import java.time.YearMonth; +import java.time.format.TextStyle; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Locale; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -15,8 +19,10 @@ import mineplex.core.account.CoreClientManager; import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; import mineplex.core.common.util.banner.CountryFlag; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; @@ -149,7 +155,18 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop> else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -14) { itemLore.add(C.cBlack); - itemLore.add(C.cBlue + "Found in Power Play Club"); + YearMonth yearMonth = gadget.getYearMonth(); + if (yearMonth != null) + { + int year = yearMonth.getYear(); + Month month = yearMonth.getMonth(); + String monthName = month.getDisplayName(TextStyle.FULL, Locale.US); + itemLore.addAll(UtilText.splitLine(C.cBlue + "Monthly Power Play Club Reward for " + monthName + " " + year, LineFormat.LORE)); + } + else + { + itemLore.add(C.cBlue + "Found in Power Play Club"); + } } //Rank Unlocks diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java index 821a325aa..86638709d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java @@ -1,8 +1,12 @@ package mineplex.core.cosmetic.ui.page; +import java.time.Month; +import java.time.YearMonth; +import java.time.format.TextStyle; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Locale; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -11,6 +15,8 @@ import org.bukkit.event.inventory.ClickType; import mineplex.core.account.CoreClientManager; import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.button.MountButton; @@ -105,7 +111,18 @@ public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop> else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -14) { itemLore.add(C.cBlack); - itemLore.add(C.cBlue + "Found in Power Play Club"); + YearMonth yearMonth = mount.getYearMonth(); + if (yearMonth != null) + { + int year = yearMonth.getYear(); + Month month = yearMonth.getMonth(); + String monthName = month.getDisplayName(TextStyle.FULL, Locale.US); + itemLore.addAll(UtilText.splitLine(C.cBlue + "Monthly Power Play Club Reward for " + monthName + " " + year, LineFormat.LORE)); + } + else + { + itemLore.add(C.cBlue + "Found in Power Play Club"); + } } //Rank Unlocks diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index e0c1d4bcc..419576874 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -37,7 +37,6 @@ import mineplex.core.disguise.DisguiseManager; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.commands.AmmoCommand; import mineplex.core.gadget.commands.LockCosmeticsCommand; -import mineplex.core.gadget.commands.ReindeerTestCommand; import mineplex.core.gadget.commands.UnlockCosmeticsCommand; import mineplex.core.gadget.event.GadgetChangeEvent; import mineplex.core.gadget.event.GadgetCollideEntityEvent; @@ -117,7 +116,6 @@ import mineplex.core.gadget.gadgets.morph.MorphEnderman; import mineplex.core.gadget.gadgets.morph.MorphGrimReaper; import mineplex.core.gadget.gadgets.morph.MorphPig; import mineplex.core.gadget.gadgets.morph.MorphPumpkinKing; -import mineplex.core.gadget.gadgets.morph.MorphSleigh; import mineplex.core.gadget.gadgets.morph.MorphSlime; import mineplex.core.gadget.gadgets.morph.MorphSnowman; import mineplex.core.gadget.gadgets.morph.MorphSquid; @@ -139,10 +137,6 @@ import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitChestplate; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitHelmet; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitLeggings; import mineplex.core.gadget.gadgets.outfit.windupsuit.OutfitWindUpSuitBoosterManager; -import mineplex.core.gadget.gadgets.outfit.windupsuit.OutfitWindUpSuitBoots; -import mineplex.core.gadget.gadgets.outfit.windupsuit.OutfitWindUpSuitChestplate; -import mineplex.core.gadget.gadgets.outfit.windupsuit.OutfitWindUpSuitHelmet; -import mineplex.core.gadget.gadgets.outfit.windupsuit.OutfitWindUpSuitLeggings; import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes; import mineplex.core.gadget.gadgets.particle.ParticleFairy; import mineplex.core.gadget.gadgets.particle.ParticleFireRings; @@ -188,7 +182,6 @@ import mineplex.core.gadget.set.SetVampire; import mineplex.core.gadget.set.SetWisdom; import mineplex.core.gadget.set.suits.SetRaveSuit; import mineplex.core.gadget.set.suits.SetSpaceSuit; -import mineplex.core.gadget.set.suits.SetWindUpSuit; import mineplex.core.gadget.types.ArrowEffectGadget; import mineplex.core.gadget.types.DeathEffectGadget; import mineplex.core.gadget.types.DoubleJumpEffectGadget; @@ -283,7 +276,6 @@ public class GadgetManager extends MiniPlugin addCommand(new UnlockCosmeticsCommand(this)); addCommand(new LockCosmeticsCommand(this)); addCommand(new AmmoCommand(this)); - addCommand(new ReindeerTestCommand(this)); } private void createSets() @@ -296,7 +288,8 @@ public class GadgetManager extends MiniPlugin //Costumes addSet(new SetRaveSuit(this)); addSet(new SetSpaceSuit(this)); - addSet(new SetWindUpSuit(this)); + // Hidden in this update + //addSet(new SetWindUpSuit(this)); addSet(new SetParty(this)); addSet(new SetCupidsLove(this)); addSet(new SetEmerald(this)); @@ -342,10 +335,11 @@ public class GadgetManager extends MiniPlugin addGadget(new OutfitSpaceSuitLeggings(this)); addGadget(new OutfitSpaceSuitBoots(this)); - addGadget(new OutfitWindUpSuitHelmet(this)); + // Hidden in this update + /*addGadget(new OutfitWindUpSuitHelmet(this)); addGadget(new OutfitWindUpSuitChestplate(this)); addGadget(new OutfitWindUpSuitLeggings(this)); - addGadget(new OutfitWindUpSuitBoots(this)); + addGadget(new OutfitWindUpSuitBoots(this));*/ addGadget(new OutfitTeam(this, "Team Helmet", -1, ArmorSlot.Helmet, Material.LEATHER_HELMET, (byte)0)); addGadget(new OutfitTeam(this, "Team Shirt", -1, ArmorSlot.Chest, Material.LEATHER_CHESTPLATE, (byte)0)); @@ -372,11 +366,11 @@ public class GadgetManager extends MiniPlugin addGadget(new MorphSquid(this)); addGadget(new MorphWitch(this)); addGadget(new MorphGrimReaper(this)); - // Not being added in this update! - //addGadget(new MorphMetalMan(this)); addGadget(new MorphTurkey(this)); - addGadget(new MorphSleigh(this)); - + // Hidden in this update + //addGadget(new MorphSleigh(this)); + //addGadget(new MorphMetalMan(this)); + // Particles addGadget(new ParticleFoot(this)); addGadget(new ParticleFireRings(this)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSleigh.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSleigh.java index dcc94efa8..9f6bb794c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSleigh.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSleigh.java @@ -2,6 +2,8 @@ package mineplex.core.gadget.gadgets.morph; import java.io.File; import java.io.IOException; +import java.time.Month; +import java.time.YearMonth; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -34,8 +36,9 @@ import mineplex.core.updater.event.UpdateEvent; public class MorphSleigh extends MorphGadget { - // TODO JAVADOCS + LIMIT AMOUNT OF SLEIGHS - + /** + * Directions of the Sleigh, with the correct coord for the player to be teleported and the schematic name + */ public enum SleighDirection { NORTH("SleighMorphNorth.schematic", 0.5, 4.5), @@ -80,7 +83,7 @@ public class MorphSleigh extends MorphGadget public MorphSleigh(GadgetManager manager) { - super(manager, "Sleigh Morph", UtilText.splitLinesToArray(new String[]{"Placeholder"}, LineFormat.LORE), -14, Material.STAINED_CLAY, (byte) 14); + super(manager, "Sleigh Morph", UtilText.splitLinesToArray(new String[]{"Placeholder"}, LineFormat.LORE), -14, Material.STAINED_CLAY, (byte) 14, YearMonth.of(2016, Month.DECEMBER)); // Loads sleigh schematics for (SleighDirection sleighDirection : SleighDirection.values()) { @@ -117,6 +120,11 @@ public class MorphSleigh extends MorphGadget } } + /** + * Activates the sleigh effect when left-clicking + * This will be changed in the next releases + * @param event + */ @EventHandler public void activateSleigh(PlayerInteractEvent event) { @@ -166,6 +174,10 @@ public class MorphSleigh extends MorphGadget _sleighs.put(player, sleigh); } + /** + * Stops player from leaving the sleigh if it's activte + * @param event + */ @EventHandler public void onLeaveVehicle(VehicleExitEvent event) { @@ -179,6 +191,10 @@ public class MorphSleigh extends MorphGadget } } + /** + * Creates positions in the hub map + * TODO add arcade positions + */ private void buildPositions() { _positions.add(new SleighPosition(-11, 143, -30, SleighDirection.SOUTH, -9.5, 145.5, -28.5)); @@ -192,6 +208,10 @@ public class MorphSleigh extends MorphGadget _positions.add(new SleighPosition(136, 116, 85, SleighDirection.WEST, 140.5, 118.5, 86.5)); } + /** + * Removes sleighs if they run out of time, or moves them if they still have time + * @param event + */ @EventHandler public void onUpdate(UpdateEvent event) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java index 487ee3db1..b7a4fba03 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java @@ -1,5 +1,8 @@ package mineplex.core.gadget.gadgets.morph; +import java.time.Month; +import java.time.YearMonth; + import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.enchantments.Enchantment; @@ -43,7 +46,7 @@ public class MorphSquid extends MorphGadget implements IThrown C.cWhite + "Swim to enable Fast Swimming", C.cWhite + "Sneak to shoot a fish above you" }, LineFormat.LORE), - -14, Material.INK_SACK, (byte) 0); + -14, Material.INK_SACK, (byte) 0, YearMonth.of(2016, Month.SEPTEMBER)); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTurkey.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTurkey.java index 323603fc4..6fc6a2f90 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTurkey.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTurkey.java @@ -1,5 +1,8 @@ package mineplex.core.gadget.gadgets.morph; +import java.time.Month; +import java.time.YearMonth; + import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -9,6 +12,7 @@ import org.bukkit.event.player.PlayerToggleSneakEvent; import com.mojang.authlib.GameProfile; import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.C; import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilText; import mineplex.core.disguise.disguises.DisguisePlayer; @@ -22,8 +26,13 @@ public class MorphTurkey extends MorphGadget public MorphTurkey(GadgetManager manager) { - super(manager, "Turkey Morph", UtilText.splitLinesToArray(new String[]{"Placeholder"}, - LineFormat.LORE), 0, Material.GLASS, (byte) 0); + super(manager, "Turkey Morph", UtilText.splitLinesToArray(new String[] + { + C.cGray + "Gobble, Gobble, please don't stuff me!", + C.blankLine, + C.cWhite + "Sneak to gobble." + }, + LineFormat.LORE), -14, Material.COOKED_CHICKEN, (byte) 0, YearMonth.of(2016, Month.NOVEMBER)); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWitch.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWitch.java index e35a4b7e5..d394b3e87 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWitch.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWitch.java @@ -1,5 +1,8 @@ package mineplex.core.gadget.gadgets.morph; +import java.time.Month; +import java.time.YearMonth; + import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -31,7 +34,7 @@ public class MorphWitch extends MorphGadget super(manager, "Witch Morph", UtilText.splitLinesToArray(new String[]{ C.cWhite + "Press sneak to summon your trusty bat and start brewing" }, LineFormat.LORE), - -14, Material.SKULL_ITEM, (byte) 3); + -14, Material.SKULL_ITEM, (byte) 3, YearMonth.of(2016, Month.OCTOBER)); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/Sleigh.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/Sleigh.java index 95b0c1092..07a32faaf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/Sleigh.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/Sleigh.java @@ -16,6 +16,9 @@ import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilServer; import mineplex.core.gadget.gadgets.morph.MorphSleigh; +/** + * Creates the sleigh effect for the Sleigh Morph + */ public class Sleigh { @@ -41,6 +44,9 @@ public class Sleigh (sleighPosition.getDirection() == MorphSleigh.SleighDirection.WEST) ? 90f : -90f; } + /** + * Starts the sleigh effect + */ public void startEffect() { _originalLocation = _player.getLocation().clone(); @@ -55,6 +61,9 @@ public class Sleigh } } + /** + * Stops the sleigh effect + */ public void stopEffect() { restoreBlocks(); @@ -63,6 +72,13 @@ public class Sleigh _sleighPosition.setUsed(false); } + /** + * Pastes the schematic for the sleigh + * @param origin The location where the sleigh schematic will be placed + * @param playerX The X coord where player will be teleported + * @param playerZ The Z coord where player will be teleported + * @throws IOException + */ private void pasteSchematic(Location origin, int playerX, int playerZ) throws IOException { restoreBlocks(); @@ -97,6 +113,10 @@ public class Sleigh _arrow.setPassenger(_player); } + /** + * Updates sleigh to look like its moving + * @return true if the sleigh was moved, false if the time is over (3 seconds) + */ public boolean update() { _moves++; @@ -135,11 +155,17 @@ public class Sleigh return true; } + /** + * Plays sleigh sound to the player + */ public void playSound() { _player.playSound(_player.getLocation(), Sound.ORB_PICKUP, 1f, 1f); } + /** + * Restores the blocks that were changed from pasting the schematic + */ private void restoreBlocks() { for (Map.Entry<Location, Material> entry : _oldBlockMaterials.entrySet()) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighBlock.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighBlock.java deleted file mode 100644 index c7ac99a3f..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighBlock.java +++ /dev/null @@ -1,53 +0,0 @@ -package mineplex.core.gadget.gadgets.morph.managers.sleigh; - -import org.bukkit.Material; - -public class SleighBlock -{ - - private int _x, _y, _z; - private Material _material; - private byte _data; - private boolean _middle; - - public SleighBlock(int x, int y, int z, Material material, int data, boolean middle) - { - _x = x; - _y = y; - _z = z; - _material = material; - _data = (byte) data; - _middle = middle; - } - - public int getX() - { - return _x; - } - - public int getY() - { - return _y; - } - - public int getZ() - { - return _z; - } - - public Material getMaterial() - { - return _material; - } - - public byte getData() - { - return _data; - } - - public boolean isMiddle() - { - return _middle; - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighPosition.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighPosition.java index bc44ea9c7..f8d76bd3d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighPosition.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighPosition.java @@ -2,6 +2,9 @@ package mineplex.core.gadget.gadgets.morph.managers.sleigh; import mineplex.core.gadget.gadgets.morph.MorphSleigh; +/** + * Handles positions from Sleigh and player, and the direction of the sleigh and player + */ public class SleighPosition { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighReindeer.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighReindeer.java deleted file mode 100644 index 413a5ad53..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighReindeer.java +++ /dev/null @@ -1,170 +0,0 @@ -package mineplex.core.gadget.gadgets.morph.managers.sleigh; - -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.entity.ArmorStand; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.Horse; -import org.bukkit.inventory.ItemStack; -import org.bukkit.util.EulerAngle; - -import mineplex.core.common.util.UtilEnt; - -public class SleighReindeer -{ - - private enum AntlerPosition - { - SOUTH(0.4, 0.2, 0.6, 0.7, 4.0, 2.0), - NORTH(-0.3, -0.25, -0.5, -0.6, 4.0, 2.0); - - private double _xA, _xB, _zA, _zB, _angleA, _angleB; - - AntlerPosition(double xA, double xB, double zA, double zB, double angleA, double angleB) - { - _xA = xA; - _xB = xB; - _zA = zA; - _zB = zB; - _angleA = angleA; - _angleB = angleB; - } - - public double getxA() - { - return _xA; - } - - public double getxB() - { - return _xB; - } - - public double getzA() - { - return _zA; - } - - public double getzB() - { - return _zB; - } - - public double getAngleA() - { - return _angleA; - } - - public double getAngleB() - { - return _angleB; - } - } - - private Location _location; - private int _yaw; - private Horse _horse; - private Arrow _base; - private ArmorStand _hornA; - private ArmorStand _hornB; - - public SleighReindeer(Location location, int yaw) - { - _location = location; - _yaw = yaw; - } - - public void spawn() - { - _location.setYaw(_yaw); - _base = _location.getWorld().spawn(_location.clone().subtract(0, 1.5, 0), Arrow.class); - UtilEnt.Vegetate(_base, true); - UtilEnt.ghost(_base, true, true); - - _horse = _location.getWorld().spawn(_location, Horse.class); - _horse.setStyle(Horse.Style.NONE); - _horse.setColor(Horse.Color.CREAMY); - _horse.setVariant(Horse.Variant.HORSE); - _horse.setCustomName("Rudolph"); - _horse.setCustomNameVisible(true); - - //_base.setPassenger(_horse); - - createAntlers(); - } - - public void remove() - { - _horse.remove(); - _base.remove(); - } - - public void move(int x, int z) - { - _horse.eject(); - _base.remove(); - _base = _location.getWorld().spawn(_location.clone().subtract(0, 1.5, 0).add(x, 0, z), Arrow.class); - UtilEnt.Vegetate(_base, true); - UtilEnt.ghost(_base, true, true); - Location horseLocation = _location.clone().subtract(0, 0.5, 0).add(x, 0, z); - horseLocation.setYaw(_yaw); - _horse.teleport(horseLocation); - //_base.setPassenger(_horse); - UtilEnt.Vegetate(_horse, true); - UtilEnt.ghost(_horse, true, false); - _hornA.remove(); - _hornB.remove(); - createAntlers(); - } - - private void createAntlers() - { - AntlerPosition antlerPosition = AntlerPosition.SOUTH; - - switch (_yaw) - { - case 0: - antlerPosition = AntlerPosition.SOUTH; - break; - case 180: - antlerPosition = AntlerPosition.NORTH; - } - - /*Location hornALoc = _horse.getLocation().clone().add(.4, 1, .6); - Location hornBLoc = _horse.getLocation().clone().add(.2, 1, .7); - - ArmorStand hornA = hornALoc.getWorld().spawn(hornALoc, ArmorStand.class); - hornA.setVisible(false); - hornA.setGravity(false); - hornA.getEquipment().setItemInHand(new ItemStack(Material.DEAD_BUSH)); - hornA.setRightArmPose(new EulerAngle(0, 4, 0)); - - ArmorStand hornB = hornBLoc.getWorld().spawn(hornBLoc, ArmorStand.class); - hornB.setVisible(false); - hornB.setGravity(false); - hornB.getEquipment().setItemInHand(new ItemStack(Material.DEAD_BUSH)); - hornB.setRightArmPose(new EulerAngle(0, 2, 0)); - - _hornA = hornA; - _hornB = hornB;*/ - - Location hornALoc = _horse.getLocation().clone().add(antlerPosition.getxA(), 1, antlerPosition.getzA()); - Location hornBLoc = _horse.getLocation().clone().add(antlerPosition.getxB(), 1, antlerPosition.getzB()); - - ArmorStand hornA = hornALoc.getWorld().spawn(hornALoc, ArmorStand.class); - hornA.setVisible(false); - hornA.setGravity(false); - hornA.getEquipment().setItemInHand(new ItemStack(Material.DEAD_BUSH)); - hornA.setRightArmPose(new EulerAngle(0, antlerPosition.getAngleA(), 0)); - - ArmorStand hornB = hornBLoc.getWorld().spawn(hornBLoc, ArmorStand.class); - hornB.setVisible(false); - hornB.setGravity(false); - hornB.getEquipment().setItemInHand(new ItemStack(Material.DEAD_BUSH)); - hornB.setRightArmPose(new EulerAngle(0, antlerPosition.getAngleB(), 0)); - - _hornA = hornA; - _hornB = hornB; - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java index ba38e4d5f..a39d7b46b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java @@ -1,5 +1,6 @@ package mineplex.core.gadget.types; +import java.time.YearMonth; import java.util.HashSet; import org.bukkit.Bukkit; @@ -31,19 +32,43 @@ public abstract class Gadget extends SalesPackageBase implements Listener private String[] _alternativePackageNames; private boolean _free; + + private YearMonth _yearMonth = null; public Gadget(GadgetManager manager, GadgetType gadgetType, String name, String[] desc, int cost, Material mat, byte data) { this(manager, gadgetType, name, desc, cost, mat, data, 1); } + + public Gadget(GadgetManager manager, GadgetType gadgetType, String name, String[] desc, int cost, Material mat, byte data, YearMonth yearMonth) + { + this(manager, gadgetType, name, desc, cost, mat, data, yearMonth, 1); + } + + public Gadget(GadgetManager manager, GadgetType gadgetType, String name, String[] desc, int cost, Material mat, byte data, int quantity, String... alternativesalepackageNames) + { + super(name, mat, data, desc, cost, quantity); + + _gadgetType = gadgetType; + KnownPackage = false; + _free = false; + + _alternativePackageNames = alternativesalepackageNames; + if(_alternativePackageNames == null) { _alternativePackageNames = new String[0]; } + + Manager = manager; + + Manager.getPlugin().getServer().getPluginManager().registerEvents(this, Manager.getPlugin()); + } - public Gadget(GadgetManager manager, GadgetType gadgetType, String name, String[] desc, int cost, Material mat, byte data, int quantity, String... alternativesalepackageNames) + public Gadget(GadgetManager manager, GadgetType gadgetType, String name, String[] desc, int cost, Material mat, byte data, YearMonth yearMonth, int quantity, String... alternativesalepackageNames) { super(name, mat, data, desc, cost, quantity); _gadgetType = gadgetType; KnownPackage = false; _free = false; + _yearMonth = yearMonth; _alternativePackageNames = alternativesalepackageNames; if(_alternativePackageNames == null) { _alternativePackageNames = new String[0]; } @@ -83,6 +108,11 @@ public abstract class Gadget extends SalesPackageBase implements Listener { return _active.contains(player); } + + public YearMonth getYearMonth() + { + return _yearMonth; + } @EventHandler public void onPlayerQuit(PlayerQuitEvent event) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MorphGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MorphGadget.java index 335f9d0ff..ff08e8152 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MorphGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MorphGadget.java @@ -1,5 +1,7 @@ package mineplex.core.gadget.types; +import java.time.YearMonth; + import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -15,6 +17,11 @@ public abstract class MorphGadget extends Gadget { super(manager, GadgetType.MORPH, name, desc, cost, mat, data); } + + public MorphGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, YearMonth yearMonth) + { + super(manager, GadgetType.MORPH, name, desc, cost, mat, data, yearMonth); + } public void applyArmor(Player player, boolean message) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/HorseMount.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/HorseMount.java index 232084feb..05a85e24d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/HorseMount.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/HorseMount.java @@ -1,26 +1,28 @@ package mineplex.core.mount; +import java.time.YearMonth; import java.util.Iterator; +import net.minecraft.server.v1_8_R3.EntityCreature; +import net.minecraft.server.v1_8_R3.NavigationAbstract; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; +import org.bukkit.entity.Horse; +import org.bukkit.entity.Horse.Color; +import org.bukkit.entity.Horse.Style; +import org.bukkit.entity.Horse.Variant; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; + import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import net.minecraft.server.v1_8_R3.EntityCreature; -import net.minecraft.server.v1_8_R3.NavigationAbstract; - -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; -import org.bukkit.entity.Horse.Variant; -import org.bukkit.entity.Horse; -import org.bukkit.entity.Player; -import org.bukkit.entity.Horse.Color; -import org.bukkit.entity.Horse.Style; -import org.bukkit.event.EventHandler; -import org.bukkit.inventory.ItemStack; public class HorseMount extends Mount<SingleEntityMountData<Horse>> { @@ -29,7 +31,7 @@ public class HorseMount extends Mount<SingleEntityMountData<Horse>> protected Variant _variant; protected double _jump; protected Material _armor; - + public HorseMount(MountManager manager, String name, String[] desc, Material displayMaterial, byte displayData, int cost, Color color, Style style, Variant variant, double jump, Material armor) { super (manager, name, displayMaterial, displayData, desc, cost); @@ -41,6 +43,18 @@ public class HorseMount extends Mount<SingleEntityMountData<Horse>> _jump = jump; _armor = armor; } + + public HorseMount(MountManager manager, String name, String[] desc, Material displayMaterial, byte displayData, int cost, Color color, Style style, Variant variant, double jump, Material armor, YearMonth yearMonth) + { + super (manager, name, displayMaterial, displayData, desc, cost, yearMonth); + KnownPackage = false; + + _color = color; + _style = style; + _variant = variant; + _jump = jump; + _armor = armor; + } @EventHandler public void UpdateHorse(UpdateEvent event) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/Mount.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/Mount.java index 9735c3a20..a978fd69f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/Mount.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/Mount.java @@ -1,10 +1,9 @@ package mineplex.core.mount; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.mount.event.MountActivateEvent; -import mineplex.core.shop.item.SalesPackageBase; +import java.time.YearMonth; +import java.util.HashMap; +import java.util.HashSet; + import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.Entity; @@ -14,8 +13,11 @@ import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; -import java.util.HashMap; -import java.util.HashSet; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.mount.event.MountActivateEvent; +import mineplex.core.shop.item.SalesPackageBase; public abstract class Mount<T extends MountData> extends SalesPackageBase implements Listener { @@ -23,6 +25,8 @@ public abstract class Mount<T extends MountData> extends SalesPackageBase implem protected HashMap<Player, T> _active = new HashMap<Player, T>(); public MountManager Manager; + + private YearMonth _yearMonth = null; public Mount(MountManager manager, String name, Material material, byte displayData, String[] description, int coins) { @@ -33,6 +37,17 @@ public abstract class Mount<T extends MountData> extends SalesPackageBase implem Manager.getPlugin().getServer().getPluginManager().registerEvents(this, Manager.getPlugin()); } + public Mount(MountManager manager, String name, Material material, byte displayData, String[] description, int coins, YearMonth yearMonth) + { + super(name, material, displayData, description, coins); + + Manager = manager; + + _yearMonth = yearMonth; + + Manager.getPlugin().getServer().getPluginManager().registerEvents(this, Manager.getPlugin()); + } + public final void enable(Player player) { MountActivateEvent gadgetEvent = new MountActivateEvent(player, this); @@ -99,4 +114,9 @@ public abstract class Mount<T extends MountData> extends SalesPackageBase implem } return null; } + + public YearMonth getYearMonth() + { + return _yearMonth; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java index 238082e40..bbd78a15e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java @@ -25,7 +25,6 @@ import mineplex.core.disguise.DisguiseManager; import mineplex.core.donation.DonationManager; import mineplex.core.mount.types.MountBabyReindeer; import mineplex.core.mount.types.MountCart; -import mineplex.core.mount.types.MountChicken; import mineplex.core.mount.types.MountDragon; import mineplex.core.mount.types.MountFreedomHorse; import mineplex.core.mount.types.MountFrost; @@ -77,7 +76,8 @@ public class MountManager extends MiniPlugin _types.add(new MountValentinesSheep(this)); _types.add(new MountFreedomHorse(this)); _types.add(new MountNightmareSteed(this)); - _types.add(new MountChicken(this)); + // Hidden in this update + //_types.add(new MountChicken(this)); //_types.add(new MountSheep(this)); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountChicken.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountChicken.java index b5d1a2df2..1d87ed989 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountChicken.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountChicken.java @@ -1,6 +1,8 @@ package mineplex.core.mount.types; import java.lang.reflect.Field; +import java.time.Month; +import java.time.YearMonth; import java.util.Map; import net.minecraft.server.v1_8_R3.EntityLiving; @@ -36,9 +38,9 @@ public class MountChicken extends HorseMount super(manager, "Chicken Mount", UtilText.splitLinesToArray(new String[] { - "Placeholder" + "This isn't flying! It is falling with style." }, LineFormat.LORE), - Material.GLASS, (byte) 0, -1, Horse.Color.BLACK, Horse.Style.NONE, Horse.Variant.HORSE, 2.0, Material.AIR); + Material.FEATHER, (byte) 0, -1, Horse.Color.BLACK, Horse.Style.NONE, Horse.Variant.HORSE, 2.0, Material.AIR, YearMonth.of(2017, Month.JANUARY)); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java index a21248956..7bf4ec023 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java @@ -348,7 +348,6 @@ public class TreasureLocation implements Listener { if (_currentTreasure.getPlayer().equals(player)) { - event.setCancelled(true); return; } double toDistanceFromCenter = _currentTreasure.getCenterBlock().getLocation().add(0.5, 1.5, 0.5).distanceSquared(event.getTo()); From 1ae89adfb001e97bfd5e9fe78c56fb834b85209e Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Sat, 22 Oct 2016 09:40:06 +0200 Subject: [PATCH 123/147] Remove debug messages --- .../games/smash/perks/spider/SmashSpider.java | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java index 305e4cabd..3ffcf8635 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/spider/SmashSpider.java @@ -3,7 +3,6 @@ package nautilus.game.arcade.game.games.smash.perks.spider; import java.util.HashMap; import java.util.Map; -import org.bukkit.Bukkit; import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.entity.LivingEntity; @@ -11,7 +10,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.entity.EntityRegainHealthEvent; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilParticle; @@ -154,18 +152,4 @@ public class SmashSpider extends SmashUltimate } } - @EventHandler(priority = EventPriority.HIGHEST) - public void onRegen(EntityRegainHealthEvent event) - { - if(!(event.getEntity() instanceof Player)) return; - - Player p = (Player) event.getEntity(); - - if(!hasPerk(p)) - { - return; - } - - Bukkit.broadcastMessage("Regen: " + p.getName() + " - " + event.getRegainReason().name() + " - " + event.getAmount() + " " + event.isCancelled()); - } } From d2be1fc64656da7b9a27f773a5af6e0dad4a04fe Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Sat, 22 Oct 2016 10:48:09 +0200 Subject: [PATCH 124/147] Don't set team mates on fire on direct fireball hit --- .../game/games/smash/perks/magmacube/PerkMagmaBlast.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBlast.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBlast.java index 20d96917b..036734ecd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBlast.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBlast.java @@ -213,6 +213,14 @@ public class PerkMagmaBlast extends Perk } Player player = event.GetDamageePlayer(); + if(proj.getShooter() instanceof Player) + { + Player shooter = (Player) proj.getShooter(); + if(TeamSuperSmash.getTeam(Manager, shooter, true).contains(player)) + { + return; + } + } if (UtilMath.offset(player, proj) < FIRE_RADIUS) { From 8414a17978fc9ce214a13a70698830f7cfb6fc68 Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Sat, 22 Oct 2016 10:48:36 +0200 Subject: [PATCH 125/147] Don't apply velocity to team mates --- .../games/smash/perks/guardian/PerkWhirlpoolBlade.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java index a40a2c735..e738a721a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWhirlpoolBlade.java @@ -30,6 +30,8 @@ import mineplex.core.projectile.ProjectileUser; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.kit.Perk; public class PerkWhirlpoolBlade extends Perk implements IThrown @@ -129,8 +131,11 @@ public class PerkWhirlpoolBlade extends Perk implements IThrown return; } - Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, DAMAGE, false, true, true, data.getThrower().getName(), GetName()); - + CustomDamageEvent event = Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, DAMAGE, false, true, true, data.getThrower().getName(), GetName()); + if(event.IsCancelled()) + { + return; + } UtilAction.velocity(target, UtilAlg.getTrajectory(target, data.getThrower()).setY(0.5)); } From 4e433665cc38e83bb2b26530d8d98511def1b957 Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Sat, 22 Oct 2016 10:49:02 +0200 Subject: [PATCH 126/147] Fixed golem smash affecting team mates --- .../game/arcade/game/games/smash/perks/golem/SmashGolem.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashGolem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashGolem.java index 973837961..a92739364 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashGolem.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/golem/SmashGolem.java @@ -19,6 +19,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.games.smash.TeamSuperSmash; import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashGolem extends SmashUltimate @@ -56,10 +57,12 @@ public class SmashGolem extends SmashUltimate { continue; } + + List<Player> team = TeamSuperSmash.getTeam(Manager, player, true); for (Player other : alivePlayers) { - if (player.equals(other) || UtilPlayer.isSpectator(other)) + if (player.equals(other) || UtilPlayer.isSpectator(other) || team.contains(other)) { continue; } From 720e965d08dd751cf5f7a5bfc9c891ca6217001c Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Sat, 22 Oct 2016 10:49:21 +0200 Subject: [PATCH 127/147] Fixed chicken rocket. --- .../game/games/smash/perks/chicken/PerkChickenRocket.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java index 2625bf466..196503f61 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java @@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.smash.perks.chicken; import java.util.HashSet; import java.util.Iterator; +import java.util.List; import java.util.Set; import org.bukkit.Color; @@ -35,6 +36,8 @@ import mineplex.core.common.util.UtilTime; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; + +import nautilus.game.arcade.game.games.smash.TeamSuperSmash; import nautilus.game.arcade.game.games.smash.perks.SmashPerk; import nautilus.game.arcade.kit.perks.data.ChickenMissileData; @@ -141,6 +144,7 @@ public class PerkChickenRocket extends SmashPerk } else { + List<Player> team = TeamSuperSmash.getTeam(Manager, data.Player, true); // Hit Entity for (Entity ent : UtilEnt.getInRadius(data.Chicken.getLocation(), HIT_BOX_RADIUS).keySet()) { @@ -164,7 +168,7 @@ public class PerkChickenRocket extends SmashPerk continue; } - if(Manager.GetGame().GetTeam(data.Player).GetPlayers(true).contains(ent)) + if(team.contains(ent)) { continue; } From 295f1f255f8c04fa356c74fb61459c410ec4143e Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Sat, 22 Oct 2016 13:09:56 +0200 Subject: [PATCH 128/147] Fixed rare NPEs --- .../nautilus/game/arcade/game/games/smash/kits/KitPig.java | 5 +++++ .../games/smash/perks/witherskeleton/PerkWitherImage.java | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java index ac7d67712..c97306a50 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java @@ -118,6 +118,11 @@ public class KitPig extends SmashKit return; } + if(Manager.GetGame() == null) + { + return; + } + for (Player player : Manager.GetGame().GetPlayers(true)) { if (!HasKit(player)) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java index dd5413a20..bdc668038 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java @@ -168,7 +168,7 @@ public class PerkWitherImage extends SmashPerk } } - if (_skeletons.get(event.getTarget().getUniqueId()).equals(event.getEntity())) + if (event.getTarget() != null && _skeletons.get(event.getTarget().getUniqueId()).equals(event.getEntity())) { event.setCancelled(true); } From 2d0d78e1b7e72c6e1a3d366682f52bbadaef594c Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Sat, 22 Oct 2016 21:28:11 +0200 Subject: [PATCH 129/147] Prevent snowman smash from affecting self, and give 3 snowmen --- .../arcade/game/games/smash/SuperSmash.java | 7 +++- .../smash/perks/snowman/SmashSnowman.java | 34 +++++++++++++++++-- 2 files changed, 37 insertions(+), 4 deletions(-) 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 bd40fd96f..82dbb73c7 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 @@ -403,7 +403,12 @@ public abstract class SuperSmash extends Game private void giveSmashItem(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 1, C.cYellowB + "Click" + C.cWhiteB + " - " + C.cGreenB + "Smash")); + int amount = 1; + if(GetKit(player) instanceof KitSnowman) + { + amount = 3; + } + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, amount, C.cYellowB + "Click" + C.cWhiteB + " - " + C.cGreenB + "Smash")); Manager.GetGame().Announce(C.Bold + player.getName() + " collected " + C.cGreen + C.Bold + "Smash Crystal" + ChatColor.RESET + C.Bold + "!"); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java index b7d20c5f5..cd35a6c62 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java @@ -16,6 +16,8 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.util.Vector; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; @@ -25,10 +27,12 @@ import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.games.smash.TeamSuperSmash; import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; @@ -53,7 +57,10 @@ public class SmashSnowman extends SmashUltimate @Override public void activate(Player player) { - super.activate(player); +// super.activate(player); + + player.sendMessage(F.main("Game", "Activated " + F.skill(GetName()) + ".")); + Game game = Manager.GetGame(); @@ -75,8 +82,12 @@ public class SmashSnowman extends SmashUltimate @Override public void cancel(Player player) { - super.cancel(player); +// super.cancel(player); + + player.sendMessage(F.main("Game", "Deactivated " + F.skill(GetName()) + ".")); + + /* Iterator<Snowman> iterator = _turret.keySet().iterator(); while (iterator.hasNext()) @@ -91,6 +102,7 @@ public class SmashSnowman extends SmashUltimate return; } } + */ } @EventHandler @@ -106,6 +118,21 @@ public class SmashSnowman extends SmashUltimate while (turretIter.hasNext()) { Snowman snowman = turretIter.next(); + + if(snowman.getTicksLived() >= (DURATION/50.0)) + { + UtilParticle.PlayParticle(ParticleType.SNOWBALL_POOF, snowman.getLocation().add(0, 1, 0), 0.4f, 0.4f, 0.4f, 0, 12, ViewDist.LONG, UtilServer.getPlayers()); + snowman.remove(); + turretIter.remove(); + continue; + } + else + { + double amount = 1 - snowman.getTicksLived() / (DURATION/50.0); + snowman.setCustomName(UtilText.getProgress(C.cGreen, amount, C.cRed, false)); + snowman.setCustomNameVisible(true); + } + Player player = _turret.get(snowman); Player target = UtilPlayer.getClosest(snowman.getLocation(), TeamSuperSmash.getTeam(Manager, player, true)); @@ -168,7 +195,7 @@ public class SmashSnowman extends SmashUltimate event.SetCancelled("Turret"); - if(TeamSuperSmash.getTeam(Manager, damager, false).contains(damagee)) + if(TeamSuperSmash.getTeam(Manager, damager, true).contains(damagee)) { return; } @@ -214,4 +241,5 @@ public class SmashSnowman extends SmashUltimate event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); } + } From 0306d0d9d131549ce1e7c00e5da2d09a28521784 Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Sun, 23 Oct 2016 01:27:09 +0200 Subject: [PATCH 130/147] Fix chicken rocket to deal damage and knockback --- .../game/games/smash/perks/chicken/PerkChickenRocket.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java index 196503f61..2c04bff35 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java @@ -190,6 +190,7 @@ public class PerkChickenRocket extends SmashPerk if (detonate) { + List<Player> team = TeamSuperSmash.getTeam(Manager, data.Player, true); // Damage for (LivingEntity ent : UtilEnt.getInRadius(data.Chicken.getLocation(), DAMAGE_RADIUS).keySet()) { @@ -204,7 +205,7 @@ public class PerkChickenRocket extends SmashPerk { continue; } - if (Manager.GetGame().GetTeam(data.Player).GetPlayers(true).contains(ent)) + if (team.contains(ent)) { continue; } From 4531902adcc3b20c69e729e1583374db33477885 Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Sun, 23 Oct 2016 01:27:34 +0200 Subject: [PATCH 131/147] Prevent guardian abilities from affecting team mates --- .../game/games/smash/perks/guardian/PerkWaterSplash.java | 9 +++++++-- .../games/smash/perks/guardian/SmashAnimationData.java | 5 ++++- .../game/games/smash/perks/guardian/SmashGuardian.java | 9 ++++++--- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java index ad5729e53..653344a77 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/PerkWaterSplash.java @@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.smash.perks.guardian; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.Set; import java.util.UUID; @@ -33,6 +34,8 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + +import nautilus.game.arcade.game.games.smash.TeamSuperSmash; import nautilus.game.arcade.kit.Perk; public class PerkWaterSplash extends Perk @@ -91,9 +94,10 @@ public class PerkWaterSplash extends Perk UtilAction.velocity(player, new Vector(0, VELOCITY_Y, 0)); _active.put(player.getUniqueId(), System.currentTimeMillis()); + List<Player> team = TeamSuperSmash.getTeam(Manager, player, true); for (Player other : UtilPlayer.getNearby(player.getLocation(), RADIUS)) { - if (player.equals(other)) + if (team.contains(other)) { continue; } @@ -161,9 +165,10 @@ public class PerkWaterSplash extends Perk Map<Player, Double> nearby = UtilPlayer.getInRadius(player.getLocation(), RADIUS); + List<Player> team = TeamSuperSmash.getTeam(Manager, player, true); for (Player other : nearby.keySet()) { - if (player.equals(other)) + if (team.contains(other)) { continue; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashAnimationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashAnimationData.java index 1a243a989..e891ca5cf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashAnimationData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashAnimationData.java @@ -1,5 +1,6 @@ package nautilus.game.arcade.game.games.smash.perks.guardian; +import java.util.List; import java.util.Map; import java.util.Random; @@ -24,6 +25,7 @@ import mineplex.core.common.util.particles.effects.LineParticle; import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.disguises.DisguiseGuardian; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.smash.TeamSuperSmash; public class SmashAnimationData { @@ -114,9 +116,10 @@ public class SmashAnimationData blockRestore.add(block, Material.PRISMARINE.getId(), (byte) random.nextInt(3), (long) (_duration + 5000 * Math.random())); } + List<Player> team = TeamSuperSmash.getTeam(_manager, _player, true); for (Player player : UtilPlayer.getNearby(_target.getLocation(), DAMAGE_RADIUS)) { - if (player.equals(_player)) + if (team.contains(player)) { continue; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashGuardian.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashGuardian.java index 920ba62e4..78e133ba2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashGuardian.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/guardian/SmashGuardian.java @@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.smash.perks.guardian; import java.util.HashSet; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.Set; @@ -19,6 +20,8 @@ import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; + +import nautilus.game.arcade.game.games.smash.TeamSuperSmash; import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; public class SmashGuardian extends SmashUltimate @@ -60,12 +63,12 @@ public class SmashGuardian extends SmashUltimate SmashAnimationData data = iterator.next(); if (data.getPlayer().equals(player)) - { + { Map<Player, Double> inRadius = UtilPlayer.getInRadius(data.getTarget().getLocation(), RADIUS); - + List<Player> team = TeamSuperSmash.getTeam(Manager, player, true); for (Player other : inRadius.keySet()) { - if (player.equals(other)) + if (team.contains(other)) { continue; } From 1a847862d5e5b9da39408cb41b0270c26a0d0b5e Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Sun, 23 Oct 2016 01:28:04 +0200 Subject: [PATCH 132/147] Prevent sometimes duplicate usage of the snowman smash --- .../game/games/smash/perks/snowman/SmashSnowman.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java index cd35a6c62..83823308a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java @@ -44,6 +44,7 @@ public class SmashSnowman extends SmashUltimate private static final int TURRET_HEALTH = 40; private static final int RATE = 250; private static final float KNOCKBACK_MAGNITUDE = 2.5F; + private static final int COOLDOWN = 1000; private Map<Projectile, Player> _snowball = new HashMap<>(); @@ -75,6 +76,8 @@ public class SmashSnowman extends SmashUltimate ent.setHealth(TURRET_HEALTH); UtilAction.velocity(ent, player.getLocation().getDirection(), 1, false, 0, 0.2, 1, false); + + Recharge.Instance.useForce(player, "Smash Cooldown - " + GetName(), COOLDOWN); _turret.put(ent, player); } @@ -242,4 +245,10 @@ public class SmashSnowman extends SmashUltimate event.AddKnockback(GetName(), KNOCKBACK_MAGNITUDE); } + @Override + public boolean isUsable(Player player) + { + return Recharge.Instance.usable(player, "Smash Cooldown - " + GetName()); + } + } From 7b7b7aadf8d9c180725a35c87be61c40be0bd15c Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Sun, 23 Oct 2016 01:28:57 +0200 Subject: [PATCH 133/147] Fix a notorious XP bug in the wolf kit --- .../game/arcade/game/games/smash/perks/wolf/PerkWolf.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/PerkWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/PerkWolf.java index bc060b790..74501dd68 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/PerkWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/PerkWolf.java @@ -514,9 +514,15 @@ public class PerkWolf extends SmashPerk timeIterator.remove(); } } - + // Exp player.setExp(Math.min(0.999f, _repeat.get(uuid).size() / 9f)); + + if(_repeat.get(uuid).isEmpty()) + { + playerIterator.remove(); + continue; + } } } } From c0ec1e1ff76ab15b370a87c3ce2b51e3a03cf570 Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Sun, 23 Oct 2016 03:11:51 +0200 Subject: [PATCH 134/147] Prevent infinite speed effect on creeper --- .../game/games/smash/perks/creeper/PerkCreeperElectricity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperElectricity.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperElectricity.java index 6581b6a97..a92cb53b5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperElectricity.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/creeper/PerkCreeperElectricity.java @@ -45,7 +45,7 @@ public class PerkCreeperElectricity extends Perk return; } - if (event.GetCause() == DamageCause.ENTITY_ATTACK || event.GetCause() == DamageCause.FIRE_TICK || event.GetCause() == DamageCause.STARVATION) + if (event.GetCause() == DamageCause.ENTITY_ATTACK || event.GetCause() == DamageCause.FIRE_TICK || event.GetCause() == DamageCause.STARVATION || event.GetCause() == DamageCause.POISON) { return; } From eaee382e7f358cd1c16f0f5b8961c1397be56872 Mon Sep 17 00:00:00 2001 From: xGamingDudex <kissan12@live.no> Date: Sun, 23 Oct 2016 16:22:27 +0200 Subject: [PATCH 135/147] Small typo --- .../nautilus/game/arcade/game/games/smash/kits/KitGuardian.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java index 822d73294..45129c462 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGuardian.java @@ -65,7 +65,7 @@ public class KitGuardian extends SmashKit C.cYellowB + "Passive" + C.cWhiteB + " - " + C.cGreenB + "Thorns", new String[] { C.Reset + "Takes 66% less damage and knockback from projectiles", - C.Reset + "when uder 10 health.", + C.Reset + "when under 10 health.", }), ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 1, C.cYellowB + "Smash Crystal" + C.cWhiteB + " - " + C.cGreenB + "Rise of the Guardian", From d6dc750ecefc75bc8ae27fa411aba0ede02d30ae Mon Sep 17 00:00:00 2001 From: Alexander Meech <Alex-The-Coder@users.noreply.github.com> Date: Sat, 22 Oct 2016 14:36:47 -0400 Subject: [PATCH 136/147] Prevent MPS servers with Lobbyblablabla-1 as... ...the name from being loaded as an applicable lobby server --- .../src/mineplex/bungee/lobbyBalancer/LobbyBalancer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/lobbyBalancer/LobbyBalancer.java b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/lobbyBalancer/LobbyBalancer.java index 0c57abfea..de8602e07 100644 --- a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/lobbyBalancer/LobbyBalancer.java +++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/lobbyBalancer/LobbyBalancer.java @@ -106,14 +106,14 @@ public class LobbyBalancer implements Listener, Runnable InetSocketAddress socketAddress = new InetSocketAddress(server.getPublicAddress(), server.getPort()); _plugin.getProxy().getServers().put(server.getName(), _plugin.getProxy().constructServerInfo(server.getName(), socketAddress, "LobbyBalancer", false)); - if (server.getName().toUpperCase().startsWith("LOBBY")) + if (server.getName().toUpperCase().startsWith("LOBBY-")) { if (server.getMotd() == null || !server.getMotd().contains("Restarting")) { _sortedLobbies.add(server); } } - if (server.getName().toUpperCase().startsWith("CLANSHUB")) + if (server.getName().toUpperCase().startsWith("CLANSHUB-")) { if (server.getMotd() == null || !server.getMotd().contains("Restarting")) { From 44e016f272243beec067bfa61a2d274f6b7d15d1 Mon Sep 17 00:00:00 2001 From: cnr <ConnorNJames@gmail.com> Date: Tue, 25 Oct 2016 01:43:42 -0500 Subject: [PATCH 137/147] Fix infinite loop in GameWorldManager --- .../src/nautilus/game/arcade/managers/GameWorldManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameWorldManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameWorldManager.java index fdaf4c271..43a654f57 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameWorldManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameWorldManager.java @@ -39,7 +39,7 @@ public class GameWorldManager implements Listener while (worldIterator.hasNext()) { long timeLeft = endTime - System.currentTimeMillis(); - if (timeLeft <= 0) continue; + if (timeLeft <= 0) break; final WorldData worldData = worldIterator.next(); From ab228fb4923a56998da6f73f093b3faed161bbc6 Mon Sep 17 00:00:00 2001 From: AlexTheCoder <alexjmeech@gmail.com> Date: Sat, 22 Oct 2016 23:52:33 -0400 Subject: [PATCH 138/147] Implement trick or treat chest in customer support server --- .../customerSupport/CustomerSupport.java | 13 +++++++++++++ .../salespackage/SalesPackageManager.java | 4 +++- .../salespackages/TrickOrTreatChest.java | 19 +++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/TrickOrTreatChest.java diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index b81e2ae90..fa2d4c7bf 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -158,6 +158,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable int omegaChestsReceived = 0; int hauntedChestsReceived = 0; int hauntedChestsOpened = 0; + int trickOrTreatChestsReceived = 0; for (CoinTransactionToken transaction : donor.getCoinTransactions()) { @@ -257,6 +258,17 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable hauntedChestsReceived += 1; } + } + if (transaction.SalesPackageName.startsWith("Trick or Treat Chest")) + { + if (transaction.Coins == 0 && transaction.Gems == 0) + { + if (transaction.SalesPackageName.split(" ").length == 3) + trickOrTreatChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); + else if (transaction.SalesPackageName.split(" ").length == 2) + trickOrTreatChestsReceived += 1; + } + } if (transaction.SalesPackageName.startsWith("Valentines Gift")) { @@ -326,6 +338,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable caller.sendMessage(C.cBlue + "Omega Chests Received: " + C.cYellow + omegaChestsReceived); caller.sendMessage(C.cBlue + "Haunted Chests Received: " + C.cYellow + hauntedChestsReceived); caller.sendMessage(C.cBlue + "Haunted Chests Opened: " + C.cYellow + hauntedChestsOpened); + caller.sendMessage(C.cBlue + "Trick or Treat Chests Received: " + C.cYellow + trickOrTreatChestsReceived); caller.sendMessage(C.cBlue + "Game Amplifiers Received: " + C.cYellow + boostersReceived); caller.sendMessage(C.cBlue + "Rune Amplifiers (20 min) Received: " + C.cYellow + runeAmplifier20); caller.sendMessage(C.cBlue + "Rune Amplifiers (60 min) Received: " + C.cYellow + runeAmplifier60); diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java index 7996621e1..aed398e97 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java @@ -35,6 +35,7 @@ import mineplex.staffServer.salespackage.salespackages.Pet; import mineplex.staffServer.salespackage.salespackages.PowerPlayClub; import mineplex.staffServer.salespackage.salespackages.RuneAmplifier; import mineplex.staffServer.salespackage.salespackages.SalesPackageBase; +import mineplex.staffServer.salespackage.salespackages.TrickOrTreatChest; public class SalesPackageManager extends MiniPlugin { @@ -92,6 +93,7 @@ public class SalesPackageManager extends MiniPlugin AddSalesPackage(new PowerPlayClub(this, true)); AddSalesPackage(new OmegaChest(this)); AddSalesPackage(new HauntedChest(this)); + AddSalesPackage(new TrickOrTreatChest(this)); for (mineplex.core.pet.Pet pet : _petFactory.GetPets()) { @@ -165,7 +167,7 @@ public class SalesPackageManager extends MiniPlugin { coinBuilder = coinBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray"); } - else if (salesPackage instanceof MythicalChest || salesPackage instanceof AncientChest || salesPackage instanceof OldChest || salesPackage instanceof IlluminatedChest || salesPackage instanceof FreedomChest) + else if (salesPackage instanceof MythicalChest || salesPackage instanceof AncientChest || salesPackage instanceof OldChest || salesPackage instanceof IlluminatedChest || salesPackage instanceof FreedomChest || salesPackage instanceof HauntedChest || salesPackage instanceof TrickOrTreatChest) { chestBuilder = chestBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray"); } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/TrickOrTreatChest.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/TrickOrTreatChest.java new file mode 100644 index 000000000..315dd6151 --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/TrickOrTreatChest.java @@ -0,0 +1,19 @@ +package mineplex.staffServer.salespackage.salespackages; + +import mineplex.staffServer.salespackage.SalesPackageManager; +import org.bukkit.entity.Player; + +public class TrickOrTreatChest extends SalesPackageBase +{ + public TrickOrTreatChest(SalesPackageManager manager) + { + super(manager, "1 Trick or Treat Chest"); + } + + public void displayToAgent(Player agent, String playerName) + { + addButton(agent, "/sales item " + playerName + " 1 Item Trick or Treat Chest", "Give 1 Trick or Treat Chest."); + agent.sendMessage(" "); + addBackButton(agent, playerName); + } +} \ No newline at end of file From a36ebf4528150b40321c2a7907974fab392863f1 Mon Sep 17 00:00:00 2001 From: AlexTheCoder <alexjmeech@gmail.com> Date: Sun, 23 Oct 2016 00:03:26 -0400 Subject: [PATCH 139/147] Add several new reward types, implement trick or treat chest and all its animations, and fix playwire nested threads --- .../core/playwire/PlayWireManager.java | 15 ++- .../mineplex/core/reward/RewardManager.java | 25 +++- .../src/mineplex/core/reward/RewardPool.java | 1 + .../src/mineplex/core/reward/RewardType.java | 1 + .../core/reward/rewards/ChestReward.java | 80 ++++++++++++ .../reward/rewards/GameAmplifierReward.java | 78 ++++++++++++ .../core/reward/rewards/RankReward.java | 2 +- .../reward/rewards/RuneAmplifierReward.java | 78 ++++++++++++ .../core/reward/rewards/SpinTicketReward.java | 120 ++++++++++++++++++ .../mineplex/core/treasure/TreasureType.java | 4 +- .../animation/BlockChangeAnimation.java | 23 +++- .../animation/ChestOpenAnimation.java | 13 +- .../animation/ChestSpawnAnimation.java | 87 +++++++++++-- .../core/treasure/gui/TreasurePage.java | 24 ++++ 14 files changed, 526 insertions(+), 25 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/ChestReward.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/GameAmplifierReward.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RuneAmplifierReward.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/SpinTicketReward.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java b/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java index 3e7995add..501711c78 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java @@ -15,6 +15,7 @@ import mineplex.core.MiniDbClientPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.bonuses.BonusManager; import mineplex.core.common.util.C; +import mineplex.core.common.util.Callback; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTime.TimeUnit; import mineplex.core.donation.DonationManager; @@ -82,6 +83,14 @@ public class PlayWireManager extends MiniDbClientPlugin<PlayWireClientData> { _donationManager.RewardCoinsLater("Watching Ad", player, 100); final int accountId = _clientManager.Get(player).getAccountId(); + final Callback<Integer> ticketCallback = new Callback<Integer>() + { + public void run(Integer newTickets) + { + Managers.get(BonusManager.class).Get(player).setTickets(newTickets); + Managers.get(BonusManager.class).updateCreeperVisual(player, true, C.cAqua); + } + }; runAsync(() -> { try (Connection c = DBPool.getAccount().getConnection(); Statement statement = c.createStatement()) @@ -97,11 +106,7 @@ public class PlayWireManager extends MiniDbClientPlugin<PlayWireClientData> { final int newTickets = rs.getInt(1); - runSync(() -> - { - Managers.get(BonusManager.class).Get(player).setTickets(newTickets); - Managers.get(BonusManager.class).updateCreeperVisual(player, true, C.cAqua); - }); + ticketCallback.run(newTickets); } } catch (Exception e) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index 48fce2012..d5e7b6b12 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java @@ -5,6 +5,7 @@ import java.util.EnumMap; import java.util.List; import java.util.Random; +import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -131,12 +132,17 @@ import mineplex.core.mount.types.MountZombie; import mineplex.core.pet.Pet; import mineplex.core.pet.PetManager; import mineplex.core.reward.RewardPool.Type; +import mineplex.core.reward.rewards.ChestReward; +import mineplex.core.reward.rewards.GameAmplifierReward; import mineplex.core.reward.rewards.InventoryReward; import mineplex.core.reward.rewards.PetReward; import mineplex.core.reward.rewards.RankReward; +import mineplex.core.reward.rewards.RuneAmplifierReward; +import mineplex.core.reward.rewards.SpinTicketReward; import mineplex.core.reward.rewards.TreasureShardReward; import mineplex.core.reward.rewards.UnknownPackageReward; import mineplex.core.stats.StatsManager; +import mineplex.core.treasure.TreasureType; public class RewardManager { @@ -443,6 +449,14 @@ public class RewardManager addGadget(Type.HAUNTED, getGadget(DoubleJumpHalloween.class), rarity, 10); addHat(Type.HAUNTED, HatType.PUMPKIN, rarity, 10); addGadget(Type.HAUNTED, getGadget(ArrowTrailHalloween.class), rarity, 100); + + //TRICK OR TREAT + addReward(Type.TRICK_OR_TREAT, new SpinTicketReward(_clientManager, 1, 3, rarity, 5, 0)); + addReward(Type.TRICK_OR_TREAT, new GameAmplifierReward(_inventoryManager, 1, 2, rarity, 5, 0)); + addReward(Type.TRICK_OR_TREAT, new RuneAmplifierReward(_inventoryManager, 20, 1, 3, rarity, 2, 0)); + addReward(Type.TRICK_OR_TREAT, new UnknownPackageReward(_donationManager, "Clan Banner Access", "Wear/Place Clan Banner", "Clan Banner Usage", new ItemStack(Material.BANNER), rarity, 1, 0)); + addReward(Type.TRICK_OR_TREAT, new ChestReward(_inventoryManager, TreasureType.OLD, 1, 5, rarity, 5, 0)); + addReward(Type.TRICK_OR_TREAT, new ChestReward(_inventoryManager, TreasureType.ANCIENT, 1, 5, rarity, 10, 0)); } public void addLegendary() @@ -595,6 +609,13 @@ public class RewardManager addGadget(Type.HAUNTED, getGadget(MorphGrimReaper.class), rarity, 25); addGadget(Type.HAUNTED, getGadget(WinEffectHalloween.class), rarity, 50); addMount(Type.HAUNTED, getMount(MountNightmareSteed.class), rarity, 60); + + //TRICK OR TREAT + addReward(Type.TRICK_OR_TREAT, new ChestReward(_inventoryManager, TreasureType.MYTHICAL, 1, 3, rarity, 10, 0)); + addReward(Type.TRICK_OR_TREAT, new ChestReward(_inventoryManager, TreasureType.ILLUMINATED, 1, 1, rarity, 3, 0)); + addMount(Type.TRICK_OR_TREAT, getMount(MountZombie.class), rarity, 1); + addPetReward(Type.HAUNTED, EntityType.ZOMBIE, rarity, 1); + addGadget(Type.TRICK_OR_TREAT, getGadget(MorphPumpkinKing.class), rarity, 1); } public UnknownPackageReward addMount(Type type, Mount<?> mount, RewardRarity rarity, int weight) @@ -805,7 +826,7 @@ public class RewardManager { int amount = 4; if(type == RewardType.ILLUMINATED_CHEST || type == RewardType.FREEDOM_CHEST || type == RewardType.OMEGA_CHEST - || type == RewardType.HAUNTED_CHEST) amount = 1; + || type == RewardType.HAUNTED_CHEST || type == RewardType.TRICK_OR_TREAT_CHEST) amount = 1; int currentReward = 0; Reward[] rewards = new Reward[amount]; @@ -885,7 +906,7 @@ public class RewardManager //Dont give Rank Upgrade if already has Titan if (rarity == RewardRarity.MYTHICAL) { - if (canGiveMythical && type == RewardType.MYTHICAL_CHEST && !_clientManager.Get(player).GetRank().has(Rank.TITAN)) + if (canGiveMythical && (type == RewardType.MYTHICAL_CHEST || type == RewardType.TRICK_OR_TREAT_CHEST) && !_clientManager.Get(player).GetRank().has(Rank.TITAN)) { return new RankReward(_clientManager, 0, 0, rarity); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java index 2ccd852ab..086909b66 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java @@ -57,6 +57,7 @@ public class RewardPool FREEDOM(false), OMEGA(false), HAUNTED(false), + TRICK_OR_TREAT(false), CARL_SPINNER(true); private boolean _useDuplicates; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java index ecd9ab3a2..9c6550cb9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java @@ -15,6 +15,7 @@ public enum RewardType FREEDOM_CHEST( 0, 5, 18, 0), HAUNTED_CHEST( 0, 5, 18, 0), OMEGA_CHEST( 0, 2, 16, 32), + TRICK_OR_TREAT_CHEST(0.1, 2, 16, 0), VALENTINES_GIFT( 0, 7, 20, 20), SPINNER_FILLER( 0.1, 1, 4, 20), diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/ChestReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/ChestReward.java new file mode 100644 index 000000000..21b038228 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/ChestReward.java @@ -0,0 +1,80 @@ +package mineplex.core.reward.rewards; + +import java.util.Random; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.inventory.InventoryManager; +import mineplex.core.reward.Reward; +import mineplex.core.reward.RewardData; +import mineplex.core.reward.RewardRarity; +import mineplex.core.reward.RewardType; +import mineplex.core.treasure.TreasureType; + +public class ChestReward extends Reward +{ + private Random _random; + + private InventoryManager _inventoryManager; + private int _max, _min; + private TreasureType _type; + + public ChestReward(InventoryManager inventoryManager, TreasureType type, int min, int max, RewardRarity rarity, int weight, int shardValue) + { + this(RANDOM, inventoryManager, type, min, max, rarity, weight, shardValue); + } + + public ChestReward(Random random, InventoryManager inventoryManager, TreasureType type, int min, int max, RewardRarity rarity, int weight, int shardValue) + { + super(rarity, weight, shardValue); + + _random = random; + _inventoryManager = inventoryManager; + _max = max; + _min = min; + _type = type; + } + + @Override + public RewardData giveRewardCustom(Player player, RewardType rewardType) + { + int amountToGive; + + if (_min != _max) + { + amountToGive = _random.nextInt(_max - _min) + _min; + } + else + { + amountToGive = _min; + } + + _inventoryManager.addItemToInventory(player, _type.getItemName(), amountToGive); + + return new RewardData(getRarity().getDarkColor() + "Treasure Chest", getRarity().getColor() + amountToGive + " " + ChatColor.stripColor(_type.getName()), new ItemStack(_type.getMaterial()), getRarity()); + } + + @Override + public RewardData getFakeRewardData(Player player) + { + return new RewardData(getRarity().getDarkColor() + "Treasure Chest", getRarity().getColor() + ChatColor.stripColor(_type.getName()), new ItemStack(_type.getMaterial()), getRarity()); + } + + @Override + public boolean canGiveReward(Player player) + { + return true; + } + + @Override + public boolean equals(Object obj) + { + if (obj instanceof ChestReward) + { + return ((ChestReward) obj)._type.getName().equals(_type.getName()); + } + return false; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/GameAmplifierReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/GameAmplifierReward.java new file mode 100644 index 000000000..cabff6482 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/GameAmplifierReward.java @@ -0,0 +1,78 @@ +package mineplex.core.reward.rewards; + +import java.util.Random; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.boosters.BoosterManager; +import mineplex.core.inventory.InventoryManager; +import mineplex.core.reward.Reward; +import mineplex.core.reward.RewardData; +import mineplex.core.reward.RewardRarity; +import mineplex.core.reward.RewardType; + +public class GameAmplifierReward extends Reward +{ + private Random _random; + + private InventoryManager _inventoryManager; + private int _max, _min; + + public GameAmplifierReward(InventoryManager inventoryManager, int min, int max, RewardRarity rarity, int weight, int shardValue) + { + this(RANDOM, inventoryManager, min, max, rarity, weight, shardValue); + } + + public GameAmplifierReward(Random random, InventoryManager inventoryManager, int min, int max, RewardRarity rarity, int weight, int shardValue) + { + super(rarity, weight, shardValue); + + _random = random; + _inventoryManager = inventoryManager; + _max = max; + _min = min; + } + + @Override + public RewardData giveRewardCustom(Player player, RewardType rewardType) + { + int amountToGive; + + if (_min != _max) + { + amountToGive = _random.nextInt(_max - _min) + _min; + } + else + { + amountToGive = _min; + } + + _inventoryManager.addItemToInventory(player, BoosterManager.BOOSTER_ITEM, amountToGive); + + return new RewardData(getRarity().getDarkColor() + "Game Amplifier", getRarity().getColor() + amountToGive + " Game Amplifier", new ItemStack(Material.EMERALD), getRarity()); + } + + @Override + public RewardData getFakeRewardData(Player player) + { + return new RewardData(getRarity().getDarkColor() + "Game Amplifier", getRarity().getColor() + "Game Amplifier", new ItemStack(Material.EMERALD), getRarity()); + } + + @Override + public boolean canGiveReward(Player player) + { + return true; + } + + @Override + public boolean equals(Object obj) + { + if (obj instanceof GameAmplifierReward) + { + return true; + } + return false; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java index 9dcb1f070..c42b26dd1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java @@ -34,7 +34,7 @@ public class RankReward extends Reward if (_clientManager.Get(player).GetRank() == Rank.ALL) rank = Rank.ULTRA; else if (_clientManager.Get(player).GetRank() == Rank.ULTRA) rank = Rank.HERO; else if (_clientManager.Get(player).GetRank() == Rank.HERO) rank = Rank.LEGEND; - else if (rewardType == RewardType.MYTHICAL_CHEST && _clientManager.Get(player).GetRank() == Rank.LEGEND) rank = Rank.TITAN; + else if ((rewardType == RewardType.MYTHICAL_CHEST || rewardType == RewardType.TRICK_OR_TREAT_CHEST) && _clientManager.Get(player).GetRank() == Rank.LEGEND) rank = Rank.TITAN; if (rewardType == RewardType.MYTHICAL_CHEST && _random.nextDouble() < 0.01) // 1 Percent rank = Rank.TITAN; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RuneAmplifierReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RuneAmplifierReward.java new file mode 100644 index 000000000..96ac448ee --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RuneAmplifierReward.java @@ -0,0 +1,78 @@ +package mineplex.core.reward.rewards; + +import java.util.Random; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.inventory.InventoryManager; +import mineplex.core.reward.Reward; +import mineplex.core.reward.RewardData; +import mineplex.core.reward.RewardRarity; +import mineplex.core.reward.RewardType; + +public class RuneAmplifierReward extends Reward +{ + private Random _random; + + private InventoryManager _inventoryManager; + private int _max, _min, _minutes; + + public RuneAmplifierReward(InventoryManager inventoryManager, int minutes, int min, int max, RewardRarity rarity, int weight, int shardValue) + { + this(RANDOM, inventoryManager, minutes, min, max, rarity, weight, shardValue); + } + + public RuneAmplifierReward(Random random, InventoryManager inventoryManager, int minutes, int min, int max, RewardRarity rarity, int weight, int shardValue) + { + super(rarity, weight, shardValue); + + _random = random; + _inventoryManager = inventoryManager; + _max = max; + _min = min; + _minutes = minutes; + } + + @Override + public RewardData giveRewardCustom(Player player, RewardType rewardType) + { + int amountToGive; + + if (_min != _max) + { + amountToGive = _random.nextInt(_max - _min) + _min; + } + else + { + amountToGive = _min; + } + + _inventoryManager.addItemToInventory(player, "Rune Amplifier " + _minutes, amountToGive); + + return new RewardData(getRarity().getDarkColor() + "Rune Amplifier", getRarity().getColor() + amountToGive + " " + _minutes + " minute Amplifier", new ItemStack(Material.NETHER_STAR), getRarity()); + } + + @Override + public RewardData getFakeRewardData(Player player) + { + return new RewardData(getRarity().getDarkColor() + "Rune Amplifier", getRarity().getColor() + _minutes + " minute Amplifier", new ItemStack(Material.NETHER_STAR), getRarity()); + } + + @Override + public boolean canGiveReward(Player player) + { + return true; + } + + @Override + public boolean equals(Object obj) + { + if (obj instanceof RuneAmplifierReward) + { + return ((RuneAmplifierReward) obj)._minutes == _minutes; + } + return false; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/SpinTicketReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/SpinTicketReward.java new file mode 100644 index 000000000..afa7f610d --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/SpinTicketReward.java @@ -0,0 +1,120 @@ +package mineplex.core.reward.rewards; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.Statement; +import java.util.Random; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.Managers; +import mineplex.core.account.CoreClientManager; +import mineplex.core.bonuses.BonusManager; +import mineplex.core.common.util.Callback; +import mineplex.core.reward.Reward; +import mineplex.core.reward.RewardData; +import mineplex.core.reward.RewardRarity; +import mineplex.core.reward.RewardType; +import mineplex.serverdata.database.DBPool; + +public class SpinTicketReward extends Reward +{ + private Random _random; + + private CoreClientManager _clientManager; + private int _max, _min; + + public SpinTicketReward(CoreClientManager clientManager, int min, int max, RewardRarity rarity, int weight, int shardValue) + { + this(RANDOM, clientManager, min, max, rarity, weight, shardValue); + } + + public SpinTicketReward(Random random, CoreClientManager clientManager, int min, int max, RewardRarity rarity, int weight, int shardValue) + { + super(rarity, weight, shardValue); + + _random = random; + _clientManager = clientManager; + _max = max; + _min = min; + } + + @Override + public RewardData giveRewardCustom(Player player, RewardType rewardType) + { + if (_clientManager.getAccountId(player) == -1) + { + return getFakeRewardData(player); + } + + final int amountToGive; + + if (_min != _max) + { + amountToGive = _random.nextInt(_max - _min) + _min; + } + else + { + amountToGive = _min; + } + + final int accountId = _clientManager.getAccountId(player); + final Callback<Integer> ticketCallback = new Callback<Integer>() + { + public void run(Integer newTickets) + { + Managers.get(BonusManager.class).Get(player).setTickets(newTickets); + } + }; + _clientManager.runAsync(() -> + { + try (Connection c = DBPool.getAccount().getConnection(); Statement statement = c.createStatement()) + { + final String query = "UPDATE bonus SET tickets = tickets + " + amountToGive + " WHERE accountId = " + accountId + ";SELECT tickets FROM bonus WHERE accountId = " + accountId; + + statement.execute(query); + statement.getUpdateCount(); + statement.getMoreResults(); + + ResultSet rs = statement.getResultSet(); + if (rs.next()) + { + final int newTickets = rs.getInt(1); + + ticketCallback.run(newTickets); + } + } + catch (Exception e) + { + System.out.println("Failed to award ticket to player: " + player); + e.printStackTrace(); + } + }); + + return new RewardData(getRarity().getDarkColor() + "Carl Spin Ticket", getRarity().getColor() + amountToGive + " Carl Spin Ticket", new ItemStack(Material.PAPER), getRarity()); + } + + @Override + public RewardData getFakeRewardData(Player player) + { + return new RewardData(getRarity().getDarkColor() + "Carl Spin Ticket", getRarity().getColor() + "Carl Spin ticket", new ItemStack(Material.PAPER), getRarity()); + } + + @Override + public boolean canGiveReward(Player player) + { + return true; + } + + @Override + public boolean equals(Object obj) + { + if (obj instanceof SpinTicketReward) + { + return true; + } + return false; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java index 3e3549344..80cfff9fd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java @@ -22,7 +22,9 @@ public enum TreasureType OMEGA(C.cAqua + "Omega Chest", "Omega Chest", "Omega", RewardType.OMEGA_CHEST, Material.ENDER_CHEST, TreasureStyle.OMEGA, RewardPool.Type.OMEGA, false, 50000), - HAUNTED(C.cGold + "Haunted Chest", "Haunted Chest", "Haunted", RewardType.HAUNTED_CHEST, Material.CHEST, TreasureStyle.HALLOWEEN, RewardPool.Type.HAUNTED, true, 35000); + HAUNTED(C.cGold + "Haunted Chest", "Haunted Chest", "Haunted", RewardType.HAUNTED_CHEST, Material.CHEST, TreasureStyle.HALLOWEEN, RewardPool.Type.HAUNTED, true, 35000), + + TRICK_OR_TREAT(C.cGold + "Trick or Treat Treasure", "Trick or Treat Chest", "TrickOrTreat", RewardType.TRICK_OR_TREAT_CHEST, Material.CHEST, TreasureStyle.HALLOWEEN, RewardPool.Type.TRICK_OR_TREAT, true, 20000); private final String _name; private final RewardType _rewardType; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java index c058974b2..5dbc7ebd4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java @@ -2,13 +2,14 @@ package mineplex.core.treasure.animation; import java.util.List; -import mineplex.core.treasure.BlockInfo; -import mineplex.core.treasure.Treasure; -import mineplex.core.treasure.TreasureType; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; +import mineplex.core.treasure.BlockInfo; +import mineplex.core.treasure.Treasure; +import mineplex.core.treasure.TreasureType; + public class BlockChangeAnimation extends Animation { private static final int MAX_RADIUS = 4; @@ -75,7 +76,7 @@ public class BlockChangeAnimation extends Animation mat = Material.ENDER_STONE; data = 0; } - else if (getTreasure().getTreasureType() == TreasureType.HAUNTED) + else if (getTreasure().getTreasureType() == TreasureType.HAUNTED || getTreasure().getTreasureType() == TreasureType.TRICK_OR_TREAT) { mat = Material.WOOL; data = 1; @@ -112,7 +113,7 @@ public class BlockChangeAnimation extends Animation mat = Material.ENDER_STONE; data = 0; } - else if (getTreasure().getTreasureType() == TreasureType.HAUNTED) + else if (getTreasure().getTreasureType() == TreasureType.HAUNTED || getTreasure().getTreasureType() == TreasureType.TRICK_OR_TREAT) { mat = Material.WOOL; data = 15; @@ -161,6 +162,18 @@ public class BlockChangeAnimation extends Animation } } } + else if (getTreasure().getTreasureType() == TreasureType.TRICK_OR_TREAT) + { + for (Block c : _chests) + { + if (c.equals(b)) + { + _blockInfoList.add(new BlockInfo(b)); + b.setType(Material.CAULDRON); + b.setData((byte)3); + } + } + } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestOpenAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestOpenAnimation.java index 6b723e8f2..8e65a6da1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestOpenAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestOpenAnimation.java @@ -1,6 +1,5 @@ package mineplex.core.treasure.animation; -import mineplex.core.common.util.banner.CountryFlag; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -19,13 +18,14 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.hologram.Hologram; import mineplex.core.hologram.HologramManager; +import mineplex.core.reward.RankRewardData; import mineplex.core.reward.RewardData; import mineplex.core.treasure.ChestData; import mineplex.core.treasure.Treasure; +import mineplex.core.treasure.TreasureType; import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction; import net.minecraft.server.v1_8_R3.TileEntity; -import net.minecraft.server.v1_8_R3.TileEntityChest; import net.minecraft.server.v1_8_R3.TileEntityEnderChest; /** @@ -47,6 +47,15 @@ public class ChestOpenAnimation extends Animation _chestData = chestData; _rewardData = rewardData; + if (treasure.getTreasureType() == TreasureType.TRICK_OR_TREAT && rewardData instanceof RankRewardData) + { + Block block = chestData.getBlock(); + for (Player other : UtilServer.getPlayers()) + { + other.sendBlockChange(block.getLocation(), Material.DRAGON_EGG, (byte)0); + } + return; + } // Send chest open packet Block block = chestData.getBlock(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java index eff9e7d70..2b17df518 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java @@ -2,23 +2,37 @@ package mineplex.core.treasure.animation; import java.util.List; -import mineplex.core.common.util.*; +import org.bukkit.Color; +import org.bukkit.Location; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.EntityType; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +import com.google.common.collect.Lists; + +import mineplex.core.Managers; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.particles.ColoredParticle; import mineplex.core.common.util.particles.DustSpellColor; +import mineplex.core.disguise.DisguiseManager; +import mineplex.core.disguise.disguises.DisguiseBat; import mineplex.core.gadget.gadgets.particle.unrelated.BabyFireworkEffect; import mineplex.core.treasure.BlockInfo; import mineplex.core.treasure.Treasure; import mineplex.core.treasure.TreasureType; import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.MathHelper; -import org.bukkit.Color; -import org.bukkit.Location; -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; -import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.util.Vector; /** * Created by Shaun on 8/29/2014. @@ -43,6 +57,8 @@ public class ChestSpawnAnimation extends Animation private int _circleAmount = 0; private int _currentHauntedColor = 0; + + private List<ArmorStand> _bats = Lists.newArrayList(); public ChestSpawnAnimation(Treasure treasure, Block block, List<BlockInfo> chestBlockInfo, Block openingCenter, double radialOffset, JavaPlugin javaPlugin) { @@ -73,6 +89,17 @@ public class ChestSpawnAnimation extends Animation _particleDirection = UtilAlg.getTrajectory(_particleLocation, _centerLocation); _particleDirection.multiply(UtilMath.offset(_particleLocation, _centerLocation) / (double)ANIMATION_DURATION); + if (treasure.getTreasureType() == TreasureType.TRICK_OR_TREAT) + { + for (int i = 0; i < 5; i++) + { + ArmorStand stand = (ArmorStand)_centerLocation.getWorld().spawnEntity(_centerLocation, EntityType.ARMOR_STAND); + stand.setGravity(false); + stand.setVisible(false); + _bats.add(stand); + } + doBats(true, _centerLocation.clone().add(0, 6, 0), _bats); + } _radialOffset = radialOffset; @@ -176,7 +203,7 @@ public class ChestSpawnAnimation extends Animation _circleAmount++; } - else if (getTreasure().getTreasureType() == TreasureType.HAUNTED) + else if (getTreasure().getTreasureType() == TreasureType.HAUNTED || getTreasure().getTreasureType() == TreasureType.TRICK_OR_TREAT) { float x = (float) (Math.sin(getTicks()/4D)); float z = (float) (Math.cos(getTicks()/4D)); @@ -196,6 +223,11 @@ public class ChestSpawnAnimation extends Animation { _currentHauntedColor = 0; } + + if (getTreasure().getTreasureType() == TreasureType.TRICK_OR_TREAT) + { + doBats(true, _centerLocation.clone().add(0, 6, 0), _bats); + } } //Spawn Chest @@ -217,7 +249,12 @@ public class ChestSpawnAnimation extends Animation UtilParticle.PlayParticle(getTreasure().getTreasureType().getStyle().getSecondaryParticle(), loc, 0.7f, 0.7f, 0.7f, 1, 50, ViewDist.NORMAL, UtilServer.getPlayers()); } - + + if (getTreasure().getTreasureType() == TreasureType.TRICK_OR_TREAT) + { + _bats.forEach(bat -> bat.remove()); + _bats.clear(); + } UtilParticle.ParticleType particleType = getTreasure().getTreasureType().getStyle().getChestSpawnParticle(); @@ -262,4 +299,36 @@ public class ChestSpawnAnimation extends Animation { } + + private void doBats(boolean initial, Location center, List<ArmorStand> bats) + { + for (int i = 0; i < bats.size(); i++) + { + ArmorStand bat = bats.get(i); + double lead = i * ((2d * Math.PI)/bats.size()); + + double sizeMod = 2; + + //Orbit + double speed = 10d; + double oX = -Math.sin(getTicks()/speed + lead) * 2 * sizeMod; + double oY = 0; + double oZ = Math.cos(getTicks()/speed + lead) * 2 * sizeMod; + + if (initial) + { + DisguiseManager disguiseMan = Managers.get(DisguiseManager.class); + DisguiseBat disguise = new DisguiseBat(bat); + disguise.setSitting(false); + disguiseMan.disguise(disguise); + bat.teleport(center.clone().add(oX, oY, oZ)); + } + else + { + Location to = center.clone().add(oX, oY, oZ); + UtilEnt.LookAt(bat, to); + UtilAction.velocity(bat, UtilAlg.getTrajectory(bat.getLocation(), to), 0.4, false, 0, 0.1, 1, true); + } + } + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java index ca64c99c2..9121bc794 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java @@ -8,6 +8,8 @@ import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import com.google.common.collect.Lists; + import mineplex.core.account.CoreClientManager; import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.skin.SkinData; @@ -60,6 +62,7 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop> int freedomCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.FREEDOM.getItemName()); int omegaCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.OMEGA.getItemName()); int hauntedCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.HAUNTED.getItemName()); + int trickCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.TRICK_OR_TREAT.getItemName()); List<String> shardLore = new ArrayList<>(); shardLore.add(" "); @@ -211,6 +214,25 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop> hauntedLore.add(" "); hauntedLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop"); } + + List<String> trickLore = Lists.newArrayList(); + trickLore.add(" "); + trickLore.add(F.value("Trick or Treat Chests Owned", "" + trickCount)); + trickLore.add(" "); + trickLore.add(C.cGray + "The Trick or Treat Chest contains all"); + trickLore.add(C.cGray + "sorts of surprises, from Rank Upgrades to"); + trickLore.add(C.cGray + "long lost Halloween items, and even other chests!"); + trickLore.add(" "); + if (trickCount > 0) + { + trickLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); + } + else + { + trickLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + "20000 Treasure Shards"); + trickLore.add(" "); + hauntedLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop"); + } ShopItem shards = new ShopItem(Material.PRISMARINE_SHARD, C.cAqua + C.Bold + treasureShards + " Treasure Shards", shardLore.toArray(new String[0]), 0, false); ShopItem basic = new ShopItem(Material.CHEST, C.cGreen + C.Bold + "Old Treasure", basicLore.toArray(new String[0]), 0, false, false); @@ -221,9 +243,11 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop> ItemStack freedom = SkinData.FREEDOM_CHEST.getSkull(C.cRedB + "Freedom " + C.cBlueB + "Treasure", freedomLore); ItemStack omega = SkinData.OMEGA_CHEST.getSkull(C.cAquaB + "Omega Treasure", omegaLore); ItemStack haunted = SkinData.HAUNTED_CHEST.getSkull(C.cGoldB + "Haunted Treasure", hauntedLore); + ItemStack trick = new ShopItem(Material.SKULL_ITEM, C.cGoldB + "Trick or Treat Treasure", trickLore.toArray(new String[0]), 0, false, false); addItem(49, shards); + addChest(4, trick, TreasureType.TRICK_OR_TREAT, trickCount); addChest(10, christmas, TreasureType.CHRISTMAS, christmasCount); addChest(12, freedom, TreasureType.FREEDOM, freedomCount); addChest(14, haunted, TreasureType.HAUNTED, hauntedCount); From 273f95f8fffe48f292b04d3b9b09a021434663af Mon Sep 17 00:00:00 2001 From: Alexander Meech <Alex-The-Coder@users.noreply.github.com> Date: Tue, 25 Oct 2016 12:42:32 -0400 Subject: [PATCH 140/147] Fix playwire threading --- .../src/mineplex/core/playwire/PlayWireManager.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java b/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java index 501711c78..67c4b44fc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java @@ -106,7 +106,10 @@ public class PlayWireManager extends MiniDbClientPlugin<PlayWireClientData> { final int newTickets = rs.getInt(1); - ticketCallback.run(newTickets); + runSync(() -> + { + ticketCallback.run(newTickets); + }); } } catch (Exception e) From 6d982f3df9eeb9c6e6256a147307ec96dfbb5870 Mon Sep 17 00:00:00 2001 From: Alexander Meech <Alex-The-Coder@users.noreply.github.com> Date: Tue, 25 Oct 2016 12:49:16 -0400 Subject: [PATCH 141/147] Fix spin ticket reward threading --- .../src/mineplex/core/reward/rewards/SpinTicketReward.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/SpinTicketReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/SpinTicketReward.java index afa7f610d..588ea9486 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/SpinTicketReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/SpinTicketReward.java @@ -83,7 +83,10 @@ public class SpinTicketReward extends Reward { final int newTickets = rs.getInt(1); - ticketCallback.run(newTickets); + _clientManager.runSync(() -> + { + ticketCallback.run(newTickets); + }); } } catch (Exception e) @@ -117,4 +120,4 @@ public class SpinTicketReward extends Reward } return false; } -} \ No newline at end of file +} From 3e8eecdf91c655d8b7fb821375f4906d9fc4ea5a Mon Sep 17 00:00:00 2001 From: Alexander Meech <Alex-The-Coder@users.noreply.github.com> Date: Tue, 25 Oct 2016 12:54:37 -0400 Subject: [PATCH 142/147] Update reward weightings for sigils --- .../mineplex/core/reward/RewardManager.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index d5e7b6b12..2d5c46f28 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java @@ -451,12 +451,12 @@ public class RewardManager addGadget(Type.HAUNTED, getGadget(ArrowTrailHalloween.class), rarity, 100); //TRICK OR TREAT - addReward(Type.TRICK_OR_TREAT, new SpinTicketReward(_clientManager, 1, 3, rarity, 5, 0)); - addReward(Type.TRICK_OR_TREAT, new GameAmplifierReward(_inventoryManager, 1, 2, rarity, 5, 0)); - addReward(Type.TRICK_OR_TREAT, new RuneAmplifierReward(_inventoryManager, 20, 1, 3, rarity, 2, 0)); - addReward(Type.TRICK_OR_TREAT, new UnknownPackageReward(_donationManager, "Clan Banner Access", "Wear/Place Clan Banner", "Clan Banner Usage", new ItemStack(Material.BANNER), rarity, 1, 0)); - addReward(Type.TRICK_OR_TREAT, new ChestReward(_inventoryManager, TreasureType.OLD, 1, 5, rarity, 5, 0)); - addReward(Type.TRICK_OR_TREAT, new ChestReward(_inventoryManager, TreasureType.ANCIENT, 1, 5, rarity, 10, 0)); + addReward(Type.TRICK_OR_TREAT, new SpinTicketReward(_clientManager, 1, 3, rarity, 150, 0)); + addReward(Type.TRICK_OR_TREAT, new GameAmplifierReward(_inventoryManager, 1, 2, rarity, 150, 0)); + addReward(Type.TRICK_OR_TREAT, new RuneAmplifierReward(_inventoryManager, 20, 1, 3, rarity, 120, 0)); + addReward(Type.TRICK_OR_TREAT, new UnknownPackageReward(_donationManager, "Clan Banner Access", "Wear/Place Clan Banner", "Clan Banner Usage", new ItemStack(Material.BANNER), rarity, 110, 0)); + addReward(Type.TRICK_OR_TREAT, new ChestReward(_inventoryManager, TreasureType.OLD, 1, 5, rarity, 150, 0)); + addReward(Type.TRICK_OR_TREAT, new ChestReward(_inventoryManager, TreasureType.ANCIENT, 1, 5, rarity, 80, 0)); } public void addLegendary() @@ -611,11 +611,11 @@ public class RewardManager addMount(Type.HAUNTED, getMount(MountNightmareSteed.class), rarity, 60); //TRICK OR TREAT - addReward(Type.TRICK_OR_TREAT, new ChestReward(_inventoryManager, TreasureType.MYTHICAL, 1, 3, rarity, 10, 0)); - addReward(Type.TRICK_OR_TREAT, new ChestReward(_inventoryManager, TreasureType.ILLUMINATED, 1, 1, rarity, 3, 0)); - addMount(Type.TRICK_OR_TREAT, getMount(MountZombie.class), rarity, 1); - addPetReward(Type.HAUNTED, EntityType.ZOMBIE, rarity, 1); - addGadget(Type.TRICK_OR_TREAT, getGadget(MorphPumpkinKing.class), rarity, 1); + addReward(Type.TRICK_OR_TREAT, new ChestReward(_inventoryManager, TreasureType.MYTHICAL, 1, 3, rarity, 50, 0)); + addReward(Type.TRICK_OR_TREAT, new ChestReward(_inventoryManager, TreasureType.ILLUMINATED, 1, 1, rarity, 30, 0)); + addMount(Type.TRICK_OR_TREAT, getMount(MountZombie.class), rarity, 25); + addPetReward(Type.HAUNTED, EntityType.ZOMBIE, rarity, 10); + addGadget(Type.TRICK_OR_TREAT, getGadget(MorphPumpkinKing.class), rarity, 5); } public UnknownPackageReward addMount(Type type, Mount<?> mount, RewardRarity rarity, int weight) From 39f0cd79bb50c84c0266819ff0c7fcb3776b7d9b Mon Sep 17 00:00:00 2001 From: Alexander Meech <Alex-The-Coder@users.noreply.github.com> Date: Tue, 25 Oct 2016 13:26:09 -0400 Subject: [PATCH 143/147] Cap purchase date for sampson --- .../src/mineplex/core/treasure/gui/BuyChestButton.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java index 9256bc7a0..35e92ca7e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java @@ -13,6 +13,7 @@ import mineplex.core.treasure.TreasureType; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; +import java.util.Calendar; public class BuyChestButton implements IButton { @@ -46,6 +47,14 @@ public class BuyChestButton implements IButton return; } + if (_chestType == TreasureType.TRICK_OR_TREAT) + { + if (Calendar.MONTH != Calendar.OCTOBER || Calendar.DAY_OF_WEEK < CALENDAR.FRIDAY) + { + player.sendMessage(F.main("Treasure", "That chest is no longer available for purchase!")); + return; + } + } if (_chestType == TreasureType.FREEDOM) { if (!_page.getPlugin().hasItemsToGivePlayer(_chestType.getRewardPool(), player)) From d13387df52a90fa659fc4f09e3c3a9ba7d72953a Mon Sep 17 00:00:00 2001 From: Alexander Meech <Alex-The-Coder@users.noreply.github.com> Date: Wed, 26 Oct 2016 22:02:46 -0400 Subject: [PATCH 144/147] Make trick or treat chest dynamically controlled (#256) * Implement trick or treat chest in customer support server * Add several new reward types, implement trick or treat chest and all its animations, and fix playwire nested threads --- .../core/playwire/PlayWireManager.java | 7 ++-- .../core/reward/rewards/SpinTicketReward.java | 9 +++-- .../core/treasure/gui/BuyChestButton.java | 34 ++++++++++--------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java b/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java index 67c4b44fc..631ffc7ec 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java @@ -105,11 +105,10 @@ public class PlayWireManager extends MiniDbClientPlugin<PlayWireClientData> if (rs.next()) { final int newTickets = rs.getInt(1); - runSync(() -> - { - ticketCallback.run(newTickets); - }); + { + ticketCallback.run(newTickets); + }); } } catch (Exception e) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/SpinTicketReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/SpinTicketReward.java index 588ea9486..eefa2085a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/SpinTicketReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/SpinTicketReward.java @@ -82,11 +82,10 @@ public class SpinTicketReward extends Reward if (rs.next()) { final int newTickets = rs.getInt(1); - _clientManager.runSync(() -> - { - ticketCallback.run(newTickets); - }); + { + ticketCallback.run(newTickets); + }); } } catch (Exception e) @@ -120,4 +119,4 @@ public class SpinTicketReward extends Reward } return false; } -} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java index 35e92ca7e..8194799c8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java @@ -1,5 +1,11 @@ package mineplex.core.treasure.gui; +import java.io.File; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.F; import mineplex.core.inventory.InventoryManager; @@ -10,29 +16,25 @@ import mineplex.core.shop.item.SalesPackageBase; import mineplex.core.shop.item.SalesPackageProcessor; import mineplex.core.treasure.ChestPackage; import mineplex.core.treasure.TreasureType; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; -import java.util.Calendar; public class BuyChestButton implements IButton { private InventoryManager _inventoryManager; private TreasurePage _page; - + private String _chestName; private Material _chestMat; private int _chestCost; private TreasureType _chestType; - + public BuyChestButton(InventoryManager inventoryManager, TreasurePage page, String chestName, Material chestMat, int chestCost, TreasureType chestType) { _inventoryManager = inventoryManager; _page = page; - + _chestName = chestName; _chestMat = chestMat; _chestCost = chestCost; @@ -46,15 +48,15 @@ public class BuyChestButton implements IButton { return; } - - if (_chestType == TreasureType.TRICK_OR_TREAT) - { - if (Calendar.MONTH != Calendar.OCTOBER || Calendar.DAY_OF_WEEK < CALENDAR.FRIDAY) - { - player.sendMessage(F.main("Treasure", "That chest is no longer available for purchase!")); - return; - } - } + + if (_chestType == TreasureType.TRICK_OR_TREAT) + { + if (!new File("../../update/files/EnableTrickOrTreat.dat").exists()) + { + player.sendMessage(F.main("Treasure", "That chest is no longer available for purchase!")); + return; + } + } if (_chestType == TreasureType.FREEDOM) { if (!_page.getPlugin().hasItemsToGivePlayer(_chestType.getRewardPool(), player)) From a340f15d63be0b5a0450ca4c4aa99c952855eb90 Mon Sep 17 00:00:00 2001 From: LCastr0 <castr0mmbr@gmail.com> Date: Thu, 27 Oct 2016 00:27:50 -0200 Subject: [PATCH 145/147] Fixed changes requested by Shaun --- .../core/mount/types/MountChicken.java | 50 ++++++++----------- .../core/mount/types/MountSpider.java | 18 ++++--- 2 files changed, 31 insertions(+), 37 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountChicken.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountChicken.java index 1d87ed989..68b439005 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountChicken.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountChicken.java @@ -3,7 +3,6 @@ package mineplex.core.mount.types; import java.lang.reflect.Field; import java.time.Month; import java.time.YearMonth; -import java.util.Map; import net.minecraft.server.v1_8_R3.EntityLiving; @@ -13,8 +12,8 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Horse; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; import mineplex.core.common.util.F; import mineplex.core.common.util.LineFormat; @@ -33,6 +32,8 @@ import mineplex.core.updater.event.UpdateEvent; public class MountChicken extends HorseMount { + private static Field _jumpField; + public MountChicken(MountManager manager) { super(manager, "Chicken Mount", @@ -41,6 +42,14 @@ public class MountChicken extends HorseMount "This isn't flying! It is falling with style." }, LineFormat.LORE), Material.FEATHER, (byte) 0, -1, Horse.Color.BLACK, Horse.Style.NONE, Horse.Variant.HORSE, 2.0, Material.AIR, YearMonth.of(2017, Month.JANUARY)); + try + { + _jumpField = EntityLiving.class.getDeclaredField("aY"); + _jumpField.setAccessible(false); + } catch (NoSuchFieldException e) + { + e.printStackTrace(); + } } @Override @@ -87,27 +96,6 @@ public class MountChicken extends HorseMount UtilEnt.silence(horse, true); } - // Detects player falling and slows down, like it happens with a chicken falling - @EventHandler - public void onPlayerFall(PlayerMoveEvent event) - { - Player player = event.getPlayer(); - - for (Map.Entry<Player, SingleEntityMountData<Horse>> entry : getActive().entrySet()) - { - Horse horse = entry.getValue().getEntity(); - - if (horse.getPassenger() == player) - { - if (event.getFrom().getY() > event.getTo().getY()) - { - // Slows down horse - horse.setVelocity(horse.getVelocity().setY(horse.getVelocity().getY() * .75)); - } - } - } - } - @EventHandler public void jump(UpdateEvent event) { @@ -118,6 +106,14 @@ public class MountChicken extends HorseMount { final Horse horse = getActive().get(player).getEntity(); + // Slows down falling + if (!horse.isOnGround() && horse.getVelocity().getY() < 0) + { + Vector velocity = horse.getVelocity(); + velocity.setY(velocity.getY() * 0.6); + horse.setVelocity(velocity); + } + if (horse.getPassenger() != player) continue; @@ -129,13 +125,7 @@ public class MountChicken extends HorseMount try { - Field jump = EntityLiving.class.getDeclaredField("aY"); - final boolean accessible = jump.isAccessible(); - - jump.setAccessible(true); - boolean isJumping = jump.getBoolean(((CraftPlayer) player).getHandle()); - - jump.setAccessible(accessible); + boolean isJumping = _jumpField.getBoolean(((CraftPlayer) player).getHandle()); if (!isJumping) continue; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java index 68486bd4c..90b7ab87c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java @@ -41,6 +41,8 @@ public class MountSpider extends HorseMount /** * @author Mysticate */ + + private static Field _jumpField; public MountSpider(MountManager manager) { @@ -55,6 +57,14 @@ public class MountSpider extends HorseMount C.cBlue + "Only buyable during Halloween 2015" }, LineFormat.LORE), Material.WEB, (byte) 0, -1, Color.BLACK, Style.NONE, Variant.HORSE, 2.0, Material.AIR); + try + { + _jumpField = EntityLiving.class.getDeclaredField("aY"); + _jumpField.setAccessible(true); + } catch (NoSuchFieldException e) + { + e.printStackTrace(); + } } @Override @@ -175,13 +185,7 @@ public class MountSpider extends HorseMount try { - Field jump = EntityLiving.class.getDeclaredField("aY"); - final boolean accessible = jump.isAccessible(); - - jump.setAccessible(true); - boolean isJumping = jump.getBoolean(((CraftPlayer) player).getHandle()); - - jump.setAccessible(accessible); + boolean isJumping = _jumpField.getBoolean(((CraftPlayer) player).getHandle()); if (!isJumping) continue; From 577e640f4aa66f1e9d75cbd87d990a29b2019e05 Mon Sep 17 00:00:00 2001 From: Shaun Bennett <me@phinary.ca> Date: Wed, 26 Oct 2016 23:00:47 -0400 Subject: [PATCH 146/147] Add KillAura Type E and F checks - no Action enabled yet --- Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java index 5db45158f..b8bd978f1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java @@ -68,6 +68,8 @@ public class AntiHack extends MiniPlugin .put("Killaura (Type B)", new CheckThresholds("High CPS", 0, 0, Integer.MAX_VALUE)) .put("Killaura (Type C)", new CheckThresholds("Reach", 0, Integer.MAX_VALUE, Integer.MAX_VALUE)) .put("Killaura (Type D)", new CheckThresholds("Kill Aura", 500, 1000, 1500)) + .put("Killaura (Type E)", new CheckThresholds("Kill Aura", 300, 700, 2000)) + .put("Killaura (Type F)", new CheckThresholds("Kill Aura", 150, 250, 350)) .put("BadPackets", new CheckThresholds("Regen", 500, 1000, 2000)) .put("Glide", new CheckThresholds("Flying", 50, 100, 200)) // TODO: specific VL levels .put("Speed", new CheckThresholds("Speed", 50, 100, 200)) // TODO: specific VL levels From 7a0fba3027532214875990b70f7a7b29276ca6e2 Mon Sep 17 00:00:00 2001 From: samczsun <github@samczsun.com> Date: Fri, 28 Oct 2016 00:53:59 -0400 Subject: [PATCH 147/147] Make Trick Or Treat chests open 4 --- .../Mineplex.Core/src/mineplex/core/reward/RewardManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index 2d5c46f28..01e9cde68 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java @@ -826,7 +826,7 @@ public class RewardManager { int amount = 4; if(type == RewardType.ILLUMINATED_CHEST || type == RewardType.FREEDOM_CHEST || type == RewardType.OMEGA_CHEST - || type == RewardType.HAUNTED_CHEST || type == RewardType.TRICK_OR_TREAT_CHEST) amount = 1; + || type == RewardType.HAUNTED_CHEST) amount = 1; int currentReward = 0; Reward[] rewards = new Reward[amount];