Core/src/eu/univento/core/commands/TS.java

57 lines
1.6 KiB
Java

package eu.univento.core.commands;
import java.util.List;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import eu.univento.core.Core;
import eu.univento.core.api.AutoCommand;
import eu.univento.core.api.Messages;
import eu.univento.core.api.player.CustomPlayer;
import eu.univento.core.api.player.TeamSpeak;
/**
* sets ts groups according to player rank
* @author joethei
* @version 1.0
*/
public class TS extends AutoCommand<Core>{
/**
* @param plugin main class
* @param command command to execute
* @param description describes the command
* @param aliases aliases of command
*/
public TS(Core plugin, String command, String description, String[] aliases) {
super(plugin, command, description, aliases);
}
@Override
public boolean execute(CommandSender sender, String label, String[] args) {
if(sender instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
if(p.getTSClientInfo() != null) {
for(int i = 0; i >= p.getTSClientInfo().getServerGroups().length; i++) {
int[] groups = p.getTSClientInfo().getServerGroups();
if(groups[i] == TeamSpeak.getVerifiedId()) {
p.sendMessage(Messages.PREFIX + "§cDu hast schon einen verknüpften TS Account !");
}else {
p.verifyTs();
p.sendMessage(Messages.PREFIX + "§aDu bist nun verifiziert");
}
}
}
}else {
sender.sendMessage(Messages.NOT_A_PLAYER);
}
return true;
}
@Override
public List<String> tabComplete(CommandSender sender, String label, String[] args) {
return null;
}
}