diff --git a/src/main/java/me/kaiyan/missilewarfare/blocks/GroundMissileLauncher.java b/src/main/java/me/kaiyan/missilewarfare/blocks/GroundMissileLauncher.java index 6ef32a9..b6e2cb3 100644 --- a/src/main/java/me/kaiyan/missilewarfare/blocks/GroundMissileLauncher.java +++ b/src/main/java/me/kaiyan/missilewarfare/blocks/GroundMissileLauncher.java @@ -86,7 +86,7 @@ private void blockDispense(BlockDispenseEvent blockDispenseEvent, Dispenser disp TileState state = (TileState)dispenser.getBlock().getState(); PersistentDataContainer cont = state.getPersistentDataContainer(); - if (cont.get(new NamespacedKey(MissileWarfare.getInstance(), "canfire"), PersistentDataType.INTEGER) != 1){ + if (cont.has(new NamespacedKey(MissileWarfare.getInstance(), "canfire"), PersistentDataType.INTEGER) && cont.get(new NamespacedKey(MissileWarfare.getInstance(), "canfire"), PersistentDataType.INTEGER) != 1){ MissileWarfare.getInstance().getServer().broadcastMessage("Missile at : "+dispenser.getBlock().getLocation().toVector() +" Is unable to fire: Missing GREEN_CONCRETE Below"); } diff --git a/src/main/java/me/kaiyan/missilewarfare/missiles/MissileController.java b/src/main/java/me/kaiyan/missilewarfare/missiles/MissileController.java index 66a0a35..feebba8 100644 --- a/src/main/java/me/kaiyan/missilewarfare/missiles/MissileController.java +++ b/src/main/java/me/kaiyan/missilewarfare/missiles/MissileController.java @@ -213,17 +213,17 @@ public void Update(BukkitRunnable run, MissileController other){ world.spawnParticle(Particle.CAMPFIRE_COSY_SMOKE, pos.toLocation(world), 0, 0, 0, 0, 0.1, null, true); world.spawnParticle(Particle.CAMPFIRE_COSY_SMOKE, (pos.toLocation(world).subtract(velocity.divide(new Vector(2,2,2)))), 0, 0, 0, 0, 0.1, null, true); if (target.distanceSquared(pos) < (speed*speed)*1.1){ - if (Math.random()>0.1){ + if (Math.random()>MissileWarfare.getInstance().getConfig().getDouble("AA-missile-success")){ run.cancel(); return; } - explode(run); - for (int i = 0; i < 40; i++) { - world.spawnParticle(Particle.CAMPFIRE_COSY_SMOKE, pos.toLocation(world), 0, Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5, 0.1, null, true); - world.spawnParticle(Particle.FLAME, pos.toLocation(world), 0, Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5, 0.1, null,true); - } if (other.update != null) { other.explode(other.update); + explode(run); + for (int i = 0; i < 40; i++) { + world.spawnParticle(Particle.CAMPFIRE_COSY_SMOKE, pos.toLocation(world), 0, Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5, 0.1, null, true); + world.spawnParticle(Particle.FLAME, pos.toLocation(world), 0, Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5, 0.1, null,true); + } run.cancel(); } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index ad8c61b..100d0a6 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -130,6 +130,9 @@ saved-packs: - pack-TW - pack-FR +# chance for anti missile missile to successfully fire. +AA-missile-success: 0.6 + logging: # Sends a message to console on missile shot :O logMissileShots: true