use of com.github.games647.changeskin.core.message.SkinUpdateMessage in project ChangeSkin by games647.
the class BungeeSkinAPI method applySkin.
@Override
public void applySkin(ProxiedPlayer player, SkinModel targetSkin) {
plugin.getLog().debug("Applying skin for {}", player.getName());
InitialHandler initialHandler = (InitialHandler) player.getPendingConnection();
LoginResult loginProfile = initialHandler.getLoginProfile();
// this is null in offline mode
if (loginProfile == null) {
String mojangUUID = UUIDTypeAdapter.toMojangId(player.getUniqueId());
if (profileSetter != null) {
try {
LoginResult loginResult = new LoginResult(mojangUUID, player.getName(), toProperties(targetSkin));
profileSetter.invokeExact(initialHandler, loginResult);
} catch (Error error) {
// rethrow errors we shouldn't silence them like OutOfMemoryError
throw error;
} catch (Throwable throwable) {
plugin.getLog().error("Error applying skin: {} for {}", targetSkin, player, throwable);
}
}
} else {
applyProperties(loginProfile, targetSkin);
}
// send plugin channel update request
plugin.sendPluginMessage(player.getServer(), new SkinUpdateMessage(player.getName()));
}
use of com.github.games647.changeskin.core.message.SkinUpdateMessage in project ChangeSkin by games647.
the class SharedBungeeListener method updateSkin.
private void updateSkin(ByteArrayDataInput dataInput) throws IllegalArgumentException {
SkinUpdateMessage message = new SkinUpdateMessage();
message.readFrom(dataInput);
String playerName = message.getPlayerName();
P receiver = getPlayerExact(playerName);
plugin.getLog().info("Instant update for {}", playerName);
runUpdater(receiver);
}
Aggregations