use of com.github.games647.changeskin.sponge.task.SkinSelector in project ChangeSkin by games647.
the class SelectCommand method execute.
@Override
public CommandResult execute(CommandSource src, CommandContext args) {
if (!(src instanceof Player)) {
plugin.sendMessage(src, "no-console");
return CommandResult.empty();
}
String skinName = args.<String>getOne("skinName").get().toLowerCase().replace("skin-", "");
try {
int targetId = Integer.parseInt(skinName);
Player receiver = (Player) src;
Task.builder().async().execute(new SkinSelector(plugin, receiver, targetId)).submit(plugin);
} catch (NumberFormatException numberFormatException) {
plugin.sendMessage(src, "invalid-skin-name");
}
return CommandResult.success();
}
Aggregations