diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index 64d6215aa..f122d3034 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -662,7 +662,7 @@ public enum Achievement new int[]{20}, AchievementCategory.BOMB_LOBBERS), - BOMB_LOBBERS_SNIPER("Sniper", 10000, + BOMB_LOBBERS_SNIPER("Sniper", 1000, new String[]{"Bomb Lobbers.Direct Hit"}, new String[]{"Get 50 direct hits"}, new int[]{50}, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileManager.java b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileManager.java index 132500dc8..03f44665d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileManager.java @@ -1,6 +1,7 @@ package mineplex.core.projectile; import java.util.Iterator; +import java.util.List; import java.util.Map.Entry; import java.util.WeakHashMap; @@ -13,6 +14,7 @@ import org.bukkit.Effect; 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.EventPriority; import org.bukkit.event.inventory.InventoryPickupItemEvent; @@ -75,10 +77,63 @@ public class ProjectileManager extends MiniPlugin long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, Sound sound, float soundVolume, float soundPitch, ParticleType particle, float pX, float pY, float pZ, float pS, int pC, UpdateType effectRate, float hitboxMult) { - _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, + _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, expireTime, hitPlayer, hitBlock, idle, false, sound, soundVolume, soundPitch, null, 0, effectRate, particle, pX, pY, pZ, pS, pC, hitboxMult)); } + + // WITH CAN HIT PLAYERS LIST: + public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, + long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, float hitboxGrow, List canHit) + { + _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, + expireTime, hitPlayer, hitBlock, idle, false, + null, 1f, 1f, null, 0, null, null, 0F, 0F, 0F, 0F, 1, hitboxGrow, canHit)); + } + + public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, + long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, boolean pickup, float hitboxGrow, List canHit) + { + _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, + expireTime, hitPlayer, hitBlock, idle, pickup, + null, 1f, 1f, null, 0, null, null, 0F, 0F, 0F, 0F, 1, hitboxGrow, canHit)); + } + + public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, + long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, + Sound sound, float soundVolume, float soundPitch, Effect effect, int effectData, UpdateType effectRate , float hitboxGrow, List canHit) + { + _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, + expireTime, hitPlayer, hitBlock, idle, false, + sound, soundVolume, soundPitch, effect, effectData, effectRate, null, 0F, 0F, 0F, 0F, 1, hitboxGrow, canHit)); + } + + public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, + long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, + Sound sound, float soundVolume, float soundPitch, ParticleType particle, Effect effect, int effectData, UpdateType effectRate, float hitboxGrow, List canHit) + { + _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, + expireTime, hitPlayer, hitBlock, idle, false, + sound, soundVolume, soundPitch, effect, effectData, effectRate, particle, 0F, 0F, 0F, 0F, 1, hitboxGrow, canHit)); + } + + public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, + long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, + Sound sound, float soundVolume, float soundPitch, ParticleType particle, UpdateType effectRate, float hitboxMult, List canHit) + { + _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, + expireTime, hitPlayer, hitBlock, idle, false, + sound, soundVolume, soundPitch, null, 0, effectRate, particle, 0F, 0F, 0F, 0F, 1, hitboxMult, canHit)); + } + + public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, + long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, + Sound sound, float soundVolume, float soundPitch, ParticleType particle, float pX, float pY, float pZ, float pS, int pC, UpdateType effectRate, float hitboxMult, List canHit) + { + _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, + expireTime, hitPlayer, hitBlock, idle, false, + sound, soundVolume, soundPitch, null, 0, effectRate, particle, pX, pY, pZ, pS, pC, hitboxMult, canHit)); + } @EventHandler public void Update(UpdateEvent event) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java index 6c94d9e00..3d71c0831 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java @@ -1,5 +1,7 @@ package mineplex.core.projectile; +import java.util.List; + import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; @@ -55,13 +57,51 @@ public class ProjectileUser private UpdateType _effectRate = UpdateType.TICK; private double _hitboxGrow; + + private List _canHit; + + public ProjectileUser(ProjectileManager throwInput, Entity thrown, LivingEntity thrower, IThrown callback, + long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, boolean pickup, + Sound sound, float soundVolume, float soundPitch, + Effect effect, int effectData, UpdateType effectRate, + ParticleType particle, float particleX, float particleY, + float particleZ, float particleS, int particleC, double hitboxMult) + { + Throw = throwInput; + + _thrown = thrown; + _thrower = thrower; + _callback = callback; + + _expireTime = expireTime; + _hitPlayer = hitPlayer; + _hitBlock = hitBlock; + _idle = idle; + _pickup = pickup; + + _sound = sound; + _soundVolume = soundVolume; + _soundPitch = soundPitch; + _particle = particle; + _particleX = particleX; + _particleY = particleY; + _particleZ = particleZ; + _particleS = particleS; + _particleC = particleC; + _effect = effect; + _effectData = effectData; + _effectRate = effectRate; + + _hitboxGrow = hitboxMult; + _canHit = null; + } public ProjectileUser(ProjectileManager throwInput, Entity thrown, LivingEntity thrower, IThrown callback, long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, boolean pickup, Sound sound, float soundVolume, float soundPitch, Effect effect, int effectData, UpdateType effectRate, ParticleType particle, float particleX, float particleY, - float particleZ, float particleS, int particleC, double hitboxMult) + float particleZ, float particleS, int particleC, double hitboxMult, List canHit) { Throw = throwInput; @@ -89,6 +129,7 @@ public class ProjectileUser _effectRate = effectRate; _hitboxGrow = hitboxMult; + _canHit = canHit; } public void Effect(UpdateEvent event) @@ -152,11 +193,22 @@ public class ProjectileUser if (ent.equals(_thrower)) continue; - //Creative or Spec + //Creative or Spec or No Hit if (ent instanceof Player) - if (((Player)ent).getGameMode() == GameMode.CREATIVE || UtilPlayer.isSpectator(ent)) + { + if (((Player)ent).getGameMode() == GameMode.CREATIVE) continue; + if (UtilPlayer.isSpectator(ent)) + continue; + + if (_canHit != null) + { + if (!_canHit.contains(((Player)ent))) + continue; + } + } + //float f1 = (float)(nmsEntity.boundingBox.a() * 0.6f); AxisAlignedBB axisalignedbb1 = ((CraftEntity)ent).getHandle().boundingBox.grow(1F, 1F, 1F); MovingObjectPosition entityCollisionPosition = axisalignedbb1.a(vec3d, vec3d1); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java index e43c1adb1..5a7f6a0de 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java @@ -130,11 +130,6 @@ public class BombLobbers extends TeamGame implements IThrown _kills.put(player, _kills.containsKey(player) ? _kills.get(player) + 1 : 1); } - public void addAssist(Player player) - { - _kills.put(player, _kills.containsKey(player) ? _kills.get(player) + .5 : .5); - } - public double getKills(Player player) { if (_kills.containsKey(player)) @@ -172,10 +167,6 @@ public class BombLobbers extends TeamGame implements IThrown { addKill(killer); } - else - { - addAssist(killer); - } } } } @@ -228,11 +219,23 @@ public class BombLobbers extends TeamGame implements IThrown tnt.setFuseTicks(60); UtilAction.velocity(tnt, player.getLocation().getDirection(), 2.0D, false, 0.0D, 0.1D, 10.0D, false); - Manager.GetProjectile().AddThrow(tnt, player, this, -1L, true, false, true, .2F); - + + ArrayList canHit = new ArrayList(); + for (Player pos : GetPlayers(true)) + { + if (GetTeam(player).HasPlayer(pos)) + continue; + + canHit.add(pos); + } + + Manager.GetProjectile().AddThrow(tnt, player, this, -1L, true, false, true, .2F, canHit); + Manager.getPlugin().getServer().getPluginManager().callEvent(new TNTThrowEvent(player, tnt)); _tnt.put(tnt, new BombToken(player)); + + AddGems(player, 0.5, "TNT Thrown", true, true); } public Player getThrower(TNTPrimed tnt) @@ -562,6 +565,8 @@ public class BombLobbers extends TeamGame implements IThrown UtilAction.velocity(target, UtilAlg.getTrajectory2d(data.GetThrown().getLocation(), target.getLocation()), .2, false, 0, 0.2, .4, true); Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, DamageCause.PROJECTILE, 10.0, false, false, false, "Throwing TNT", "Throwing TNT Direct Hit"); + + AddGems((Player) data.GetThrower(), 4.0, "Direct Hit", true, true); } @Override