public synchronized int getNumberOfItems(char type){
        int num = 0;
        for (int x = 0; x < this.getXLength(); x++) {
            for (int y = 0; y < this.getYLength(); y++) {
                if (field[x][y] != null) {
                    if (field[x][y].getType() == type) num++;
                }
            }
        }
        return num;
    }