Пример #1
0
 @Override
 public ItemStack getItemStack(final String path) {
   final ItemStack stack =
       new ItemStack(
           Material.valueOf(getString(path + ".type", "AIR")),
           getInt(path + ".amount", 1),
           (short) getInt(path + ".damage", 0));
   final ConfigurationSection enchants = getConfigurationSection(path + ".enchant");
   if (enchants != null) {
     for (String enchant : enchants.getKeys(false)) {
       final Enchantment enchantment = Enchantment.getByName(enchant.toUpperCase(Locale.ENGLISH));
       if (enchantment == null) {
         continue;
       }
       final int level = getInt(path + ".enchant." + enchant, enchantment.getStartLevel());
       stack.addUnsafeEnchantment(enchantment, level);
     }
   }
   return stack;
   /*
    * ,
    * (byte)getInt(path + ".data", 0)
    */
 }