Update TransferShopsCommand.java
This commit is contained in:
parent
22e30ba949
commit
89f2dc7b51
|
|
@ -40,12 +40,17 @@ public class TransferShopsCommand implements Subcommand {
|
|||
player.sendMiniMessage("<red>Invalid command syntax, use /transfershops <uuid> <newplayer>", null);
|
||||
return false;
|
||||
}
|
||||
UUID oldUUID = UUID.fromString(args[0]);
|
||||
OfflinePlayer oldOfflinePlayer = Bukkit.getOfflinePlayer(args[0]);
|
||||
if (!oldOfflinePlayer.hasPlayedBefore()) {
|
||||
player.sendMiniMessage("<red>" + args[0] + " has not joined this server before.", null);
|
||||
return false;
|
||||
}
|
||||
Player newShopOwner = Bukkit.getPlayer(args[1]);
|
||||
if (newShopOwner == null) {
|
||||
player.sendMiniMessage("<red>" + args[1] + " is not online and has to be online for this process.", null);
|
||||
return false;
|
||||
}
|
||||
UUID oldUUID = oldOfflinePlayer.getUniqueId();
|
||||
List<PlayerShop> playerShops = PlayerShops.getInstance().getShopHandler().getShops(oldUUID);
|
||||
sender.sendMiniMessage("<red>Starting the transfer process now, this might lag the server.", null);
|
||||
for (PlayerShop playerShop : playerShops) {
|
||||
|
|
@ -56,14 +61,4 @@ public class TransferShopsCommand implements Subcommand {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> tabComplete(final CommandSender sender, final String subCommand, final String[] args) {
|
||||
if (args.length == 1) {
|
||||
return PlayerShops.getInstance().getShopHandler().getShopOwners().stream().map(uuid -> toString()).toList();
|
||||
} else if (args.length == 2) {
|
||||
return Bukkit.getOnlinePlayers().stream().map(Player::getName).toList();
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user