mirror of
https://github.com/kaboomserver/weapons.git
synced 2025-02-05 06:02:57 +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
|
||||
&& projectile.getShooter() instanceof Player
|
||||
&& ((Player) projectile.getShooter()).getUniqueId().equals(
|
||||
collidedWith.getUniqueId())) {
|
||||
collidedWith.getUniqueId()))
|
||||
|| collidedWith.getType() == EntityType.FIREBALL) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
|
|
@ -116,21 +116,22 @@ public final class WeaponMachineGun implements Listener {
|
|||
final World world = player.getWorld();
|
||||
final Vector velocity = eyeLocation.getDirection().multiply(12);
|
||||
|
||||
final Arrow arrow = player.launchProjectile(Arrow.class);
|
||||
world.getChunkAtAsync(eyeLocation).thenAccept(chunk -> {
|
||||
final Arrow arrow = player.launchProjectile(Arrow.class);
|
||||
final float volume = 1.0F;
|
||||
final float pitch = 63.0F;
|
||||
|
||||
arrow.customName(Component.text("WeaponMachineGunBullet"));
|
||||
arrow.setShooter(player);
|
||||
arrow.setVelocity(velocity);
|
||||
arrow.customName(Component.text("WeaponMachineGunBullet"));
|
||||
arrow.setShooter(player);
|
||||
arrow.setVelocity(velocity);
|
||||
|
||||
final float volume = 1.0F;
|
||||
final float pitch = 63.0F;
|
||||
|
||||
world.playSound(
|
||||
eyeLocation,
|
||||
Sound.ENTITY_GENERIC_EXPLODE,
|
||||
volume,
|
||||
pitch
|
||||
);
|
||||
world.playSound(
|
||||
eyeLocation,
|
||||
Sound.ENTITY_GENERIC_EXPLODE,
|
||||
volume,
|
||||
pitch
|
||||
);
|
||||
});
|
||||
|
||||
numFiredBullets++;
|
||||
machineGunActive.put(playerUUID, numFiredBullets);
|
||||
|
|
Loading…
Reference in a new issue