This commit is contained in:
speed 2020-07-14 21:35:02 -04:00 committed by GitHub
parent f4f28584b5
commit a62572111c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,8 +23,10 @@ public class InviteSubcommand extends Common implements CommandExecutor
sender.sendMessage(NO_PERMS);
return true;
}
if (args.length != 2)
return false;
Player player = (Player) sender;
Guild guild = Guild.getGuild(player);
Player invitee = Bukkit.getPlayer(args[1]);
@ -33,30 +35,37 @@ public class InviteSubcommand extends Common implements CommandExecutor
sender.sendMessage(PNF);
return true;
}
if (Guild.getGuild(invitee) != null)
{
sender.sendMessage(ChatColor.RED + "This player is already in another guild!");
return true;
}
if (guild == null)
{
sender.sendMessage(ChatColor.RED + "You aren't in a guild!");
return true;
}
if (guild.getState() == GuildState.CLOSED)
{
sender.sendMessage(ChatColor.RED + "The guild is currently closed!");
return true;
}
if (guild.getState() == GuildState.OPEN)
{
sender.sendMessage(ChatColor.RED + "The guild is open! Tell your friend to join using \"/g join\"!");
return true;
}
if (INVITES.containsKey(invitee))
{
sender.sendMessage(ChatColor.RED + "They have already been invited to your guild!");
return true;
}
INVITES.put(invitee, guild);
invitee.sendMessage(tl("%p%You have been invited to join %s%" + GUtil.colorize(guild.getName())) + "%p% through %s%" + player.getName() + "%p%'s invite!");
invitee.sendMessage(tl("%p%Do %s%/g join " + ChatColor.stripColor(GUtil.colorize(guild.getName())) + "%p% to join!"));
@ -75,4 +84,4 @@ public class InviteSubcommand extends Common implements CommandExecutor
}.runTaskLater(plugin, 20 * 90);
return true;
}
}
}