public static void setOwner(final Skull skull, String ownerName) { SkinUtils.fetchProfile(ownerName, new SkinUtils.ProfileCallback() { @Override public void result(SkinUtils.ProfileResponse response) { if (response != null) { Object gameProfile = response.getGameProfile(); InventoryUtils.setSkullProfile(skull, gameProfile); } skull.update(true, false); } }); }
@Deprecated public static String getPlayerSkullURL(String playerName) { return SkinUtils.getOnlineSkinURL(playerName); }
public static String getOnlineSkinURL(Player player) { Object profile = getProfile(player); return profile == null ? null : getProfileURL(profile); }
plugin.getLogger().info(getProfileURL(gameProfile));
public static String getProfileURL(Object profile) { String url = null; if (profile == null) { return null; } try { @SuppressWarnings("unchecked") Multimap<String, Object> properties = (Multimap<String, Object>)class_GameProfile_properties.get(profile); Collection<Object> textures = properties.get("textures"); if (textures != null && textures.size() > 0) { Object textureProperty = textures.iterator().next(); String texture = (String)class_GameProfileProperty_value.get(textureProperty); String decoded = Base64Coder.decodeString(texture); url = getTextureURL(decoded); } } catch (Exception ex) { ex.printStackTrace(); } return url; }
public static void fetchProfile(final String playerName, final ProfileCallback callback) { fetchUUID(playerName, new UUIDCallback() { @Override public void result(UUID uuid) { if (uuid != null) { fetchProfile(uuid, callback); } else { callback.result(null); } } }); }
public MagicController(final MagicPlugin plugin) { this.plugin = plugin; this.logger = new ColoredLogger(plugin.getLogger()); SkinUtils.initialize(plugin); configFolder = plugin.getDataFolder(); configFolder.mkdirs(); dataFolder = new File(configFolder, "data"); dataFolder.mkdirs(); defaultsFolder = new File(configFolder, "defaults"); defaultsFolder.mkdirs(); }
public static String getSkullURL(ItemStack skull) { return SkinUtils.getProfileURL(getSkullProfile(skull.getItemMeta())); }
String skinURL = getTextureURL(decodedTextures);
public static void setOwner(final Skull skull, UUID uuid) { SkinUtils.fetchProfile(uuid, new SkinUtils.ProfileCallback() { @Override public void result(SkinUtils.ProfileResponse response) { if (response != null) { Object gameProfile = response.getGameProfile(); InventoryUtils.setSkullProfile(skull, gameProfile); } skull.update(true, false); } }); }
public static String getOnlineSkinURL(String playerName) { Player player = DeprecatedUtils.getPlayerExact(playerName); String url = null; if (player != null) { url = getOnlineSkinURL(player); } return url; }
private ProfileResponse(Player onlinePlayer) { this.uuid = onlinePlayer.getUniqueId(); Object gameProfile = getProfile(onlinePlayer); JsonElement profileJson = getGson().toJsonTree(gameProfile); if (profileJson.isJsonObject()) { JsonObject profileObject = (JsonObject)profileJson; try { @SuppressWarnings("unchecked") Multimap<String, Object> properties = (Multimap<String, Object>)class_GameProfile_properties.get(gameProfile); JsonArray propertiesArray = new JsonArray(); for (Map.Entry<String, Object> entry : properties.entries()) { JsonObject newObject = new JsonObject(); newObject.addProperty("name", entry.getKey()); String value = (String)class_GameProfileProperty_value.get(entry.getValue()); newObject.addProperty("value", value); String signature = (String)class_GameProfileProperty_signature.get(entry.getValue()); newObject.addProperty("signature", signature); propertiesArray.add(newObject); } profileObject.add("properties", propertiesArray); } catch (Exception ex) { plugin.getLogger().log(Level.WARNING, "Error serializing profile for " + onlinePlayer.getName(), ex); } } this.profileJSON = getGson().toJson(profileJson); this.skinURL = getProfileURL(gameProfile); this.playerName = onlinePlayer.getName(); }
public static void setSkullOwner(final ItemStack itemStack, UUID ownerUUID, final SkullLoadedCallback callback) { SkinUtils.fetchProfile(ownerUUID, new SkinUtils.ProfileCallback() { @Override public void result(SkinUtils.ProfileResponse response) { if (response != null) { Object gameProfile = response.getGameProfile(); ItemMeta meta = itemStack.getItemMeta(); if (meta instanceof SkullMeta) { InventoryUtils.setSkullProfile(meta, gameProfile); itemStack.setItemMeta(meta); } } if (callback != null) { callback.updated(itemStack); } } }); }
public RegisterTask(Plugin plugin, Player player, String code) { logger = plugin.getLogger(); File dataFolder = new File(plugin.getDataFolder(), "data"); registerFile = new File(dataFolder, "registered.yml"); playerId = player.getUniqueId().toString(); playerName = player.getName(); skinURL = SkinUtils.getOnlineSkinURL(playerName); this.code = code; }
materialKey += ":" + skullData.playerName; } else { String profileURL = SkinUtils.getProfileURL(skullData.profile); if (profileURL != null) { materialKey += ":" + profileURL;
public static void setSkullOwner(final ItemStack itemStack, String ownerName, final SkullLoadedCallback callback) { SkinUtils.fetchProfile(ownerName, new SkinUtils.ProfileCallback() { @Override public void result(SkinUtils.ProfileResponse response) { if (response != null) { Object gameProfile = response.getGameProfile(); ItemMeta meta = itemStack.getItemMeta(); if (meta instanceof SkullMeta) { InventoryUtils.setSkullProfile(meta, gameProfile); itemStack.setItemMeta(meta); } } if (callback != null) { callback.updated(itemStack); } } }); }
@Nullable protected Waypoint getFriend(String uuid) { Player onlinePlayer = Bukkit.getPlayer(UUID.fromString(uuid)); if (onlinePlayer == null) return null; String playerName = onlinePlayer.getDisplayName(); String castMessage = context.getMessage("cast_friend").replace("$name", playerName); String failMessage = context.getMessage("no_target_friend").replace("$name", playerName); String title = context.getMessage("title_friend", "$name").replace("$name", playerName); String iconURL = SkinUtils.getOnlineSkinURL(onlinePlayer); return new Waypoint(RecallType.WARP, onlinePlayer.getLocation(), title, castMessage, failMessage, "", null, iconURL); }
@Override public void result(UUID uuid) { if (uuid != null) { fetchProfile(uuid, callback); } else { callback.result(null); } } });
/** * Get an ItemStack that is a headshot of a player's skin. */ @Nullable @Override public ItemStack getPlayerPortrait(String worldName, String playerName, Integer priority, String photoLabel) { photoLabel = photoLabel == null ? playerName : photoLabel; String url = SkinUtils.getOnlineSkinURL(playerName); if (url != null) { MapView mapView = getURL(worldName, url, photoLabel, 8, 8, 40, 8, 8, 8, priority, playerName); return getMapItem(photoLabel, mapView); } MapView mapView = getURL(worldName, null, photoLabel, 8, 8, 40, 8, 8, 8, priority, playerName); return getMapItem(photoLabel, mapView); }
if (playerName != null) { loading = true; SkinUtils.fetchProfile(playerName, new SkinUtils.ProfileCallback() { @Override public void result(SkinUtils.ProfileResponse response) {