Various Fixes.

• Merged w/ master
• Changed to William's method of Projectile limiting.
- Prevented TNT hitting Teammates
• Fixed gem count for Sniper
• Added gems for direct hits + TNT Thrown
• Removed assists counting for kills in 6 kill.
This commit is contained in:
Mysticate 2015-08-09 15:01:27 -04:00
parent cbb0cb96c8
commit f8a6a25b46
4 changed files with 128 additions and 16 deletions

View File

@ -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},

View File

@ -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<Player> 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<Player> 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<Player> 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<Player> 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<Player> 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<Player> 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)

View File

@ -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<Player> _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<Player> 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);

View File

@ -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<Player> canHit = new ArrayList<Player>();
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