get other guilds

This commit is contained in:
speedxx 2020-06-22 17:48:42 -04:00
parent cce9d0879d
commit 87e591abc1
2 changed files with 57 additions and 3 deletions

View file

@ -16,11 +16,37 @@ public class GuildInfoCommand extends GBase implements CommandExecutor
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{
Player player = (Player) sender;
String guild = GUtil.getGuild(player);
if (args.length == 0)
{
String guild = GUtil.getGuild(player);
if (guild == null)
{
sender.sendMessage(ChatColor.RED + "You aren't in a guild!");
return true;
}
String owner = GUtil.getOwner(guild);
String tag = GUtil.getTag(guild);
String creation = GUtil.getTimeCreated(guild);
List<String> members = GUtil.getMember(guild);
player.sendMessage(GUtil.color("&2-=-=-=- &aGuild Information &2-=-=-=-"));
player.sendMessage(GUtil.color("&2Guild Name: &a" + guild));
player.sendMessage(GUtil.color("&2Guild Owner: &a" + owner));
player.sendMessage(GUtil.color("&2Guild Tag: &a" + tag));
player.sendMessage(GUtil.color("&2Guild Creation Date: &a" + creation));
player.sendMessage(GUtil.color("&2Member Count: &a" + members.size()));
player.sendMessage(GUtil.color("&2Members: &a" + members));
player.sendMessage(GUtil.color("&2-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"));
return true;
}
String guild = GUtil.getGuild(args[0]);
if (guild == null)
{
sender.sendMessage(ChatColor.RED + "You aren't in a guild!");
sender.sendMessage(ChatColor.RED + "Guild not found.");
return true;
}
@ -36,7 +62,7 @@ public class GuildInfoCommand extends GBase implements CommandExecutor
player.sendMessage(GUtil.color("&2Guild Creation Date: &a" + creation));
player.sendMessage(GUtil.color("&2Member Count: &a" + members.size()));
player.sendMessage(GUtil.color("&2Members: &a" + members));
player.sendMessage(GUtil.color("&2-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="));
player.sendMessage(GUtil.color("&2-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"));
return true;
}
}

View file

@ -119,6 +119,34 @@ public class GUtil
return g;
}
public static String getGuild(String arg)
{
String g = "";
boolean a = false;
ConfigurationSection guildMembers = plugin.guilds.getConfigurationSection("guilds");
if (guildMembers != null)
{
try
{
for (String guild : guildMembers.getKeys(false))
{
if (guild.equals(arg))
{
a = true;
g = guild;
}
}
}
catch (Exception e)
{
e.fillInStackTrace();
}
}
if (!a)
return null;
return g;
}
public static String getOwner(String guildName)
{
return plugin.guilds.getString("guilds." + guildName + ".owner");