mirror of
https://github.com/TotalFreedomMC/TFGuilds.git
synced 2024-12-22 16:05:00 +00:00
ADD CHECKS
This commit is contained in:
parent
8d19feae46
commit
00c0bd26ae
1 changed files with 23 additions and 7 deletions
|
@ -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]);
|
||||
|
|
Loading…
Reference in a new issue