63 lines
2.0 KiB
Java
63 lines
2.0 KiB
Java
package eu.univento.core.commands;
|
|
|
|
import eu.univento.core.Core;
|
|
import eu.univento.core.api.AutoCommand;
|
|
import eu.univento.core.api.languages.Messages;
|
|
import eu.univento.core.api.player.CustomPlayer;
|
|
import eu.univento.core.api.youtube.YTAPI;
|
|
import eu.univento.core.api.youtube.YoutubeChannel;
|
|
import org.bukkit.command.CommandSender;
|
|
import org.bukkit.entity.Player;
|
|
|
|
import java.util.List;
|
|
|
|
/**
|
|
* sets player to youtube rank
|
|
* @author joethei
|
|
* @version 1.0
|
|
*/
|
|
public class Youtuber extends AutoCommand<Core>{
|
|
|
|
/**
|
|
* @param plugin main class
|
|
* @param command command to execute
|
|
* @param description describes the command
|
|
* @param aliases aliases of command
|
|
*/
|
|
public Youtuber(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());
|
|
Messages msgs = new Messages(p);
|
|
if(args.length == 1) {
|
|
YoutubeChannel yt = YTAPI.getYTChannelFromName(args[0]);
|
|
if(yt != null) {
|
|
p.sendMessage("§aBenutzername: " + yt.getUsername());
|
|
p.sendMessage("§aGooglePlus ID: " + yt.getGoogleplusid());
|
|
p.sendMessage("§aZuletzt online: " + yt.getLastwebaccess());
|
|
p.sendMessage("§aVon: " + yt.getLocation());
|
|
p.sendMessage("§aAbos: " + yt.getSubscribers());
|
|
p.sendMessage("§aVideo Watch Count: " + yt.getVideoWatchCount());
|
|
p.sendMessage("§aViewcount: " + yt.getViewcount());
|
|
}else {
|
|
p.sendMessage(msgs.PREFIX() + "§cDer Youtube Kanal exsistiert nicht");
|
|
}
|
|
}else {
|
|
p.sendMessage(msgs.PREFIX() + "§cBenutze doch /youtuber <Channel Name>");
|
|
}
|
|
}else {
|
|
sender.sendMessage(Messages.Console.NOT_A_PLAYER);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public List<String> tabComplete(CommandSender sender, String label, String[] args) {
|
|
return null;
|
|
}
|
|
|
|
} |