Example usage for java.lang Character toString

List of usage examples for java.lang Character toString

Introduction

In this page you can find the example usage for java.lang Character toString.

Prototype

public static String toString(int codePoint) 

Source Link

Document

Returns a String object representing the specified character (Unicode code point).

Usage

From source file:org.apache.hive.hcatalog.api.HCatTable.java

/**
 * See <i>row_format</i> element of CREATE_TABLE DDL for Hive.
 *///w  w w .  ja  v  a 2 s. c  o  m
public HCatTable mapKeysTerminatedBy(char delimiter) {
    return serdeParam(serdeConstants.MAPKEY_DELIM, Character.toString(delimiter));
}

From source file:edu.amc.sakai.user.SimpleLdapAttributeMapper.java

public String escapeSearchFilterTerm(String term) {
    if (term == null)
        return null;
    //From RFC 2254
    term = term.replaceAll("\\\\", "\\\\5c");
    term = term.replaceAll("\\*", "\\\\2a");
    term = term.replaceAll("\\(", "\\\\28");
    term = term.replaceAll("\\)", "\\\\29");
    term = term.replaceAll("\\" + Character.toString('\u0000'), "\\\\00");
    return term;//www. j  a  v a  2s  .com
}

From source file:org.apache.hive.hcatalog.api.HCatTable.java

/**
 * See <i>row_format</i> element of CREATE_TABLE DDL for Hive.
 *//*www .  j a v  a 2  s  .  c om*/
public HCatTable linesTerminatedBy(char delimiter) {
    return serdeParam(serdeConstants.LINE_DELIM, Character.toString(delimiter));
}

From source file:net.morphbank.mbsvc3.mapsheet.MapSpreadsheetToXml.java

public static String getColumnId(int i) {
    String columnId = "";

    if (i > 26) {
        int alphaBase = i / 26 - 1;
        int asciiBase = alphaBase + 65;
        int afterZ = i % 26;
        int asciiCode = afterZ + 65;
        columnId = Character.toString((char) asciiBase) + Character.toString((char) asciiCode);
    } else {/*from www  . j a  va  2 s.  c o m*/
        int asciiBase = i + 65;
        columnId = Character.toString((char) asciiBase);
    }

    return columnId;
}

From source file:org.apache.hive.hcatalog.api.HCatTable.java

/**
 * See <i>row_format</i> element of CREATE_TABLE DDL for Hive.
 *//*from www . j av  a  2s. co  m*/
public HCatTable nullDefinedAs(char nullChar) {
    return serdeParam(serdeConstants.SERIALIZATION_NULL_FORMAT, Character.toString(nullChar));
}

From source file:com.lgallardo.youtorrentcontroller.TorrentDetailsFragment.java

public void updateDetails(Torrent torrent) {

    try {/*from  w  w  w .j a v a 2s. co m*/

        // Hide herderInfo in phone's view
        if (getActivity().findViewById(R.id.one_frame) != null) {
            MainActivity.headerInfo.setVisibility(View.GONE);
        }

        // Get values from current activity
        name = torrent.getFile();
        size = torrent.getSize();
        hash = torrent.getHash();
        ratio = torrent.getRatio();
        state = torrent.getState();
        peersConnected = torrent.getPeersConnected();
        peersInSwarm = torrent.getPeersInSwarm();
        seedsConnected = torrent.getSeedsConnected();
        seedsInSwarm = torrent.getSeedInSwarm();
        progress = torrent.getProgress();
        priority = torrent.getPriority();
        eta = torrent.getEta();
        uploadSpeed = torrent.getUploadSpeed();
        downloadSpeed = torrent.getDownloadSpeed();
        downloaded = torrent.getDownloaded();

        int index = torrent.getProgress().indexOf(".");

        if (index == -1) {
            index = torrent.getProgress().indexOf(",");

            if (index == -1) {
                index = torrent.getProgress().length();
            }
        }

        percentage = torrent.getProgress().substring(0, index);

        int donwloadSpeedWeigth = torrent.getDownloadSpeedWeight();
        int uploadSpeedWeigth = torrent.getUploadSpeedWeight();

        FragmentManager fragmentManager = getFragmentManager();

        TorrentDetailsFragment detailsFragment = null;

        if (getActivity().findViewById(R.id.one_frame) != null) {
            detailsFragment = (TorrentDetailsFragment) fragmentManager.findFragmentByTag("firstFragment");
        } else {
            detailsFragment = (TorrentDetailsFragment) fragmentManager.findFragmentByTag("secondFragment");
        }

        View rootView = detailsFragment.getView();

        TextView nameTextView = (TextView) rootView.findViewById(R.id.torrentName);
        TextView sizeTextView = (TextView) rootView.findViewById(R.id.torrentSize);
        TextView ratioTextView = (TextView) rootView.findViewById(R.id.torrentRatio);
        TextView priorityTextView = (TextView) rootView.findViewById(R.id.torrentPriority);
        TextView stateTextView = (TextView) rootView.findViewById(R.id.torrentState);
        TextView leechsTextView = (TextView) rootView.findViewById(R.id.torrentLeechs);
        TextView seedsTextView = (TextView) rootView.findViewById(R.id.torrentSeeds);
        TextView progressTextView = (TextView) rootView.findViewById(R.id.torrentProgress);
        TextView hashTextView = (TextView) rootView.findViewById(R.id.torrentHash);

        TextView etaTextView = (TextView) rootView.findViewById(R.id.torrentEta);
        TextView uploadSpeedTextView = (TextView) rootView.findViewById(R.id.torrentUploadSpeed);
        TextView downloadSpeedTextView = (TextView) rootView.findViewById(R.id.torrentDownloadSpeed);

        CheckBox sequentialDownloadCheckBox;
        CheckBox firstLAstPiecePrioCheckBox;

        nameTextView.setText(name);
        ratioTextView.setText(ratio);
        stateTextView.setText(state);
        leechsTextView.setText("" + peersConnected + " (" + peersInSwarm + ")");
        seedsTextView.setText("" + seedsConnected + " (" + seedsInSwarm + ")");
        progressTextView.setText(progress);
        hashTextView.setText(hash);
        priorityTextView.setText(priority);
        etaTextView.setText(eta);

        // Set Downloaded vs Total size
        sizeTextView.setText(downloaded + " / " + size);

        // Only for Pro version
        if (MainActivity.packageName.equals("com.lgallardo.youtorrentcontrollerpro")) {
            downloadSpeedTextView.setText(Character.toString('\u2193') + " " + downloadSpeed);
            uploadSpeedTextView.setText(Character.toString('\u2191') + " " + uploadSpeed);

            // Set progress bar
            ProgressBar progressBar = (ProgressBar) rootView.findViewById(R.id.progressBar1);
            TextView percentageTV = (TextView) rootView.findViewById(R.id.percentage);

            progressBar.setProgress(Integer.parseInt(percentage));
            percentageTV.setText(percentage + "%");

        } else {
            downloadSpeedTextView.setText(downloadSpeed);
            uploadSpeedTextView.setText(uploadSpeed);
        }

        nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.error, 0, 0, 0);

        //            Log.d("Debug", "TorrentDetailsFragment - state: " + state);

        if ("paused".equals(state)) {
            nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.paused, 0, 0, 0);
        }

        if ("downloading".equals(state)) {
            nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.stalleddl, 0, 0, 0);

            if (donwloadSpeedWeigth > 0 || seedsConnected > 0 || peersConnected > 0) {
                nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.downloading, 0, 0, 0);
            }
        }

        if ("seeding".equals(state)) {
            nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.stalledup, 0, 0, 0);

            if (uploadSpeedWeigth > 0 || seedsConnected > 0 || peersConnected > 0) {
                nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.uploading, 0, 0, 0);
            }
        }

        if ("queued".equals(state)) {
            nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.queued, 0, 0, 0);
        }

        if ("checking".equals(state)) {
            nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_action_recheck, 0, 0, 0);
        }

        if ("stopped".equals(state)) {
            nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_action_stopped, 0, 0, 0);
        }

        //            // Get Content files in background
        //            qBittorrentContentFile qcf = new qBittorrentContentFile();
        //            qcf.execute(new View[]{rootView});
        //
        //            // Get trackers in background
        //            qBittorrentTrackers qt = new qBittorrentTrackers();
        //            qt.execute(new View[]{rootView});
        //
        //            // Get General info in background
        //            qBittorrentGeneralInfoTask qgit = new qBittorrentGeneralInfoTask();
        //            qgit.execute(new View[]{rootView});

    } catch (Exception e) {

        Log.e("Debug", "TorrentDetailsFragment - onCreateView: " + e.toString());
    }

}

From source file:org.jaffa.ria.finder.apis.ExcelExportService.java

public static Workbook generateExcel(QueryServiceConfig master, QueryServiceConfig child, String sheetName)
        throws ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException,
        IllegalArgumentException, InvocationTargetException {

    Workbook wb = null;//from w  w w .  j  av  a2s  .c  o m
    String legacyExport = (String) ContextManagerFactory.instance()
            .getProperty("jaffa.widgets.exportToExcel.legacy");
    if (legacyExport != null && legacyExport.equals("T")) {
        wb = new HSSFWorkbook();
    } else {
        wb = new SXSSFWorkbook(100);
    }
    try {
        // Creating worksheet
        Sheet sheet = null;
        if (sheetName != null) {
            if (sheetName.length() > 31)
                sheetName = sheetName.substring(0, 31);
            char replaceChar = '_';
            sheetName = sheetName.replace('\u0003', replaceChar).replace(':', replaceChar)
                    .replace('/', replaceChar).replace("\\\\", Character.toString(replaceChar))
                    .replace('?', replaceChar).replace('*', replaceChar).replace(']', replaceChar)
                    .replace('[', replaceChar);
            sheet = wb.createSheet(sheetName);
        } else
            sheet = wb.createSheet();

        // creating a custom palette for the workbook
        CellStyle style = wb.createCellStyle();
        style = wb.createCellStyle();

        // setting the foreground color to gray
        style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
        style.setFillPattern(CellStyle.SOLID_FOREGROUND);

        // Setting the border for the cells
        style.setBorderBottom(CellStyle.BORDER_THIN);
        style.setBottomBorderColor(IndexedColors.BLACK.getIndex());
        style.setBorderLeft(CellStyle.BORDER_THIN);
        style.setLeftBorderColor(IndexedColors.GREEN.getIndex());
        style.setBorderRight(CellStyle.BORDER_THIN);
        style.setRightBorderColor(IndexedColors.BLACK.getIndex());
        style.setBorderTop(CellStyle.BORDER_THIN);
        style.setTopBorderColor(IndexedColors.BLACK.getIndex());
        style.setAlignment(CellStyle.ALIGN_CENTER);

        // setting font weight
        Font titleFont = wb.createFont();
        titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
        style.setFont(titleFont);

        int rowNum = 0;
        Row headerRow = sheet.createRow(rowNum);
        int colIndex = 0;
        for (Object o : master.getColumnModel()) {
            String columnTitle = (String) ((DynaBean) o).get("header");
            if (columnTitle == null || columnTitle.length() == 0)
                columnTitle = (String) ((DynaBean) o).get("mapping");

            headerRow.createCell(colIndex).setCellValue(columnTitle);
            Cell cell = headerRow.getCell(colIndex);
            cell.setCellStyle(style);
            sheet.autoSizeColumn(colIndex);
            colIndex += 1;
        }

        // Generate the Excel output by creating a simple HTML table
        if (child != null) {
            for (Object o : child.getColumnModel()) {
                String columnTitle = (String) ((DynaBean) o).get("header");
                if (columnTitle == null || columnTitle.length() == 0)
                    columnTitle = (String) ((DynaBean) o).get("mapping");

                headerRow.createCell(colIndex).setCellValue(columnTitle);
                Cell cell = headerRow.getCell(colIndex);
                cell.setCellStyle(style);
                sheet.autoSizeColumn(colIndex);
                colIndex += 1;

            }
        }

        // Invoke the query and obtain an array of Graph objects
        Object[] queryOutput = invokeQueryService(master.getCriteriaClassName(), master.getCriteriaObject(),
                master.getServiceClassName(), master.getServiceClassMethodName());

        // Add the data rows
        if (queryOutput != null) {
            for (Object row : queryOutput) {
                Object[] detailQueryOutput = new Object[0];
                if (child == null) {
                    rowNum += 1;
                    Row dataRow = sheet.createRow((short) rowNum);
                    int colNum = 0;
                    // extract the columns from master object
                    for (Object o : master.getColumnModel()) {
                        String mapping = (String) ((DynaBean) o).get("mapping");
                        Object value = null;
                        try {
                            value = PropertyUtils.getProperty(row, mapping);
                        } catch (Exception e) {
                            if (log.isDebugEnabled())
                                log.debug("Property not found: " + mapping, e);
                        }

                        dataRow.createCell(colNum).setCellValue(format(value, (DynaBean) o));
                        colNum += 1;
                    }
                } else { //child is not null
                    // load the child rows
                    String detailCriteriaObject = child.getCriteriaObject();
                    for (int i = 0; i < child.getMasterKeyFieldNames().length; i++) {
                        String kfn = child.getMasterKeyFieldNames()[i];
                        try {
                            String keyValue = (String) PropertyUtils.getProperty(row, kfn);
                            detailCriteriaObject = detailCriteriaObject.replace("{" + i + "}", keyValue);
                        } catch (Exception e) {
                            if (log.isDebugEnabled())
                                log.debug("Key property not found: " + kfn, e);
                        }
                    }
                    detailQueryOutput = invokeQueryService(child.getCriteriaClassName(), detailCriteriaObject,
                            child.getServiceClassName(), "query");

                    // add the child columns
                    if (detailQueryOutput != null && detailQueryOutput.length > 0) {
                        for (Object detailRow : detailQueryOutput) {
                            rowNum += 1;
                            Row dataRow = sheet.createRow((short) rowNum);

                            int colNum = 0;
                            // extract the columns from master object
                            for (Object obj : master.getColumnModel()) {
                                String masterMapping = (String) ((DynaBean) obj).get("mapping");
                                Object masterValue = null;
                                try {
                                    masterValue = PropertyUtils.getProperty(row, masterMapping);
                                } catch (Exception e) {
                                    if (log.isDebugEnabled())
                                        log.debug("Property not found: " + masterMapping, e);
                                }

                                dataRow.createCell(colNum).setCellValue(format(masterValue, (DynaBean) obj));
                                colNum += 1;
                            }

                            for (Object o : child.getColumnModel()) {
                                String mapping = (String) ((DynaBean) o).get("mapping");
                                Object value = null;
                                try {
                                    value = PropertyUtils.getProperty(detailRow, mapping);
                                } catch (Exception e) {
                                    if (log.isDebugEnabled())
                                        log.debug("Property not found in child result: " + mapping, e);
                                }

                                dataRow.createCell(colNum).setCellValue(format(value, (DynaBean) o));
                                colNum += 1;
                            }
                        }
                    }
                }
            }
        }

    } catch (Exception e) {
        e.printStackTrace();
    }
    return wb;
}

From source file:org.kepler.util.DelimitedReader.java

private static String transferDigitsToCharString(int radix, String digits) {
    if (digits == null) {
        return null;
    }//  w  w w . j av a  2  s.  c o  m
    Integer integer = Integer.valueOf(digits, radix);
    int inter = integer.intValue();
    log.debug("The decimal value of char is " + inter);
    char charactor = (char) inter;
    String newDelimiter = Character.toString(charactor);
    log.debug("The new delimter is " + newDelimiter);
    return newDelimiter;
}

From source file:org.elasticsearch.xpack.security.authc.saml.SamlAuthenticationIT.java

private String htmlDecode(String text) {
    final Pattern hexEntity = Pattern.compile("&#x([0-9a-f]{2});");
    while (true) {
        final Matcher matcher = hexEntity.matcher(text);
        if (matcher.find() == false) {
            return text;
        }/*from  w w  w .j  a  va2  s. co m*/
        char ch = (char) Integer.parseInt(matcher.group(1), 16);
        text = matcher.replaceFirst(Character.toString(ch));
    }
}

From source file:com.hm.achievement.AdvancedAchievements.java

/**
 * Called when server is launched or reloaded.
 *///from  ww  w. j  a  va2  s  . c  o m
@Override
public void onEnable() {

    // Start enabling plugin.
    long startTime = System.currentTimeMillis();

    AchievementCommentedYamlConfiguration configFile = loadAndBackupFile("config.yml");
    AchievementCommentedYamlConfiguration langFile = loadAndBackupFile(
            configFile.getString("LanguageFileName", "lang.yml"));

    // Error while loading .yml files; do not do any further work.
    if (overrideDisable) {
        overrideDisable = false;
        return;
    }

    // Update configurations from previous versions of the plugin; only if server reload or restart.
    fileUpdater.updateOldConfiguration(configFile);
    fileUpdater.updateOldLanguage(langFile);

    configurationLoad(configFile, langFile);

    // Load Metrics Lite.
    try {
        MetricsLite metrics = new MetricsLite(this);
        metrics.start();
    } catch (IOException e) {
        this.getLogger().severe("Error while sending Metrics statistics.");
        successfulLoad = false;
    }

    if (databaseBackup && (!"mysql".equalsIgnoreCase(config.getString("DatabaseType", "sqlite"))
            || !"postgresql".equalsIgnoreCase(config.getString("DatabaseType", "sqlite")))) {
        File backup = new File(this.getDataFolder(), "achievements.db.bak");
        // Only do a daily backup for the .db file.
        if (System.currentTimeMillis() - backup.lastModified() > 86400000 || backup.length() == 0) {
            this.getLogger().info("Backing up database file...");
            try {
                FileManager fileManager = new FileManager("achievements.db", this);
                fileManager.backupFile();
            } catch (IOException e) {
                this.getLogger().log(Level.SEVERE, "Error while backing up database file: ", e);
                successfulLoad = false;
            }
        }
    }

    PluginManager pm = getServer().getPluginManager();
    this.getLogger().info("Registering listeners...");

    // Check for available plugin update.
    if (config.getBoolean("CheckForUpdate", true)) {
        updateChecker = new UpdateChecker(this,
                "https://raw.githubusercontent.com/PyvesB/AdvancedAchievements/master/pom.xml",
                new String[] { "dev.bukkit.org/bukkit-plugins/advanced-achievements/files",
                        "spigotmc.org/resources/advanced-achievements.6239" },
                "achievement.update", chatHeader);
        pm.registerEvents(updateChecker, this);
        updateChecker.launchUpdateCheckerTask();
    }

    // Register listeners so they can monitor server events; if there are no config related achievements, listeners
    // aren't registered.
    if (!disabledCategorySet.contains(MultipleAchievements.PLACES.toString())) {
        blockPlaceListener = new AchieveBlockPlaceListener(this);
        pm.registerEvents(blockPlaceListener, this);
    }

    if (!disabledCategorySet.contains(MultipleAchievements.BREAKS.toString())) {
        blockBreakListener = new AchieveBlockBreakListener(this);
        pm.registerEvents(blockBreakListener, this);
    }

    if (!disabledCategorySet.contains(MultipleAchievements.KILLS.toString())) {
        killListener = new AchieveKillListener(this);
        pm.registerEvents(killListener, this);
    }

    if (!disabledCategorySet.contains(MultipleAchievements.CRAFTS.toString())) {
        craftListener = new AchieveCraftListener(this);
        pm.registerEvents(craftListener, this);
    }

    if (!disabledCategorySet.contains(MultipleAchievements.PLAYERCOMMANDS.toString())) {
        playerCommandListener = new AchievePlayerCommandListener(this);
        pm.registerEvents(playerCommandListener, this);
    }

    if (!disabledCategorySet.contains(NormalAchievements.DEATHS.toString())) {
        deathListener = new AchieveDeathListener(this);
        pm.registerEvents(deathListener, this);
    }

    if (!disabledCategorySet.contains(NormalAchievements.ARROWS.toString())) {
        arrowListener = new AchieveArrowListener(this);
        pm.registerEvents(arrowListener, this);
    }

    if (!disabledCategorySet.contains(NormalAchievements.SNOWBALLS.toString())
            || !disabledCategorySet.contains(NormalAchievements.EGGS.toString())) {
        snowballEggListener = new AchieveSnowballEggListener(this);
        pm.registerEvents(snowballEggListener, this);
    }

    if (!disabledCategorySet.contains(NormalAchievements.FISH.toString())
            || !disabledCategorySet.contains(NormalAchievements.TREASURES.toString())) {
        fishListener = new AchieveFishListener(this);
        pm.registerEvents(fishListener, this);
    }

    if (!disabledCategorySet.contains(NormalAchievements.ITEMBREAKS.toString())) {
        itemBreakListener = new AchieveItemBreakListener(this);
        pm.registerEvents(itemBreakListener, this);
    }

    if (!disabledCategorySet.contains(NormalAchievements.CONSUMEDPOTIONS.toString())
            || !disabledCategorySet.contains(NormalAchievements.EATENITEMS.toString())) {
        consumeListener = new AchieveConsumeListener(this);
        pm.registerEvents(consumeListener, this);
    }

    if (!disabledCategorySet.contains(NormalAchievements.SHEARS.toString())) {
        shearListener = new AchieveShearListener(this);
        pm.registerEvents(shearListener, this);
    }

    if (!disabledCategorySet.contains(NormalAchievements.MILKS.toString())
            || !disabledCategorySet.contains(NormalAchievements.LAVABUCKETS.toString())
            || !disabledCategorySet.contains(NormalAchievements.WATERBUCKETS.toString())) {
        milkLavaWaterListener = new AchieveMilkLavaWaterListener(this);
        pm.registerEvents(milkLavaWaterListener, this);
    }

    if (!disabledCategorySet.contains(NormalAchievements.CONNECTIONS.toString())) {
        connectionListener = new AchieveConnectionListener(this);
        pm.registerEvents(connectionListener, this);
    }

    if (!disabledCategorySet.contains(NormalAchievements.TRADES.toString())
            || !disabledCategorySet.contains(NormalAchievements.ANVILS.toString())
            || !disabledCategorySet.contains(NormalAchievements.BREWING.toString())
            || !disabledCategorySet.contains(NormalAchievements.SMELTING.toString())) {
        inventoryClickListener = new AchieveTradeAnvilBrewSmeltListener(this);
        pm.registerEvents(inventoryClickListener, this);
    }

    if (!disabledCategorySet.contains(NormalAchievements.ENCHANTMENTS.toString())) {
        enchantmentListener = new AchieveEnchantListener(this);
        pm.registerEvents(enchantmentListener, this);
    }

    if (!disabledCategorySet.contains(NormalAchievements.LEVELS.toString())) {
        xpListener = new AchieveXPListener(this);
        pm.registerEvents(xpListener, this);
    }

    if (!disabledCategorySet.contains(NormalAchievements.BEDS.toString())) {
        bedListener = new AchieveBedListener(this);
        pm.registerEvents(bedListener, this);
    }

    if (!disabledCategorySet.contains(NormalAchievements.DROPS.toString())) {
        dropListener = new AchieveDropListener(this);
        pm.registerEvents(dropListener, this);
    }

    if (!disabledCategorySet.contains(NormalAchievements.PICKUPS.toString())) {
        pickupListener = new AchievePickupListener(this);
        pm.registerEvents(pickupListener, this);
    }

    if (!disabledCategorySet.contains(NormalAchievements.TAMES.toString())) {
        tameListener = new AchieveTameListener(this);
        pm.registerEvents(tameListener, this);
    }

    if (!disabledCategorySet.contains(NormalAchievements.HOEPLOWING.toString())
            || !disabledCategorySet.contains(NormalAchievements.FERTILISING.toString())
            || !disabledCategorySet.contains(NormalAchievements.FIREWORKS.toString())
            || !disabledCategorySet.contains(NormalAchievements.MUSICDISCS.toString())) {
        hoeFertiliseFireworkMusicListener = new AchieveHoeFertiliseFireworkMusicListener(this);
        pm.registerEvents(hoeFertiliseFireworkMusicListener, this);
    }

    if (!disabledCategorySet.contains(NormalAchievements.DISTANCEFOOT.toString())
            || !disabledCategorySet.contains(NormalAchievements.DISTANCEPIG.toString())
            || !disabledCategorySet.contains(NormalAchievements.DISTANCEHORSE.toString())
            || !disabledCategorySet.contains(NormalAchievements.DISTANCEMINECART.toString())
            || !disabledCategorySet.contains(NormalAchievements.DISTANCEBOAT.toString())
            || !disabledCategorySet.contains(NormalAchievements.DISTANCEGLIDING.toString())
            || !disabledCategorySet.contains(NormalAchievements.DISTANCELLAMA.toString())) {
        if (!disabledCategorySet.contains(NormalAchievements.LEVELS.toString())
                || !disabledCategorySet.contains(NormalAchievements.PLAYEDTIME.toString())) {
            quitListener = new AchieveQuitListener(this);
            pm.registerEvents(quitListener, this);
        }
        if (!disabledCategorySet.contains(NormalAchievements.ENDERPEARLS.toString())) {
            teleportRespawnListener = new AchieveTeleportRespawnListener(this);
            pm.registerEvents(teleportRespawnListener, this);
        }
    }

    if (!disabledCategorySet.contains(NormalAchievements.PETMASTERGIVE.toString())
            || !disabledCategorySet.contains(NormalAchievements.PETMASTERRECEIVE.toString())) {
        // Need PetMaster with a minimum version of 1.4.
        if (Bukkit.getPluginManager().isPluginEnabled("PetMaster") && Integer.parseInt(Character.toString(Bukkit
                .getPluginManager().getPlugin("PetMaster").getDescription().getVersion().charAt(2))) >= 4) {
            petMasterGiveReceiveListener = new AchievePetMasterGiveReceiveListener(this);
            pm.registerEvents(petMasterGiveReceiveListener, this);
        } else {
            this.getLogger().warning(
                    "Failed to pair with Pet Master plugin; disabling PetMasterGive and PetMasterReceive categories.");
            this.getLogger().warning(
                    "Ensure you have placed Pet Master with a minimum version of 1.4 in your plugins folder.");
            this.getLogger().warning(
                    "If you do not wish to use these categories, you must add PetMasterGive and PetMasterReceive to the DisabledCategories list in your config.");
        }
    }

    listGUIListener = new ListGUIListener(this);
    pm.registerEvents(listGUIListener, this);

    fireworkListener = new FireworkListener(this);
    pm.registerEvents(fireworkListener, this);

    this.getLogger().info("Initialising database and launching scheduled tasks...");

    // Initialise the SQLite/MySQL/PostgreSQL database.
    db.initialise();

    // Error while loading database do not do any further work.
    if (overrideDisable) {
        overrideDisable = false;
        return;
    }

    pooledRequestsSender = new PooledRequestsSender(this);
    // Schedule a repeating task to group database queries for some frequent
    // events.
    pooledRequestsSenderTask = Bukkit.getServer().getScheduler().runTaskTimerAsynchronously(this,
            pooledRequestsSender, pooledRequestsTaskInterval * 40L, pooledRequestsTaskInterval * 20L);

    // Schedule a repeating task to monitor played time for each player (not directly related to an event).
    if (!disabledCategorySet.contains(NormalAchievements.PLAYEDTIME.toString())) {
        achievePlayTimeRunnable = new AchievePlayTimeRunnable(this);
        playedTimeTask = Bukkit.getServer().getScheduler().runTaskTimer(this, achievePlayTimeRunnable,
                playtimeTaskInterval * 10L, playtimeTaskInterval * 20L);
    }

    // Schedule a repeating task to monitor distances travelled by each player (not directly related to an event).
    if (!disabledCategorySet.contains(NormalAchievements.DISTANCEFOOT.toString())
            || !disabledCategorySet.contains(NormalAchievements.DISTANCEPIG.toString())
            || !disabledCategorySet.contains(NormalAchievements.DISTANCEHORSE.toString())
            || !disabledCategorySet.contains(NormalAchievements.DISTANCEMINECART.toString())
            || !disabledCategorySet.contains(NormalAchievements.DISTANCEBOAT.toString())
            || !disabledCategorySet.contains(NormalAchievements.DISTANCEGLIDING.toString())
            || !disabledCategorySet.contains(NormalAchievements.DISTANCELLAMA.toString())) {
        achieveDistanceRunnable = new AchieveDistanceRunnable(this);
        distanceTask = Bukkit.getServer().getScheduler().runTaskTimer(this, achieveDistanceRunnable,
                distanceTaskInterval * 40L, distanceTaskInterval * 20L);
    }

    if (successfulLoad) {
        this.getLogger().info("Plugin successfully enabled and ready to run! Took "
                + (System.currentTimeMillis() - startTime) + "ms.");
    } else {
        this.getLogger()
                .severe("Error(s) while loading plugin. Please view previous logs for more information.");
    }
}