start duo
This commit is contained in:
parent
b7e97212ac
commit
b57e9ff410
9 changed files with 258 additions and 65 deletions
|
|
@ -3,9 +3,14 @@ package de.lunarakai.minecleaner.commands;
|
|||
import de.iani.cubesideutils.bukkit.commands.SubCommand;
|
||||
import de.iani.cubesideutils.bukkit.commands.exceptions.*;
|
||||
import de.iani.cubesideutils.commands.ArgsParser;
|
||||
import de.lunarakai.minecleaner.MinecleanerGroup;
|
||||
import de.lunarakai.minecleaner.MinecleanerPlugin;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class InviteCommand extends SubCommand {
|
||||
/*
|
||||
|
|
@ -15,6 +20,12 @@ public class InviteCommand extends SubCommand {
|
|||
- use settings of player that invited the other player
|
||||
*/
|
||||
|
||||
private final MinecleanerPlugin plugin;
|
||||
|
||||
public InviteCommand(MinecleanerPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsage() {
|
||||
return "<Player>";
|
||||
|
|
@ -31,7 +42,21 @@ public class InviteCommand extends SubCommand {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender commandSender, Command command, String s, String s1, ArgsParser argsParser) throws DisallowsCommandBlockException, RequiresPlayerException, NoPermissionException, IllegalSyntaxException, InternalCommandException {
|
||||
public boolean onCommand(CommandSender sender, Command command, String s, String commandString, ArgsParser args) throws DisallowsCommandBlockException, RequiresPlayerException, NoPermissionException, IllegalSyntaxException, InternalCommandException {
|
||||
Player player = (Player) sender;
|
||||
if(args.remaining() < 1 || args.remaining() >= 2) {
|
||||
sender.sendMessage(ChatColor.DARK_RED + commandString + getUsage());
|
||||
return true;
|
||||
}
|
||||
String playerName = args.getNext().trim();
|
||||
Player invitedPlayer = plugin.getServer().getPlayer(playerName);
|
||||
|
||||
MinecleanerGroup group = new MinecleanerGroup();
|
||||
group.createGroup(player);
|
||||
UUID groupUUID = group.getGroupUUID(player);
|
||||
|
||||
group.invitePlayerToGroup(groupUUID, invitedPlayer);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue