use of com.github.games647.changeskin.bungee.task.SkinDownloader in project ChangeSkin by games647.
the class SetCommand method execute.
@Override
public CommandResult execute(CommandSource src, CommandContext args) {
if (!(src instanceof Player)) {
plugin.sendMessage(src, "no-console");
return CommandResult.empty();
}
UUID uniqueId = ((Player) src).getUniqueId();
if (core.getCooldownService().isTracked(uniqueId)) {
plugin.sendMessage(src, "cooldown");
return CommandResult.empty();
}
Player receiver = (Player) src;
String targetSkin = args.<String>getOne("skin").get();
boolean keepSkin = args.hasAny("keep");
if ("reset".equals(targetSkin)) {
targetSkin = receiver.getUniqueId().toString();
}
if (targetSkin.length() > 16) {
UUID targetUUID = UUID.fromString(targetSkin);
if (core.getConfig().getBoolean("skinPermission") && !plugin.hasSkinPermission(src, targetUUID, true)) {
return CommandResult.empty();
}
plugin.sendMessage(src, "skin-change-queue");
Runnable skinDownloader = new SkinDownloader(plugin, src, receiver, targetUUID, keepSkin);
Task.builder().async().execute(skinDownloader).submit(plugin);
return CommandResult.success();
}
Runnable nameResolver = new NameResolver(plugin, src, targetSkin, receiver, keepSkin);
Task.builder().async().execute(nameResolver).submit(plugin);
return CommandResult.success();
}
use of com.github.games647.changeskin.bungee.task.SkinDownloader in project ChangeSkin by games647.
the class SetCommand method setSkinUUID.
private void setSkinUUID(CommandSender sender, Player receiverPayer, String targetUUID, boolean keepSkin) {
try {
UUID uuid = UUID.fromString(targetUUID);
if (plugin.getConfig().getBoolean("skinPermission") && !plugin.hasSkinPermission(sender, uuid, true)) {
return;
}
plugin.sendMessage(sender, "skin-change-queue");
Runnable skinDownloader = new SkinDownloader(plugin, sender, receiverPayer, uuid, keepSkin);
Bukkit.getScheduler().runTaskAsynchronously(plugin, skinDownloader);
} catch (IllegalArgumentException illegalArgumentException) {
plugin.sendMessage(sender, "invalid-uuid");
}
}
use of com.github.games647.changeskin.bungee.task.SkinDownloader in project ChangeSkin by games647.
the class SetCommand method setSkinUUID.
private void setSkinUUID(CommandSender sender, ProxiedPlayer receiverPayer, String targetUUID, boolean bukkitOp, boolean keepSkin) {
try {
UUID uuid = UUID.fromString(targetUUID);
if (plugin.getCore().getConfig().getBoolean("skinPermission") && !plugin.hasSkinPermission(sender, uuid, true)) {
return;
}
plugin.sendMessage(sender, "skin-change-queue");
Runnable skinDownloader = new SkinDownloader(plugin, sender, receiverPayer, uuid, bukkitOp, keepSkin);
ProxyServer.getInstance().getScheduler().runAsync(plugin, skinDownloader);
} catch (IllegalArgumentException illegalArgumentException) {
plugin.sendMessage(sender, "invalid-uuid");
}
}
Aggregations