|
19 | 19 | package net.mohron.skyclaims.command.user; |
20 | 20 |
|
21 | 21 | import java.util.Optional; |
| 22 | +import java.util.UUID; |
22 | 23 | import java.util.function.Consumer; |
23 | 24 | import net.mohron.skyclaims.command.CommandBase; |
24 | 25 | import net.mohron.skyclaims.command.CommandIsland; |
25 | 26 | import net.mohron.skyclaims.command.argument.Arguments; |
26 | 27 | import net.mohron.skyclaims.permissions.Permissions; |
27 | 28 | import net.mohron.skyclaims.util.CommandUtil; |
28 | 29 | import net.mohron.skyclaims.world.Island; |
| 30 | +import net.mohron.skyclaims.world.IslandManager; |
29 | 31 | import org.spongepowered.api.command.CommandException; |
30 | 32 | import org.spongepowered.api.command.CommandPermissionException; |
31 | 33 | import org.spongepowered.api.command.CommandResult; |
@@ -60,12 +62,15 @@ public static void register() { |
60 | 62 |
|
61 | 63 | @Override |
62 | 64 | public CommandResult execute(Player player, CommandContext args) throws CommandException { |
63 | | - Optional<Island> island = args.getOne(ISLAND); |
64 | | - if (island.isPresent()) { |
65 | | - return sendPlayerToSpawn(player, island.get()); |
66 | | - } else { |
67 | | - return listIslands(player, this::sendPlayerToSpawn); |
| 65 | + Optional<UUID> uuid = args.getOne(ISLAND); |
| 66 | + if (uuid.isPresent()) { |
| 67 | + final Optional<Island> island = IslandManager.get(uuid.get()); |
| 68 | + if (island.isPresent()) { |
| 69 | + return sendPlayerToSpawn(player, island.get()); |
| 70 | + } |
68 | 71 | } |
| 72 | + |
| 73 | + return listIslands(player, this::sendPlayerToSpawn); |
69 | 74 | } |
70 | 75 |
|
71 | 76 | private CommandResult sendPlayerToSpawn(Player player, Island island) throws CommandException { |
|
0 commit comments