fix stuff social links

This commit is contained in:
Telesphoreo 2018-06-08 01:21:10 -07:00 committed by Lemon
parent c9a0626239
commit 1ad60c1c80

View File

@ -19,6 +19,8 @@ public class Command_links extends FreedomCommand
protected boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) protected boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{ {
ConfigurationSection section = plugin.getConfig().getConfigurationSection("social_links"); ConfigurationSection section = plugin.getConfig().getConfigurationSection("social_links");
if (section != null)
{
Map<String, Object> values = section.getValues(false); Map<String, Object> values = section.getValues(false);
List<String> lines = new ArrayList<>(); List<String> lines = new ArrayList<>();
@ -29,19 +31,18 @@ public class Command_links extends FreedomCommand
{ {
continue; continue;
} }
String link = (String) values.get(key); String link = (String) values.get(key);
lines.add(ChatColor.GOLD + "- " + key + ": " + ChatColor.AQUA + link); lines.add(ChatColor.GOLD + "- " + key + ": " + ChatColor.AQUA + link);
} }
if (lines.size() == 0)
{
lines.add(ChatColor.GOLD + "- There are no links currently added in the config.");
}
lines.add(ChatColor.AQUA + "TotalFreedom Social Media Links:"); sender.sendMessage(ChatColor.AQUA + "Social Media Links:");
sender.sendMessage(lines.toArray(new String[0])); sender.sendMessage(lines.toArray(new String[0]));
return true;
}
else
{
sender.sendMessage(ChatColor.RED + "There are no links added in the configuration file.");
}
return true; return true;
} }
} }