2020-07-13 00:40:11 +00:00
|
|
|
package me.totalfreedom.tfguilds.command;
|
|
|
|
|
|
|
|
import me.totalfreedom.tfguilds.Common;
|
|
|
|
import me.totalfreedom.tfguilds.guild.Guild;
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
import org.bukkit.ChatColor;
|
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.command.CommandExecutor;
|
|
|
|
import org.bukkit.command.CommandSender;
|
2020-07-14 23:22:37 +00:00
|
|
|
|
|
|
|
import java.util.List;
|
2020-07-13 00:40:11 +00:00
|
|
|
|
|
|
|
public class ListSubcommand extends Common implements CommandExecutor
|
|
|
|
{
|
|
|
|
@Override
|
|
|
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
|
|
|
|
{
|
2020-07-14 23:22:37 +00:00
|
|
|
List<String> guilds = Guild.getGuildList();
|
|
|
|
|
|
|
|
if (guilds.isEmpty())
|
2020-07-13 00:40:11 +00:00
|
|
|
{
|
2020-07-14 23:22:37 +00:00
|
|
|
sender.sendMessage(ChatColor.RED + "Nobody has made a guild yet.");
|
2020-07-13 00:40:11 +00:00
|
|
|
return true;
|
|
|
|
}
|
2020-07-14 23:22:37 +00:00
|
|
|
|
|
|
|
sender.sendMessage(tl(PREFIX + "%s%Guild List (%p%" + guilds.size() + " total%s%)"));
|
2020-07-15 02:54:54 +00:00
|
|
|
sender.sendMessage(tl("%s%- %p%" + StringUtils.join(guilds, "\n%s%- %p%")));
|
2020-07-13 00:40:11 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|