Skip to content

Commit

Permalink
more SittingTrait edge case bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jul 8, 2022
1 parent 6b7affb commit 964737f
Showing 1 changed file with 9 additions and 3 deletions.
Expand Up @@ -113,21 +113,27 @@ public void sit() {
}

private void standInternal() {
sitting = false;
safetyCleanup(chairLocation.clone());
if (!npc.isSpawned()) {
return;
}
forceUnsit(npc.getEntity());
if (chairLocation == null) {
return;
}
safetyCleanup(chairLocation.clone());
npc.teleport(chairLocation.clone().add(0, 0.3, 0), PlayerTeleportEvent.TeleportCause.PLUGIN);
sitting = false;
}

public void sitInternal(Location location) {
sitting = true;
safetyCleanup(location.clone());
if (!npc.isSpawned()) {
return;
}
new NPCTag(npc).action("sit", null);
npc.getEntity().teleport(location, PlayerTeleportEvent.TeleportCause.PLUGIN);
forceEntitySit(npc.getEntity(), location.clone(), 0);
sitting = true;
}

public void safetyCleanup(Location loc) {
Expand Down

0 comments on commit 964737f

Please sign in to comment.