Search in sources :

Example 1 with SkinSelector

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();
}
Also used : Player(org.spongepowered.api.entity.living.player.Player) SkinSelector(com.github.games647.changeskin.sponge.task.SkinSelector)

Aggregations

SkinSelector (com.github.games647.changeskin.sponge.task.SkinSelector)1 Player (org.spongepowered.api.entity.living.player.Player)1