diff --git a/src/main/java/rip/tilly/bedwars/commands/party/InviteCommand.java b/src/main/java/rip/tilly/bedwars/commands/party/InviteCommand.java index 8feecb9..9d8bd61 100644 --- a/src/main/java/rip/tilly/bedwars/commands/party/InviteCommand.java +++ b/src/main/java/rip/tilly/bedwars/commands/party/InviteCommand.java @@ -6,6 +6,7 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import rip.tilly.bedwars.BedWars; import rip.tilly.bedwars.commands.BaseCommand; +import rip.tilly.bedwars.utils.CC; import java.util.ArrayList; import java.util.List; @@ -24,6 +25,12 @@ public class InviteCommand extends BaseCommand { return; } + if (this.main.getPartyManager().getParty(target.getUniqueId()) != null) { + player.sendMessage(CC.translate("&cError: This player is currently already in a party")); + + return; + } + this.main.getPartyManager().createPartyInvite(player.getUniqueId(), target.getUniqueId()); } diff --git a/src/main/java/rip/tilly/bedwars/commands/party/JoinCommand.java b/src/main/java/rip/tilly/bedwars/commands/party/JoinCommand.java index 0222f21..420bed4 100644 --- a/src/main/java/rip/tilly/bedwars/commands/party/JoinCommand.java +++ b/src/main/java/rip/tilly/bedwars/commands/party/JoinCommand.java @@ -24,7 +24,7 @@ public class JoinCommand extends BaseCommand { return; } - this.main.getPartyManager().joinParty(player.getUniqueId(), target); + this.main.getPartyManager().joinParty(target.getUniqueId(), player); } @Override diff --git a/src/main/java/rip/tilly/bedwars/commands/party/PartyCommand.java b/src/main/java/rip/tilly/bedwars/commands/party/PartyCommand.java index a7d8980..6606343 100644 --- a/src/main/java/rip/tilly/bedwars/commands/party/PartyCommand.java +++ b/src/main/java/rip/tilly/bedwars/commands/party/PartyCommand.java @@ -21,9 +21,10 @@ public class PartyCommand implements CommandExecutor { player.sendMessage(CC.translate("&7⚫ &9/party &7- &eParty help information")); player.sendMessage(CC.translate("&7⚫ &9/party create &7- &eCreate a party")); player.sendMessage(CC.translate("&7⚫ &9/party leave &7- &eLeave a party")); - player.sendMessage(CC.translate("&7⚫ &9/party join &7- &eJoin a party")); + // player.sendMessage(CC.translate("&7⚫ &9/party join &7- &eJoin a party")); player.sendMessage(CC.translate("&7⚫ &9/party accept &7- &eAccept a party invitation")); player.sendMessage(CC.translate("&7⚫ &9/party invite &7- &eInvite a player to a party")); + player.sendMessage(CC.translate("&7⚫ &9/party remove &7- &eRemove a player from a party")); player.sendMessage(CC.translate("&7⚫ &9/party info &7- &eCheck a party's information")); player.sendMessage(CC.translate(CC.chatBar)); } else { @@ -47,6 +48,10 @@ public class PartyCommand implements CommandExecutor { case "invite": new InviteCommand().executeAs(sender, cmd, label, args); + break; + case "remove": + new RemoveCommand().executeAs(sender, cmd, label, args); + break; case "info": new InfoCommand().executeAs(sender, cmd, label, args); diff --git a/src/main/java/rip/tilly/bedwars/commands/party/RemoveCommand.java b/src/main/java/rip/tilly/bedwars/commands/party/RemoveCommand.java index a508a86..96df993 100644 --- a/src/main/java/rip/tilly/bedwars/commands/party/RemoveCommand.java +++ b/src/main/java/rip/tilly/bedwars/commands/party/RemoveCommand.java @@ -1,4 +1,34 @@ package rip.tilly.bedwars.commands.party; -public class RemoveCommand { +import org.bukkit.Bukkit; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import rip.tilly.bedwars.BedWars; +import rip.tilly.bedwars.commands.BaseCommand; + +import java.util.ArrayList; +import java.util.List; + +public class RemoveCommand extends BaseCommand { + + private BedWars main = BedWars.getInstance(); + + @Override + public void executeAs(CommandSender sender, Command cmd, String label, String[] args) { + Player target = Bukkit.getPlayer(args[1]); + + if (target == null) { + return; + } + + this.main.getPartyManager().leaveParty(target); + } + + @Override + public List getTabCompletions(CommandSender sender, Command cmd, String label, String[] args) { + List tabCompletions = new ArrayList(); + + return tabCompletions; + } }