mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-06 16:37:38 +01:00
Fix boat steer NPE (Minestom/Minestom#1854)
(cherry picked from commit 80f5db34a6
)
This commit is contained in:
parent
1874b238e4
commit
96cd23fa7c
@ -36,8 +36,10 @@ public class PlayerVehicleListener {
|
|||||||
|
|
||||||
public static void boatSteerListener(ClientSteerBoatPacket packet, Player player) {
|
public static void boatSteerListener(ClientSteerBoatPacket packet, Player player) {
|
||||||
final Entity vehicle = player.getVehicle();
|
final Entity vehicle = player.getVehicle();
|
||||||
|
/* The packet may have been received after already exiting the vehicle. */
|
||||||
|
if (vehicle == null) return;
|
||||||
if (!(vehicle.getEntityMeta() instanceof BoatMeta boat)) return;
|
if (!(vehicle.getEntityMeta() instanceof BoatMeta boat)) return;
|
||||||
boat.setLeftPaddleTurning(packet.leftPaddleTurning());
|
boat.setLeftPaddleTurning(packet.leftPaddleTurning());
|
||||||
boat.setRightPaddleTurning(packet.rightPaddleTurning());
|
boat.setRightPaddleTurning(packet.rightPaddleTurning());
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user