mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-01 22:16:08 +00:00
Continue command refactor work
This commit is contained in:
31 files changed
+319
-391
No files matched your search
@@ -14,27 +14,25 @@ import java.util.Optional;
|
||||
public class BackCommand extends Command {
|
||||
|
||||
protected BackCommand(@NotNull HuskHomes plugin) {
|
||||
super("back", List.of(), plugin);
|
||||
super("back", List.of(), "", plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(@NotNull CommandUser executor, @NotNull String[] args) {
|
||||
final OnlineUser player = (OnlineUser) executor;
|
||||
plugin.runAsync(() -> {
|
||||
final Optional<Position> lastPosition = plugin.getDatabase().getLastPosition(player);
|
||||
if (lastPosition.isEmpty()) {
|
||||
plugin.getLocales().getLocale("error_no_last_position")
|
||||
.ifPresent(player::sendMessage);
|
||||
return;
|
||||
}
|
||||
final Optional<Position> lastPosition = plugin.getDatabase().getLastPosition(player);
|
||||
if (lastPosition.isEmpty()) {
|
||||
plugin.getLocales().getLocale("error_no_last_position")
|
||||
.ifPresent(player::sendMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
Teleport.builder(plugin)
|
||||
.teleporter(player)
|
||||
.target(lastPosition.get())
|
||||
.economyActions(EconomyHook.Action.BACK_COMMAND)
|
||||
.toTimedTeleport()
|
||||
.execute();
|
||||
});
|
||||
Teleport.builder(plugin)
|
||||
.teleporter(player)
|
||||
.target(lastPosition.get())
|
||||
.economyActions(EconomyHook.Action.BACK_COMMAND)
|
||||
.toTimedTeleport()
|
||||
.execute();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user