2018-06-01 17:35:48 +00:00
|
|
|
package me.totalfreedom.totalfreedommod.command;
|
|
|
|
|
|
|
|
import org.bukkit.ChatColor;
|
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.configuration.ConfigurationSection;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
|
2018-06-02 21:09:58 +00:00
|
|
|
public class Command_links extends FreedomCommand
|
|
|
|
{
|
2018-06-01 17:35:48 +00:00
|
|
|
@Override
|
2018-06-02 21:09:58 +00:00
|
|
|
protected boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
|
|
|
{
|
2018-06-01 17:35:48 +00:00
|
|
|
ConfigurationSection section = plugin.getConfig().getConfigurationSection("social_links");
|
|
|
|
Map<String,Object> values = section.getValues(false);
|
|
|
|
|
|
|
|
List<String> lines = new ArrayList<>();
|
|
|
|
|
2018-06-02 21:09:58 +00:00
|
|
|
for(String key : values.keySet())
|
|
|
|
{
|
|
|
|
if(!(values.get(key) instanceof String))
|
|
|
|
{
|
2018-06-01 17:35:48 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
String link = (String) values.get(key);
|
|
|
|
|
|
|
|
lines.add(ChatColor.GOLD + "- " + key + ": " + ChatColor.AQUA + link);
|
|
|
|
}
|
2018-06-02 21:09:58 +00:00
|
|
|
if(lines.size() == 0)
|
|
|
|
{
|
2018-06-01 17:35:48 +00:00
|
|
|
lines.add(ChatColor.GOLD + "- There are no links currently added in the config");
|
|
|
|
}
|
|
|
|
|
|
|
|
lines.add(ChatColor.AQUA + "TotalFreedom Social Media Links:");
|
|
|
|
sender.sendMessage(lines.toArray(new String[0]));
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|