Added some more party commands

This commit is contained in:
Trixkz 2021-11-21 16:51:23 -05:00
parent bafe517ad4
commit 9a442cbb9d
4 changed files with 45 additions and 3 deletions

View File

@ -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());
}

View File

@ -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

View File

@ -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 <player> &7- &eJoin a party"));
// player.sendMessage(CC.translate("&7⚫ &9/party join <player> &7- &eJoin a party"));
player.sendMessage(CC.translate("&7⚫ &9/party accept <player> &7- &eAccept a party invitation"));
player.sendMessage(CC.translate("&7⚫ &9/party invite <player> &7- &eInvite a player to a party"));
player.sendMessage(CC.translate("&7⚫ &9/party remove <player> &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);

View File

@ -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<String> getTabCompletions(CommandSender sender, Command cmd, String label, String[] args) {
List<String> tabCompletions = new ArrayList<String>();
return tabCompletions;
}
}