mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-01 22:16:08 +00:00
Spawn: Simplify getting method, refactoring, add way of getting via API
This commit is contained in:
1 parent
f94f9e82db
commit
4db869abf1
6 files changed
+36
-20
No files matched your search
@@ -21,16 +21,13 @@ public class SpawnCommand extends CommandBase {
|
||||
return;
|
||||
}
|
||||
|
||||
CompletableFuture.supplyAsync(() -> plugin.getSettings().crossServer && plugin.getSettings().globalSpawn
|
||||
? plugin.getDatabase().getWarp(plugin.getSettings().globalSpawnName).join()
|
||||
: plugin.getServerSpawn().flatMap(spawn -> spawn.getLocation(plugin.getPluginServer())))
|
||||
.thenAccept(position -> {
|
||||
if (position.isEmpty()) {
|
||||
plugin.getLocales().getLocale("error_spawn_not_set")
|
||||
.ifPresent(onlineUser::sendMessage);
|
||||
return;
|
||||
}
|
||||
plugin.getTeleportManager().timedTeleport(onlineUser, position.get());
|
||||
});
|
||||
CompletableFuture.supplyAsync(plugin::getSpawn).thenAccept(position -> {
|
||||
if (position.isEmpty()) {
|
||||
plugin.getLocales().getLocale("error_spawn_not_set")
|
||||
.ifPresent(onlineUser::sendMessage);
|
||||
return;
|
||||
}
|
||||
plugin.getTeleportManager().timedTeleport(onlineUser, position.get());
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user