コード例 #1
0
  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>();
  }