diff --git a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java index a8cc962c7..09d038abd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java @@ -11,6 +11,7 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import net.minecraft.server.v1_7_R4.AxisAlignedBB; +import net.minecraft.server.v1_7_R4.EntityPlayer; import net.minecraft.server.v1_7_R4.MathHelper; import net.minecraft.server.v1_7_R4.MovingObjectPosition; import net.minecraft.server.v1_7_R4.Vec3D; @@ -184,9 +185,12 @@ public class ProjectileUser ((CraftEntity)_thrown).getHandle().motY, ((CraftEntity)_thrown).getHandle().motZ).grow(_hitboxGrow, _hitboxGrow, _hitboxGrow))) { - if (!_hitNonPlayerEntity && !(entity instanceof Player)) + if (!_hitNonPlayerEntity && !(entity instanceof EntityPlayer)) continue; - + + if (!_hitPlayer && entity instanceof EntityPlayer) + continue; + if (entity instanceof net.minecraft.server.v1_7_R4.Entity) { Entity bukkitEntity = ((net.minecraft.server.v1_7_R4.Entity) entity).getBukkitEntity(); diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java index e7b460fe3..0374f2a6a 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java @@ -7,6 +7,7 @@ import mineplex.core.common.util.C; import org.bukkit.ChatColor; import org.bukkit.Location; +import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; @@ -36,6 +37,7 @@ public class CustomDamageEvent extends Event implements Cancellable private Player _damagerPlayer; private Projectile _projectile; private Location _knockbackOrigin = null; + private Entity _knockbackSource = null; //Flags private boolean _ignoreArmor = false; @@ -46,7 +48,7 @@ public class CustomDamageEvent extends Event implements Cancellable public CustomDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile projectile, DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor, - String initialSource, String initialReason, boolean cancelled) + String initialSource, String initialReason, boolean cancelled, Entity knockbackSource) { _eventCause = cause; @@ -64,6 +66,8 @@ public class CustomDamageEvent extends Event implements Cancellable _knockback = knockback; _ignoreRate = ignoreRate; _ignoreArmor = ignoreArmor; + + _knockbackSource = knockbackSource; if (initialSource != null && initialReason != null) AddMod(initialSource, initialReason, 0, true); @@ -266,6 +270,9 @@ public class CustomDamageEvent extends Event implements Cancellable public Location getKnockbackOrigin() { + if (_knockbackSource != null) + return _knockbackSource.getLocation(); + return _knockbackOrigin; } diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java index e58efe9b1..e583cdcd6 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java @@ -32,6 +32,7 @@ import org.bukkit.Sound; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Arrow; +import org.bukkit.entity.Entity; import org.bukkit.entity.Fish; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -167,17 +168,35 @@ public class DamageManager extends MiniPlugin { NewDamageEvent(damagee, damager, proj, cause, damage, knockback, ignoreRate, ignoreArmor, - source, reason, false); + source, reason, false, null); } - + + public void NewDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile proj, + DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor, + String source, String reason, Entity knockbackSource) + { + NewDamageEvent(damagee, damager, proj, + cause, damage, knockback, ignoreRate, ignoreArmor, + source, reason, false, knockbackSource); + } + public void NewDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile proj, DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor, String source, String reason, boolean cancelled) + { + NewDamageEvent(damagee, damager, proj, + cause, damage, knockback, ignoreRate, ignoreArmor, + source, reason, cancelled, null); + } + + public void NewDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile proj, + DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor, + String source, String reason, boolean cancelled, Entity knockbackSource) { _plugin.getServer().getPluginManager().callEvent( new CustomDamageEvent(damagee, damager, proj, cause, damage, knockback, ignoreRate, ignoreArmor, - source, reason, cancelled)); + source, reason, cancelled, knockbackSource)); } @EventHandler(priority = EventPriority.LOW) 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 9f6576da5..440a5df97 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 @@ -46,7 +46,7 @@ public class KitCow extends SmashKit 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 + "Stampede", + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Angry Herd", new String[] { ChatColor.RESET + "", 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 index 98cdb65fc..73feb7ce8 100644 --- 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 @@ -214,13 +214,13 @@ public class KitKnight extends SmashKit Horse horse = (Horse)damagee.getVehicle(); //Damage Event - CustomDamageEvent newEvent = new CustomDamageEvent(horse, event.GetDamagerEntity(true), event.GetProjectile(), - event.GetCause(), event.GetDamageInitial(), true, false, false, - UtilEnt.getName(event.GetDamagerPlayer(true)), event.GetReason(), false); +// CustomDamageEvent newEvent = new CustomDamageEvent(horse, event.GetDamagerEntity(true), event.GetProjectile(), +// 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); +// _calledEvents.add(newEvent); +// Manager.getPlugin().getServer().getPluginManager().callEvent(newEvent); +// _calledEvents.remove(newEvent); } @EventHandler(priority = EventPriority.LOWEST) @@ -246,13 +246,13 @@ public class KitKnight extends SmashKit Player player = (Player)horse.getPassenger(); //Damage Event - final CustomDamageEvent newEvent = new CustomDamageEvent(player, event.GetDamagerEntity(true), event.GetProjectile(), - 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); +// final CustomDamageEvent newEvent = new CustomDamageEvent(player, event.GetDamagerEntity(true), event.GetProjectile(), +// 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); } 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/PerkCowStampede.java index debd7a9e5..885312190 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/PerkCowStampede.java @@ -1,17 +1,11 @@ package nautilus.game.arcade.game.games.smash.perks; import java.util.ArrayList; -import java.util.HashSet; import java.util.Iterator; 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.Cow; -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; @@ -21,7 +15,6 @@ 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; @@ -32,24 +25,21 @@ 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; 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 PerkCowStampede extends SmashPerk implements IThrown +public class PerkCowStampede extends SmashPerk { private ArrayList _active = new ArrayList(); public PerkCowStampede() { - super("Fish Flurry", new String[] + super("Angry Herd", new String[] { - C.cYellow + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + "Fish Flurry" + C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Angry Herd" }); } @@ -94,17 +84,12 @@ public class PerkCowStampede extends SmashPerk implements IThrown Location loc = player.getLocation(); loc.add(dir); - loc.add(UtilAlg.getLeft(dir).multiply(i*1.5)); + loc.add(UtilAlg.getLeft(dir).multiply(i*1.25)); Manager.GetGame().CreatureAllowOverride = true; Cow cow = player.getWorld().spawn(loc, Cow.class); Manager.GetGame().CreatureAllowOverride = false; - Manager.GetProjectile().AddThrow(cow, player, this, - -1, true, false, false, false, - null, 1f, 1f, - null, UpdateType.TICK, 2.5f); - _active.add(new DataCowCharge(player, cow)); } @@ -149,12 +134,12 @@ public class PerkCowStampede extends SmashPerk implements IThrown } //Stuck Remove - if (UtilTime.elapsed(data.LastMoveTime, 2000)) + if (UtilTime.elapsed(data.LastMoveTime, 1000)) { if (data.Cow.isValid()) { data.Cow.remove(); - UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.Cow.getLocation().add(0, 1, 0), 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); + UtilParticle.PlayParticle(ParticleType.EXPLODE, data.Cow.getLocation().add(0, 1, 0), 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); } activeIter.remove(); @@ -172,47 +157,42 @@ public class PerkCowStampede extends SmashPerk implements IThrown } //Move - data.Cow.setVelocity(data.Direction); + if (UtilTime.elapsed(data.LastMoveTime, 350)) + 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); - } - } - - @Override - public void Collide(LivingEntity target, Block block, ProjectileUser data) - { - if (target != null && target instanceof Player) - { - //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, - DamageCause.PROJECTILE, 6, 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()); + //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)) + { + //Damage Event + Manager.GetDamage().NewDamageEvent(player, data.Player, null, + DamageCause.CUSTOM, 7, true, true, false, + UtilEnt.getName(data.Player), GetName(), + data.Cow); + + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.Cow.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 12, ViewDist.LONG, UtilServer.getPlayers()); + + 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); + } + } + } } - - Manager.GetProjectile().AddThrow(data.GetThrown(), data.GetThrower(), this, - -1, true, false, false, false, - null, 1f, 1f, - null, UpdateType.TICK, 2.5f); } - - @Override - public void Idle(ProjectileUser data) - { - - } - - @Override - public void Expire(ProjectileUser data) - { - - } - @EventHandler public void Knockback(CustomDamageEvent event) @@ -220,6 +200,6 @@ public class PerkCowStampede extends SmashPerk implements IThrown if (event.GetReason() == null || !event.GetReason().contains(GetName())) return; - event.AddKnockback(GetName(), 2); + event.AddKnockback(GetName(), 1.5); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java index a2e27f88e..8c10034b1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java @@ -153,7 +153,7 @@ public class SnowFight extends TeamGame { if(IsOnIce(player)) { - Bukkit.getPluginManager().callEvent(new CustomDamageEvent(player, null, null, DamageCause.CUSTOM, 2.0D, false, true, true, "Ice", "Ice", false)); + Bukkit.getPluginManager().callEvent(new CustomDamageEvent(player, null, null, DamageCause.CUSTOM, 2.0D, false, true, true, "Ice", "Ice", false, null)); } } @@ -510,7 +510,7 @@ public class SnowFight extends TeamGame if(player instanceof Player) { Player damagee = (Player) player; - Bukkit.getPluginManager().callEvent(new CustomDamageEvent(damagee, null, null, DamageCause.CUSTOM, damage, false, true, true, "Ice Meteoroid", "Ice Meteoroid", false)); + Bukkit.getPluginManager().callEvent(new CustomDamageEvent(damagee, null, null, DamageCause.CUSTOM, damage, false, true, true, "Ice Meteoroid", "Ice Meteoroid", false, null)); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java index 818a98a4a..bff3a481e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java @@ -524,9 +524,9 @@ public class GameLobbyManager implements Listener, IPacketHandler { //Positions double space = 4; - double offset = (divide-1)*space/2d; + double offset = (divide)*space/2d; - for (int i=0 ; i