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