// Path: src/main/java/com/nisovin/shopkeepers/compat/NMSManager.java
// public final class NMSManager {
// 
// 	private static NMSCallProvider provider;
// 
// 	public static NMSCallProvider getProvider() {
// 		return NMSManager.provider;
// 	}
// 
// 	public static void load(Plugin plugin) {
// 		final String packageName = plugin.getServer().getClass().getPackage().getName();
// 		String cbversion = packageName.substring(packageName.lastIndexOf('.') + 1);
// 		try {
// 			final Class<?> clazz = Class.forName("com.nisovin.shopkeepers.compat." + cbversion + ".NMSHandler");
// 			if (NMSCallProvider.class.isAssignableFrom(clazz)) {
// 				NMSManager.provider = (NMSCallProvider) clazz.getConstructor().newInstance();
// 			} else {
// 				throw new Exception("Nope");
// 			}
// 		} catch (final Exception e) {
// 			Log.severe("Potentially incompatible server version: " + cbversion);
// 			Log.severe("Shopkeepers is trying to run in 'compatibility mode'.");
// 			Log.info("Check for updates at: " + plugin.getDescription().getWebsite());
// 
// 			try {
// 				NMSManager.provider = new FailedHandler();
// 			} catch (Exception e_u) {
// 				// uncomment for debugging:
// 				// e_u.printStackTrace();
// 			}
// 		}
// 	}
// }


import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.configuration.Configuration;
import org.bukkit.entity.EntityType;
import org.bukkit.inventory.ItemStack;
import com.google.common.base.Objects;
import com.nisovin.shopkeepers.compat.NMSManager;
		if (highCurrencyValue <= 0) highCurrencyItem = Material.AIR;
		// certain items cannot be of type AIR:
		if (shopCreationItem == Material.AIR) shopCreationItem = Material.MONSTER_EGG;
		if (hireItem == Material.AIR) hireItem = Material.EMERALD;
		if (currencyItem == Material.AIR) currencyItem = Material.EMERALD;

		return misses;
	}

	public static void loadLanguageConfiguration(Configuration config) {
		try {
			Field[] fields = Settings.class.getDeclaredFields();
			for (Field field : fields) {
				if (field.getType() == String.class && field.getName().startsWith("msg")) {
					String configKey = toConfigKey(field.getName());
					field.set(null, Utils.colorize(config.getString(configKey, (String) field.get(null))));
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	// item utilities:

	// creation item:
	public static ItemStack createShopCreationItem() {
		ItemStack creationItem = Utils.createItemStack(shopCreationItem, 1, (short) shopCreationItemData, shopCreationItemName, shopCreationItemLore);

		// apply spawn egg entity type:
// Path: src/main/java/com/nisovin/shopkeepers/compat/NMSManager.java
// public final class NMSManager {
// 
// 	private static NMSCallProvider provider;
// 
// 	public static NMSCallProvider getProvider() {
// 		return NMSManager.provider;
// 	}
// 
// 	public static void load(Plugin plugin) {
// 		final String packageName = plugin.getServer().getClass().getPackage().getName();
// 		String cbversion = packageName.substring(packageName.lastIndexOf('.') + 1);
// 		try {
// 			final Class<?> clazz = Class.forName("com.nisovin.shopkeepers.compat." + cbversion + ".NMSHandler");
// 			if (NMSCallProvider.class.isAssignableFrom(clazz)) {
// 				NMSManager.provider = (NMSCallProvider) clazz.getConstructor().newInstance();
// 			} else {
// 				throw new Exception("Nope");
// 			}
// 		} catch (final Exception e) {
// 			Log.severe("Potentially incompatible server version: " + cbversion);
// 			Log.severe("Shopkeepers is trying to run in 'compatibility mode'.");
// 			Log.info("Check for updates at: " + plugin.getDescription().getWebsite());
// 
// 			try {
// 				NMSManager.provider = new FailedHandler();
// 			} catch (Exception e_u) {
// 				// uncomment for debugging:
// 				// e_u.printStackTrace();
// 			}
// 		}
// 	}
// }


// Path: src/main/java/com/nisovin/shopkeepers/Settings.java
import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.configuration.Configuration;
import org.bukkit.entity.EntityType;
import org.bukkit.inventory.ItemStack;
import com.google.common.base.Objects;
import com.nisovin.shopkeepers.compat.NMSManager;

		if (highCurrencyValue <= 0) highCurrencyItem = Material.AIR;
		// certain items cannot be of type AIR:
		if (shopCreationItem == Material.AIR) shopCreationItem = Material.MONSTER_EGG;
		if (hireItem == Material.AIR) hireItem = Material.EMERALD;
		if (currencyItem == Material.AIR) currencyItem = Material.EMERALD;

		return misses;
	}

	public static void loadLanguageConfiguration(Configuration config) {
		try {
			Field[] fields = Settings.class.getDeclaredFields();
			for (Field field : fields) {
				if (field.getType() == String.class && field.getName().startsWith("msg")) {
					String configKey = toConfigKey(field.getName());
					field.set(null, Utils.colorize(config.getString(configKey, (String) field.get(null))));
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	// item utilities:

	// creation item:
	public static ItemStack createShopCreationItem() {
		ItemStack creationItem = Utils.createItemStack(shopCreationItem, 1, (short) shopCreationItemData, shopCreationItemName, shopCreationItemLore);

		// apply spawn egg entity type:
		if (shopCreationItem == Material.MONSTER_EGG && !Utils.isEmpty(shopCreationItemSpawnEggEntityType) && NMSManager.getProvider().supportsSpawnEggEntityType()) {