Continue command refactor work

This commit is contained in:
William committed 2023-03-07 15:17:20 +00:00
1 parent 3e27f7c5b1
commit 0bd63a9f01
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();
}
}