13
0

Add Seat Change

Dieser Commit ist enthalten in:
Chaoscaot 2020-11-02 16:19:35 +01:00
Ursprung d72e31b811
Commit 38e59848f0

Datei anzeigen

@ -41,11 +41,13 @@ public class PlayerSeatListener extends BasicListener {
if(event.getPlayer().getGameMode() != GameMode.ADVENTURE)
return;
if(event.getPlayer().isInsideVehicle())
event.getPlayer().getVehicle().remove();
Arrow arrow = (Arrow) event.getPlayer().getWorld().spawnEntity(event.getClickedBlock().getLocation().add(0.5, 0, 0.5), EntityType.ARROW);
arrow.setGravity(false);
arrow.addScoreboardTag(event.getPlayer().getUniqueId().toString());
arrow.setPickupStatus(AbstractArrow.PickupStatus.DISALLOWED);
arrow.setPassenger(event.getPlayer());
arrow.addPassenger(event.getPlayer());
}
@EventHandler
@ -56,9 +58,6 @@ public class PlayerSeatListener extends BasicListener {
if(event.getEntityType() != EntityType.PLAYER)
return;
event.getEntity().getWorld().getEntitiesByClasses(Arrow.class).forEach(entity -> {
if(entity.getScoreboardTags().contains(event.getEntity().getUniqueId().toString()))
entity.remove();
});
event.getDismounted().remove();
}
}