use of com.github.games647.changeskin.sponge.task.SkinUploader in project ChangeSkin by games647.
the class UploadCommand method onCommand.
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (args.length == 0) {
plugin.sendMessage(sender, "upload-noargs");
} else {
String url = args[0];
if (url.startsWith("http://") || url.startsWith("https://")) {
List<Account> accounts = plugin.getCore().getUploadAccounts();
if (accounts.isEmpty()) {
plugin.sendMessage(sender, "no-accounts");
} else {
Account uploadAccount = accounts.get(0);
Runnable skinUploader = new SkinUploader(plugin, sender, uploadAccount, url);
Bukkit.getScheduler().runTaskAsynchronously(plugin, skinUploader);
}
} else {
plugin.sendMessage(sender, "no-valid-url");
}
}
return true;
}
use of com.github.games647.changeskin.sponge.task.SkinUploader in project ChangeSkin by games647.
the class UploadCommand method execute.
@Override
public CommandResult execute(CommandSource src, CommandContext args) {
String url = args.<String>getOne("url").get();
if (url.startsWith("http://") || url.startsWith("https://")) {
List<Account> accounts = plugin.getCore().getUploadAccounts();
if (accounts.isEmpty()) {
plugin.sendMessage(src, "no-accounts");
} else {
Account uploadAccount = accounts.get(0);
Runnable skinUploader = new SkinUploader(plugin, src, uploadAccount, url);
Task.builder().async().execute(skinUploader).submit(plugin);
}
} else {
plugin.sendMessage(src, "no-valid-url");
}
return CommandResult.success();
}
use of com.github.games647.changeskin.sponge.task.SkinUploader in project ChangeSkin by games647.
the class UploadCommand method execute.
@Override
public void execute(CommandSender sender, String[] args) {
if (args.length == 0) {
plugin.sendMessage(sender, "upload-noargs");
} else {
String url = args[0];
if (url.startsWith("http://") || url.startsWith("https://")) {
List<Account> accounts = plugin.getCore().getUploadAccounts();
if (accounts.isEmpty()) {
plugin.sendMessage(sender, "no-accounts");
} else {
Account uploadAccount = accounts.get(0);
Runnable skinUploader = new SkinUploader(plugin, sender, uploadAccount, url);
ProxyServer.getInstance().getScheduler().runAsync(plugin, skinUploader);
}
} else {
plugin.sendMessage(sender, "no-valid-url");
}
}
}
Aggregations