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");
}
}
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);
}
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));
}
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);
}
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");
}
}
}
Aggregations