11package de .theshadowsdust .ultimatespawn .command ;
22
3- import cloud .commandframework .annotations .Argument ;
4- import cloud .commandframework .annotations .CommandDescription ;
5- import cloud .commandframework .annotations .CommandMethod ;
6- import cloud .commandframework .annotations .CommandPermission ;
7- import cloud .commandframework .annotations .specifier .Greedy ;
8- import cloud .commandframework .annotations .suggestions .Suggestions ;
9- import cloud .commandframework .context .CommandContext ;
3+ import de .theshadowsdust .ultimatespawn .UltimateSpawnPlugin ;
104import de .theshadowsdust .ultimatespawn .position .SpawnPosition ;
115import de .theshadowsdust .ultimatespawn .position .WrappedLocation ;
126import de .theshadowsdust .ultimatespawn .service .LanguageService ;
13- import de .theshadowsdust .ultimatespawn .UltimateSpawnPlugin ;
147import org .bukkit .Location ;
158import org .bukkit .command .CommandSender ;
169import org .bukkit .entity .Player ;
1710import org .bukkit .util .StringUtil ;
11+ import org .incendo .cloud .annotation .specifier .Greedy ;
12+ import org .incendo .cloud .annotations .Argument ;
13+ import org .incendo .cloud .annotations .Command ;
14+ import org .incendo .cloud .annotations .CommandDescription ;
15+ import org .incendo .cloud .annotations .Permission ;
16+ import org .incendo .cloud .annotations .suggestion .Suggestions ;
17+ import org .incendo .cloud .context .CommandContext ;
1818import org .jetbrains .annotations .NotNull ;
1919
2020import java .util .ArrayList ;
@@ -32,8 +32,8 @@ public SpawnCommand(@NotNull UltimateSpawnPlugin plugin) {
3232 this .languageService = plugin .getLanguageService ();
3333 }
3434
35- @ CommandMethod ("spawn [name]" )
36- @ CommandPermission ("ultimatespawn.command.spawn" )
35+ @ Command ("spawn [name]" )
36+ @ Permission ("ultimatespawn.command.spawn" )
3737 @ CommandDescription ("Teleport to the spawn" )
3838 public void executeSpawnCommand (Player player , final @ Argument (value = "name" , suggestions = "spawn_names" ) @ Greedy String name ) {
3939
@@ -53,8 +53,16 @@ public void executeSpawnCommand(Player player, final @Argument(value = "name", s
5353 return ;
5454 }
5555
56- player .teleport (location );
57- player .sendMessage (this .languageService .getMessage ("spawn-teleport-success" , this .languageService .getPluginPrefix ()));
56+ player .teleportAsync (location ).thenAccept (success -> {
57+ if (Boolean .TRUE .equals (success )) {
58+ player .sendMessage (this .languageService .getMessage ("spawn-teleport-success" ,
59+ this .languageService .getPluginPrefix ()));
60+ } else {
61+ player .sendMessage (this .languageService .getMessage ("spawn-teleport-failure" ,
62+ this .languageService .getPluginPrefix ()));
63+ }
64+ });
65+
5866 } catch (ExecutionException | InterruptedException e ) {
5967 this .plugin .getLogger ().log (Level .SEVERE , "Something went wrong on teleportation" , e );
6068 Thread .currentThread ().interrupt ();
0 commit comments