@Override
    public void onEnable() {
        saveDefaultConfig();
        PluginManager pm = getServer().getPluginManager();
        Plugin gmi = pm.getPlugin("GameModeInventories");
        if (gmi == null) {
            System.err.println("[GMIDatabaseConverter] This plugin requires GameModeInventories!");
            pm.disablePlugin(this);
            return;
        }
        String v = gmi.getDescription().getVersion();
        Version gmiversion = new Version(v);
        Version notneededversion = new Version("2.0");
        if (gmiversion.compareTo(notneededversion) >= 0) {
            System.err.println("[GMIDatabaseConverter] You do not need to run this with version " + v + " of GameModeInventories!");
            pm.disablePlugin(this);
            return;
        }
        if (getConfig().getBoolean("conversion_done")) {
            System.err.println("[GMIDatabaseConverter] The GameModeInventories database has already been converted!");
            pm.disablePlugin(this);
            return;
        }
        File old_file = new File(gmi.getDataFolder() + File.separator + "GMI.db");
        if (!old_file.exists()) {
            System.err.println("[GMIDatabaseConverter] Could not find GameModeInventories database file!");
            pm.disablePlugin(this);
            return;
        }
        File backup_file = new File(gmi.getDataFolder() + File.separator + "GMI_backup.db");
        try {
            copyFile(old_file, backup_file);
        } catch (IOException io) {
            System.err.println("[GMIDatabaseConverter] Could backup GameModeInventories database file!");
            pm.disablePlugin(this);
            return;
        }
        System.out.println("[GMIDatabaseConverter] The GameModeInventories database file was backed up successfully!");
        try {
            String path = gmi.getDataFolder() + File.separator + "GMI.db";
            service.setConnection(path);
        } catch (Exception e) {
            System.err.println("[GMIDatabaseConverter] Database connection error: " + e);
        }
        if (!convertInventories()) {
            System.err.println("[GMIDatabaseConverter] Inventory conversion failed!");
            pm.disablePlugin(this);
        } else {
            getConfig().set("conversion_done", true);
        }
    }