Skip to content

Commit

Permalink
fix: Wrong builder method calls
Browse files Browse the repository at this point in the history
  • Loading branch information
WiIIiam278 committed Feb 13, 2024
1 parent b49375f commit 75f03ba
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -772,14 +772,10 @@ public final void randomlyTeleportPlayer(@NotNull OnlineUser user, boolean timed
throw new IllegalStateException("Random teleport engine returned an empty position");
}

final TeleportBuilder builder = Teleport.builder(plugin)
Teleport.builder(plugin)
.teleporter(user)
.target(position.get());
if (timedTeleport) {
builder.executeTimed();
} else {
builder.executeTeleport();
}
.target(position.get())
.buildAndComplete(timedTeleport);
}).exceptionally(e -> {
throw new IllegalStateException("Random teleport engine threw an exception", e);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void execute(@NotNull OnlineUser executor, @NotNull String[] args) {
.target(lastPosition.get())
.actions(TransactionResolver.Action.BACK_COMMAND)
.type(Teleport.Type.BACK)
.executeTimed();
.buildAndComplete(true);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import net.william278.huskhomes.HuskHomes;
import net.william278.huskhomes.position.Position;
import net.william278.huskhomes.teleport.Teleport;
import net.william278.huskhomes.teleport.TeleportBuilder;
import net.william278.huskhomes.teleport.Teleportable;
import net.william278.huskhomes.user.CommandUser;
import net.william278.huskhomes.util.TransactionResolver;
Expand Down Expand Up @@ -66,15 +65,11 @@ public void teleportToSpawn(@NotNull Teleportable teleporter, @NotNull CommandUs
return;
}

final TeleportBuilder builder = Teleport.builder(plugin)
Teleport.builder(plugin)
.teleporter(teleporter)
.actions(TransactionResolver.Action.SPAWN_TELEPORT)
.target(spawn);
if (teleporter.equals(executor)) {
builder.executeTimed();
} else {
builder.executeTeleport();
}
.target(spawn)
.buildAndComplete(teleporter.equals(executor), args);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ private void execute(@NotNull CommandUser executor, @NotNull Teleportable telepo
if (executor instanceof OnlineUser user) {
builder.executor(user);
}
builder.executeTeleport(args);
builder.buildAndComplete(false, args);

// Display a teleport completion message
final String teleporterName = teleportable instanceof OnlineUser user
Expand Down

0 comments on commit 75f03ba

Please sign in to comment.