Example #1
0
 /**
  * Gets mythic material name.
  *
  * @param matData the mat data
  * @return the mythic material name
  */
 public String getMythicMaterialName(MaterialData matData) {
   String comb =
       String.format(
           "%s;%s", String.valueOf(matData.getItemTypeId()), String.valueOf(matData.getData()));
   String comb2;
   if (matData.getData() == (byte) 0) {
     comb2 = String.valueOf(matData.getItemTypeId());
   } else {
     comb2 = comb;
   }
   String mythicMatName =
       getPlugin()
           .getConfigurationManager()
           .getConfiguration(MythicConfigurationFile.LANGUAGE)
           .getString(comb.toLowerCase());
   if (mythicMatName == null) {
     mythicMatName =
         getPlugin()
             .getConfigurationManager()
             .getConfiguration(MythicConfigurationFile.LANGUAGE)
             .getString(comb2.toLowerCase());
     if (mythicMatName == null) {
       mythicMatName = getMinecraftMaterialName(matData.getItemType());
     }
   }
   return StringUtils.getInitCappedString(mythicMatName.split(" "));
 }
Example #2
0
 /**
  * Gets item type name.
  *
  * @param matData the mat data
  * @return the item type name
  */
 public String getItemTypeName(MaterialData matData) {
   String itemType = getPlugin().getItemManager().itemTypeFromMatData(matData);
   if (itemType == null) {
     return null;
   }
   String mythicMatName =
       getPlugin()
           .getConfigurationManager()
           .getConfiguration(MythicConfigurationFile.LANGUAGE)
           .getString(itemType.toLowerCase());
   if (mythicMatName == null) {
     mythicMatName = itemType;
   }
   return StringUtils.getInitCappedString(mythicMatName.split(" "));
 }
Example #3
0
 /**
  * Gets Minecraft material name.
  *
  * @param material the material
  * @return the minecraft material name
  */
 public String getMinecraftMaterialName(Material material) {
   String prettyMaterialName = "";
   String matName = material.name();
   String[] split = matName.split("_");
   for (String s : split) {
     if (s.equals(split[split.length - 1])) {
       prettyMaterialName =
           String.format(
               "%s%s%s",
               prettyMaterialName,
               s.substring(0, 1).toUpperCase(),
               s.substring(1, s.length()).toLowerCase());
     } else {
       prettyMaterialName =
           prettyMaterialName
               + (String.format(
                   "%s%s",
                   s.substring(0, 1).toUpperCase(), s.substring(1, s.length()).toLowerCase()))
               + " ";
     }
   }
   return StringUtils.getInitCappedString(prettyMaterialName.split(" "));
 }