Search in sources :

Example 6 with SkinModel

use of com.github.games647.changeskin.core.model.skin.SkinModel in project ChangeSkin by games647.

the class SharedInvalidator method run.

@Override
public void run() {
    UserPreference preferences = core.getStorage().getPreferences(receiverUUID);
    Optional<SkinModel> ownedSkin = preferences.getTargetSkin();
    if (ownedSkin.isPresent()) {
        sendMessageInvoker("invalidate-request");
        core.getSkinApi().downloadSkin(ownedSkin.get().getProfileId()).ifPresent(this::scheduleApplyTask);
    } else {
        sendMessageInvoker("dont-have-skin");
    }
}
Also used : UserPreference(com.github.games647.changeskin.core.model.UserPreference) SkinModel(com.github.games647.changeskin.core.model.skin.SkinModel)

Example 7 with SkinModel

use of com.github.games647.changeskin.core.model.skin.SkinModel in project ChangeSkin by games647.

the class SharedSkinSelect method run.

@Override
public void run() {
    SkinModel targetSkin = core.getStorage().getSkin(targetId);
    if (targetSkin == null) {
        sendMessageInvoker("skin-not-found");
        return;
    }
    scheduleApplyTask(targetSkin);
}
Also used : SkinModel(com.github.games647.changeskin.core.model.skin.SkinModel)

Example 8 with SkinModel

use of com.github.games647.changeskin.core.model.skin.SkinModel in project ChangeSkin by games647.

the class SharedBungeeListener method checkPermissions.

private void checkPermissions(P player, ByteArrayDataInput dataInput) {
    CheckPermMessage message = new CheckPermMessage();
    message.readFrom(dataInput);
    UUID receiverUUID = message.getReceiverUUD();
    boolean op = message.isOp();
    SkinModel targetSkin = message.getTargetSkin();
    UUID skinProfile = targetSkin.getProfileId();
    boolean success = op || checkBungeePerms(player, receiverUUID, message.isSkinPerm(), skinProfile);
    sendMessage(player, new PermResultMessage(success, targetSkin, receiverUUID));
}
Also used : CheckPermMessage(com.github.games647.changeskin.core.message.CheckPermMessage) PermResultMessage(com.github.games647.changeskin.core.message.PermResultMessage) UUID(java.util.UUID) SkinModel(com.github.games647.changeskin.core.model.skin.SkinModel)

Example 9 with SkinModel

use of com.github.games647.changeskin.core.model.skin.SkinModel in project ChangeSkin by games647.

the class SharedDownloader method run.

@Override
public void run() {
    SkinModel storedSkin = core.getStorage().getSkin(targetUUID);
    if (storedSkin == null) {
        storedSkin = core.getSkinApi().downloadSkin(targetUUID).orElse(null);
    } else {
        storedSkin = core.checkAutoUpdate(storedSkin);
    }
    if (targetUUID.equals(receiverUUID)) {
        sendMessageInvoker("reset");
    }
    scheduleApplyTask(storedSkin);
}
Also used : SkinModel(com.github.games647.changeskin.core.model.skin.SkinModel)

Example 10 with SkinModel

use of com.github.games647.changeskin.core.model.skin.SkinModel in project ChangeSkin by games647.

the class InfoCommand method sendSkinDetails.

private void sendSkinDetails(UUID uuid, UserPreference preference) {
    Player player = Bukkit.getPlayer(uuid);
    if (player != null) {
        Optional<SkinModel> optSkin = preference.getTargetSkin();
        if (optSkin.isPresent()) {
            String template = plugin.getCore().getMessage("skin-info");
            player.sendMessage(formatter.apply(template, optSkin.get()));
        } else {
            plugin.sendMessage(player, "skin-not-found");
        }
    }
}
Also used : Player(org.bukkit.entity.Player) SkinModel(com.github.games647.changeskin.core.model.skin.SkinModel)

Aggregations

SkinModel (com.github.games647.changeskin.core.model.skin.SkinModel)21 UUID (java.util.UUID)9 UserPreference (com.github.games647.changeskin.core.model.UserPreference)8 Connection (java.sql.Connection)3 PreparedStatement (java.sql.PreparedStatement)3 ResultSet (java.sql.ResultSet)3 SQLException (java.sql.SQLException)3 ProxiedPlayer (net.md_5.bungee.api.connection.ProxiedPlayer)3 SkinProperty (com.github.games647.changeskin.core.model.skin.SkinProperty)2 TextureModel (com.github.games647.changeskin.core.model.skin.TextureModel)2 TextureType (com.github.games647.changeskin.core.model.skin.TextureType)2 ChangeSkinBungee (com.github.games647.changeskin.bungee.ChangeSkinBungee)1 ChangeSkinCore (com.github.games647.changeskin.core.ChangeSkinCore)1 NotPremiumException (com.github.games647.changeskin.core.NotPremiumException)1 RateLimitException (com.github.games647.changeskin.core.RateLimitException)1 SkinStorage (com.github.games647.changeskin.core.SkinStorage)1 CheckPermMessage (com.github.games647.changeskin.core.message.CheckPermMessage)1 PermResultMessage (com.github.games647.changeskin.core.message.PermResultMessage)1 SkinUpdateMessage (com.github.games647.changeskin.core.message.SkinUpdateMessage)1 GameProfile (com.github.games647.changeskin.core.model.GameProfile)1