@Override public String toString() { return Material.getMaterial(getItemTypeId()).toString() + (isStem() ? "{STEM}" : getPaintedFaces()); }
sender.sendMessage("The player isn't holding an item"); } else { String itemName = item.getType().toString().replaceAll("_", " "); itemName = WordUtils.capitalizeFully(itemName);
public static boolean hasGravity(Material material) { switch (material.toString()) { case "DRAGON_EGG": case "SAND": case "GRAVEL": case "ANVIL": case "CONCRETE_POWDER": return true; default: return false; } }
@Override public String serialize(Material material) { return material.toString(); }
@Override public String toString() { return this.x + ", " + this.y + ", " + this.z + ", " + this.type.toString(); } }
/** * Attempts to get the SCHEMATIC with the given seed Material. * * @param mat Name of the SCHEMATIC to get * @return SCHEMATIC if found, or null */ public static SCHEMATIC SCHEMATICFor(Material mat) { return BY_MATERIALS.get(mat.toString()); }
@Override public List<String> getWallFloorBlocks() { List<String> blocks = new ArrayList<>(); TARDISWalls.BLOCKS.forEach((m) -> blocks.add(m.toString())); return blocks; }
private static String getFormattedPrice(double amount, Material currency) { if (isItemCurrency(currency)) { return amount + " " + currency.toString(); } else { return ""; } }
@Override public String toString() { StringBuilder builder = new StringBuilder(); for (Material material : getMaterials()) { if (builder.length() > 0) { builder.append(';'); } builder.append(material.toString().toLowerCase(Locale.ENGLISH)); } return builder.toString(); } }
/** * Returns the name of an item reward, in a readable format. * * @param item the item reward * @return the item name */ public String getItemName(ItemStack item) { return WordUtils.capitalizeFully(item.getType().toString().replace('_', ' ')); }
public static String getMaterialName(Material material) { PluginConfig config = Settings.getConfig(); if (config.translatedMaterialsEnable && config.translatedMaterials.containsKey(material)) { return ChatUtils.colored(Settings.getConfig().translatedMaterials.get(material)); } else { return StringUtils.replace(material.toString().toLowerCase(), "_", " "); } }
/** * Returns the material string if its a vanilla block, the id if not * * @param typeId * @return */ public static String getMaterialString(int typeId) { if (Material.getMaterial(typeId) == null) { return typeId + ""; } return Material.getMaterial(typeId).toString(); }
/** * @return the block type name */ public String getType() { return Material.getMaterial(this.getTypeId()).toString(); }
public String highestBetName(){ String highest = "iron ingot"; int largest = 0; for(ItemStack item : bet.values()){ if(betValue(item.getType()) > largest){ largest = betValue(item.getType()); highest = item.getType().toString().toLowerCase().replace("_", " "); } } return highest; }
private void convertToMaterial(String sectionPath) { ConfigurationSection section = configuration.getConfigurationSection(sectionPath); if (section != null) { for (String typeId : section.getKeys(false)) { Material material = Material.matchMaterial(typeId); if (material != null) { configuration.set(sectionPath + "." + material.toString().toLowerCase(), configuration.get(sectionPath + "." + typeId)); configuration.set(sectionPath + "." + typeId, null); } } } }
public static String saveLineToString(CraftHologramLine line) { if (line instanceof CraftTextLine) { return StringConverter.toSaveableFormat(((CraftTextLine) line).getText()); } else if (line instanceof CraftItemLine) { CraftItemLine itemLine = (CraftItemLine) line; return "ICON: " + itemLine.getItemStack().getType().toString().replace("_", " ").toLowerCase() + (itemLine.getItemStack().getDurability() != 0 ? ":" + itemLine.getItemStack().getDurability() : ""); } else { return "Unknown"; } }
public void perform() { if (!me.getItemInHand().getType().toString().contains("BANNER")) { fme.msg(TL.COMMAND_SETBANNER_NOTBANNER); return; } fme.getFaction().setBannerPattern(me.getItemInHand()); fme.msg(TL.COMMAND_SETBANNER_SUCCESS); }
@SuppressWarnings("deprecation") public static Material getMaterial(String name, CommandSender sender) { Material m = Material.matchMaterial(name, false); if (m == null) { m = Material.matchMaterial(name, true); if (m != null) { m = Bukkit.getUnsafe().fromLegacy(m); sender.sendMessage(I18n.format("message.error.legacy_name", name, m.toString())); } } return m; }
@Override public void giveReward(MinigamePlayer player) { if(player.isInMinigame()) player.addRewardItem(item); else player.getPlayer().getInventory().addItem(item); player.sendMessage(MinigameUtils.formStr("reward.item", item.getAmount(), MinigameUtils.capitalize(item.getType().toString())), null); }