Skip to content

Commit

Permalink
reduce code dup and misplacement issues with SittingTrait
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jan 4, 2019
1 parent d47ca88 commit 436b4eb
Showing 1 changed file with 2 additions and 7 deletions.
Expand Up @@ -78,14 +78,13 @@ public void onDespawn() {
* Makes the NPC sit
*/
public void sit() {
if (!npc.isSpawned() || npc.getEntity().getType() != EntityType.PLAYER) {
if (!npc.isSpawned()) {
return;
}

DenizenAPI.getDenizenNPC(npc).action("sit", null);

chairLocation = npc.getEntity().getLocation().clone();
sitInternal();
sit(npc.getEntity().getLocation());
}

private void sitInternal() {
Expand Down Expand Up @@ -120,10 +119,6 @@ private void standInternal() {
public void sitInternal(Location location) {
DenizenAPI.getDenizenNPC(npc).action("sit", null);

if (npc.getEntity().getType() != EntityType.PLAYER) {
return;
}

/*
* Teleport NPC to the location before
* sending the sit packet to the clients.
Expand Down

0 comments on commit 436b4eb

Please sign in to comment.