mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-01 14:38:53 +00:00
refactor: Simplify teleport execution logic (#565)
* refactor: simplify teleport execution logic * docs: document better way of executing a teleport * fix: TimedTeleport should still handle internal errors * fix: Wrong builder method calls * fix: Typos * fix: More typos * fix: Cancel timed teleport on failed execute
This commit is contained in:
1 parent
1723aa44fc
commit
d79fcaacb6
17 files changed
+159
-209
No files matched your search
@@ -22,7 +22,6 @@ package net.william278.huskhomes.command;
|
||||
import net.william278.huskhomes.HuskHomes;
|
||||
import net.william278.huskhomes.position.Position;
|
||||
import net.william278.huskhomes.teleport.Teleport;
|
||||
import net.william278.huskhomes.teleport.TeleportationException;
|
||||
import net.william278.huskhomes.user.OnlineUser;
|
||||
import net.william278.huskhomes.user.SavedUser;
|
||||
import net.william278.huskhomes.user.User;
|
||||
@@ -69,14 +68,10 @@ public class TpOfflineCommand extends InGameCommand implements UserListTabProvid
|
||||
|
||||
plugin.getLocales().getLocale("teleporting_offline_player", target.getUsername())
|
||||
.ifPresent(user::sendMessage);
|
||||
try {
|
||||
Teleport.builder(plugin)
|
||||
.teleporter(user)
|
||||
.target(position.get())
|
||||
.toTeleport().execute();
|
||||
} catch (TeleportationException e) {
|
||||
e.displayMessage(user, args);
|
||||
}
|
||||
Teleport.builder(plugin)
|
||||
.teleporter(user)
|
||||
.target(position.get())
|
||||
.buildAndComplete(false, args);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user