ADD CHECKS

This commit is contained in:
speed 2020-06-16 14:08:34 -04:00 committed by GitHub
parent 8d19feae46
commit 00c0bd26ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,6 +4,7 @@ import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
import totalfreedom.tfguilds.util.GBase;
import totalfreedom.tfguilds.util.GUtil;
@ -26,17 +27,32 @@ public class CreateGuildCommand extends GBase implements CommandExecutor
return true;
}
// this stupid shit
ConfigurationSection guildMembers = plugin.guilds.getConfigurationSection("guilds");
/* List<String> members = plugin.guilds.getStringList("guilds." + args[0] + ".members");
for (String players : members)
if (guildMembers != null)
{
if (players.contains(player.getName()))
try
{
player.sendMessage(ChatColor.RED + "You are already in a guild.");
return true;
for (String guild : guildMembers.getKeys(false))
{
if (plugin.guilds.getString("guilds." + guild + ".members").contains(player.getName()))
{
player.sendMessage(ChatColor.RED + "You are already in a guild.");
return true;
}
if (guild.equals(args[0]))
{
player.sendMessage(ChatColor.RED + "A guild with that name already exists.");
return true;
}
}
}
} */
catch (Exception e)
{
e.printStackTrace();
}
}
GUtil.createGuild(sender, args[0]);
sender.sendMessage(ChatColor.GREEN + "Successfully created a guild named " + args[0]);