13
0

Fix PlayerSeatListener
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2022-03-26 11:17:56 +01:00
Ursprung a93fe5797d
Commit 9922f0b595

Datei anzeigen

@ -25,6 +25,7 @@ import org.bukkit.block.data.Bisected;
import org.bukkit.block.data.type.Stairs;
import org.bukkit.entity.AbstractArrow;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
@ -70,7 +71,7 @@ public class PlayerSeatListener extends BasicListener{
if (((Stairs) event.getClickedBlock().getBlockData()).getShape() != Stairs.Shape.STRAIGHT)
return;
if (event.getPlayer().isInsideVehicle())
if (event.getPlayer().isInsideVehicle() && isArrow(event.getPlayer().getVehicle()))
event.getPlayer().getVehicle().remove();
if (event.getClickedBlock().getRelative(0, 1, 0).getType() != Material.AIR)
@ -93,7 +94,7 @@ public class PlayerSeatListener extends BasicListener{
public void onEntityDismount(EntityDismountEvent event) {
seats.remove(getSeatLocation(event.getDismounted().getLocation()));
if (event.getEntityType() != EntityType.PLAYER && event.getDismounted().getType() != EntityType.ARROW)
if (event.getEntityType() != EntityType.PLAYER && !isArrow(event.getDismounted()))
return;
event.getDismounted().remove();
@ -101,7 +102,7 @@ public class PlayerSeatListener extends BasicListener{
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
if (event.getPlayer().isInsideVehicle() && event.getPlayer().getVehicle().getType() == EntityType.ARROW)
if (event.getPlayer().isInsideVehicle() && isArrow(event.getPlayer().getVehicle()))
event.getPlayer().getVehicle().remove();
}
@ -109,4 +110,7 @@ public class PlayerSeatListener extends BasicListener{
return new Location(world,location.getBlockX(), location.getBlockY(), location.getBlockZ());
}
private boolean isArrow(Entity entity) {
return entity.getType() == EntityType.ARROW;
}
}