public void loadPlayer(Player player) {

    StatistikPlayer statistikPlayer = new StatistikPlayer(playerTable, player.getName());

    players.add(statistikPlayer);

    statistikPlayer.setAviableRanks(plugin.getRankManager().getRanks(player));
  }
  public StatistikManager() {
    plugin = Statistik.getInstance();
    settingsManager = plugin.getSettingsManager();
    connection = plugin.getConnection();

    playerTable = new Table(connection, "stats_player");

    try {

      if (!playerTable.exists()) {

        Map<String, DataType> columnDataTypeMap = new HashMap<String, DataType>();
        columnDataTypeMap.put("name", new DataType(DataType.TEXT));

        columnDataTypeMap.put("play_time", new DataType(DataType.INTEGER));

        columnDataTypeMap.put("block_break", new DataType(DataType.INTEGER));
        columnDataTypeMap.put("block_place", new DataType(DataType.INTEGER));

        columnDataTypeMap.put("player_kill", new DataType(DataType.INTEGER));
        columnDataTypeMap.put("player_death", new DataType(DataType.INTEGER));

        columnDataTypeMap.put("monster_kill", new DataType(DataType.INTEGER));
        columnDataTypeMap.put("monster_death", new DataType(DataType.INTEGER));

        columnDataTypeMap.put("other_death", new DataType(DataType.INTEGER));
        columnDataTypeMap.put("fishing", new DataType(DataType.INTEGER));

        columnDataTypeMap.put("block_move", new DataType(DataType.INTEGER));
        columnDataTypeMap.put("block_fall", new DataType(DataType.INTEGER));

        columnDataTypeMap.put("points", new DataType(DataType.INTEGER));

        playerTable.create(columnDataTypeMap);
      }

    } catch (SQLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    players = new ArrayList<StatistikPlayer>();
  }
  public void checkNewRanks() {

    if (players.size() > 0) {

      for (StatistikPlayer player : players) {

        Player spieler = plugin.getServer().getPlayer(player.getName());

        ArrayList<Rank> ranks =
            Statistik.getInstance()
                .getRankManager()
                .getRanks(plugin.getServer().getPlayer(player.getName()));
        ArrayList<Rank> newRanks =
            Statistik.getInstance()
                .getRankManager()
                .getRanks(plugin.getServer().getPlayer(player.getName()));
        ArrayList<Rank> oldRanks = player.getAviableRanks();

        if (oldRanks != null) {

          if (ranks != null) {

            if (ranks.size() > 0) {

              for (Rank rank : ranks) {

                for (Rank rank2 : oldRanks) {

                  if (rank.equals(rank2)) {
                    newRanks.remove(rank);
                  }
                }
              }
            }

            if (ranks.size() > 0) {

              for (Rank rank : newRanks) {
                spieler.sendMessage(
                    ChatColor.GOLD
                        + "Du hast soeben den Titel "
                        + rank.getName()
                        + ChatColor.WHITE
                        + " freigeschaltet, nutze nun "
                        + ChatColor.GREEN
                        + "/rank set "
                        + rank.getTag()
                        + ChatColor.GOLD
                        + " um den Titel festzulegen.");
              }
            }
          }

        } else {

          if (ranks != null) {

            for (Rank rank : ranks) {
              spieler.sendMessage(
                  ChatColor.GOLD
                      + "Du hast soeben den Titel "
                      + rank.getName()
                      + ChatColor.WHITE
                      + " freigeschaltet, nutze nun "
                      + ChatColor.GREEN
                      + "/rank set "
                      + rank.getTag()
                      + ChatColor.GOLD
                      + " um den Titel festzulegen.");
            }
          }
        }

        player.setAviableRanks(ranks);
      }
    }
  }