public static boolean loadAllTagsFromNBT(ConfigurationSection tags, ItemStack item) { if (item == null) { return false; } Object handle = NMSUtils.getHandle(item); if (handle == null) return false; Object tag = NMSUtils.getTag(handle); if (tag == null) return false; return loadAllTagsFromNBT(tags, tag); }
public static String getOnlineSkinURL(String playerName) { Player player = DeprecatedUtils.getPlayerExact(playerName); String url = null; if (player != null) { url = getOnlineSkinURL(player); } return url; }
@Override public void result(UUID uuid) { if (uuid != null) { fetchProfile(uuid, callback); } else { callback.result(null); } } });
public static boolean isQuickCastSkill(ItemStack item) { if (InventoryUtils.isEmpty(item)) return false; Object spellNode = InventoryUtils.getNode(item, "spell"); if (spellNode == null) return false; Boolean quickCast = InventoryUtils.containsNode(spellNode, "quick_cast") ? InventoryUtils.getMetaBoolean(spellNode, "quick_cast") : null; return quickCast == null ? true : quickCast; }
public static boolean saveTagsToItem(ConfigurationSection tags, ItemStack item) { Object handle = getHandle(item); if (handle == null) return false; Object tag = getTag(handle); if (tag == null) return false; return saveTagsToNBT(tags, tag, null); }
public static boolean isBound(ItemStack item) { Object wandSection = InventoryUtils.getNode(item, WAND_KEY); if (wandSection == null) return false; String boundValue = InventoryUtils.getMetaString(wandSection, "owner_id"); return boundValue != null; }
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); } }); }
@Override public String getPropertyString(String templateName, float amount, float max, String propertyTemplateName) { String templateString = get(templateName, ""); String propertyTemplateString = get(propertyTemplateName, ""); return formatPropertyString(templateString, amount, max, propertyTemplateString); }
public ColorHD mixColor(long r, long g, long b, double weight) { double totalWeight = weight + 1; double totalRed = (red + (r * weight)); double totalGreen = (green + (g * weight)); double totalBlue = (blue + (b * weight)); return new ColorHD( (long)(totalRed / totalWeight), (long)(totalGreen / totalWeight), (long)(totalBlue / totalWeight) ); }
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); } } }); }
@Override public void apply(Entity entity) { if (variant != null) { CompatibilityUtils.setParrotVariant(entity, variant); } }
protected void checkRunningTask() { if (runningTask != null && runningTask.isFinished()) { runningTask = null; } }
/** * Decodes a byte array from Base64 format. * No blanks or line breaks are allowed within the Base64 encoded input data. * @param in A character array containing the Base64 encoded data. * @return An array containing the decoded data bytes. * @throws IllegalArgumentException If the input is not valid Base64 encoded data. */ public static byte[] decode (char[] in) { return decode(in, 0, in.length); }
@Override public void run() { callback.result(response); } });
/** * Encodes a byte array into Base64 format. * No blanks or line breaks are inserted in the output. * @param in An array containing the data bytes to be encoded. * @param iLen Number of bytes to process in <code>in</code>. * @return A character array containing the Base64 encoded data. */ public static char[] encode (byte[] in, int iLen) { return encode(in, 0, iLen); }
protected void initializeTargeting() { targeting.reset(); reverseTargeting = false; targetLocation = null; targetLocation2 = null; }
@Override public void run() { CompatibilityUtils.setResourcePack(player, resourcePack, resourcePackHash); } }, resourcePackDelay * 20 / 1000);
@Override public void run() { callback.result(uuid); } });
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); } }); }