3131import org .bukkit .event .Event .Result ;
3232import org .bukkit .event .block .BlockBreakEvent ;
3333import org .bukkit .event .block .BlockDamageEvent ;
34+ import org .bukkit .event .block .BlockExplodeEvent ;
3435import org .bukkit .event .entity .EntityDamageByEntityEvent ;
3536import org .bukkit .event .entity .EntityPickupItemEvent ;
3637import org .bukkit .event .entity .ProjectileHitEvent ;
@@ -95,6 +96,7 @@ public Guns() {
9596 public void gunBulletHitGroundEvent (ProjectileHitEvent event ) {
9697 if (!(event .getEntity () instanceof Projectile )) return ;
9798 if (event .getHitBlock () == null ) return ;
99+
98100 Projectile bullet = (Projectile ) event .getEntity ();
99101
100102 StandardGun gun = bulletToGunMap .get (bullet .getName ());
@@ -115,6 +117,29 @@ public void gunBulletHitGroundEvent(ProjectileHitEvent event) {
115117 return ;
116118 }
117119
120+ Material block = event .getHitBlock ().getType ();
121+ if (!block .isSolid () && block .isTransparent ()) {
122+ if (Material .LAVA .equals (block ) || Material .STATIONARY_LAVA .equals (block )) {
123+ // lava, it dies.
124+ } else {
125+ // respawn it
126+ /*Location newBegin = event.getHitBlock().getLocation().clone();
127+ if (hit instanceof Damageable) {
128+ Damageable dhit = (Damageable) hit;
129+ newBegin.add(bullet.getVelocity().normalize().multiply(dhit.getWidth() * 2));
130+ } else {
131+ newBegin.add(bullet.getVelocity().normalize().multiply(1.42)); // diagonalize!
132+ }
133+ AddGun.getPlugin().debug(" Just Missed at location {0}, spawning continue at {1} with velocity {2}",
134+ end, newBegin, bullet.getVelocity());
135+
136+ Projectile continueBullet = gun.shoot(newBegin, bulletType, bullet.getShooter(), bullet.getVelocity(), true);
137+
138+ gun.postMiss(whereEnd, hit, bullet, continueBullet, bulletType);
139+ */
140+ }
141+ }
142+
118143 Location end = event .getHitBlock ().getLocation ().clone ().add (0.5 , 0.5 , 0.5 );
119144
120145 AddGun .getPlugin ().debug ("Warning: bullet {1} of {0} hit ground {2}" , gun .getBulletTag (), bullet .getUniqueId (), end );
@@ -663,7 +688,6 @@ public void chunkUnloadClearBullets(ChunkUnloadEvent event) {
663688 }
664689 }
665690
666-
667691 /**
668692 * Using a supplied item, identifies which gun, or if none, null.
669693 *
0 commit comments