Bump to v3.1, rewrite Teleport/TimedTeleport and add TeleportBuilder, expose new Teleport API, remove TeleportManager, minor database utility refactoring

This commit is contained in:
William committed 2022-10-18 17:45:44 +01:00
1 parent e7f8298b12
commit 9630e53613
35 files changed
+1070 -881

No files matched your search

@@ -2,6 +2,7 @@ package net.william278.huskhomes.command;
import net.william278.huskhomes.HuskHomes;
import net.william278.huskhomes.player.OnlineUser;
import net.william278.huskhomes.teleport.Teleport;
import net.william278.huskhomes.util.Permission;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -38,8 +39,15 @@ public class TpOfflineCommand extends CommandBase implements TabCompletable {
}
plugin.getLocales().getLocale("teleporting_offline_player", targetUser)
.ifPresent(onlineUser::sendMessage);
plugin.getTeleportManager().teleport(onlineUser, offlinePosition.get()).thenAccept(
result -> plugin.getTeleportManager().finishTeleport(onlineUser, result));
Teleport.builder(plugin, onlineUser)
.setTarget(offlinePosition.get())
.toTeleport()
.thenAccept(teleport -> teleport.execute().thenAccept(result -> {
if (result.successful) {
plugin.getLocales().getLocale("teleporting_offline_complete", targetUser)
.ifPresent(onlineUser::sendMessage);
}
}));
});
});
}