diff --git a/common/src/main/java/net/william278/huskhomes/api/BaseHuskHomesAPI.java b/common/src/main/java/net/william278/huskhomes/api/BaseHuskHomesAPI.java index 3f881f7c..dc68a384 100644 --- a/common/src/main/java/net/william278/huskhomes/api/BaseHuskHomesAPI.java +++ b/common/src/main/java/net/william278/huskhomes/api/BaseHuskHomesAPI.java @@ -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); }); diff --git a/common/src/main/java/net/william278/huskhomes/command/BackCommand.java b/common/src/main/java/net/william278/huskhomes/command/BackCommand.java index 9146e239..7bd92762 100644 --- a/common/src/main/java/net/william278/huskhomes/command/BackCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/BackCommand.java @@ -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); } } diff --git a/common/src/main/java/net/william278/huskhomes/command/SpawnCommand.java b/common/src/main/java/net/william278/huskhomes/command/SpawnCommand.java index bfa5ed57..b6589e03 100644 --- a/common/src/main/java/net/william278/huskhomes/command/SpawnCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/SpawnCommand.java @@ -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; @@ -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); } } diff --git a/common/src/main/java/net/william278/huskhomes/command/TpCommand.java b/common/src/main/java/net/william278/huskhomes/command/TpCommand.java index bd89fdfd..c7694f45 100644 --- a/common/src/main/java/net/william278/huskhomes/command/TpCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/TpCommand.java @@ -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