mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-10-22 12:29:59 +02:00
Extra null check in sit trait
This commit is contained in:
parent
0f701a3c40
commit
e78499f6ca
@ -41,8 +41,9 @@ public class MountTrait extends Trait {
|
||||
|
||||
@Override
|
||||
public void onDespawn() {
|
||||
if (NMS.getVehicle(npc.getEntity()) != null) {
|
||||
if (currentMount != null) {
|
||||
npc.getEntity().leaveVehicle();
|
||||
currentMount = null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,11 +52,6 @@ public class MountTrait extends Trait {
|
||||
onDespawn();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSpawn() {
|
||||
checkMounted();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (!npc.isSpawned())
|
||||
@ -79,10 +75,7 @@ public class MountTrait extends Trait {
|
||||
public void unmount() {
|
||||
if (currentMount == null)
|
||||
return;
|
||||
if (NMS.getVehicle(npc.getEntity()) != null) {
|
||||
npc.getEntity().leaveVehicle();
|
||||
}
|
||||
onDespawn();
|
||||
uuid = null;
|
||||
currentMount = null;
|
||||
}
|
||||
}
|
@ -26,7 +26,7 @@ public class SitTrait extends Trait {
|
||||
}
|
||||
|
||||
public boolean isSitting() {
|
||||
return sittingAt != null;
|
||||
return sittingAt != null && sittingAt.getWorld() != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user