mirror of
https://github.com/kaboomserver/weapons.git
synced 2025-02-05 14:13:52 +00:00
Machine Gun: Avoid exception in Folia
Not a great solution, but it will do for now.
This commit is contained in:
parent
7177cd1767
commit
42df4d8795
2 changed files with 15 additions and 14 deletions
|
@ -88,7 +88,7 @@ public final class WeaponArmageddon implements Listener {
|
||||||
if ((collidedWith.getType() == EntityType.PLAYER
|
if ((collidedWith.getType() == EntityType.PLAYER
|
||||||
&& projectile.getShooter() instanceof Player
|
&& projectile.getShooter() instanceof Player
|
||||||
&& ((Player) projectile.getShooter()).getUniqueId().equals(
|
&& ((Player) projectile.getShooter()).getUniqueId().equals(
|
||||||
collidedWith.getUniqueId())) {
|
collidedWith.getUniqueId()))
|
||||||
|| collidedWith.getType() == EntityType.FIREBALL) {
|
|| collidedWith.getType() == EntityType.FIREBALL) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,21 +116,22 @@ public final class WeaponMachineGun implements Listener {
|
||||||
final World world = player.getWorld();
|
final World world = player.getWorld();
|
||||||
final Vector velocity = eyeLocation.getDirection().multiply(12);
|
final Vector velocity = eyeLocation.getDirection().multiply(12);
|
||||||
|
|
||||||
|
world.getChunkAtAsync(eyeLocation).thenAccept(chunk -> {
|
||||||
final Arrow arrow = player.launchProjectile(Arrow.class);
|
final Arrow arrow = player.launchProjectile(Arrow.class);
|
||||||
|
final float volume = 1.0F;
|
||||||
|
final float pitch = 63.0F;
|
||||||
|
|
||||||
arrow.customName(Component.text("WeaponMachineGunBullet"));
|
arrow.customName(Component.text("WeaponMachineGunBullet"));
|
||||||
arrow.setShooter(player);
|
arrow.setShooter(player);
|
||||||
arrow.setVelocity(velocity);
|
arrow.setVelocity(velocity);
|
||||||
|
|
||||||
final float volume = 1.0F;
|
|
||||||
final float pitch = 63.0F;
|
|
||||||
|
|
||||||
world.playSound(
|
world.playSound(
|
||||||
eyeLocation,
|
eyeLocation,
|
||||||
Sound.ENTITY_GENERIC_EXPLODE,
|
Sound.ENTITY_GENERIC_EXPLODE,
|
||||||
volume,
|
volume,
|
||||||
pitch
|
pitch
|
||||||
);
|
);
|
||||||
|
});
|
||||||
|
|
||||||
numFiredBullets++;
|
numFiredBullets++;
|
||||||
machineGunActive.put(playerUUID, numFiredBullets);
|
machineGunActive.put(playerUUID, numFiredBullets);
|
||||||
|
|
Loading…
Reference in a new issue